Search in sources :

Example 1 with ISMLockingFactory

use of org.apache.jackrabbit.core.state.ISMLockingFactory in project jackrabbit by apache.

the class RepositoryConfigurationParser method parseVersioningConfig.

/**
     * Parses versioning configuration. Versioning configuration uses the
     * following format:
     * <pre>
     *   &lt;Versioning rootPath="..."&gt;
     *     &lt;FileSystem ...&gt;
     *     &lt;PersistenceManager ...&gt;
     *   &lt;/Versioning&gt;
     * </pre>
     * <p>
     * Both the <code>FileSystem</code> and <code>PersistenceManager</code>
     * elements are {@link #parseBeanConfig(Element,String) bean configuration}
     * elements. In addition to the bean parameter values,
     * {@link #replaceVariables(String) variable replacement} is performed
     * also on the versioning root path attribute.
     *
     * @param parent parent of the <code>Versioning</code> element
     * @return versioning configuration
     * @throws ConfigurationException if the configuration is broken
     */
protected VersioningConfig parseVersioningConfig(Element parent) throws ConfigurationException {
    Element element = getElement(parent, VERSIONING_ELEMENT);
    // Versioning home directory
    String home = replaceVariables(getAttribute(element, ROOT_PATH_ATTRIBUTE));
    // File system implementation
    FileSystemFactory fsf = getFileSystemFactory(element, FILE_SYSTEM_ELEMENT);
    // Persistence manager implementation
    PersistenceManagerConfig pmc = parsePersistenceManagerConfig(element);
    // Item state manager locking configuration (optional)
    ISMLockingFactory ismLockingFactory = getISMLockingFactory(element);
    return new VersioningConfig(home, fsf, pmc, ismLockingFactory);
}
Also used : Element(org.w3c.dom.Element) ISMLockingFactory(org.apache.jackrabbit.core.state.ISMLockingFactory) FileSystemFactory(org.apache.jackrabbit.core.fs.FileSystemFactory)

Example 2 with ISMLockingFactory

use of org.apache.jackrabbit.core.state.ISMLockingFactory in project jackrabbit by apache.

the class RepositoryConfigurationParser method parseWorkspaceConfig.

/**
     * Parse workspace config.
     *
     * @param root root element of the workspace configuration
     * @return The workspace configuration
     * @throws ConfigurationException
     * @see #parseWorkspaceConfig(InputSource)
     */
protected WorkspaceConfig parseWorkspaceConfig(Element root) throws ConfigurationException {
    // Workspace home directory
    String home = getVariables().getProperty(WORKSPACE_HOME_VARIABLE);
    // Workspace name
    String name = getAttribute(root, "name", new File(home).getName());
    // Clustered attribute
    boolean clustered = Boolean.valueOf(getAttribute(root, CLUSTERED_ATTRIBUTE, "true"));
    // Create a temporary parser that contains the ${wsp.name} variable
    Properties tmpVariables = (Properties) getVariables().clone();
    tmpVariables.put(WORKSPACE_NAME_VARIABLE, name);
    RepositoryConfigurationParser tmpParser = createSubParser(tmpVariables);
    // File system implementation
    FileSystemFactory fsf = tmpParser.getFileSystemFactory(root, FILE_SYSTEM_ELEMENT);
    // Persistence manager implementation
    PersistenceManagerConfig pmc = tmpParser.parsePersistenceManagerConfig(root);
    // Query handler implementation
    QueryHandlerFactory qhf = tmpParser.getQueryHandlerFactory(root);
    // Item state manager locking configuration (optional)
    ISMLockingFactory ismLockingFactory = tmpParser.getISMLockingFactory(root);
    // workspace specific security configuration
    WorkspaceSecurityConfig workspaceSecurityConfig = tmpParser.parseWorkspaceSecurityConfig(root);
    // optional config for import handling
    ImportConfig importConfig = tmpParser.parseImportConfig(root);
    // default lock timeout
    String to = getAttribute(root, "defaultLockTimeout", new Long(Long.MAX_VALUE).toString());
    long defaultLockTimeout;
    try {
        defaultLockTimeout = Long.parseLong(to);
    } catch (NumberFormatException ex) {
        throw new ConfigurationException("defaultLockTimeout must be an integer value", ex);
    }
    return new WorkspaceConfig(home, name, clustered, fsf, pmc, qhf, ismLockingFactory, workspaceSecurityConfig, importConfig, defaultLockTimeout);
}
Also used : Properties(java.util.Properties) FileSystemFactory(org.apache.jackrabbit.core.fs.FileSystemFactory) QueryHandlerFactory(org.apache.jackrabbit.core.query.QueryHandlerFactory) ISMLockingFactory(org.apache.jackrabbit.core.state.ISMLockingFactory) File(java.io.File)

Aggregations

FileSystemFactory (org.apache.jackrabbit.core.fs.FileSystemFactory)2 ISMLockingFactory (org.apache.jackrabbit.core.state.ISMLockingFactory)2 File (java.io.File)1 Properties (java.util.Properties)1 QueryHandlerFactory (org.apache.jackrabbit.core.query.QueryHandlerFactory)1 Element (org.w3c.dom.Element)1