|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.jackrabbit.core.config.ConfigurationParser
Configuration parser. This class is used to parse the repository and workspace configuration files. Each configuration parser instance contains a set of parser variables that are used for variable replacement in the configuration file.
The following code sample outlines the usage of this class:
Properties variables = ...; // parser variables ConfigurationParser parser = new ConfigurationParser(variables); RepositoryConfig rc = parser.parseRepositoryConfig(...); WorkspaceConfig wc = parser.parseWorkspaceConfig(...);
Note that the configuration objects returned by this parser are not initialized. The caller needs to initialize the configuration objects before using them.
Field Summary | |
static String |
ACCESS_MANAGER_ELEMENT
Name of the access manager configuration element. |
static String |
APP_NAME_ATTRIBUTE
Name of the application name configuration attribute. |
static String |
CLASS_ATTRIBUTE
Name of the bean implementation class configuration attribute. |
static String |
CONFIG_ROOT_PATH_ATTRIBUTE
Name of the config root path configuration attribute. |
static String |
DEFAULT_QUERY_HANDLER
Name of the default search index implementation class. |
static String |
DEFAULT_WORKSPACE_ATTRIBUTE
Name of the default workspace configuration attribute. |
static String |
FILE_SYSTEM_ELEMENT
Name of the file system configuration element. |
static String |
LOGIN_MODULE_ELEMENT
Name of the login module configuration element. |
static String |
MAX_IDLE_TIME_ATTRIBUTE
Name of the maximum idle time configuration attribute. |
static String |
NAME_ATTRIBUTE
Name of the bean parameter name configuration attribute. |
static String |
PARAM_ELEMENT
Name of the bean parameter configuration element. |
static String |
PERSISTENCE_MANAGER_ELEMENT
Name of the persistence manager configuration element. |
static String |
REPOSITORY_HOME_VARIABLE
Name of the repository home directory parser variable. |
static String |
ROOT_PATH_ATTRIBUTE
Name of the root path configuration attribute. |
static String |
SEARCH_INDEX_ELEMENT
Name of the search index configuration element. |
static String |
SECURITY_ELEMENT
Name of the security configuration element. |
static String |
VALUE_ATTRIBUTE
Name of the bean parameter value configuration attribute. |
static String |
VERSIONING_ELEMENT
Name of the versioning configuration element. |
static String |
WORKSPACE_ELEMENT
Name of the workspace configuration element. |
static String |
WORKSPACE_HOME_VARIABLE
Name of the workspace home directory parser variable. |
static String |
WORKSPACE_NAME_VARIABLE
Name of the repository name parser variable. |
static String |
WORKSPACES_ELEMENT
Name of the general workspace configuration element. |
Constructor Summary | |
ConfigurationParser(Properties variables)
Creates a new configuration parser with the given parser variables. |
Method Summary | |
protected ConfigurationParser |
createSubParser(Properties variables)
Creates a new instance of a configuration parser but with overlayed variables. |
protected String |
getAttribute(Element element,
String name)
Returns the value of the named attribute of the given element. |
protected String |
getAttribute(Element element,
String name,
String def)
Returns the value of the named attribute of the given element. |
protected Element |
getElement(Element parent,
String name)
Returns the named child of the given parent element. |
protected Element |
getElement(Element parent,
String name,
boolean required)
Returns the named child of the given parent element. |
Properties |
getVariables()
Returns the variables. |
protected BeanConfig |
parseBeanConfig(Element parent,
String name)
Parses a named bean configuration from the given element. |
protected Properties |
parseParameters(Element element)
Parses the configuration parameters of the given element. |
protected PersistenceManagerConfig |
parsePersistenceManagerConfig(Element parent)
Parses the PersistenceManager config. |
RepositoryConfig |
parseRepositoryConfig(InputSource xml)
Parses repository configuration. |
protected SearchConfig |
parseSearchConfig(Element parent)
Parses search index configuration. |
protected VersioningConfig |
parseVersioningConfig(Element parent)
Parses versioning configuration. |
WorkspaceConfig |
parseWorkspaceConfig(InputSource xml)
Parses workspace configuration. |
protected Element |
parseXML(InputSource xml)
Parses the given XML document and returns the DOM root element. |
protected String |
replaceVariables(String value)
Performs variable replacement on the given string value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String REPOSITORY_HOME_VARIABLE
public static final String WORKSPACE_HOME_VARIABLE
public static final String WORKSPACE_NAME_VARIABLE
public static final String SECURITY_ELEMENT
public static final String ACCESS_MANAGER_ELEMENT
public static final String LOGIN_MODULE_ELEMENT
public static final String WORKSPACES_ELEMENT
public static final String WORKSPACE_ELEMENT
public static final String VERSIONING_ELEMENT
public static final String FILE_SYSTEM_ELEMENT
public static final String PERSISTENCE_MANAGER_ELEMENT
public static final String SEARCH_INDEX_ELEMENT
public static final String PARAM_ELEMENT
public static final String APP_NAME_ATTRIBUTE
public static final String ROOT_PATH_ATTRIBUTE
public static final String CONFIG_ROOT_PATH_ATTRIBUTE
public static final String MAX_IDLE_TIME_ATTRIBUTE
public static final String DEFAULT_WORKSPACE_ATTRIBUTE
public static final String CLASS_ATTRIBUTE
public static final String NAME_ATTRIBUTE
public static final String VALUE_ATTRIBUTE
public static final String DEFAULT_QUERY_HANDLER
Constructor Detail |
public ConfigurationParser(Properties variables)
variables
- parser variablesMethod Detail |
public Properties getVariables()
public RepositoryConfig parseRepositoryConfig(InputSource xml) throws ConfigurationException
<Repository> <FileSystem ...> <Security appName="..."> <AccessManager ...> <LoginModule ... (optional)> </Security> <Workspaces rootPath="..." defaultWorkspace="..."/> <Workspace ...> <Versioning ...> </Repository>
The FileSystem
element is a
bean configuration
element,
that specifies the file system implementation for storing global
repository information. The Security
element contains
an AccessManager
bean configuration element and the
JAAS name of the repository application. The Workspaces
element contains general workspace parameters, and the
Workspace
element is a template for the individual
workspace configuration files. The Versioning
element
contains
versioning configuration
for
the repository.
In addition to the configured information, the returned repository configuration object also contains the repository home directory path that is given as the ${rep.home} parser variable. Note that the variable must be available for the configuration document to be correctly parsed.
Variable replacement
is performed
on the security application name attribute, the general workspace
configuration attributes, and on the file system, access manager,
and versioning configuration information.
Note that the returned repository configuration object has not been initialized.
xml
- repository configuration document
ConfigurationException
- if the configuration is brokenparseBeanConfig(Element, String)
,
parseVersioningConfig(Element)
public WorkspaceConfig parseWorkspaceConfig(InputSource xml) throws ConfigurationException
<Workspace name="..."> <FileSystem ...> <PersistenceManager ...> <SearchIndex ...> </Workspace>
All the child elements (FileSystem
,
PersistenceManager
, and SearchIndex
) are
bean configuration
elements.
In addition to bean configuration, the
search element
also contains
configuration for the search file system.
In addition to the configured information, the returned workspace configuration object also contains the workspace home directory path that is given as the ${wsp.home} parser variable. Note that the variable must be available for the configuration document to be correctly parsed.
Variable replacement is performed on the optional workspace name attribute. If the name is not given, then the name of the workspace home directory is used as the workspace name. Once the name has been determined, it will be added as the ${wsp.name} variable in a temporary configuration parser that is used to parse the contained configuration elements.
The search index configuration element is optional. If it is not given, then the workspace will not have search capabilities.
Note that the returned workspace configuration object has not been initialized.
xml
- workspace configuration document
ConfigurationException
- if the configuration is brokenparseBeanConfig(Element, String)
,
parseSearchConfig(Element)
protected SearchConfig parseSearchConfig(Element parent) throws ConfigurationException
<SearchIndex class="..."> <param name="..." value="..."> ... <FileSystem ...> </Search>Both the
SearchIndex
and FileSystem
elements are bean configuration
elements. If the search implementation class is not given, then
a default implementation is used.
The search index is an optional feature of workspace configuration.
If the search configuration element is not found, then this method
returns null
.
The FileSystem element in a search index configuration is optional.
However some implementations may require a FileSystem.
parent
- parent of the SearchIndex
element
null
ConfigurationException
- if the configuration is brokenprotected VersioningConfig parseVersioningConfig(Element parent) throws ConfigurationException
<Versioning rootPath="..."> <FileSystem ...> <PersistenceManager ...> </Versioning>
Both the FileSystem
and PersistenceManager
elements are bean configuration
elements. In addition to the bean parameter values,
variable replacement
is performed
also on the versioning root path attribute.
parent
- parent of the Versioning
element
ConfigurationException
- if the configuration is brokenprotected PersistenceManagerConfig parsePersistenceManagerConfig(Element parent) throws ConfigurationException
parent
-
ConfigurationException
protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException
<BeanName class="..."> <param name="..." value="..."/> ... </BeanName>
The returned bean configuration object contains the configured class name and configuration parameters. Variable replacement is performed on the parameter values.
parent
- parent elementname
- name of the bean configuration element
ConfigurationException
- if the configuration element does not
exist or is brokenprotected Properties parseParameters(Element element) throws ConfigurationException
<param name="..." value="..."/>
child elements. This method parses all param elements,
performs variable replacement
on parameter values, and returns the resulting name-value pairs.
element
- configuration element
ConfigurationException
- if a param
element does
not contain the name
and
value
attributesprotected String replaceVariables(String value) throws ConfigurationException
${...}
sequence within the given value is replaced
with the value of the named parser variable. The replacement is not
done if the named variable does not exist.
value
- original value
ConfigurationException
- if the replacement of a referenced
variable is not foundprotected Element parseXML(InputSource xml) throws ConfigurationException
xml
- xml document
ConfigurationException
- if the configuration document could
not be read or parsedConfigurationEntityResolver
protected Element getElement(Element parent, String name) throws ConfigurationException
parent
- parent elementname
- name of the child element
ConfigurationException
ConfigurationException
- if the child element is not foundprotected Element getElement(Element parent, String name, boolean required) throws ConfigurationException
parent
- parent elementname
- name of the child elementrequired
- indicates if the child element is required
null
if not found and
required
is false
.
ConfigurationException
- if the child element is not found and
required
is true
.protected String getAttribute(Element element, String name) throws ConfigurationException
element
- elementname
- attribute name
ConfigurationException
- if the attribute is not foundprotected String getAttribute(Element element, String name, String def)
element
- elementname
- attribute namedef
- default value
protected ConfigurationParser createSubParser(Properties variables)
variables
- the variables overlay
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |