jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r948818 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: NamespaceRegistryImpl.java RepositoryImpl.java nodetype/NodeTypeRegistry.java
Date Thu, 27 May 2010 13:02:50 GMT
Author: jukka
Date: Thu May 27 13:02:50 2010
New Revision: 948818

URL: http://svn.apache.org/viewvc?rev=948818&view=rev
Log:
JCR-2640: Internal repository context

Streamline namespace and node type registry creation

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java?rev=948818&r1=948817&r2=948818&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NamespaceRegistryImpl.java
Thu May 27 13:02:50 2010
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.core;
 
 import org.apache.jackrabbit.core.cluster.NamespaceEventChannel;
 import org.apache.jackrabbit.core.cluster.NamespaceEventListener;
+import org.apache.jackrabbit.core.fs.BasedFileSystem;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
 import org.apache.jackrabbit.core.util.StringIndex;
@@ -91,12 +92,11 @@ public class NamespaceRegistryImpl imple
     /**
      * Protected constructor: Constructs a new instance of this class.
      *
-     * @param nsRegStore
+     * @param fs repository file system
      * @throws RepositoryException
      */
-    protected NamespaceRegistryImpl(FileSystem nsRegStore)
-            throws RepositoryException {
-        this.nsRegStore = nsRegStore;
+    public NamespaceRegistryImpl(FileSystem fs) throws RepositoryException {
+        this.nsRegStore = new BasedFileSystem(fs, "/namespaces");
         load();
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=948818&r1=948817&r2=948818&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Thu May 27 13:02:50 2010
@@ -295,9 +295,7 @@ public class RepositoryImpl extends Abst
         try {
             this.repConfig = repConfig;
 
-            // setup file systems
-            FileSystem repStore = repConfig.getFileSystem();
-            context.setFileSystem(repStore);
+            context.setFileSystem(repConfig.getFileSystem());
 
             // Load root node identifier
             context.setRootNodeId(loadRootNodeId());
@@ -306,10 +304,10 @@ public class RepositoryImpl extends Abst
             initRepositoryDescriptors();
 
             // create registries
-            context.setNamespaceRegistry(createNamespaceRegistry(
-                    new BasedFileSystem(repStore, "/namespaces")));
-            context.setNodeTypeRegistry(createNodeTypeRegistry(
-                    new BasedFileSystem(repStore, "/nodetypes")));
+            context.setNamespaceRegistry(
+                    new NamespaceRegistryImpl(context.getFileSystem()));
+            context.setNodeTypeRegistry(new NodeTypeRegistry(
+                    context.getNamespaceRegistry(), context.getFileSystem()));
 
             dataStore = repConfig.getDataStore();
 
@@ -587,30 +585,6 @@ public class RepositoryImpl extends Abst
     }
 
     /**
-     * Creates the <code>NamespaceRegistry</code> instance.
-     *
-     * @param fs
-     * @return
-     * @throws RepositoryException
-     */
-    protected NamespaceRegistryImpl createNamespaceRegistry(FileSystem fs)
-            throws RepositoryException {
-        return new NamespaceRegistryImpl(fs);
-    }
-
-    /**
-     * Creates the <code>NodeTypeRegistry</code> instance.
-     *
-     * @param fs
-     * @return
-     * @throws RepositoryException
-     */
-    protected NodeTypeRegistry createNodeTypeRegistry(FileSystem fs)
-            throws RepositoryException {
-        return NodeTypeRegistry.create(context.getNamespaceRegistry(), fs);
-    }
-
-    /**
      * Creates a new <code>RepositoryImpl</code> instance.
      * <p/>
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java?rev=948818&r1=948817&r2=948818&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/NodeTypeRegistry.java
Thu May 27 13:02:50 2010
@@ -73,8 +73,9 @@ public class NodeTypeRegistry implements
 
     private static final String BUILTIN_NODETYPES_RESOURCE_PATH =
             "org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd";
+
     private static final String CUSTOM_NODETYPES_RESOURCE_NAME =
-            "custom_nodetypes.xml";
+            "nodetypes/custom_nodetypes.xml";
 
     /**
      * resource holding custom node type definitions which are represented as
@@ -113,19 +114,6 @@ public class NodeTypeRegistry implements
      */
     private NodeTypeEventChannel eventChannel;
 
-    /**
-     * Create a new <code>NodeTypeRegistry</codes>
-     *
-     * @param nsReg namespace registry
-     * @param ntStore node type store
-     * @return <code>NodeTypeRegistry</codes> object
-     * @throws RepositoryException if an error occurs
-     */
-    public static NodeTypeRegistry create(NamespaceRegistry nsReg, FileSystem ntStore)
-            throws RepositoryException {
-        return new NodeTypeRegistry(nsReg, ntStore);
-    }
-
     //----------------------------------------< public NodeTypeRegistry 'api' >
     /**
      * Returns the names of all registered node types. That includes primary
@@ -693,18 +681,18 @@ public class NodeTypeRegistry implements
 
     //---------------------------------------------------------< overridables >
     /**
-     * Protected constructor
+     * Constructor
      *
      * @param nsReg name space registry
-     * @param ntStore store
+     * @param fs repository file system
      * @throws RepositoryException if an error occurs
      */
     @SuppressWarnings("unchecked")
-    protected NodeTypeRegistry(NamespaceRegistry nsReg, FileSystem ntStore)
+    public NodeTypeRegistry(NamespaceRegistry nsReg, FileSystem fs)
             throws RepositoryException {
         this.nsReg = nsReg;
         customNodeTypesResource =
-                new FileSystemResource(ntStore, CUSTOM_NODETYPES_RESOURCE_NAME);
+            new FileSystemResource(fs, CUSTOM_NODETYPES_RESOURCE_NAME);
         try {
             // make sure path to resource exists
             if (!customNodeTypesResource.exists()) {



Mime
View raw message