public class RepositoryConfigurationParser extends ConfigurationParser
The following code sample outlines the usage of this class:
Properties variables = ...; // parser variables RepositoryConfigurationParser parser = new RepositoryConfigurationParser(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.
Modifier and Type | Field and Description |
---|---|
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 |
ARCHIVE_DATASTORE_ATTRIBUTE
Name of the archive DataStore class attribute.
|
protected BeanFactory |
beanFactory |
static String |
CLUSTER_ELEMENT
Name of the cluster configuration element.
|
static String |
CLUSTERED_ATTRIBUTE
Name of the clustered configuration attribute.
|
static String |
CONFIG_ROOT_PATH_ATTRIBUTE
Name of the config root path configuration attribute.
|
protected BeanConfigVisitor |
configVisitor |
protected ConnectionFactory |
connectionFactory
The repositories
ConnectionFactory . |
static String |
DATA_STORE_ELEMENT
Name of the data store configuration element.
|
static String |
DATASOURCE_ELEMENT
Name of the data source configuration element.
|
static String |
DATASOURCES_ELEMENT
Name of the data source configuration element.
|
static String |
DEFAULT_QUERY_HANDLER
Name of the default search index implementation class.
|
static String |
DEFAULT_STOP_DELAY
Default stop delay, in milliseconds or -1 if the default is derived
from the sync delay.
|
static String |
DEFAULT_SYNC_DELAY
Default synchronization delay, in milliseconds.
|
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 |
ID_ATTRIBUTE
Name of the id configuration attribute.
|
static String |
ISM_LOCKING_ELEMENT
Name of the ism locking configuration element.
|
static String |
JOURNAL_ELEMENT
Name of the journal 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 |
PERSISTENCE_MANAGER_ELEMENT
Name of the persistence manager configuration element.
|
static String |
PRIMARY_DATASTORE_ATTRIBUTE
Name of the primary DataStore class attribute.
|
static String |
REPOSITORY_CONF_VARIABLE
Name of the repository configuration file parser variable.
|
static String |
REPOSITORY_HOME_VARIABLE
Name of the repository home directory parser variable.
|
static String |
REPOSITORY_LOCK_MECHANISM_ELEMENT
Name of the repository lock mechanism configuration element.
|
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 |
SECURITY_MANAGER_ELEMENT
Name of the security manager configuration element.
|
static String |
STOP_DELAY_ATTRIBUTE
Name of the stopDelay configuration attribute.
|
static String |
SYNC_DELAY_ATTRIBUTE
Name of the syncDelay 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.
|
static String |
WSP_NAME_ATTRIBUTE
Name of the workspace containing security data.
|
CLASS_ATTRIBUTE, NAME_ATTRIBUTE, PARAM_ELEMENT, VALUE_ATTRIBUTE
Modifier | Constructor and Description |
---|---|
|
RepositoryConfigurationParser(Properties variables)
Creates a new configuration parser with the given parser variables.
|
protected |
RepositoryConfigurationParser(Properties variables,
ConnectionFactory connectionFactory)
Creates a new configuration parser with the given parser variables
and connection factory.
|
Modifier and Type | Method and Description |
---|---|
protected RepositoryConfigurationParser |
createSubParser(Properties variables)
Creates a new instance of a configuration parser but with overlayed
variables and the same connection factory as this parser.
|
protected DataStoreFactory |
getDataStoreFactory(Element parent,
String directory)
Parses data store configuration.
|
protected FileSystemFactory |
getFileSystemFactory(Element parent,
String name)
Creates and returns a factory object that creates
FileSystem
instances based on the bean configuration at the named element. |
protected ISMLockingFactory |
getISMLockingFactory(Element parent)
Returns an ISM locking factory that creates
ISMLocking instances
based on the given configuration. |
protected JournalFactory |
getJournalFactory(Element cluster,
File home,
String id)
Parses journal configuration.
|
protected QueryHandlerFactory |
getQueryHandlerFactory(Element parent)
Parses search index configuration.
|
protected RepositoryLockMechanismFactory |
getRepositoryLockMechanismFactory(Element root)
Parses repository lock mechanism configuration.
|
AccessManagerConfig |
parseAccessManagerConfig(Element security)
Parses the access manager configuration.
|
protected BeanConfig |
parseBeanConfig(Element element)
Parses a named bean configuration from the given element.
|
protected BeanConfig |
parseBeanConfig(Element parent,
String name)
Parses a named bean configuration from the given element.
|
protected ClusterConfig |
parseClusterConfig(Element parent,
File home)
Parses cluster configuration.
|
protected DataSourceConfig |
parseDataSourceConfig(Element parent)
Parses the DataSources configuration under the given parent.
|
ImportConfig |
parseImportConfig(Element parent)
Read the optional Import Element of Workspace's configuration.
|
LoginModuleConfig |
parseLoginModuleConfig(Element security)
Parses the login module configuration.
|
protected PersistenceManagerConfig |
parsePersistenceManagerConfig(Element parent)
Parses the PersistenceManager config.
|
RepositoryConfig |
parseRepositoryConfig(InputSource xml)
Parses repository configuration.
|
SecurityConfig |
parseSecurityConfig(Element security)
Parses security configuration.
|
SecurityManagerConfig |
parseSecurityManagerConfig(Element security)
Parses the security manager configuration.
|
protected VersioningConfig |
parseVersioningConfig(Element parent)
Parses versioning configuration.
|
protected WorkspaceConfig |
parseWorkspaceConfig(Element root)
Parse workspace config.
|
WorkspaceConfig |
parseWorkspaceConfig(InputSource xml)
Parses workspace configuration.
|
WorkspaceSecurityConfig |
parseWorkspaceSecurityConfig(Element parent)
Read the optional WorkspaceSecurity Element of Workspace's configuration.
|
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setConfigVisitor(BeanConfigVisitor configVisitor) |
getAttribute, getAttribute, getElement, getElement, getElements, getEntityResolver, getErrorHandler, getVariables, parseParameters, parseXML, parseXML, postParseModificationHook, replaceVariables
public static final String REPOSITORY_HOME_VARIABLE
public static final String REPOSITORY_CONF_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 SECURITY_MANAGER_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 CLUSTER_ELEMENT
public static final String DATASOURCES_ELEMENT
public static final String DATASOURCE_ELEMENT
public static final String JOURNAL_ELEMENT
public static final String DATA_STORE_ELEMENT
public static final String REPOSITORY_LOCK_MECHANISM_ELEMENT
public static final String PERSISTENCE_MANAGER_ELEMENT
public static final String SEARCH_INDEX_ELEMENT
public static final String ISM_LOCKING_ELEMENT
public static final String APP_NAME_ATTRIBUTE
public static final String WSP_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 ID_ATTRIBUTE
public static final String SYNC_DELAY_ATTRIBUTE
public static final String STOP_DELAY_ATTRIBUTE
public static final String DEFAULT_QUERY_HANDLER
public static final String CLUSTERED_ATTRIBUTE
public static final String PRIMARY_DATASTORE_ATTRIBUTE
public static final String ARCHIVE_DATASTORE_ATTRIBUTE
public static final String DEFAULT_SYNC_DELAY
public static final String DEFAULT_STOP_DELAY
protected final ConnectionFactory connectionFactory
ConnectionFactory
.protected BeanFactory beanFactory
protected BeanConfigVisitor configVisitor
protected RepositoryConfigurationParser(Properties variables, ConnectionFactory connectionFactory)
variables
- parser variablesconnectionFactory
- connection factorypublic RepositoryConfigurationParser(Properties variables)
variables
- parser variablespublic RepositoryConfig parseRepositoryConfig(InputSource xml) throws ConfigurationException
<Repository> <FileSystem ...> <Security appName="..."> <SecurityManager ...> <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 documentConfigurationException
- if the configuration is brokenparseBeanConfig(Element, String)
,
parseVersioningConfig(Element)
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.
parseBeanConfig
in class ConfigurationParser
parent
- parent elementname
- name of the bean configuration elementConfigurationException
- if the configuration element does not
exist or is brokenprotected BeanConfig parseBeanConfig(Element element) 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.
parseBeanConfig
in class ConfigurationParser
ConfigurationException
- if the configuration element does not
exist or is brokenpublic SecurityConfig parseSecurityConfig(Element security) throws ConfigurationException
<Security appName="..."> <SecurityManager ...> <AccessManager ...> <LoginModule ... (optional)> </Security>
The SecurityManager
, the AccessManager
and LoginModule
are all
bean configuration
elements.
The login module is an optional feature of repository configuration.
security
- the <security> element.ConfigurationException
- if the configuration is brokenpublic SecurityManagerConfig parseSecurityManagerConfig(Element security) throws ConfigurationException
security
- the <security> element.null
.ConfigurationException
- if the configuration is brokenpublic AccessManagerConfig parseAccessManagerConfig(Element security) throws ConfigurationException
security
- the <security> element.null
.ConfigurationException
- if the configuration is brokenpublic LoginModuleConfig parseLoginModuleConfig(Element security) throws ConfigurationException
security
- the <security> element.null
.ConfigurationException
- if the configuration is brokenpublic WorkspaceConfig parseWorkspaceConfig(InputSource xml) throws ConfigurationException
<Workspace name="..."> <FileSystem ...> <PersistenceManager ...> <SearchIndex ...> <ISMLocking ...> <WorkspaceSecurity ...> <ISMLocking ...> </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.
The ism locking configuration element is optional. If it is not given, then a default implementation is used.
Note that the returned workspace configuration object has not been initialized.
xml
- workspace configuration documentConfigurationException
- if the configuration is brokenparseBeanConfig(Element, String)
,
parseWorkspaceSecurityConfig(Element)
protected WorkspaceConfig parseWorkspaceConfig(Element root) throws ConfigurationException
root
- root element of the workspace configurationConfigurationException
parseWorkspaceConfig(InputSource)
protected QueryHandlerFactory getQueryHandlerFactory(Element parent)
<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
elementpublic WorkspaceSecurityConfig parseWorkspaceSecurityConfig(Element parent) throws ConfigurationException
<WorkspaceSecurity> <AccessControlProvider class="..." (optional)> </WorkspaceSecurity>
parent
- Workspace-Root-ElementWorkspaceSecurityConfig
or null
if none is configured.ConfigurationException
public ImportConfig parseImportConfig(Element parent) throws ConfigurationException
<Import> <ProtectedNodeImporter class="..." (optional)> <ProtectedNodeImporter class="..." (optional)> ... <ProtectedPropertyImporter class="..." (optional)> </Import>
parent
- Workspace-Root-ElementImportConfig
or null
if none is
configured.ConfigurationException
protected ISMLockingFactory getISMLockingFactory(Element parent)
ISMLocking
instances
based on the given configuration. ISM locking configuration uses the
following format:
<ISMLocking class="..."> <param name="..." value="..."> ... </ISMLocking>
The ISMLocking
is a
bean configuration
element.
ISM locking is an optional part of the workspace configuration. If
the ISM locking element is not found, then the returned factory will
create instances of the DefaultISMLocking
class.
parent
- parent of the ISMLocking
elementprotected 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
elementConfigurationException
- if the configuration is brokenprotected ClusterConfig parseClusterConfig(Element parent, File home) throws ConfigurationException
<Cluster> <Journal ...> </Journal>
Cluster
is a bean configuration
element.
Clustering is an optional feature. If the cluster element is not found, then this
method returns null
.
parent
- parent of the Journal
elementhome
- repository home directorynull
ConfigurationException
- if the configuration is brokenprotected JournalFactory getJournalFactory(Element cluster, File home, String id) throws ConfigurationException
<Journal class="..."> <param name="..." value="..."> ... </Journal>
Journal
is a bean configuration
element.
cluster
- parent cluster elementhome
- repository home directoryid
- cluster node idConfigurationException
- if the configuration is brokenprotected DataSourceConfig parseDataSourceConfig(Element parent) throws ConfigurationException
<DataSources> <DataSource name="..."> <param name="..." value="..."> ... </DataSource> <DataSource name="..."> <param name="..." value="..."> ... </DataSource> </DataSources>
parent
- the parent of the DataSources elementDataSourceConfig
for the repositoryConfigurationException
- on errorprotected DataStoreFactory getDataStoreFactory(Element parent, String directory) throws ConfigurationException
<DataStore class="..."> <param name="..." value="..."> ... </DataStore>Its also possible to configure a multi data store. The configuration uses following format:
<DataStore class="org.apache.jackrabbit.core.data.MultiDataStore"> <param name="primary" value="org.apache.jackrabbit.core.data.db.XXDataStore"> <param name="..." value="..."> ... </param> <param name="archive" value="org.apache.jackrabbit.core.data.db.XXDataStore"> <param name="..." value="..."> ... </param> </DataStore>
DataStore
is a bean configuration
element.
parent
- configuration elementdirectory
- the repository directoryConfigurationException
- if the configuration is brokenprotected RepositoryLockMechanismFactory getRepositoryLockMechanismFactory(Element root)
<RepositoryLockMechanism class="..." > <param name="..." value="..."> ... </RepositoryLockMechanism>
RepositoryLockMechanism
is a
bean configuration
element.
root
- the root configuration elementprotected PersistenceManagerConfig parsePersistenceManagerConfig(Element parent) throws ConfigurationException
parent
- parent of the PersistenceManager
elementConfigurationException
- if the configuration is brokenprotected RepositoryConfigurationParser createSubParser(Properties variables)
variables
- the variables overlayprotected FileSystemFactory getFileSystemFactory(Element parent, String name) throws ConfigurationException
FileSystem
instances based on the bean configuration at the named element.parent
- parent elementname
- name of the bean configuration elementConfigurationException
- if the bean configuration is invalidpublic void setBeanFactory(BeanFactory beanFactory)
public void setConfigVisitor(BeanConfigVisitor configVisitor)
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.