jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1171606 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jackrabbit-spi-commons/src/main/java/org/apache/jackr...
Date Fri, 16 Sep 2011 14:54:42 GMT
Author: mduerig
Date: Fri Sep 16 14:54:41 2011
New Revision: 1171606

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

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Path.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=1171606&r1=1171605&r2=1171606&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Fri Sep 16 14:54:41 2011
@@ -131,11 +131,9 @@ public class SessionImpl extends Abstrac
         this.config = config;
         this.sessionInfo = sessionInfo;
 
-        workspace = new WorkspaceImpl(sessionInfo.getWorkspaceName(), this, config, sessionInfo);
-
         // build local name-mapping
-        IdentifierResolver idResolver = new IdResolver();
-        npResolver = new DefaultNamePathResolver(this, idResolver, true);
+        npResolver = new DefaultNamePathResolver(this, new IdResolver(), true);
+        workspace = new WorkspaceImpl(this, sessionInfo, config);
 
         // build ValueFactory
         qValueFactory = config.getRepositoryService().getQValueFactory();
@@ -151,7 +149,6 @@ public class SessionImpl extends Abstrac
         HierarchyManager hMgr = getHierarchyManager();
         ItemCache cache = new ItemCache(this.config.getItemCacheSize());
         itemManager = new ItemManager(hMgr, this, cache);
