use of org.apache.jackrabbit.core.util.RepositoryLockMechanismFactory in project jackrabbit by apache.
the class RepositoryConfigurationParser method parseRepositoryConfig.
/**
* Parses repository configuration. Repository configuration uses the
* following format:
* <pre>
* <Repository>
* <FileSystem ...>
* <Security appName="...">
* <SecurityManager ...>
* <AccessManager ...>
* <LoginModule ... (optional)>
* </Security>
* <Workspaces rootPath="..." defaultWorkspace="..."/>
* <Workspace ...>
* <Versioning ...>
* </Repository>
* </pre>
* <p>
* The <code>FileSystem</code> element is a
* {@link #parseBeanConfig(Element,String) bean configuration} element,
* that specifies the file system implementation for storing global
* repository information. The <code>Security</code> element contains
* an <code>AccessManager</code> bean configuration element and the
* JAAS name of the repository application. The <code>Workspaces</code>
* element contains general workspace parameters, and the
* <code>Workspace</code> element is a template for the individual
* workspace configuration files. The <code>Versioning</code> element
* contains
* {@link #parseVersioningConfig(Element) versioning configuration} for
* the repository.
* <p>
* 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 <em>must</em> be available for the configuration document to
* be correctly parsed.
* <p>
* {@link #replaceVariables(String) 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.
* <p>
* Note that the returned repository configuration object has not been
* initialized.
*
* @param xml repository configuration document
* @return repository configuration
* @throws ConfigurationException if the configuration is broken
* @see #parseBeanConfig(Element, String)
* @see #parseVersioningConfig(Element)
*/
public RepositoryConfig parseRepositoryConfig(InputSource xml) throws ConfigurationException {
Element root = parseXML(xml, true);
// Repository home directory
String home = getVariables().getProperty(REPOSITORY_HOME_VARIABLE);
// File system implementation
FileSystemFactory fsf = getFileSystemFactory(root, FILE_SYSTEM_ELEMENT);
// Security configuration and access manager implementation
Element security = getElement(root, SECURITY_ELEMENT);
SecurityConfig securityConfig = parseSecurityConfig(security);
// General workspace configuration
Element workspaces = getElement(root, WORKSPACES_ELEMENT);
String workspaceDirectory = replaceVariables(getAttribute(workspaces, ROOT_PATH_ATTRIBUTE));
String workspaceConfigDirectory = getAttribute(workspaces, CONFIG_ROOT_PATH_ATTRIBUTE, null);
String defaultWorkspace = replaceVariables(getAttribute(workspaces, DEFAULT_WORKSPACE_ATTRIBUTE));
int maxIdleTime = Integer.parseInt(getAttribute(workspaces, MAX_IDLE_TIME_ATTRIBUTE, "0"));
// Workspace configuration template
Element template = getElement(root, WORKSPACE_ELEMENT);
// Versioning configuration
VersioningConfig vc = parseVersioningConfig(root);
// Query handler implementation
QueryHandlerFactory qhf = getQueryHandlerFactory(root);
// Optional journal configuration
ClusterConfig cc = parseClusterConfig(root, new File(home));
// Optional data store factory
DataStoreFactory dsf = getDataStoreFactory(root, home);
RepositoryLockMechanismFactory rlf = getRepositoryLockMechanismFactory(root);
// Optional data source configuration
DataSourceConfig dsc = parseDataSourceConfig(root);
return new RepositoryConfig(home, securityConfig, fsf, workspaceDirectory, workspaceConfigDirectory, defaultWorkspace, maxIdleTime, template, vc, qhf, cc, dsf, rlf, dsc, connectionFactory, this);
}
Aggregations