org.weborganic.bastille.psml
Class PSMLConfig

java.lang.Object
  extended by org.weborganic.bastille.psml.PSMLConfig

public final class PSMLConfig
extends Object

PSML configuration.


Field Summary
static String BASTILLE_PSML_ROOT
          The key for the root folder containing all PSML files, including config and content.
static String DEFAULT_PSML_EXTENSION
          The default extension used by PSML files.
static String DEFAULT_PSML_ROOT
          The default folder used by PSML files.
static String MEDIATYPE
          The media type.
 
Method Summary
static PSMLFile getConfigFile(String pathInfo)
          Returns the config file from the path.
static PSMLFile getContentFile(String pathInfo)
          Returns the content file from the path.
static PSMLFile getContentFolder(String pathInfo)
          Returns the content folder from the path.
static PSMLFile getFile(String pathInfo)
          Returns the config file from the path.
static PSMLFile getFolder(String pathInfo)
          Returns the config file from the path.
static File getRoot()
          Returns the root folder for all files.
static File getRoot(boolean create)
          Returns the root folder for all files.
static String load(PSMLFile psml)
          Loads the specified XML file and returns it as a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEDIATYPE

public static final String MEDIATYPE
The media type.

See Also:
Constant Field Values

BASTILLE_PSML_ROOT

public static final String BASTILLE_PSML_ROOT
The key for the root folder containing all PSML files, including config and content.

See Also:
Constant Field Values

DEFAULT_PSML_ROOT

public static final String DEFAULT_PSML_ROOT
The default folder used by PSML files.

See Also:
Constant Field Values

DEFAULT_PSML_EXTENSION

public static final String DEFAULT_PSML_EXTENSION
The default extension used by PSML files.

See Also:
Constant Field Values
Method Detail

getConfigFile

public static PSMLFile getConfigFile(String pathInfo)
Returns the config file from the path.

Parameters:
pathInfo - The path info from within the "config" folder.
Returns:
The corresponding PSML file.

getContentFile

public static PSMLFile getContentFile(String pathInfo)
Returns the content file from the path.

Parameters:
pathInfo - The path info from within the "content" folder.
Returns:
The corresponding PSML file.

getContentFolder

public static PSMLFile getContentFolder(String pathInfo)
Returns the content folder from the path.

Parameters:
pathInfo - The path info from within the "content" folder.
Returns:
A PSML file for a folder in the content folder.

getFolder

public static PSMLFile getFolder(String pathInfo)
Returns the config file from the path.

Parameters:
pathInfo - The path info from within the root folder.
Returns:
A PSML file for a folder in the content folder.

getFile

public static PSMLFile getFile(String pathInfo)
Returns the config file from the path.

Parameters:
pathInfo - The path info from within the root folder.
Returns:
A PSML file for a folder in the content folder.

getRoot

public static File getRoot()
Returns the root folder for all files.

The PSML root folder can be defined in the config-[mode].xml using the key "bastille.psml.root".

Returns:
the XML Root folder as defined in the configuration or "xml" if undefined.

getRoot

public static File getRoot(boolean create)
Returns the root folder for all files.

The PSML root folder can be defined in the config-[mode].xml using the key "bastille.psml.root".

Parameters:
create - Do create if the directory does not exist.
Returns:
the XML Root folder as defined in the configuration or "xml" if undefined.

load

public static String load(PSMLFile psml)
                   throws IOException
Loads the specified XML file and returns it as a string.

The XML returned is wrapped in the following XML:

<psml-file name="[filename]" base="[basedir]" status="[status]"> ... </psml-file>

Parameters:
psml - The PSML file to load
Returns:
the content of the XML file.
Throws:
IOException - If an error occurs while trying to read or write the XML.