-        hMgr.setResolver(npResolver);
     }
 
     public IdFactory getIdFactory() {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=1171606&r1=1171605&r2=1171606&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Fri Sep 16 14:54:41 2011
@@ -95,14 +95,12 @@ public class WorkspaceImpl implements Wo
     private LockManager lockMgr;
     private VersionManagerImpl versionManager;
 
-    public WorkspaceImpl(String name, SessionImpl session, RepositoryConfig config, SessionInfo
sessionInfo)
+    public WorkspaceImpl(SessionImpl session, SessionInfo sessionInfo, RepositoryConfig config)
             throws RepositoryException {
         
-        this.name = name;
+        name = sessionInfo.getWorkspaceName();
         this.session = session;
-
-        wspManager = new WorkspaceManager(config.getRepositoryService(), sessionInfo, session.getCacheBehaviour(),
-                session.getPollTimeout(), this.session.isSupportedOption(Repository.OPTION_OBSERVATION_SUPPORTED));
+        wspManager = new WorkspaceManager(session, sessionInfo, config);
     }
 
     //----------------------------------------------------------< Workspace >---

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=1171606&r1=1171605&r2=1171606&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Fri Sep 16 14:54:41 2011
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.jcr2spi;
 
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
+import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEventListener;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
@@ -90,6 +91,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.NamespaceRegistry;
+import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.lock.LockException;
@@ -116,10 +118,9 @@ public final class WorkspaceManager impl
     private final NameFactory nameFactory;
     private final PathFactory pathFactory;
 
-    private final ItemStateFactory isf;
+    private final TransientItemStateFactory itemStateFactory;
     private final HierarchyManager hierarchyManager;
 
-    private final CacheBehaviour cacheBehaviour;
     private final int pollTimeout;
 
     private final IdFactory idFactory;
@@ -158,15 +159,13 @@ public final class WorkspaceManager impl
      */
     private ItemInfoCache cache;
 
-    public WorkspaceManager(RepositoryService service, SessionInfo sessionInfo, CacheBehaviour
cacheBehaviour,
-            int pollTimeout, boolean observationSupported)
+    public WorkspaceManager(SessionImpl session, SessionInfo sessionInfo, RepositoryConfig
config)
             throws RepositoryException {
 
-        this.service = service;
+        service = config.getRepositoryService();
         this.sessionInfo = sessionInfo;
-        this.cacheBehaviour = cacheBehaviour;
-        this.pollTimeout = observationSupported
-            ? pollTimeout
+        pollTimeout = session.isSupportedOption(Repository.OPTION_OBSERVATION_SUPPORTED)
+            ? session.getPollTimeout()
             : -1;
                 
         nameFactory = service.getNameFactory();
@@ -177,17 +176,16 @@ public final class WorkspaceManager impl
         ntRegistry = createNodeTypeRegistry(nsRegistry);
         definitionProvider = createDefinitionProvider(getEffectiveNodeTypeProvider());
 
-        TransientItemStateFactory stateFactory = createItemStateFactory();
-        isf = stateFactory;
-        hierarchyManager = createHierarchyManager(stateFactory, idFactory);
+        itemStateFactory = createItemStateFactory();
+        hierarchyManager = new HierarchyManager(itemStateFactory, idFactory, pathFactory,
session.getNamePathResolver());
 
         // If cache behavior is observation register a hierarchy listener which is
         // notified about all changes. Otherwise just add a hierarchy listener which
         // is only notified on changes for which client event listeners have been
         // installed. Note: this listener has to be the first one called in order
         // for the hierarchy to be consistent with the event (See JCR-2293).
-        InternalEventListener listener = createHierarchyListener(hierarchyManager);
-        if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
+        InternalEventListener listener = new HierarchyEventListener(this, hierarchyManager,
config.getCacheBehaviour());
+        if (config.getCacheBehaviour() == CacheBehaviour.OBSERVATION) {
             addEventListener(listener);
         } else {
             listeners.add(listener);
@@ -231,7 +229,7 @@ public final class WorkspaceManager impl
     }
 
     public ItemStateFactory getItemStateFactory() {
-        return isf;
+        return itemStateFactory;
     }
 
     public LockInfo getLockInfo(NodeId nodeId) throws RepositoryException {
@@ -428,7 +426,8 @@ public final class WorkspaceManager impl
     public void setUserData(String userData) throws RepositoryException {
         sessionInfo.setUserData(userData);
     }
-    //--------------------------------------------------------------------------
+
+    //------------------------------------------< private >---
 
     /**
      * Gets the event filters from the passed listener list.
@@ -457,24 +456,6 @@ public final class WorkspaceManager impl
     }
 
     /**
-     * @param transientISF The transient item state factory.
-     * @param idFactory The id factory.
-     * @return a new instance of {@code HierarchyManager}.
-     * @throws javax.jcr.RepositoryException If an error occurs.
-     */
-    private HierarchyManager createHierarchyManager(TransientItemStateFactory transientISF,
IdFactory idFactory) {
-        return new HierarchyManager(transientISF, idFactory, getPathFactory());
-    }
-
-    /**
-     * @param hierarchyMgr The hierarchy manager.
-     * @return a new InternalEventListener
-     */
-    private InternalEventListener createHierarchyListener(HierarchyManager hierarchyMgr)
{
-        return new HierarchyEventListener(this, hierarchyMgr, cacheBehaviour);
-    }
-
-    /**
      * @param nsRegistry The namespace registry.
      * @return an instance of {@code NodeTypeRegistryImpl}.
      */

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java?rev=1171606&r1=1171605&r2=1171606&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
Fri Sep 16 14:54:41 2011
@@ -101,7 +101,7 @@ class ChildNodeAttic {
     }
 
     boolean remove(NodeEntry movedEntry) {
-        return attic.contains(movedEntry) && attic.remove(movedEntry);
+        return attic.remove(movedEntry);
     }
 
 }
\ No newline at end of file

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=1171606&r1=1171605&r2=1171606&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 14:54:41 2011
@@ -44,19 +44,15 @@ public class HierarchyManager {
     private final NodeEntry rootEntry;
     private final UniqueIdResolver uniqueIdResolver;
     private final IdFactory idFactory;
-    private NamePathResolver resolver;
+    private final NamePathResolver namePathResolver;
+
+    public HierarchyManager(TransientItemStateFactory isf, IdFactory idFactory, PathFactory
pathFactory,
+            NamePathResolver namePathResolver) {
 
-    public HierarchyManager(TransientItemStateFactory isf, IdFactory idFactory, PathFactory
pathFactory) {
         uniqueIdResolver = new UniqueIdResolver(isf);
         rootEntry = new EntryFactory(isf, idFactory, uniqueIdResolver, pathFactory).createRootEntry();
         this.idFactory = idFactory;
-    }
-
-    public void setResolver(NamePathResolver resolver) {
-        this.resolver = resolver;
-        if (rootEntry instanceof HierarchyEntry) {
-            rootEntry.factory.setResolver(resolver);
-        }
+        this.namePathResolver = namePathResolver;
     }
 
     //---------------------------------------------------< HierarchyManager >---
@@ -178,7 +174,7 @@ public class HierarchyManager {
         } else {
             if (propertyId.getPath() == null) {
                 // a property id always contains a Path part.
-                throw new ItemNotFoundException("No property found for id " + LogUtil.saveGetIdString(propertyId,
resolver));
+                throw new ItemNotFoundException("No property found for id " + LogUtil.saveGetIdString(propertyId,
namePathResolver));
             } else {
                 NodeEntry nEntry = uniqueIdResolver.resolve(idFactory.createNodeId(uniqueID),
rootEntry);
                 return nEntry.getDeepPropertyEntry(propertyId.getPath());
@@ -223,7 +219,7 @@ public class HierarchyManager {
             if (state.isValid()) {
                 return state;
             } else {
-                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, resolver));
+                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, namePathResolver));
             }
         } catch (ItemNotFoundException e) {
             throw new PathNotFoundException(e);
@@ -246,7 +242,7 @@ public class HierarchyManager {
             if (state.isValid()) {
                 return state;
             } else {
-                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, resolver));
+                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, namePathResolver));
             }
         } catch (ItemNotFoundException e) {
             throw new PathNotFoundException(e);

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java?rev=1171606&r1=1171605&r2=1171606&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
Fri Sep 16 14:54:41 2011
@@ -42,6 +42,7 @@ public class NameFactoryImpl implements 
     }
 
     //--------------------------------------------------------< NameFactory >---
