jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1174247 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src: main/java/org/apache/jackrabbit/jcr2spi/ main/java/org/apache/jackrabbit/jcr2spi/config/ main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ main/java/org/apache/jackrab...
Date Thu, 22 Sep 2011 16:34:48 GMT
Author: mduerig
Date: Thu Sep 22 16:34:48 2011
New Revision: 1174247

URL: http://svn.apache.org/viewvc?rev=1174247&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
remove CacheBehaviour and default to invalidate

Removed:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/CacheBehaviour.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/Jcr2spiRepositoryFactory.java
    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/config/RepositoryConfig.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManagerImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractRepositoryConfig.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?rev=1174247&r1=1174246&r2=1174247&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
Thu Sep 22 16:34:48 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.operation.Operation;
@@ -214,12 +213,9 @@ public abstract class ItemImpl<STATE_TYP
         // If 'keepChanges' is true, items that do not have changes pending have
         //   their state refreshed to reflect the current saved state
         if (keepChanges) {
-            if (status != Status.NEW  &&
-                session.getCacheBehaviour() != CacheBehaviour.OBSERVATION) {
+            if (status != Status.NEW) {
                 // merge current transient modifications with latest changes
                 // from the 'server'.
-                // Note, that with Observation-CacheBehaviour no manual refresh
-                // is required. changes get pushed automatically.
                 state.getHierarchyEntry().invalidate(true);
             }
         } else {
@@ -232,13 +228,7 @@ public abstract class ItemImpl<STATE_TYP
 
             // Reset all transient modifications from this item and its descendants.
             session.getSessionItemStateManager().undo(state);
-
-            // Unless the session is in 'observation' mode, mark all states
-            // within this tree 'invalidated' in order to have them refreshed
-            // from the server upon the next access.
-            if (session.getCacheBehaviour() != CacheBehaviour.OBSERVATION) {
-                state.getHierarchyEntry().invalidate(true);
-            }
+            state.getHierarchyEntry().invalidate(true);
         }
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/Jcr2spiRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/Jcr2spiRepositoryFactory.java?rev=1174247&r1=1174246&r2=1174247&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/Jcr2spiRepositoryFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/Jcr2spiRepositoryFactory.java
Thu Sep 22 16:34:48 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.RepositoryServiceFactory;
@@ -56,18 +55,6 @@ public class Jcr2spiRepositoryFactory im
     public static final String PARAM_REPOSITORY_CONFIG = "org.apache.jackrabbit.jcr2spi.RepositoryConfig";
 
     /**
-     * Optional configuration parameter for {@link RepositoryConfig#getCacheBehaviour()}.
This
-     * must be either {@link CacheBehaviour#INVALIDATE} or {@link CacheBehaviour#OBSERVATION}
-     * or one of the strings "invalidate" or "observation".
-     */
-    public static final String PARAM_CACHE_BEHAVIOR = "org.apache.jackrabbit.jcr2spi.CacheBehaviour";
-
-    /**
-     * Default value for {@link #PARAM_CACHE_BEHAVIOR}
-     */
-    public static final CacheBehaviour DEFAULT_CACHE_BEHAVIOR = CacheBehaviour.INVALIDATE;
-
-    /**
      * Optional configuration parameter for the {@link RepositoryConfig#getItemCacheSize()}.
This
      * must be either an {@code Integer} or a String which parses into an integer.
      */
@@ -221,7 +208,6 @@ public class Jcr2spiRepositoryFactory im
 
     public static class RepositoryConfigImpl implements RepositoryConfig {
         private final RepositoryServiceFactory serviceFactory;
-        private final CacheBehaviour cacheBehaviour;
         private final int itemCacheSize;
         private final int pollTimeOut;
         private final Map<?, ?> parameters;
@@ -231,18 +217,12 @@ public class Jcr2spiRepositoryFactory im
                 throws RepositoryException {
 
             this.serviceFactory = serviceFactory;
-            cacheBehaviour = getCacheBehaviour(parameters);
             itemCacheSize = getItemCacheSize(parameters);
             pollTimeOut = getPollTimeout(parameters);
             this.parameters = parameters;
         }
 
         @Override
-        public CacheBehaviour getCacheBehaviour() {
-            return cacheBehaviour;
-        }
-
-        @Override
         public int getItemCacheSize() {
             return itemCacheSize;
         }
@@ -262,40 +242,6 @@ public class Jcr2spiRepositoryFactory im
 
         // -----------------------------------------------------< private >---
 
-        private static CacheBehaviour getCacheBehaviour(Map<?, ?> parameters) throws
RepositoryException {
-            Object paramCacheBehaviour = parameters.get(PARAM_CACHE_BEHAVIOR);
-            log.debug("Setting CacheBehaviour from {}", PARAM_CACHE_BEHAVIOR);
-
-            if (paramCacheBehaviour == null) {
-                log.debug("{} not set, defaulting to {}", PARAM_CACHE_BEHAVIOR, DEFAULT_CACHE_BEHAVIOR);
-                return DEFAULT_CACHE_BEHAVIOR;
-            }
-            else if (paramCacheBehaviour instanceof CacheBehaviour) {
-                log.debug("Setting CacheBehaviour to {}", paramCacheBehaviour);
-                return (CacheBehaviour) paramCacheBehaviour;
-            }
-            else if (paramCacheBehaviour instanceof String) {
-                String cacheBehaviour = (String) paramCacheBehaviour;
-                if ("invalidate".equals(cacheBehaviour)) {
-                    log.debug("Setting CacheBehaviour to {}", CacheBehaviour.INVALIDATE);
-                    return CacheBehaviour.INVALIDATE;
-                }
-                else if ("observation".equals(cacheBehaviour)) {
-                    log.debug("Setting CacheBehaviour to {}", CacheBehaviour.OBSERVATION);
-                    return CacheBehaviour.OBSERVATION;
-                }
-                else {
-                    log.error("Invalid valid for CacheBehaviour: {}", PARAM_CACHE_BEHAVIOR,
cacheBehaviour);
-                    throw new RepositoryException("Invalid value for CacheBehaviour: " +
cacheBehaviour);
-                }
-            }
-            else {
-                String msg = "Invalid value for CacheBehaviour: " + paramCacheBehaviour;
-                log.error(msg);
-                throw new RepositoryException(msg);
-            }
-        }
-
         private static int getItemCacheSize(Map<?, ?> parameters) throws RepositoryException
{
             Object paramItemCacheSize = parameters.get(PARAM_ITEM_CACHE_SIZE);
             log.debug("Setting ItemCacheSize from {}", PARAM_ITEM_CACHE_SIZE);
@@ -385,11 +331,6 @@ public class Jcr2spiRepositoryFactory im
         }
 
         @Override
-        public CacheBehaviour getCacheBehaviour() {
-            return config.getCacheBehaviour();
-        }
-
-        @Override
         public int getItemCacheSize() {
             return config.getItemCacheSize();
         }

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=1174247&r1=1174246&r2=1174247&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
Thu Sep 22 16:34:48 2011
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.jcr2spi;
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.commons.AbstractSession;
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
@@ -792,10 +791,6 @@ public class SessionImpl extends Abstrac
         return validator;
     }
 
-    CacheBehaviour getCacheBehaviour() {
-        return config.getCacheBehaviour();
-    }
-
     int getPollTimeout() {
         return config.getPollTimeout();
     }

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=1174247&r1=1174246&r2=1174247&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
Thu Sep 22 16:34:48 2011
@@ -475,7 +475,7 @@ public class WorkspaceImpl implements Wo
      * @return a new {@code LockStateManager} instance.
      */
     protected LockStateManager createStateLockManager(WorkspaceManager wspManager, ItemManager
itemManager) {
-        LockStateManagerImpl lockStateMgr = new LockStateManagerImpl(wspManager, itemManager,
session.getCacheBehaviour());
+        LockStateManagerImpl lockStateMgr = new LockStateManagerImpl(wspManager, itemManager);
         session.addListener(lockStateMgr);
         return lockStateMgr;
     }

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=1174247&r1=1174246&r2=1174247&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
Thu Sep 22 16:34:48 2011
@@ -16,7 +16,6 @@
  */
 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;
@@ -138,8 +137,6 @@ public final class WorkspaceManager impl
     /**
      * This is the event polling for changes. If {@code null}
      * then the underlying repository service does not support observation.
-     * It is also {@code null} if {@link org.apache.jackrabbit.jcr2spi.config.CacheBehaviour#INVALIDATE}
is
-     * configured and no event listeners have been registered.
      */
     private ChangePolling changeFeed;  
 
@@ -179,17 +176,11 @@ public final class WorkspaceManager impl
         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 = new HierarchyEventListener(this, hierarchyManager,
config.getCacheBehaviour());
-        if (config.getCacheBehaviour() == CacheBehaviour.OBSERVATION) {
-            addEventListener(listener);
-        } else {
-            listeners.add(listener);
-        }
+        // Add a hierarchy listener which is 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 = new HierarchyEventListener(hierarchyManager);
+        listeners.add(listener);
     }
 
     public NamespaceRegistryImpl getNamespaceRegistryImpl() {
@@ -533,8 +524,6 @@ public final class WorkspaceManager impl
         }
         try {
             // Execute operation and delegate invalidation of affected item states to the
operation.
-            // NOTE, that the invalidation is independent of the cache behaviour due to the
fact,
-            // that local event bundles are not processed by the HierarchyEventListener.
             new OperationVisitorImpl(sessionInfo).execute(operation);
             operation.persisted();
         } finally {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java?rev=1174247&r1=1174246&r2=1174247&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/config/RepositoryConfig.java
Thu Sep 22 16:34:48 2011
@@ -16,10 +16,10 @@
  */
 package org.apache.jackrabbit.jcr2spi.config;
 
-import javax.jcr.RepositoryException;
-
 import org.apache.jackrabbit.spi.RepositoryService;
 
+import javax.jcr.RepositoryException;
+
 /**
  * This class bundles the information required by JCR2SPI to
  * bootstrap an SPI implementation.
@@ -32,8 +32,6 @@ public interface RepositoryConfig {
 
     RepositoryService getRepositoryService() throws RepositoryException;
 
-    CacheBehaviour getCacheBehaviour();
-
     int getItemCacheSize();
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java?rev=1174247&r1=1174246&r2=1174247&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEventListener.java
Thu Sep 22 16:34:48 2011
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.observation.InternalEventListener;
 import org.apache.jackrabbit.spi.Event;
 import org.apache.jackrabbit.spi.EventBundle;
@@ -47,37 +45,16 @@ public class HierarchyEventListener impl
     private static final Logger log = LoggerFactory.getLogger(HierarchyEventListener.class);
 
     private final HierarchyManager hierarchyMgr;
-    private final Collection<EventFilter> eventFilter;
 
-    public HierarchyEventListener(WorkspaceManager wspManager, HierarchyManager hierarchyMgr,
-            CacheBehaviour cacheBehaviour) {
-        
+    public HierarchyEventListener(HierarchyManager hierarchyMgr) {
         this.hierarchyMgr = hierarchyMgr;
-        if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
-            EventFilter filter = null;
-            try {
-                // listen to all events except 'local' ones
-                Path root = wspManager.getPathFactory().getRootPath();
-                filter = wspManager.createEventFilter(Event.ALL_TYPES, root, true, null,
null, true);
-            } catch (RepositoryException e) {
-                // SPI does not support observation, or another error occurred.
-                log.debug("Creating event filter for cache behavior observation failed",
e);
-            }
-            if (filter == null) {
-                eventFilter = Collections.emptyList();
-            } else {
-                eventFilter = Collections.singletonList(filter);
-            }
-        } else {
-            eventFilter = Collections.emptyList();
-        }
     }
 
     //----------------------------------------------< InternalEventListener >---
     
     @Override
     public Collection<EventFilter> getEventFilters() {
-        return eventFilter;
+        return Collections.emptyList();
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManagerImpl.java?rev=1174247&r1=1174246&r2=1174247&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManagerImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManagerImpl.java
Thu Sep 22 16:34:48 2011
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.jcr2spi.lo
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.SessionListener;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.operation.LockOperation;
 import org.apache.jackrabbit.jcr2spi.operation.LockRefresh;
@@ -28,7 +27,6 @@ import org.apache.jackrabbit.jcr2spi.ope
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateLifeCycleListener;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.Status;
 import org.apache.jackrabbit.spi.LockInfo;
 import org.apache.jackrabbit.spi.NodeId;
@@ -37,7 +35,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.Item;
-import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -66,7 +63,6 @@ public class LockStateManagerImpl implem
      */
     private final WorkspaceManager wspManager;
     private final ItemManager itemManager;
-    private final CacheBehaviour cacheBehaviour;
 
     /**
      * Map holding all locks that where created by this {@code Session} upon
@@ -77,10 +73,9 @@ public class LockStateManagerImpl implem
      */
     private final Map<NodeState, LockImpl> lockMap;
 
-    public LockStateManagerImpl(WorkspaceManager wspManager, ItemManager itemManager, CacheBehaviour
cacheBehaviour) {
+    public LockStateManagerImpl(WorkspaceManager wspManager, ItemManager itemManager) {
         this.wspManager = wspManager;
         this.itemManager = itemManager;
-        this.cacheBehaviour = cacheBehaviour;
         // use hard references in order to make sure, that entries referring
         // to locks created by the current session are not removed.
         lockMap = new HashMap<NodeState, LockImpl>();
@@ -569,39 +564,10 @@ public class LockStateManagerImpl implem
         private void startListening() {
             // LockState must be aware of removal of the Node.
             lockHoldingState.addListener(this);
-
-            // in case of CacheBehaviour.OBSERVATION this lock state can also
-            // be aware of another session removing the lock -> listen to
-            // status changes of the jcr:lockIsDeep property.
-            if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
-                try {
-                    if (!lockHoldingState.hasPropertyName(NameConstants.JCR_LOCKISDEEP))
{
-                        // force reloading of the lock holding node.
-                        itemManager.getItem(lockHoldingState.getNodeEntry());
-                    }
-                    PropertyState ps = lockHoldingState.getPropertyState(NameConstants.JCR_LOCKISDEEP);
-                    ps.addListener(this);
-                } catch (RepositoryException e) {
-                    log.warn("Unable to retrieve jcr:isDeep property after lock creation.",
e.getMessage());
-                }
-            }
         }
 
         private void stopListening() {
             lockHoldingState.removeListener(this);
-
-            if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
-                try {
-                    if (lockHoldingState.hasPropertyName(NameConstants.JCR_LOCKISDEEP)) {
-                        PropertyState ps = lockHoldingState.getPropertyState(NameConstants.JCR_LOCKISDEEP);
-                        ps.removeListener(this);
-                    }
-                } catch (ItemNotFoundException e) {
-                    log.debug("jcr:lockIsDeep doesn't exist any more.");
-                } catch (Exception e) {
-                    log.warn(e.getMessage());
-                }
-            }
         }
 
         //-------------------------------------< ItemStateLifeCycleListener >---
@@ -658,12 +624,8 @@ public class LockStateManagerImpl implem
             this.lockState = lockState;
             node = lockHoldingNode;
 
-            // if observation is supported OR if this is a session-scoped lock
-            // hold by this session -> store lock in the map
-            if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
-                lockMap.put(lockState.lockHoldingState, this);
-                lockState.startListening();
-            } else if (lockState.lockInfo.isLockOwner()) {
+            // if this is a session-scoped lock hold by this session -> store lock in
the map
+            if (lockState.lockInfo.isLockOwner()) {
                 lockMap.put(lockState.lockHoldingState, this);
                 lockState.startListening();
                 // open-scoped locks: the map entry and the lock information

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractRepositoryConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractRepositoryConfig.java?rev=1174247&r1=1174246&r2=1174247&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractRepositoryConfig.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/AbstractRepositoryConfig.java
Thu Sep 22 16:34:48 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,10 +31,6 @@ public abstract class AbstractRepository
     private static final int DEFAULT_INFO_CACHE_SIZE = 5000;
     private static final int DEFAULT_POLL_TIMEOUT = 3000; // 3 seconds
 
-    public CacheBehaviour getCacheBehaviour() {
-        return CacheBehaviour.INVALIDATE;
-    }
-
     public int getItemCacheSize() {
         return DEFAULT_ITEM_CACHE_SIZE;
     }



Mime
View raw message