jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r156176 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config: AccessManagerConfig.java BeanConfig.java ConfigurationParser.java PersistenceManagerConfig.java
Date Fri, 04 Mar 2005 16:15:55 GMT
Author: jukka
Date: Fri Mar  4 08:15:53 2005
New Revision: 156176

URL: http://svn.apache.org/viewcvs?view=rev&rev=156176
Log:
Refactoring step 6 (JCR-53)
 - Documented the simple configuration objects
 - Fixed a bean instantiation problem (Properties.containsKey does not work!)
 - Minor cleanups in ConfigurationParser

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/BeanConfig.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java?view=diff&r1=156175&r2=156176
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/AccessManagerConfig.java
Fri Mar  4 08:15:53 2005
@@ -17,13 +17,22 @@
 package org.apache.jackrabbit.core.config;
 
 /**
- * A <code>AccessManagerConfig</code> represents the configuration of an
- * <code>AccessManager</code>.
+ * Access manager configuration. This bean configuration class
+ * is used to create configured access manager objects.
+ * <p>
+ * 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.
+     *
+     * @param config bean configuration
+     */
     public AccessManagerConfig(BeanConfig config) {
         super(config);
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/BeanConfig.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/BeanConfig.java?view=diff&r1=156175&r2=156176
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/BeanConfig.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/BeanConfig.java
Fri Mar  4 08:15:53 2005
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.core.config;
 
-import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.Properties;
 
@@ -32,24 +31,32 @@
     /**
      * The class name of the configured bean.
      */
-    private String className;
+    private final String className;
 
     /**
      * The initial properties of the configured bean.
      */
-    private Properties properties;
+    private final Properties properties;
 
     /**
-     * Creates a bean configuration.
+     * 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
      */
     protected BeanConfig(String className, Properties properties) {
         this.className = className;
-        this.properties = properties;
+        this.properties = new Properties(properties);
     }
 
+    /**
+     * Copies a bean configuration.
+     *
+     * @param config the configuration to be copied
+     */
     protected BeanConfig(BeanConfig config) {
         this(config.getClassName(), config.getParameters());
     }
@@ -72,6 +79,14 @@
         return properties;
     }
 
+    /**
+     * Creates a new instance of the configured bean class.
+     *
+     * @return new bean instance
+     * @throws ClassNotFoundException if the bean class is not found
+     * @throws InstantiationException if the bean could not be instantiated
+     * @throws IllegalAccessException if the bean methods are protected
+     */
     public Object newInstance()
             throws ClassNotFoundException, InstantiationException,
             IllegalAccessException {
@@ -80,7 +95,8 @@
         Iterator iterator = map.keyIterator();
         while (iterator.hasNext()) {
             String name = (String) iterator.next();
-            if (properties.containsKey(name)) {
+            String value = properties.getProperty(name);
+            if (value != null) {
                 map.put(name, properties.getProperty(name));
             }
         }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java?view=diff&r1=156175&r2=156176
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/ConfigurationParser.java
Fri Mar  4 08:15:53 2005
@@ -28,7 +28,6 @@
 
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.log4j.Logger;
@@ -149,8 +148,6 @@
 
             // file system
             BeanConfig fsc = parseBeanConfig(root, FILE_SYSTEM_ELEMENT);
-            FileSystem repFS = (FileSystem) fsc.newInstance();
-            repFS.init();
 
             // security & access manager config
             Element secEleme = root.getChild(SECURITY_ELEMENT);
@@ -212,20 +209,13 @@
             Element vElement = config.getRootElement().getChild(VERSIONING_ELEMENT);
             VersioningConfig vc = parseVersioningConfig(vElement);
 
-            return new RepositoryConfig(config, this, home, appName, wspConfigs, repFS, wspConfigRootDir,
defaultWspName, amc, vc);
-        } catch (FileSystemException ex) {
-            throw new RepositoryException(ex);
+            return new RepositoryConfig(
+                    config, this, home, appName, wspConfigs,
+                    createFileSystem(fsc), wspConfigRootDir,
+                    defaultWspName, amc, vc);
         } catch (JDOMException ex) {
             throw new RepositoryException(ex);
         } catch (IOException ex) {
-            throw new RepositoryException(ex);
-        } catch (ClassNotFoundException ex) {
-            throw new RepositoryException(ex);
-        } catch (InstantiationException ex) {
-            throw new RepositoryException(ex);
-        } catch (IllegalAccessException ex) {
-            throw new RepositoryException(ex);
-        } catch (ClassCastException ex) {
             throw new RepositoryException(ex);
         }
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java?view=diff&r1=156175&r2=156176
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/config/PersistenceManagerConfig.java
Fri Mar  4 08:15:53 2005
@@ -16,15 +16,23 @@
  */
 package org.apache.jackrabbit.core.config;
 
-
 /**
- * A <code>PersistenceManagerConfig</code> represents the configuration of a
- * <code>PersistenceManager</code>.
+ * Persistence manager configuration. This bean configuration class
+ * is used to create configured persistence manager objects.
+ * <p>
+ * 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.
+     *
+     * @param config bean configuration
+     */
     public PersistenceManagerConfig(BeanConfig config) {
         super(config);
     }



Mime
View raw message