jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1171619 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy: EntryFactory.java HierarchyManager.java NodeEntry.java
Date Fri, 16 Sep 2011 15:17:57 GMT
Author: mduerig
Date: Fri Sep 16 15:17:56 2011
New Revision: 1171619

URL: http://svn.apache.org/viewvc?rev=1171619&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
simplify initialisation   

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java?rev=1171619&r1=1171618&r2=1171619&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
Fri Sep 16 15:17:56 2011
@@ -23,11 +23,12 @@ import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
 /**
  * {@code EntryFactory}...
  */
-public class EntryFactory {
+public final class EntryFactory {
 
     /**
      * IdFactory to create an ItemId based on the parent NodeId.
@@ -36,22 +37,22 @@ public class EntryFactory {
 
     private final PathFactory pathFactory;
 
-    private final NodeEntry rootEntry;
-
     /**
-     * Listener to creation and uid-changes of node entries.
+     * The item state factory to create the the item state.
      */
-    private final NodeEntryListener listener;
+    private final TransientItemStateFactory itemStateFactory;
 
     /**
-     * The item state factory to create the the item state.
+     * Listener to creation and uid-changes of node entries.
      */
-    private final TransientItemStateFactory isf;
+    private final NodeEntryListener listener;
 
     /**
      * NamePathResolver used to generate human readable error messages.
      */
-    private NamePathResolver resolver;
+    private final NamePathResolver namePathResolver;
+
+    private final NodeEntry rootEntry;
 
     /**
      * Strategy used for item state invalidation (refresh)
@@ -61,35 +62,35 @@ public class EntryFactory {
     /**
      * Create a new instance of the {@code EntryFactory}.
      *
-     * @param isf
+     * @param itemStateFactory
      * @param idFactory
      * @param listener
      * @param pathFactory
      */
-    public EntryFactory(TransientItemStateFactory isf, IdFactory idFactory, NodeEntryListener
listener,
-        PathFactory pathFactory) {
+    public EntryFactory(TransientItemStateFactory itemStateFactory, IdFactory idFactory,
NodeEntryListener listener,
+        PathFactory pathFactory, NamePathResolver namePathResolver) {
         
         this.idFactory = idFactory;
         this.pathFactory = pathFactory;
-        this.isf = isf;
+        this.itemStateFactory = itemStateFactory;
         this.listener = listener;
+        this.namePathResolver = namePathResolver;
 
         invalidationStrategy = new NodeEntry.LazyInvalidation();
-        rootEntry = NodeEntry.createRootEntry(this);
+        rootEntry = createNodeEntry(null, NameConstants.ROOT, null);
     }
 
     /**
      * @return the root entry.
      */
-    public NodeEntry createRootEntry() {
+    public NodeEntry getRootEntry() {
         return rootEntry;
     }
 
     public NodeEntry createNodeEntry(NodeEntry parent, Name qName, String uniqueId) {
-        if (!(parent instanceof NodeEntry)) {
-            throw new IllegalArgumentException();
-        }
-        return NodeEntry.createNodeEntry(parent, qName, uniqueId, this);
+        NodeEntry entry = new NodeEntry(parent, qName, uniqueId, this);
+        notifyEntryCreated(entry);
+        return entry;
     }
 
     public PropertyEntry createPropertyEntry(NodeEntry parent, Name qName) {
@@ -108,7 +109,7 @@ public class EntryFactory {
     }
 
     public TransientItemStateFactory getItemStateFactory() {
-        return isf;
+        return itemStateFactory;
     }
 
     public void notifyEntryCreated(NodeEntry entry) {
@@ -129,21 +130,14 @@ public class EntryFactory {
     //--------------------------------------------------------------------------
 
     /**
-     * @param resolver
-     */
-    void setResolver(NamePathResolver resolver) {
-        this.resolver = resolver;
-    }
-
-    /**
      * @param path
      * @return jcr presentation of the specified path.
      */
     String saveGetJCRPath(Path path) {
-        if (resolver == null) {
+        if (namePathResolver == null) {
             return path.toString();
         } else {
-            return LogUtil.safeGetJCRPath(path, resolver);
+            return LogUtil.safeGetJCRPath(path, namePathResolver);
         }
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java?rev=1171619&r1=1171618&r2=1171619&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
Fri Sep 16 15:17:56 2011
@@ -50,7 +50,7 @@ public class HierarchyManager {
             NamePathResolver namePathResolver) {
 
         uniqueIdResolver = new UniqueIdResolver(isf);
-        rootEntry = new EntryFactory(isf, idFactory, uniqueIdResolver, pathFactory).createRootEntry();
+        rootEntry = new EntryFactory(isf, idFactory, uniqueIdResolver, pathFactory, namePathResolver).getRootEntry();
         this.idFactory = idFactory;
         this.namePathResolver = namePathResolver;
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?rev=1171619&r1=1171618&r2=1171619&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
Fri Sep 16 15:17:56 2011
@@ -167,35 +167,15 @@ public class NodeEntry extends Hierarchy
      * @param name      the name of the child node.
      * @param factory   the entry factory.
      */
-    private NodeEntry(NodeEntry parent, Name name, String uniqueID, EntryFactory factory)
{
+    NodeEntry(NodeEntry parent, Name name, String uniqueID, EntryFactory factory) {
         super(parent, name, factory);
-        this.uniqueID = uniqueID; // NOTE: don't use setUniqueID (for mod only)
+        this.uniqueID = uniqueID; 
 
         properties = new ChildPropertyEntriesImpl(this, factory);
         childNodeEntries = new ChildNodeEntriesImpl(this, factory, null);
 
         propertiesInAttic = new HashMap<Name, PropertyEntry>();
         childNodeAttic = new ChildNodeAttic();
-
-        factory.notifyEntryCreated(this);
-    }
-
-    /**
-     * @return the entry corresponding to the root node.
-     */
-    static NodeEntry createRootEntry(EntryFactory factory) {
-        return new NodeEntry(null, NameConstants.ROOT, null, factory);
-    }
-
-    /**
-     * @param parent
-     * @param name
-     * @param uniqueId
-     * @param factory
-     * @return the created entry.
-     */
-    static NodeEntry createNodeEntry(NodeEntry parent, Name name, String uniqueId, EntryFactory
factory) {
-        return new NodeEntry(parent, name, uniqueId, factory);
     }
 
     //-----------------------------------------------------< HierarchyEntry >---



Mime
View raw message