+    
     /**
      * @see NameFactory#create(String, String)
      */
@@ -83,6 +84,7 @@ public class NameFactoryImpl implements 
     }
 
     //--------------------------------------------------------< inner class >---
+    
     /**
      * Inner class implementing the {@code Name} interface.
      */
@@ -118,6 +120,7 @@ public class NameFactoryImpl implements 
         }
 
         //-----------------------------------------------------------< Name >---
+        
         /**
          * @see Name#getLocalName()
          */
@@ -135,6 +138,7 @@ public class NameFactoryImpl implements 
         }
 
         //---------------------------------------------------------< Object >---
+
         /**
          * Returns the string representation of this {@code Name} in the
          * following format:
@@ -204,6 +208,7 @@ public class NameFactoryImpl implements 
         }
 
         //------------------------------------------------------< Cloneable >---
+
         /**
          * Creates a clone of this {@code Name}.
          * Overridden in order to make {@code clone()} public.
@@ -219,6 +224,7 @@ public class NameFactoryImpl implements 
         }
 
         //-----------------------------------------------------< Comparable >---
+        
         /**
          * Compares two {@code Name}s.
          *
@@ -240,6 +246,7 @@ public class NameFactoryImpl implements 
         }
 
         //---------------------------------------------------< Serializable >---
+        
         /**
          * Creates a new {@code Name} instance using the proper constructor
          * during deserialization in order to make sure that internalized strings

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Path.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Path.java?rev=1171606&r1=1171605&r2=1171606&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Path.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Path.java
Fri Sep 16 14:54:41 2011
@@ -481,6 +481,7 @@ public interface Path extends Serializab
     String getString();
 
     //----------------------------------------------------< inner interface >---
+    
     /**
      * Object representation of a single JCR path element. An {@code Element}
      * object contains the {@code Name} and optional index of a single



Mime
View raw message