Index: src/main/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java (working copy) @@ -17,24 +17,24 @@ package org.apache.jackrabbit.core.config; /** - * Access manager configuration. This bean configuration class - * is used to create configured access manager objects. + * Access manager configuration. This bean configuration class is used to create + * configured access manager objects. *

- * This class is currently only used to assign a static type to - * more generic bean configuration information. + * This class is currently only used to assign a static type to more generic + * bean configuration information. * * @see RepositoryConfig#getAccessManagerConfig() */ public class AccessManagerConfig extends BeanConfig { /** - * Creates an access manager configuration object from the - * given bean configuration. + * Creates an access manager configuration object from the given bean + * configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public AccessManagerConfig(BeanConfig config) { super(config); } - } Index: src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/BeanConfig.java (working copy) @@ -16,28 +16,28 @@ */ package org.apache.jackrabbit.core.config; -import org.apache.commons.collections.BeanMap; - import java.util.Iterator; import java.util.Properties; +import org.apache.commons.collections.BeanMap; + /** - * Bean configuration class. BeanConfig instances contain the class name - * and property information required to instantiate a class that conforms - * with the JavaBean conventions. + * Bean configuration class. BeanConfig instances contain the class name and + * property information required to instantiate a class that conforms with the + * JavaBean conventions. */ public class BeanConfig { /** The default class loader used by all instances of this class */ - private static ClassLoader DEFAULT_CLASS_LOADER = - BeanConfig.class.getClassLoader(); - + private static ClassLoader defaultClassLoader = BeanConfig.class + .getClassLoader(); + /** * The current class loader used by this instance to create instances of * configured classes. */ private ClassLoader classLoader = getDefaultClassLoader(); - + /** * The class name of the configured bean. */ @@ -49,13 +49,15 @@ private final Properties properties; /** - * Creates a bean configuration. Note that a copy of the given - * bean properties is stored as a part of the created configuration - * object. Thus the caller is free to modify the given properties - * once the configuration object has been created. + * Creates a bean configuration. Note that a copy of the given bean + * properties is stored as a part of the created configuration object. Thus + * the caller is free to modify the given properties once the configuration + * object has been created. * - * @param className class name of the bean - * @param properties initial properties of the bean + * @param className + * class name of the bean + * @param properties + * initial properties of the bean */ public BeanConfig(String className, Properties properties) { this.className = className; @@ -65,7 +67,8 @@ /** * Copies a bean configuration. * - * @param config the configuration to be copied + * @param config + * the configuration to be copied */ public BeanConfig(BeanConfig config) { this(config.getClassName(), config.getParameters()); @@ -93,12 +96,13 @@ * Creates a new instance of the configured bean class. * * @return new bean instance - * @throws ConfigurationException on bean configuration errors + * @throws ConfigurationException + * on bean configuration errors */ public Object newInstance() throws ConfigurationException { try { - Class objectClass = - Class.forName(getClassName(), true, getClassLoader()); + Class objectClass = Class.forName(getClassName(), true, + getClassLoader()); Object object = objectClass.newInstance(); BeanMap map = new BeanMap(object); Iterator iterator = map.keyIterator(); @@ -113,24 +117,24 @@ } catch (ClassNotFoundException e) { throw new ConfigurationException( "Configured bean implementation class " + getClassName() - + " was not found.", e); + + " was not found.", e); } catch (InstantiationException e) { throw new ConfigurationException( "Configured bean implementation class " + getClassName() - + " can not be instantiated.", e); + + " can not be instantiated.", e); } catch (IllegalAccessException e) { throw new ConfigurationException( "Configured bean implementation class " + getClassName() - + " is protected.", e); + + " is protected.", e); } } - //---------- Configurable class loader support ---------------------------- - + // ---------- Configurable class loader support ---------------------------- + /** - * Returns the current ClassLoader used to instantiate objects - * in the {@link #newInstance()} method. - * + * Returns the current ClassLoader used to instantiate + * objects in the {@link #newInstance()} method. + * * @see #newInstance() * @see #setClassLoader(ClassLoader) * @see #getDefaultClassLoader() @@ -139,15 +143,15 @@ public ClassLoader getClassLoader() { return classLoader; } - + /** * Sets the ClassLoader used to instantiate objects in the * {@link #newInstance()} method. - * - * @param classLoader The class loader to set on this instance. If this is - * null the system class loader will be used, which may - * lead to unexpected class loading failures. - * + * + * @param classLoader + * The class loader to set on this instance. If this is + * null the system class loader will be used, + * which may lead to unexpected class loading failures. * @see #newInstance() * @see #getClassLoader() * @see #getDefaultClassLoader() @@ -156,35 +160,36 @@ public void setClassLoader(ClassLoader classLoader) { this.classLoader = classLoader; } - + /** * Returns the current ClassLoader used for new instances of * this class as the loader used to instantiate objects in the * {@link #newInstance()} method. - * + * * @see #newInstance() * @see #getClassLoader() * @see #setClassLoader(ClassLoader) * @see #setDefaultClassLoader(ClassLoader) */ public static ClassLoader getDefaultClassLoader() { - return DEFAULT_CLASS_LOADER; + return defaultClassLoader; } - + /** - * Sets the ClassLoader used for new instances of this class as - * the loader to instantiate objects in the {@link #newInstance()} method. - * - * @param classLoader The class loader to set as the default class loader. - * If this is null the system class loader will be used, - * which may lead to unexpected class loading failures. - * + * Sets the ClassLoader used for new instances of this class + * as the loader to instantiate objects in the {@link #newInstance()} + * method. + * + * @param classLoader + * The class loader to set as the default class loader. If this + * is null the system class loader will be used, + * which may lead to unexpected class loading failures. * @see #newInstance() * @see #getClassLoader() * @see #setClassLoader(ClassLoader) * @see #getDefaultClassLoader() */ public static void setDefaultClassLoader(ClassLoader classLoader) { - DEFAULT_CLASS_LOADER = classLoader; + defaultClassLoader = classLoader; } } Index: src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/ClusterConfig.java (working copy) @@ -40,8 +40,10 @@ /** * Creates a new cluster configuration. * - * @param id custom cluster node id - * @param jc journal configuration + * @param id + * custom cluster node id + * @param jc + * journal configuration */ public ClusterConfig(String id, int syncDelay, JournalConfig jc) { this.id = id; Index: src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/ConfigurationEntityResolver.java (working copy) @@ -16,64 +16,66 @@ */ package org.apache.jackrabbit.core.config; +import java.io.IOException; +import java.io.InputStream; + import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import java.io.IOException; -import java.io.InputStream; - /** - * Entity resolver for Jackrabbit configuration files. - * This simple resolver contains mappings for the following - * public identifiers used for the Jackrabbit configuration files. + * Entity resolver for Jackrabbit configuration files. This simple resolver + * contains mappings for the following public identifiers used for the + * Jackrabbit configuration files. *

*

- * The public identifiers are mapped to a document type definition - * file included in the Jackrabbit jar archive. + * The public identifiers are mapped to a document type definition file included + * in the Jackrabbit jar archive. */ class ConfigurationEntityResolver implements EntityResolver { /** * Public identifier of the repository configuration DTD. */ - public static final String REPOSITORY_ID = - "-//The Apache Software Foundation//DTD Repository//EN"; + public static final String REPOSITORY_ID = "-//The Apache Software " + + "Foundation//DTD Repository//EN"; /** * Public identifier of the workspace configuration DTD. */ - public static final String WORKSPACE_ID = - "-//The Apache Software Foundation//DTD Workspace//EN"; + public static final String WORKSPACE_ID = "-//The Apache Software " + + "Foundation//DTD Workspace//EN"; /** * Resource path of the internal configuration DTD file. */ - private static final String CONFIG_DTD = - "org/apache/jackrabbit/core/config/config.dtd"; + private static final String CONFIG_DTD = "org/apache/jackrabbit/core/" + + "config/config.dtd"; /** - * Resolves an entity to the corresponding input source. - * {@inheritDoc} + * Resolves an entity to the corresponding input source. {@inheritDoc} * - * @param publicId public identifier - * @param systemId system identifier + * @param publicId + * public identifier + * @param systemId + * system identifier * @return resolved entity source - * @throws SAXException on SAX errors - * @throws IOException on IO errors + * @throws SAXException + * on SAX errors + * @throws IOException + * on IO errors */ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (REPOSITORY_ID.equals(publicId) || WORKSPACE_ID.equals(publicId)) { - InputStream dtd = - getClass().getClassLoader().getResourceAsStream(CONFIG_DTD); + InputStream dtd = getClass().getClassLoader().getResourceAsStream( + CONFIG_DTD); return new InputSource(dtd); } else { return null; } } - } Index: src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/ConfigurationException.java (working copy) @@ -26,7 +26,8 @@ /** * Creates a configuration exception. * - * @param message configuration message + * @param message + * configuration message */ ConfigurationException(String message) { super(message); @@ -35,11 +36,12 @@ /** * Creates a configuration exception that is caused by another exception. * - * @param message configuration error message - * @param cause root cause of the configuration error + * @param message + * configuration error message + * @param cause + * root cause of the configuration error */ ConfigurationException(String message, Exception cause) { super(message, cause); } - } Index: src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/ConfigurationParser.java (working copy) @@ -16,6 +16,14 @@ */ package org.apache.jackrabbit.core.config; +import java.io.IOException; +import java.util.Properties; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.jackrabbit.util.Text; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -23,21 +31,14 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import org.apache.jackrabbit.util.Text; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.io.IOException; -import java.util.Properties; - /** - * Configuration parser base class. This class provides the basic - * functionality for parsing Jackrabbit configuration files. Subclasses - * extend this functionality with knowledge of the exact structure of the - * different configuration files. Each configuration parser instance - * contains a set of parser variables that are used for variable replacement - * in the configuration file. + * Configuration parser base class. This class provides the basic functionality + * for parsing Jackrabbit configuration files. Subclasses extend this + * functionality with knowledge of the exact structure of the different + * configuration files. Each configuration parser instance contains a set of + * parser variables that are used for variable replacement in the configuration + * file. */ public class ConfigurationParser { @@ -54,9 +55,9 @@ public static final String VALUE_ATTRIBUTE = "value"; /** - * The configuration parser variables. These name-value pairs - * are used to substitute ${...} variable references - * with context-dependent values in the configuration. + * The configuration parser variables. These name-value pairs are used to + * substitute ${...} variable references with + * context-dependent values in the configuration. * * @see #replaceVariables(String) */ @@ -65,7 +66,8 @@ /** * Creates a new configuration parser with the given parser variables. * - * @param variables parser variables + * @param variables + * parser variables */ public ConfigurationParser(Properties variables) { this.variables = variables; @@ -73,6 +75,7 @@ /** * Returns the variables. + * * @return the variables. */ public Properties getVariables() { @@ -80,24 +83,28 @@ } /** - * Parses a named bean configuration from the given element. - * Bean configuration uses the following format: + * Parses a named bean configuration from the given element. Bean + * configuration uses the following format: + * *

-     *   <BeanName class="...">
-     *     <param name="..." value="..."/>
-     *     ...
-     *   </BeanName>
+     *    <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. + * The returned bean configuration object contains the configured class name + * and configuration parameters. Variable replacement is performed on the + * parameter values. * - * @param parent parent element - * @param name name of the bean configuration element + * @param parent + * parent element + * @param name + * name of the bean configuration element * @return bean configuration, - * @throws ConfigurationException if the configuration element does not - * exist or is broken + * @throws ConfigurationException + * if the configuration element does not exist or is broken */ protected BeanConfig parseBeanConfig(Element parent, String name) throws ConfigurationException { @@ -114,18 +121,18 @@ } /** - * Parses the configuration parameters of the given element. - * Parameters are stored as - * <param name="..." value="..."/> - * child elements. This method parses all param elements, - * performs {@link #replaceVariables(String) variable replacement} - * on parameter values, and returns the resulting name-value pairs. + * Parses the configuration parameters of the given element. Parameters are + * stored as <param name="..." value="..."/> child + * elements. This method parses all param elements, performs + * {@link #replaceVariables(String) variable replacement} on parameter + * values, and returns the resulting name-value pairs. * - * @param element configuration element + * @param element + * configuration element * @return configuration parameters - * @throws ConfigurationException if a param element does - * not contain the name and - * value attributes + * @throws ConfigurationException + * if a param element does not contain the + * name and value attributes */ protected Properties parseParameters(Element element) throws ConfigurationException { @@ -145,8 +152,8 @@ if (value == null) { throw new ConfigurationException("Parameter value not set"); } - parameters.put( - name.getValue(), replaceVariables(value.getValue())); + parameters.put(name.getValue(), replaceVariables(value + .getValue())); } } @@ -154,15 +161,16 @@ } /** - * Performs variable replacement on the given string value. - * Each ${...} 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. + * Performs variable replacement on the given string value. Each + * ${...} 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. * - * @param value original value + * @param value + * original value * @return value after variable replacements - * @throws ConfigurationException if the replacement of a referenced - * variable is not found + * @throws ConfigurationException + * if the replacement of a referenced variable is not found */ protected String replaceVariables(String value) throws ConfigurationException { @@ -174,20 +182,21 @@ } /** - * Parses the given XML document and returns the DOM root element. - * A custom entity resolver is used to make the included configuration - * file DTD available using the specified public identifiers. + * Parses the given XML document and returns the DOM root element. A custom + * entity resolver is used to make the included configuration file DTD + * available using the specified public identifiers. * * @see ConfigurationEntityResolver - * @param xml xml document + * @param xml + * xml document * @return root element - * @throws ConfigurationException if the configuration document could - * not be read or parsed + * @throws ConfigurationException + * if the configuration document could not be read or parsed */ protected Element parseXML(InputSource xml) throws ConfigurationException { try { - DocumentBuilderFactory factory = - DocumentBuilderFactory.newInstance(); + DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(new ConfigurationEntityResolver()); Document document = builder.parse(xml); @@ -207,11 +216,14 @@ /** * Returns the named child of the given parent element. * - * @param parent parent element - * @param name name of the child element + * @param parent + * parent element + * @param name + * name of the child element * @return named child element * @throws ConfigurationException - * @throws ConfigurationException if the child element is not found + * @throws ConfigurationException + * if the child element is not found */ protected Element getElement(Element parent, String name) throws ConfigurationException { @@ -221,13 +233,17 @@ /** * Returns the named child of the given parent element. * - * @param parent parent element - * @param name name of the child element - * @param required indicates if the child element is required + * @param parent + * parent element + * @param name + * name of the child element + * @param required + * indicates if the child element is required * @return named child element, or null if not found and * required is false. - * @throws ConfigurationException if the child element is not found and - * required is true. + * @throws ConfigurationException + * if the child element is not found and required + * is true. */ protected Element getElement(Element parent, String name, boolean required) throws ConfigurationException { @@ -240,9 +256,8 @@ } } if (required) { - throw new ConfigurationException( - "Configuration element " + name + " not found in " - + parent.getNodeName() + "."); + throw new ConfigurationException("Configuration element " + name + + " not found in " + parent.getNodeName() + "."); } else { return null; } @@ -251,10 +266,13 @@ /** * Returns the value of the named attribute of the given element. * - * @param element element - * @param name attribute name + * @param element + * element + * @param name + * attribute name * @return attribute value - * @throws ConfigurationException if the attribute is not found + * @throws ConfigurationException + * if the attribute is not found */ protected String getAttribute(Element element, String name) throws ConfigurationException { @@ -262,19 +280,21 @@ if (attribute != null) { return attribute.getValue(); } else { - throw new ConfigurationException( - "Configuration attribute " + name + " not found in " - + element.getNodeName() + "."); + throw new ConfigurationException("Configuration attribute " + name + + " not found in " + element.getNodeName() + "."); } } /** - * Returns the value of the named attribute of the given element. - * If the attribute is not found, then the given default value is returned. + * Returns the value of the named attribute of the given element. If the + * attribute is not found, then the given default value is returned. * - * @param element element - * @param name attribute name - * @param def default value + * @param element + * element + * @param name + * attribute name + * @param def + * default value * @return attribute value, or the default value */ protected String getAttribute(Element element, String name, String def) { @@ -285,5 +305,4 @@ return def; } } - } Index: src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/FileSystemConfig.java (working copy) @@ -20,26 +20,28 @@ import org.apache.jackrabbit.core.fs.FileSystemException; /** - * File system configuration. This bean configuration class - * is used to create a configured file system object. + * File system configuration. This bean configuration class is used to create a + * configured file system object. */ public class FileSystemConfig extends BeanConfig { /** * Creates a file system configuration object. * - * @param config file system implementation class configuration + * @param config + * file system implementation class configuration */ public FileSystemConfig(BeanConfig config) { super(config); } /** - * Instantiates and initializes the configured file system - * implementation class. + * Instantiates and initializes the configured file system implementation + * class. * * @return new initialized file system instance. - * @throws ConfigurationException on file system initialization errors + * @throws ConfigurationException + * on file system initialization errors */ public FileSystem createFileSystem() throws ConfigurationException { try { @@ -49,7 +51,7 @@ } catch (ClassCastException e) { throw new ConfigurationException( "Invalid file system implementation class " - + getClassName() + ".", e); + + getClassName() + ".", e); } catch (FileSystemException e) { throw new ConfigurationException( "File system initialization failure.", e); Index: src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/JournalConfig.java (working copy) @@ -17,21 +17,21 @@ package org.apache.jackrabbit.core.config; /** - * Journal configuration. This bean configuration class - * is used to create configured journal. + * Journal configuration. This bean configuration class is used to create + * configured journal. *

- * This class is currently only used to assign a static type to - * more generic bean configuration information. + * This class is currently only used to assign a static type to more generic + * bean configuration information. */ public class JournalConfig extends BeanConfig { /** * Creates a journal configuration object from the given bean configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public JournalConfig(BeanConfig config) { super(config); } - } Index: src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/LoginModuleConfig.java (working copy) @@ -19,21 +19,22 @@ import javax.security.auth.spi.LoginModule; /** - * LoginModule configuration. This bean configuration class is used to - * create login module objects. + * LoginModule configuration. This bean configuration class is used to create + * login module objects. *

- * Login module is an optional configuration that allows to use JackRabbit - * in a non-JAAS environment. + * Login module is an optional configuration that allows to use JackRabbit in a + * non-JAAS environment. * * @see RepositoryConfig#getLoginModuleConfig() */ public class LoginModuleConfig extends BeanConfig { /** - * Creates an access manager configuration object from the - * given bean configuration. + * Creates an access manager configuration object from the given bean + * configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public LoginModuleConfig(BeanConfig config) { super(config); @@ -44,8 +45,9 @@ if (result instanceof LoginModule) { return (LoginModule) result; } else { - throw new ConfigurationException("Invalid login module implementation class " - + getClassName() + "."); + throw new ConfigurationException( + "Invalid login module implementation class " + + getClassName() + "."); } } } Index: src/main/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java (working copy) @@ -17,24 +17,24 @@ package org.apache.jackrabbit.core.config; /** - * Persistence manager configuration. This bean configuration class - * is used to create configured persistence manager objects. + * Persistence manager configuration. This bean configuration class is used to + * create configured persistence manager objects. *

- * This class is currently only used to assign a static type to - * more generic bean configuration information. + * This class is currently only used to assign a static type to more generic + * bean configuration information. * * @see WorkspaceConfig#getPersistenceManagerConfig() */ public class PersistenceManagerConfig extends BeanConfig { /** - * Creates a persistence manager configuration object from the - * given bean configuration. + * Creates a persistence manager configuration object from the given bean + * configuration. * - * @param config bean configuration + * @param config + * bean configuration */ public PersistenceManagerConfig(BeanConfig config) { super(config); } - } Index: src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/RepositoryConfig.java (working copy) @@ -16,21 +16,6 @@ */ package org.apache.jackrabbit.core.config; -import org.apache.jackrabbit.core.fs.FileSystem; -import org.apache.jackrabbit.core.fs.FileSystemException; -import org.apache.jackrabbit.core.fs.FileSystemPathUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Element; -import org.xml.sax.InputSource; - -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; @@ -47,16 +32,31 @@ import java.util.Map; import java.util.Properties; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.apache.jackrabbit.core.fs.FileSystem; +import org.apache.jackrabbit.core.fs.FileSystemException; +import org.apache.jackrabbit.core.fs.FileSystemPathUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; + /** - * Repository configuration. This configuration class is used to - * create configured repository objects. + * Repository configuration. This configuration class is used to create + * configured repository objects. *

- * The contained configuration information are: the home directory and name - * of the repository, the access manager, file system and versioning - * configuration, repository index configuration, the workspace directory, - * the default workspace name, and the workspace configuration template. In - * addition the workspace configuration object keeps track of all configured - * workspaces. + * The contained configuration information are: the home directory and name of + * the repository, the access manager, file system and versioning configuration, + * repository index configuration, the workspace directory, the default + * workspace name, and the workspace configuration template. In addition the + * workspace configuration object keeps track of all configured workspaces. */ public class RepositoryConfig { @@ -68,13 +68,16 @@ /** * Convenience method that wraps the configuration file name into an - * {@link InputSource} and invokes the - * {@link #create(InputSource, String)} method. + * {@link InputSource} and invokes the {@link #create(InputSource, String)} + * method. * - * @param file repository configuration file name - * @param home repository home directory + * @param file + * repository configuration file name + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors * @see #create(InputSource, String) */ public static RepositoryConfig create(String file, String home) @@ -85,13 +88,16 @@ /** * Convenience method that wraps the configuration URI into an - * {@link InputSource} and invokes the - * {@link #create(InputSource, String)} method. + * {@link InputSource} and invokes the {@link #create(InputSource, String)} + * method. * - * @param uri repository configuration URI - * @param home repository home directory + * @param uri + * repository configuration URI + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors * @see #create(InputSource, String) */ public static RepositoryConfig create(URI uri, String home) @@ -101,13 +107,16 @@ /** * Convenience method that wraps the configuration input stream into an - * {@link InputSource} and invokes the - * {@link #create(InputSource, String)} method. + * {@link InputSource} and invokes the {@link #create(InputSource, String)} + * method. * - * @param input repository configuration input stream - * @param home repository home directory + * @param input + * repository configuration input stream + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors * @see #create(InputSource, String) */ public static RepositoryConfig create(InputStream input, String home) @@ -116,27 +125,30 @@ } /** - * Parses the given repository configuration document and returns the - * parsed and initialized repository configuration. The given repository - * home directory path will be used as the ${rep.home} parser variable. + * Parses the given repository configuration document and returns the parsed + * and initialized repository configuration. The given repository home + * directory path will be used as the ${rep.home} parser variable. *

* Note that in addition to parsing the repository configuration, this * method also initializes the configuration (creates the configured - * directories, etc.). The {@link ConfigurationParser} class should be - * used directly to just parse the configuration. + * directories, etc.). The {@link ConfigurationParser} class should be used + * directly to just parse the configuration. * - * @param xml repository configuration document - * @param home repository home directory + * @param xml + * repository configuration document + * @param home + * repository home directory * @return repository configuration - * @throws ConfigurationException on configuration errors + * @throws ConfigurationException + * on configuration errors */ public static RepositoryConfig create(InputSource xml, String home) throws ConfigurationException { Properties variables = new Properties(); variables.setProperty( RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE, home); - RepositoryConfigurationParser parser = - new RepositoryConfigurationParser(variables); + RepositoryConfigurationParser parser = new RepositoryConfigurationParser( + variables); RepositoryConfig config = parser.parseRepositoryConfig(xml); config.init(); @@ -185,8 +197,8 @@ private final String workspaceDirectory; /** - * Path to workspace configuration root directory within the - * repository file system or null if none was specified. + * Path to workspace configuration root directory within the repository file + * system or null if none was specified. */ private final String workspaceConfigDirectory; @@ -220,24 +232,38 @@ /** * Creates a repository configuration object. * - * @param template workspace configuration template - * @param home repository home directory - * @param sec the security configuration - * @param fsc file system configuration - * @param workspaceDirectory workspace root directory - * @param workspaceConfigDirectory optional workspace configuration directory - * @param workspaceMaxIdleTime maximum workspace idle time in seconds - * @param defaultWorkspace name of the default workspace - * @param vc versioning configuration - * @param sc search configuration for system search manager. - * @param cc optional cluster configuration - * @param parser configuration parser + * @param template + * workspace configuration template + * @param home + * repository home directory + * @param sec + * the security configuration + * @param fsc + * file system configuration + * @param workspaceDirectory + * workspace root directory + * @param workspaceConfigDirectory + * optional workspace configuration directory + * @param workspaceMaxIdleTime + * maximum workspace idle time in seconds + * @param defaultWorkspace + * name of the default workspace + * @param vc + * versioning configuration + * @param sc + * search configuration for system search manager. + * @param cc + * optional cluster configuration + * @param parser + * configuration parser */ - public RepositoryConfig(String home, SecurityConfig sec, FileSystemConfig fsc, - String workspaceDirectory, String workspaceConfigDirectory, - String defaultWorkspace, int workspaceMaxIdleTime, - Element template, VersioningConfig vc, SearchConfig sc, - ClusterConfig cc, RepositoryConfigurationParser parser) { + // TODO: refactor - more than 7 parameters + public RepositoryConfig(String home, SecurityConfig sec, + FileSystemConfig fsc, String workspaceDirectory, + String workspaceConfigDirectory, String defaultWorkspace, + int workspaceMaxIdleTime, Element template, VersioningConfig vc, + SearchConfig sc, ClusterConfig cc, + RepositoryConfigurationParser parser) { workspaces = new HashMap(); this.home = home; this.sec = sec; @@ -257,9 +283,10 @@ * Initializes the repository configuration. This method loads the * configurations for all available workspaces. * - * @throws ConfigurationException on initialization errors - * @throws IllegalStateException if the repository configuration has already - * been initialized + * @throws ConfigurationException + * on initialization errors + * @throws IllegalStateException + * if the repository configuration has already been initialized */ public void init() throws ConfigurationException, IllegalStateException { if (!workspaces.isEmpty()) { @@ -283,7 +310,8 @@ if (!fs.exists(workspaceConfigDirectory)) { fs.createFolder(workspaceConfigDirectory); } else { - String[] dirNames = fs.listFolders(workspaceConfigDirectory); + String[] dirNames = fs + .listFolders(workspaceConfigDirectory); for (int i = 0; i < dirNames.length; i++) { String configDir = workspaceConfigDirectory + FileSystem.SEPARATOR + dirNames[i]; @@ -296,8 +324,8 @@ } } catch (FileSystemException e) { throw new ConfigurationException( - "error while loading workspace configurations from path " - + workspaceConfigDirectory, e); + "error while loading workspace configurations from " + + "path " + workspaceConfigDirectory, e); } finally { try { fs.close(); @@ -310,7 +338,8 @@ File[] files = directory.listFiles(); if (files == null) { throw new ConfigurationException( - "Invalid workspace root directory: " + workspaceDirectory); + "Invalid workspace root directory: " + + workspaceDirectory); } for (int i = 0; i < files.length; i++) { @@ -337,14 +366,16 @@ * workspace configuration object. The returned configuration object has not * been initialized. *

- * This method returns null, if the given directory does - * not exist or does not contain a workspace configuration file. If an - * invalid configuration file is found, then a + * This method returns null, if the given directory does not + * exist or does not contain a workspace configuration file. If an invalid + * configuration file is found, then a * {@link ConfigurationException ConfigurationException} is thrown. * - * @param directory physical workspace configuration directory on disk + * @param directory + * physical workspace configuration directory on disk * @return workspace configuration - * @throws ConfigurationException if the workspace configuration is invalid + * @throws ConfigurationException + * if the workspace configuration is invalid */ private WorkspaceConfig loadWorkspaceConfig(File directory) throws ConfigurationException { @@ -357,8 +388,8 @@ variables.setProperty( RepositoryConfigurationParser.WORKSPACE_HOME_VARIABLE, directory.getPath()); - RepositoryConfigurationParser localParser = - parser.createSubParser(variables); + RepositoryConfigurationParser localParser = parser + .createSubParser(variables); return localParser.parseWorkspaceConfig(xml); } catch (FileNotFoundException e) { return null; @@ -372,21 +403,25 @@ * and returned as a workspace configuration object. The returned * configuration object has not been initialized. *

- * This method returns null, if the given directory does - * not exist or does not contain a workspace configuration file. If an - * invalid configuration file is found, then a + * This method returns null, if the given directory does not + * exist or does not contain a workspace configuration file. If an invalid + * configuration file is found, then a * {@link ConfigurationException ConfigurationException} is thrown. * - * @param fs virtual file system where to look for the configuration file - * @param configDir workspace configuration directory in virtual file system + * @param fs + * virtual file system where to look for the configuration file + * @param configDir + * workspace configuration directory in virtual file system * @return workspace configuration - * @throws ConfigurationException if the workspace configuration is invalid + * @throws ConfigurationException + * if the workspace configuration is invalid */ private WorkspaceConfig loadWorkspaceConfig(FileSystem fs, String configDir) throws ConfigurationException { Reader configReader = null; try { - String configPath = configDir + FileSystem.SEPARATOR + WORKSPACE_XML; + String configPath = configDir + FileSystem.SEPARATOR + + WORKSPACE_XML; if (!fs.exists(configPath)) { // no configuration file in this directory return null; @@ -397,8 +432,8 @@ xml.setSystemId(configPath); // the physical workspace home directory (TODO encode name?) - File homeDir = new File( - workspaceDirectory, FileSystemPathUtil.getName(configDir)); + File homeDir = new File(workspaceDirectory, FileSystemPathUtil + .getName(configDir)); if (!homeDir.exists()) { homeDir.mkdir(); } @@ -406,11 +441,12 @@ variables.setProperty( RepositoryConfigurationParser.WORKSPACE_HOME_VARIABLE, homeDir.getPath()); - RepositoryConfigurationParser localParser = - parser.createSubParser(variables); + RepositoryConfigurationParser localParser = parser + .createSubParser(variables); return localParser.parseWorkspaceConfig(xml); } catch (FileSystemException e) { - throw new ConfigurationException("Failed to load workspace configuration", e); + throw new ConfigurationException( + "Failed to load workspace configuration", e); } finally { if (configReader != null) { try { @@ -424,9 +460,10 @@ /** * Adds the given workspace configuration to the repository. * - * @param wc workspace configuration - * @throws ConfigurationException if a workspace with the same name - * already exists + * @param wc + * workspace configuration + * @throws ConfigurationException + * if a workspace with the same name already exists */ private void addWorkspaceConfig(WorkspaceConfig wc) throws ConfigurationException { @@ -455,9 +492,8 @@ * @throws ConfigurationException if creating the workspace configuration * failed */ - private synchronized WorkspaceConfig internalCreateWorkspaceConfig(String name, - Element template) - throws ConfigurationException { + private synchronized WorkspaceConfig internalCreateWorkspaceConfig( + String name, Element template) throws ConfigurationException { // The physical workspace home directory on disk (TODO encode name?) File directory = new File(workspaceDirectory, name); @@ -494,16 +530,17 @@ // on disk String configDir = workspaceConfigDirectory + FileSystem.SEPARATOR + name; - String configFile = configDir + FileSystem.SEPARATOR + WORKSPACE_XML; + String configFile = configDir + FileSystem.SEPARATOR + + WORKSPACE_XML; try { // Create the directory virtualFS.createFolder(configDir); - configWriter = new OutputStreamWriter( - virtualFS.getOutputStream(configFile)); + configWriter = new OutputStreamWriter(virtualFS + .getOutputStream(configFile)); } catch (FileSystemException e) { throw new ConfigurationException( "failed to create workspace configuration at path " - + configFile, e); + + configFile, e); } } else { File file = new File(directory, WORKSPACE_XML); @@ -512,11 +549,12 @@ } catch (IOException e) { throw new ConfigurationException( "failed to create workspace configuration at path " - + file.getPath(), e); + + file.getPath(), e); } } - // Create the workspace.xml file using the configuration template and + // Create the workspace.xml file using the configuration template + // and // the configuration writer. try { template.setAttribute("name", name); @@ -524,8 +562,8 @@ TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.transform( - new DOMSource(template), new StreamResult(configWriter)); + transformer.transform(new DOMSource(template), + new StreamResult(configWriter)); } catch (TransformerConfigurationException e) { throw new ConfigurationException( "Cannot create a workspace configuration writer", e); @@ -553,8 +591,8 @@ return wc; } else { throw new ConfigurationException( - "Failed to load the created configuration for workspace " - + name + "."); + "Failed to load the created configuration for " + + "workspace " + name + "."); } } finally { try { @@ -567,17 +605,17 @@ } /** - * Creates a new workspace configuration with the specified name. - * This method creates a workspace configuration subdirectory, - * copies the workspace configuration template into it, and finally - * adds the created workspace configuration to the repository. - * The initialized workspace configuration object is returned to - * the caller. + * Creates a new workspace configuration with the specified name. This + * method creates a workspace configuration subdirectory, copies the + * workspace configuration template into it, and finally adds the created + * workspace configuration to the repository. The initialized workspace + * configuration object is returned to the caller. * - * @param name workspace name + * @param name + * workspace name * @return created workspace configuration - * @throws ConfigurationException if creating the workspace configuration - * failed + * @throws ConfigurationException + * if creating the workspace configuration failed */ public WorkspaceConfig createWorkspaceConfig(String name) throws ConfigurationException { @@ -589,23 +627,22 @@ * Creates a new workspace configuration with the specified name. This * method uses the provided workspace template to create the * repository config instead of the template that is present in the - * repository configuration. - *

- * This method creates a workspace configuration subdirectory, - * copies the workspace configuration template into it, and finally - * adds the created workspace configuration to the repository. - * The initialized workspace configuration object is returned to + * repository configuration.

This method creates a workspace + * configuration subdirectory, copies the workspace configuration template + * into it, and finally adds the created workspace configuration to the + * repository. The initialized workspace configuration object is returned to * the caller. * - * @param name workspace name - * @param template the workspace template + * @param name + * workspace name + * @param template + * the workspace template * @return created workspace configuration - * @throws ConfigurationException if creating the workspace configuration - * failed + * @throws ConfigurationException + * if creating the workspace configuration failed */ public WorkspaceConfig createWorkspaceConfig(String name, - InputSource template) - throws ConfigurationException { + InputSource template) throws ConfigurationException { ConfigurationParser parser = new ConfigurationParser(new Properties()); Element workspaceTemplate = parser.parseXML(template); return internalCreateWorkspaceConfig(name, workspaceTemplate); @@ -630,8 +667,8 @@ } /** - * Returns the repository name. The repository name can be used for - * JAAS app-entry configuration. + * Returns the repository name. The repository name can be used for JAAS + * app-entry configuration. * * @return repository name */ @@ -708,7 +745,8 @@ /** * Returns the configuration of the specified workspace. * - * @param name workspace name + * @param name + * workspace name * @return workspace configuration, or null if the named * workspace does not exist */ @@ -726,8 +764,8 @@ } /** - * Returns the system search index configuration. Returns - * null if no search index has been configured. + * Returns the system search index configuration. Returns null + * if no search index has been configured. * * @return search index configuration, or null */ @@ -736,8 +774,8 @@ } /** - * Returns the cluster configuration. Returns null if clustering - * has not been configured. + * Returns the cluster configuration. Returns null if + * clustering has not been configured. */ public ClusterConfig getClusterConfig() { return cc; Index: src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/RepositoryConfigurationParser.java (working copy) @@ -29,17 +29,19 @@ * workspace configuration files. *

* 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(...);
+ *      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. + * initialized. The caller needs to initialize the configuration objects before + * using them. */ public class RepositoryConfigurationParser extends ConfigurationParser { @@ -80,8 +82,8 @@ public static final String JOURNAL_ELEMENT = "Journal"; /** Name of the persistence manager configuration element. */ - public static final String PERSISTENCE_MANAGER_ELEMENT = - "PersistenceManager"; + public static final String PERSISTENCE_MANAGER_ELEMENT = "Persistence" + + "Manager"; /** Name of the search index configuration element. */ public static final String SEARCH_INDEX_ELEMENT = "SearchIndex"; @@ -99,8 +101,7 @@ public static final String MAX_IDLE_TIME_ATTRIBUTE = "maxIdleTime"; /** Name of the default workspace configuration attribute. */ - public static final String DEFAULT_WORKSPACE_ATTRIBUTE = - "defaultWorkspace"; + public static final String DEFAULT_WORKSPACE_ATTRIBUTE = "defaultWorkspace"; /** Name of the id configuration attribute. */ public static final String ID_ATTRIBUTE = "id"; @@ -109,13 +110,14 @@ public static final String SYNC_DELAY_ATTRIBUTE = "syncDelay"; /** Name of the default search index implementation class. */ - public static final String DEFAULT_QUERY_HANDLER = - "org.apache.jackrabbit.core.query.lucene.SearchIndex"; + public static final String DEFAULT_QUERY_HANDLER = "org.apache.jackrabbit" + + ".core.query.lucene.SearchIndex"; /** * Creates a new configuration parser with the given parser variables. * - * @param variables parser variables + * @param variables + * parser variables */ public RepositoryConfigurationParser(Properties variables) { super(variables); @@ -124,49 +126,53 @@ /** * Parses repository configuration. Repository configuration uses the * following format: + * *

-     *   <Repository>
-     *     <FileSystem ...>
-     *     <Security appName="...">
-     *       <AccessManager ...>
-     *       <LoginModule ... (optional)>
-     *     </Security>
-     *     <Workspaces rootPath="..." defaultWorkspace="..."/>
-     *     <Workspace ...>
-     *     <Versioning ...>
-     *   </Repository>
+     *    <Repository>
+     *      <FileSystem ...>
+     *      <Security appName="...">
+     *        <AccessManager ...>
+     *        <LoginModule ... (optional)>
+     *      </Security>
+     *      <Workspaces rootPath="..."
+     *          defaultWorkspace="..."/>
+     *      <Workspace ...>
+     *      <Versioning ...>
+     *    </Repository>
      * 
+ * *

* The FileSystem element is a - * {@link #parseBeanConfig(Element,String) 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 - * {@link #parseVersioningConfig(Element) versioning configuration} for - * the repository. + * {@link #parseBeanConfig(Element,String) 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 + * {@link #parseVersioningConfig(Element) 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. + * that is given as the ${rep.home} parser variable. Note that the variable + * must be available for the configuration document to be + * correctly parsed. *

- * {@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. + * {@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. *

* Note that the returned repository configuration object has not been * initialized. * - * @param xml repository configuration document + * @param xml + * repository configuration document * @return repository configuration - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken * @see #parseBeanConfig(Element, String) * @see #parseVersioningConfig(Element) */ @@ -178,8 +184,8 @@ String home = getVariables().getProperty(REPOSITORY_HOME_VARIABLE); // File system implementation - FileSystemConfig fsc = - new FileSystemConfig(parseBeanConfig(root, FILE_SYSTEM_ELEMENT)); + FileSystemConfig fsc = new FileSystemConfig(parseBeanConfig(root, + FILE_SYSTEM_ELEMENT)); // Security configuration and access manager implementation Element security = getElement(root, SECURITY_ELEMENT); @@ -187,17 +193,17 @@ // General workspace configuration Element workspaces = getElement(root, WORKSPACES_ELEMENT); - String workspaceDirectory = replaceVariables( - getAttribute(workspaces, ROOT_PATH_ATTRIBUTE)); + String workspaceDirectory = replaceVariables(getAttribute(workspaces, + ROOT_PATH_ATTRIBUTE)); - String workspaceConfigDirectory = - getAttribute(workspaces, CONFIG_ROOT_PATH_ATTRIBUTE, null); + String workspaceConfigDirectory = getAttribute(workspaces, + CONFIG_ROOT_PATH_ATTRIBUTE, null); - String defaultWorkspace = replaceVariables( - getAttribute(workspaces, DEFAULT_WORKSPACE_ATTRIBUTE)); + String defaultWorkspace = replaceVariables(getAttribute(workspaces, + DEFAULT_WORKSPACE_ATTRIBUTE)); - int maxIdleTime = Integer.parseInt( - getAttribute(workspaces, MAX_IDLE_TIME_ATTRIBUTE, "0")); + int maxIdleTime = Integer.parseInt(getAttribute(workspaces, + MAX_IDLE_TIME_ATTRIBUTE, "0")); // Workspace configuration template Element template = getElement(root, WORKSPACE_ELEMENT); @@ -217,24 +223,26 @@ } /** - * Parses security configuration. Security configuration - * uses the following format: + * Parses security configuration. Security configuration uses the following + * format: + * *

-     *   <Security appName="...">
-     *     <AccessManager ...>
-     *     <LoginModule ... (optional)>
-     *   </Security>
+     *    <Security appName="...">
+     *      <AccessManager ...>
+     *      <LoginModule ... (optional)>
+     *    </Security>
      * 
- *

- * Both the AccessManager and LoginModule + * + *

Both the AccessManager and LoginModule * elements are {@link #parseBeanConfig(Element,String) bean configuration} - * elements. - *

- * The login module is an optional feature of repository configuration. + * elements.

The login module is an optional feature of repository + * configuration. * - * @param security the <security> element. + * @param security + * the <security> element. * @return the security configuration. - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ public SecurityConfig parseSecurityConfig(Element security) throws ConfigurationException { @@ -247,22 +255,26 @@ /** * Parses the access manager configuration. * - * @param security the <security> element. + * @param security + * the <security> element. * @return the access manager configuration. - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ public AccessManagerConfig parseAccessManagerConfig(Element security) throws ConfigurationException { - return new AccessManagerConfig( - parseBeanConfig(security, ACCESS_MANAGER_ELEMENT)); + return new AccessManagerConfig(parseBeanConfig(security, + ACCESS_MANAGER_ELEMENT)); } /** * Parses the login module configuration. * - * @param security the <security> element. + * @param security + * the <security> element. * @return the login module configuration. - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ public LoginModuleConfig parseLoginModuleConfig(Element security) throws ConfigurationException { @@ -270,7 +282,8 @@ Element loginModule = getElement(security, LOGIN_MODULE_ELEMENT, false); if (loginModule != null) { - return new LoginModuleConfig(parseBeanConfig(security, LOGIN_MODULE_ELEMENT)); + return new LoginModuleConfig(parseBeanConfig(security, + LOGIN_MODULE_ELEMENT)); } else { return null; } @@ -279,30 +292,32 @@ /** * Parses workspace configuration. Workspace configuration uses the * following format: + * *

-     *   <Workspace name="...">
-     *     <FileSystem ...>
-     *     <PersistenceManager ...>
-     *     <SearchIndex ...>
-     *   </Workspace>
+     *    <Workspace name="...">
+     *      <FileSystem ...>
+     *      <PersistenceManager ...>
+     *      <SearchIndex ...>
+     *    </Workspace>
      * 
+ * *

* All the child elements (FileSystem, * PersistenceManager, and SearchIndex) are - * {@link #parseBeanConfig(Element,String) bean configuration} elements. - * In addition to bean configuration, the + * {@link #parseBeanConfig(Element,String) bean configuration} elements. In + * addition to bean configuration, the * {@link #parseSearchConfig(Element) 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. + * 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 + * 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. @@ -313,9 +328,11 @@ * Note that the returned workspace configuration object has not been * initialized. * - * @param xml workspace configuration document + * @param xml + * workspace configuration document * @return workspace configuration - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken * @see #parseBeanConfig(Element, String) * @see #parseSearchConfig(Element) */ @@ -327,8 +344,8 @@ String home = getVariables().getProperty(WORKSPACE_HOME_VARIABLE); // Workspace name - String name = - getAttribute(root, NAME_ATTRIBUTE, new File(home).getName()); + String name = getAttribute(root, NAME_ATTRIBUTE, new File(home) + .getName()); // Create a temporary parser that contains the ${wsp.name} variable Properties tmpVariables = (Properties) getVariables().clone(); @@ -336,11 +353,12 @@ RepositoryConfigurationParser tmpParser = createSubParser(tmpVariables); // File system implementation - FileSystemConfig fsc = new FileSystemConfig( - tmpParser.parseBeanConfig(root, FILE_SYSTEM_ELEMENT)); + FileSystemConfig fsc = new FileSystemConfig(tmpParser.parseBeanConfig( + root, FILE_SYSTEM_ELEMENT)); // Persistence manager implementation - PersistenceManagerConfig pmc = tmpParser.parsePersistenceManagerConfig(root); + PersistenceManagerConfig pmc = tmpParser + .parsePersistenceManagerConfig(root); // Search implementation (optional) SearchConfig sc = tmpParser.parseSearchConfig(root); @@ -349,31 +367,31 @@ } /** - * Parses search index configuration. Search index configuration - * uses the following format: + * Parses search index configuration. Search index configuration uses the + * following format: + * *

-     *   <SearchIndex class="...">
-     *     <param name="..." value="...">
-     *     ...
-     *     <FileSystem ...>
-     *   </Search>
+     *    <SearchIndex class="...">
+     *      <param name="..." value="...">
+     *      ...
+     *      <FileSystem ...>
+     *    </Search>
      * 
- *

- * Both the SearchIndex and FileSystem + * + *

Both the SearchIndex and FileSystem * elements are {@link #parseBeanConfig(Element,String) 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. + * 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. * - * @param parent parent of the SearchIndex element + * @param parent + * parent of the SearchIndex element * @return search configuration, or null - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ protected SearchConfig parseSearchConfig(Element parent) throws ConfigurationException { @@ -385,8 +403,8 @@ Element element = (Element) child; // Search implementation class - String className = getAttribute( - element, CLASS_ATTRIBUTE, DEFAULT_QUERY_HANDLER); + String className = getAttribute(element, CLASS_ATTRIBUTE, + DEFAULT_QUERY_HANDLER); // Search parameters Properties parameters = parseParameters(element); @@ -394,8 +412,8 @@ // Optional file system implementation FileSystemConfig fsc = null; if (getElement(element, FILE_SYSTEM_ELEMENT, false) != null) { - fsc = new FileSystemConfig( - parseBeanConfig(element, FILE_SYSTEM_ELEMENT)); + fsc = new FileSystemConfig(parseBeanConfig(element, + FILE_SYSTEM_ELEMENT)); } return new SearchConfig(className, parameters, fsc); @@ -407,34 +425,38 @@ /** * Parses versioning configuration. Versioning configuration uses the * following format: + * *

-     *   <Versioning rootPath="...">
-     *     <FileSystem ...>
-     *     <PersistenceManager ...>
-     *   </Versioning>
+     *    <Versioning rootPath="...">
+     *      <FileSystem ...>
+     *      <PersistenceManager ...>
+     *    </Versioning>
      * 
+ * *

* Both the FileSystem and PersistenceManager * 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. + * {@link #replaceVariables(String) variable replacement} is performed also + * on the versioning root path attribute. * - * @param parent parent of the Versioning element + * @param parent + * parent of the Versioning element * @return versioning configuration - * @throws ConfigurationException if the configuration is broken + * @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)); + String home = replaceVariables(getAttribute(element, + ROOT_PATH_ATTRIBUTE)); // File system implementation - FileSystemConfig fsc = new FileSystemConfig( - parseBeanConfig(element, FILE_SYSTEM_ELEMENT)); + FileSystemConfig fsc = new FileSystemConfig(parseBeanConfig(element, + FILE_SYSTEM_ELEMENT)); // Persistence manager implementation PersistenceManagerConfig pmc = parsePersistenceManagerConfig(element); @@ -443,22 +465,25 @@ } /** - * Parses cluster configuration. Cluster configuration uses the following format: + * Parses cluster configuration. Cluster configuration uses the following + * format: + * *

-     *   <Cluster>
-     *     <Journal ...>
-     *   </Journal>
+     *    <Cluster>
+     *      <Journal ...>
+     *    </Journal>
      * 
- *

- * Cluster is a {@link #parseBeanConfig(Element,String) bean configuration} - * element. - *

- * Clustering is an optional feature. If the cluster element is not found, then this - * method returns null. * - * @param parent parent of the Journal element + *

Cluster is a + * {@link #parseBeanConfig(Element,String) bean configuration} element.

+ * Clustering is an optional feature. If the cluster element is not found, + * then this method returns null. + * + * @param parent + * parent of the Journal element * @return journal configuration, or null - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ protected ClusterConfig parseClusterConfig(Element parent) throws ConfigurationException { @@ -471,8 +496,8 @@ Element element = (Element) child; String id = getAttribute(element, ID_ATTRIBUTE, null); - int syncDelay = Integer.parseInt( - getAttribute(element, SYNC_DELAY_ATTRIBUTE, "5")); + int syncDelay = Integer.parseInt(getAttribute(element, + SYNC_DELAY_ATTRIBUTE, "5")); JournalConfig jc = parseJournalConfig(element); return new ClusterConfig(id, syncDelay, jc); @@ -482,53 +507,59 @@ } /** - * Parses journal configuration. Journal configuration uses the following format: + * Parses journal configuration. Journal configuration uses the following + * format: + * *

-     *   <Journal class="...">
-     *     <param name="..." value="...">
-     *     ...
-     *   </Journal>
+     *    <Journal class="...">
+     *      <param name="..." value="...">
+     *      ...
+     *    </Journal>
      * 
- *

- * Journal is a {@link #parseBeanConfig(Element,String) bean configuration} - * element. * - * @param cluster parent cluster element + *

Journal is a + * {@link #parseBeanConfig(Element,String) bean configuration} element. + * + * @param cluster + * parent cluster element * @return journal configuration, or null - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ protected JournalConfig parseJournalConfig(Element cluster) throws ConfigurationException { - return new JournalConfig( - parseBeanConfig(cluster, JOURNAL_ELEMENT)); + return new JournalConfig(parseBeanConfig(cluster, JOURNAL_ELEMENT)); } /** * Parses the PersistenceManager config. * - * @param parent parent of the PersistenceManager element + * @param parent + * parent of the PersistenceManager element * @return persistence manager configuration - * @throws ConfigurationException if the configuration is broken + * @throws ConfigurationException + * if the configuration is broken */ protected PersistenceManagerConfig parsePersistenceManagerConfig( Element parent) throws ConfigurationException { - return new PersistenceManagerConfig( - parseBeanConfig(parent, PERSISTENCE_MANAGER_ELEMENT)); + return new PersistenceManagerConfig(parseBeanConfig(parent, + PERSISTENCE_MANAGER_ELEMENT)); } /** * Creates a new instance of a configuration parser but with overlayed * variables. * - * @param variables the variables overlay + * @param variables + * the variables overlay * @return a new configuration parser instance */ - protected RepositoryConfigurationParser createSubParser(Properties variables) { + protected RepositoryConfigurationParser createSubParser( + Properties variables) { // overlay the properties Properties props = new Properties(getVariables()); props.putAll(variables); return new RepositoryConfigurationParser(props); } - } Index: src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/SearchConfig.java (working copy) @@ -19,12 +19,11 @@ import java.util.Properties; /** - * Search index configuration. This bean configuration class - * is used to create configured search index objects. + * Search index configuration. This bean configuration class is used to create + * configured search index objects. *

- * In addition to generic bean configuration information, this - * class also contains an optional file system configuration - * used by the search index. + * In addition to generic bean configuration information, this class also + * contains an optional file system configuration used by the search index. * * @see WorkspaceConfig#getSearchConfig() */ @@ -39,13 +38,16 @@ /** * Creates a search index configuration object. * - * @param className search index implementation class - * @param properties search index properties - * @param fsc search index file system configuration, or null - * if none is configured. + * @param className + * search index implementation class + * @param properties + * search index properties + * @param fsc + * search index file system configuration, or null + * if none is configured. */ - public SearchConfig( - String className, Properties properties, FileSystemConfig fsc) { + public SearchConfig(String className, Properties properties, + FileSystemConfig fsc) { super(className, properties); this.fsc = fsc; } @@ -61,9 +63,11 @@ /** * Returns the configuration for the FileSystem or - * null if none is configured in this SearchConfig. + * null if none is configured in this + * SearchConfig. * - * @return the FileSystemConfig for this SearchConfig. + * @return the FileSystemConfig for this + * SearchConfig. */ public FileSystemConfig getFileSystemConfig() { return fsc; Index: src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/SecurityConfig.java (working copy) @@ -40,20 +40,23 @@ /** * Creates a new security configuration. * - * @param name repository name for a JAAS app-entry configuration - * @param amc access manager configuration - * @param lmc login module configuration (can be null) + * @param name + * repository name for a JAAS app-entry configuration + * @param amc + * access manager configuration + * @param lmc + * login module configuration (can be null) */ - public SecurityConfig( - String name, AccessManagerConfig amc, LoginModuleConfig lmc) { + public SecurityConfig(String name, AccessManagerConfig amc, + LoginModuleConfig lmc) { this.name = name; this.amc = amc; this.lmc = lmc; } /** - * Returns the repository name. The repository name can be used for - * JAAS app-entry configuration. + * Returns the repository name. The repository name can be used for JAAS + * app-entry configuration. * * @return repository name */ @@ -79,5 +82,4 @@ public LoginModuleConfig getLoginModuleConfig() { return lmc; } - } Index: src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/VersioningConfig.java (working copy) @@ -19,12 +19,11 @@ import java.io.File; /** - * Versioning configuration. This configuration class is used to - * create configured versioning objects. + * Versioning configuration. This configuration class is used to create + * configured versioning objects. *

- * The contained configuration information are: the home directory, - * the file system implementation, and the persistence manager - * implementation. + * The contained configuration information are: the home directory, the file + * system implementation, and the persistence manager implementation. * * @see RepositoryConfig#getVersioningConfig() */ @@ -48,12 +47,15 @@ /** * Creates a versioning configuration object. * - * @param home home directory - * @param fsc file system configuration - * @param pmc persistence manager configuration + * @param home + * home directory + * @param fsc + * file system configuration + * @param pmc + * persistence manager configuration */ - public VersioningConfig( - String home, FileSystemConfig fsc, PersistenceManagerConfig pmc) { + public VersioningConfig(String home, FileSystemConfig fsc, + PersistenceManagerConfig pmc) { this.home = home; this.fsc = fsc; this.pmc = pmc; @@ -71,7 +73,8 @@ /** * Returns the configuration for the FileSystem. * - * @return the FileSystemConfig for this VersionConfig. + * @return the FileSystemConfig for this + * VersionConfig. */ public FileSystemConfig getFileSystemConfig() { return fsc; @@ -85,5 +88,4 @@ public PersistenceManagerConfig getPersistenceManagerConfig() { return pmc; } - } Index: src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java =================================================================== --- src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java (revision 483406) +++ src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java (working copy) @@ -17,12 +17,12 @@ package org.apache.jackrabbit.core.config; /** - * Workspace configuration. This configuration class is used to - * create configured workspace objects. + * Workspace configuration. This configuration class is used to create + * configured workspace objects. *

- * The contained configuration information are: the home directory and name - * of the workspace, and the file system, the persistence manager, and the - * search index configuration. The search index is an optional part of the + * The contained configuration information are: the home directory and name of + * the workspace, and the file system, the persistence manager, and the search + * index configuration. The search index is an optional part of the * configuration. */ public class WorkspaceConfig { @@ -55,11 +55,16 @@ /** * Creates a workspace configuration object. * - * @param home home directory - * @param name workspace name - * @param fsc file system configuration - * @param pmc persistence manager configuration - * @param sc search index configuration + * @param home + * home directory + * @param name + * workspace name + * @param fsc + * file system configuration + * @param pmc + * persistence manager configuration + * @param sc + * search index configuration */ public WorkspaceConfig(String home, String name, FileSystemConfig fsc, PersistenceManagerConfig pmc, SearchConfig sc) { @@ -115,5 +120,4 @@ public SearchConfig getSearchConfig() { return sc; } - }