jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r478211 - in /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ lock/ operation/ state/ version/
Date Wed, 22 Nov 2006 16:15:06 GMT
Author: angela
Date: Wed Nov 22 08:15:04 2006
New Revision: 478211

URL: http://svn.apache.org/viewvc?view=rev&rev=478211
Log:
work in progress

- invalidation of itemstates in case of CacheBehaviour != Observation
- CacheBehaviour.Observation not dependent on Observation-RepositoryDescriptor
- SPI-observation may be implemented even if Observation is not supported according
  jcr-Repository descriptor

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockOperation.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRefresh.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Wed Nov 22 08:15:04 2006
@@ -39,6 +39,7 @@
 import org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryImpl;
 import org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.jcr2spi.xml.WorkspaceContentHandler;
+import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
@@ -107,8 +108,7 @@
         this.name = name;
         this.session = session;
 
-        wspManager = createManager(service, sessionInfo);
-        wspManager.setCacheBehaviour(session.getCacheBehaviour());
+        wspManager = createManager(service, session.getCacheBehaviour(), sessionInfo);
     }
 
     //----------------------------------------------------------< Workspace >---
@@ -456,8 +456,10 @@
      * @param service the RepositoryService
      * @return state manager
      */
-    protected WorkspaceManager createManager(RepositoryService service, SessionInfo sessionInfo)
throws RepositoryException {
-        return new WorkspaceManager(service, sessionInfo);
+    protected WorkspaceManager createManager(RepositoryService service,
+                                             CacheBehaviour cacheBehaviour,
+                                             SessionInfo sessionInfo) throws RepositoryException
{
+        return new WorkspaceManager(service, cacheBehaviour, sessionInfo);
     }
 
     /**

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Wed Nov 22 08:15:04 2006
@@ -130,7 +130,7 @@
     private final SessionInfo sessionInfo;
 
     private final ItemStateManager cache;
-    private CacheBehaviour cacheBehaviour = CacheBehaviour.OBSERVATION;
+    private final CacheBehaviour cacheBehaviour;
 
     private final NamespaceRegistryImpl nsRegistry;
     private final NodeTypeRegistry ntRegistry;
@@ -161,9 +161,11 @@
      */
     private final Set listeners = Collections.synchronizedSet(new HashSet());
 
-    public WorkspaceManager(RepositoryService service, SessionInfo sessionInfo) throws RepositoryException
{
+    public WorkspaceManager(RepositoryService service, CacheBehaviour cacheBehaviour,
+                            SessionInfo sessionInfo) throws RepositoryException {
         this.service = service;
         this.sessionInfo = sessionInfo;
+        this.cacheBehaviour = cacheBehaviour;
 
         cache = createItemStateManager();
 
@@ -171,7 +173,7 @@
 
         nsRegistry = createNamespaceRegistry(repositoryDescriptors);
         ntRegistry = createNodeTypeRegistry(nsRegistry, repositoryDescriptors);
-        externalChangeFeed = createChangeFeed(repositoryDescriptors, EXTERNAL_EVENT_POLLING_INTERVAL);
+        externalChangeFeed = createChangeFeed(EXTERNAL_EVENT_POLLING_INTERVAL);
     }
 
     public NamespaceRegistryImpl getNamespaceRegistryImpl() {
@@ -240,11 +242,23 @@
         sessionInfo.removeLockToken(lt);
     }
 
+    /**
+     *
+     * @return
+     * @throws RepositoryException
+     */
     public String[] getSupportedQueryLanguages() throws RepositoryException {
         // TODO: review
         return service.getSupportedQueryLanguages(sessionInfo);
     }
 
+    /**
+     *
+     * @param statement
+     * @param language
+     * @return
+     * @throws RepositoryException
+     */
     public QueryInfo executeQuery(String statement, String language)
             throws RepositoryException {
         return service.executeQuery(sessionInfo, statement, language);
@@ -282,42 +296,20 @@
      * @throws UnsupportedRepositoryOperationException
      *          if this implementation does not support observation.
      */
-    public EventFilter createEventFilter(int eventTypes,
-                                         Path path,
-                                         boolean isDeep,
-                                         String[] uuids,
-                                         QName[] nodeTypes,
+    public EventFilter createEventFilter(int eventTypes, Path path, boolean isDeep,
+                                         String[] uuids, QName[] nodeTypes,
                                          boolean noLocal)
-            throws UnsupportedRepositoryOperationException {
+        throws UnsupportedRepositoryOperationException {
         return service.createEventFilter(eventTypes, path, isDeep, uuids, nodeTypes, noLocal);
     }
-
-    //----------------------------------------------------< package private >---
-
-    /**
-     * Returns the current cache behaviour. Defaults to {@link
-     * CacheBehaviour#OBSERVATION} unless otherwise set using {@link
-     * #setCacheBehaviour(CacheBehaviour)}.
-     *
-     * @return the current cache behaviour.
-     */
-    CacheBehaviour getCacheBehaviour() {
-        return cacheBehaviour;
-    }
-
+    //--------------------------------------------------------------------------
     /**
-     * Sets the cache behaviour for this WorkspaceManager.
      *
-     * @param behaviour the cache behaviour.
+     * @return
      */
-    void setCacheBehaviour(CacheBehaviour behaviour) {
-        this.cacheBehaviour = behaviour;
-    }
-
-    //--------------------------------------------------------------------------
     private ItemStateManager createItemStateManager() {
         ItemStateFactory isf = new WorkspaceItemStateFactory(service, sessionInfo, this);
-        WorkspaceItemStateManager ism = new WorkspaceItemStateManager(this, isf, service.getIdFactory());
+        WorkspaceItemStateManager ism = new WorkspaceItemStateManager(this, cacheBehaviour,
isf, service.getIdFactory());
         addEventListener(ism);
         return ism;
     }
@@ -354,20 +346,15 @@
      * Creates a background thread which polls for external changes on the
      * RepositoryService.
      *
-     * @param descriptors the repository descriptors.
      * @param pollingInterval the polling interval in milliseconds.
      * @return the background polling thread or <code>null</code> if the underlying
      *         <code>RepositoryService</code> does not support observation.
      */
-    private Thread createChangeFeed(Map descriptors, int pollingInterval) {
-        String desc = (String) descriptors.get(Repository.OPTION_OBSERVATION_SUPPORTED);
-        Thread t = null;
-        if (Boolean.valueOf(desc).booleanValue()) {
-            t = new Thread(new ExternalChangePolling(pollingInterval));
-            t.setName("External Change Polling");
-            t.setDaemon(true);
-            t.start();
-        }
+    private Thread createChangeFeed(int pollingInterval) {
+        Thread t = new Thread(new ExternalChangePolling(pollingInterval));
+        t.setName("External Change Polling");
+        t.setDaemon(true);
+        t.start();
         return t;
     }
 
@@ -1021,6 +1008,10 @@
                             log.debug("Event delivery signaled");
                         }
                     }
+                } catch (UnsupportedRepositoryOperationException e) {
+                    log.error("SPI implementation does not support observation: " + e);
+                    // terminate
+                    break;
                 } catch (RepositoryException e) {
                     log.warn("Exception while retrieving event bundles: " + e);
                     log.debug("Dump:", e);

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
Wed Nov 22 08:15:04 2006
@@ -466,7 +466,7 @@
             // child properties nor from the original lock request.
             this.lockInfo = wspManager.getLockInfo(lockHoldingState.getNodeId());
 
-            // TODO: TOBEFIXED...repository may not support observation
+            // TODO: TOBEFIXED...SPI may not support observation
             // register as internal listener to the wsp manager in order to get
             // informed if this lock ends his life.
             eventFilter = wspManager.createEventFilter(Event.PROPERTY_REMOVED,

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AbstractCopy.java
Wed Nov 22 08:15:04 2006
@@ -72,6 +72,16 @@
         this.srcWorkspaceName = srcWorkspaceName;
     }
 
+    //----------------------------------------------------------< Operation >---
+    /**
+     * Invalidate the destination parent <code>NodeState</code>.
+     * 
+     * @see Operation#persisted()
+     */
+    public void persisted() {
+        destParentState.invalidate(false);
+    }
+
     //----------------------------------------< Access Operation Parameters >---
     public String getWorkspaceName() {
         return srcWorkspaceName;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/AddLabel.java
Wed Nov 22 08:15:04 2006
@@ -19,7 +19,10 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
+import org.apache.jackrabbit.jcr2spi.state.entry.ChildNodeEntry;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -66,10 +69,23 @@
     }
 
     /**
+     * Invalidates the jcr:versionlabel nodestate present with the given
+     * version history. If '<code>moveLabel</code>' is true, all decendant states
+     * (property states) are invalidated as well.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        ChildNodeEntry lnEntry = versionHistoryState.getChildNodeEntry(QName.JCR_VERSIONLABELS,
Path.INDEX_DEFAULT);
+        if (lnEntry.isAvailable()) {
+            try {
+                NodeState labelNodeState = lnEntry.getNodeState();
+                // if an existing label must be moved -> invalidate recursively
+                labelNodeState.invalidate(moveLabel);
+            } catch (ItemStateException e) {
+                // ignore
+            }
+        }
     }
     //----------------------------------------< Access Operation Parameters >---
     public NodeState getVersionHistoryState() {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkin.java
Wed Nov 22 08:15:04 2006
@@ -39,22 +39,38 @@
     }
 
     //----------------------------------------------------------< Operation >---
+
+    /**
+     * @see Operation#accept(OperationVisitor)
+     */
     public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException,
AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException,
VersionException {
         visitor.visit(this);
     }
 
+    /**
+     * Invalidate the target <code>NodeState</code>.
+     *
+     * @see Operation#persisted()
+     */
+    public void persisted() {
+        nodeState.invalidate(false);
+        // TODO: invalidate the corresponding part of the version storage
+    }
     //----------------------------------------< Access Operation Parameters >---
+    /**
+     *
+     * @return The nodeState to be checked in.
+     */
     public NodeState getNodeState() {
         return nodeState;
     }
 
+    //------------------------------------------------------------< Factory >---
     /**
-     * @see Operation#persisted()
+     *
+     * @param nodeState
+     * @return
      */
-    public void persisted() {
-        // TODO
-    }
-    //------------------------------------------------------------< Factory >---
     public static Operation create(NodeState nodeState) {
         return new Checkin(nodeState);
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkout.java
Wed Nov 22 08:15:04 2006
@@ -44,12 +44,20 @@
     }
 
     /**
+     * Invalidate the target <code>NodeState</code>.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        nodeState.invalidate(false);
+        // TODO: invalidate the corresponding part of the version storage
     }
+
     //----------------------------------------< Access Operation Parameters >---
+    /**
+     *
+     * @return
+     */
     public NodeState getNodeState() {
         return nodeState;
     }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Clone.java
Wed Nov 22 08:15:04 2006
@@ -17,7 +17,11 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.ManagerProvider;
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
 import org.apache.jackrabbit.name.Path;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemExistsException;
@@ -33,14 +37,21 @@
  */
 public class Clone extends AbstractCopy {
 
+    private static Logger log = LoggerFactory.getLogger(Clone.class);
+
     private final boolean removeExisting;
+    /* In case of 'removeExisting' and INVALIDATION-cachebehaviour we need
+       to invalidate the complete tree. */
+    private final ManagerProvider destMgrProvider;
 
     private Clone(Path srcPath, Path destPath, String srcWorkspaceName,
                   boolean removeExisting, ManagerProvider srcMgrProvider,
                   ManagerProvider destMgrProvider)
         throws RepositoryException {
         super(srcPath, destPath, srcWorkspaceName, srcMgrProvider, destMgrProvider);
+
         this.removeExisting = removeExisting;
+        this.destMgrProvider = destMgrProvider;
     }
 
     //----------------------------------------------------------< Operation >---
@@ -56,7 +67,18 @@
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        if (removeExisting) {
+            // invalidate the complete tree
+            try {
+                NodeState rootState = destMgrProvider.getItemStateManager().getRootState();
+                rootState.invalidate(true);
+            } catch (ItemStateException e) {
+                // TODO: fallback behaviour?
+                log.error("Cannot invalidate root state.", e.getMessage());
+            }
+        } else {
+            super.persisted();
+        }
     }
 
     //----------------------------------------< Access Operation Parameters >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Copy.java
Wed Nov 22 08:15:04 2006
@@ -47,12 +47,6 @@
         visitor.visit(this);
     }
 
-    /**
-     * @see Operation#persisted()
-     */
-    public void persisted() {
-        // TODO
-    }
     //------------------------------------------------------------< Factory >---
     public static Operation create(Path srcPath, Path destPath,
                                    String srcWorkspaceName,

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockOperation.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockOperation.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockOperation.java
Wed Nov 22 08:15:04 2006
@@ -52,10 +52,12 @@
     }
 
     /**
+     * Invalidates the <code>NodeState</code> that has been locked.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        nodeState.invalidate(false);
     }
 
     //----------------------------------------< Access Operation Parameters >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRefresh.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRefresh.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRefresh.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRefresh.java
Wed Nov 22 08:15:04 2006
@@ -51,7 +51,7 @@
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        // nothing to do.
     }
     
     //----------------------------------------< Access Operation Parameters >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/LockRelease.java
Wed Nov 22 08:15:04 2006
@@ -17,6 +17,9 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.PropertyState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
+import org.apache.jackrabbit.jcr2spi.state.entry.ChildPropertyEntry;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -25,6 +28,8 @@
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
+import java.util.Collection;
+import java.util.Iterator;
 
 /**
  * <code>LockRelease</code>...
@@ -48,12 +53,27 @@
     }
 
     /**
+     * Invalidates the <code>NodeState</code> that has been unlocked and all
its
+     * child properties.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        Collection propEntries = nodeState.getPropertyEntries();
+        for (Iterator it = propEntries.iterator(); it.hasNext();) {
+            ChildPropertyEntry pe = (ChildPropertyEntry) it.next();
+            if (pe.isAvailable()) {
+                try {
+                    PropertyState st = pe.getPropertyState();
+                    st.invalidate(false);
+                } catch (ItemStateException e) {
+                    // ignore
+                }
+            }
+        }
+        nodeState.invalidate(false);
     }
-    
+
     //----------------------------------------< Access Operation Parameters >---
     public NodeState getNodeState() {
         return nodeState;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
Wed Nov 22 08:15:04 2006
@@ -28,7 +28,7 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 
 /**
- * <code>Update</code>...
+ * <code>Merge</code>...
  */
 public class Merge extends AbstractOperation {
 
@@ -55,10 +55,13 @@
     }
 
     /**
+     * Invalidates the target nodestate and all descendants.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        nodeState.invalidate(true);
+        // TODO: invalidate the corresponding part of the version storage
     }
 
     //----------------------------------------< Access Operation Parameters >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
Wed Nov 22 08:15:04 2006
@@ -73,13 +73,17 @@
     }
 
     /**
-     * Throws UnsupportedOperationException
+     * Throws UnsupportedOperationException if this Move Operation is a transient
+     * modification. Otherwise, the moved state as well as both parent states
+     * are invalidated.
      *
      * @see Operation#persisted()
      */
     public void persisted() {
         if (srcState.isWorkspaceState()) {
-            // TODO
+            srcParentState.invalidate(false);
+            destParentState.invalidate(false);
+            srcState.invalidate(false);
         } else {
             throw new UnsupportedOperationException("persisted() not implemented for transient
modification.");
         }

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Remove.java
Wed Nov 22 08:15:04 2006
@@ -29,7 +29,7 @@
  */
 public class Remove extends AbstractOperation {
 
-    private ItemState removeState;
+    protected ItemState removeState;
 
     protected Remove(ItemState removeState) {
         this.removeState = removeState;

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveLabel.java
Wed Nov 22 08:15:04 2006
@@ -19,7 +19,10 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
+import org.apache.jackrabbit.jcr2spi.state.entry.ChildNodeEntry;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -30,7 +33,7 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 
 /**
- * <code>AddLabel</code>...
+ * <code>RemoveLabel</code>...
  */
 public class RemoveLabel extends AbstractOperation {
 
@@ -64,10 +67,21 @@
     }
 
     /**
+     * Invalidates the jcr:versionlabel nodestate present with the given
+     * version history and all decendant states (property states).
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        ChildNodeEntry lnEntry = versionHistoryState.getChildNodeEntry(QName.JCR_VERSIONLABELS,
Path.INDEX_DEFAULT);
+        if (lnEntry.isAvailable()) {
+            try {
+                NodeState labelNodeState = lnEntry.getNodeState();
+                labelNodeState.invalidate(true);
+            } catch (ItemStateException e) {
+                // ignore
+            }
+        }
     }
 
     //----------------------------------------< Access Operation Parameters >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
Wed Nov 22 08:15:04 2006
@@ -22,7 +22,7 @@
 import javax.jcr.version.VersionException;
 
 /**
- * <code>Remove</code>...
+ * <code>RemoveVersion</code>...
  */
 public class RemoveVersion extends Remove {
 
@@ -39,10 +39,15 @@
     }
 
     /**
+     * Invalidates the <code>NodeState</code> that has been updated and all
+     * its decendants. Second, the parent state gets invalidated.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        NodeState parent = removeState.getParent();
+        removeState.invalidate(true);
+        parent.invalidate(false);
     }
 
     //------------------------------------------------------------< Factory >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ResolveMergeConflict.java
Wed Nov 22 08:15:04 2006
@@ -17,6 +17,9 @@
 package org.apache.jackrabbit.jcr2spi.operation;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.state.PropertyState;
+import org.apache.jackrabbit.jcr2spi.state.ItemStateException;
+import org.apache.jackrabbit.jcr2spi.state.entry.ChildPropertyEntry;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.AccessDeniedException;
@@ -25,6 +28,8 @@
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
+import java.util.Collection;
+import java.util.Iterator;
 
 /**
  * <code>ResolveMergeConflict</code>...
@@ -54,10 +59,25 @@
     }
 
     /**
+     * Invalidates the <code>NodeState</code> that had a merge conflict pending
+     * and all its child properties.
+     *
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        Collection propEntries = nodeState.getPropertyEntries();
+        for (Iterator it = propEntries.iterator(); it.hasNext();) {
+            ChildPropertyEntry pe = (ChildPropertyEntry) it.next();
+            if (pe.isAvailable()) {
+                try {
+                    PropertyState st = pe.getPropertyState();
+                    st.invalidate(false);
+                } catch (ItemStateException e) {
+                    // ignore
+                }
+            }
+        }
+        nodeState.invalidate(false);
     }
     //----------------------------------------< Access Operation Parameters >---
     public NodeState getNodeState() {

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Restore.java
Wed Nov 22 08:15:04 2006
@@ -30,7 +30,7 @@
 import javax.jcr.nodetype.ConstraintViolationException;
 
 /**
- * <code>Update</code>...
+ * <code>Restore</code>...
  */
 public class Restore extends AbstractOperation {
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Update.java
Wed Nov 22 08:15:04 2006
@@ -50,10 +50,13 @@
     }
 
     /**
+     * Invalidates the <code>NodeState</code> that has been updated and all
+     * its decendants.
+     * 
      * @see Operation#persisted()
      */
     public void persisted() {
-        // TODO
+        nodeState.invalidate(true);
     }
 
     //----------------------------------------< Access Operation Parameters >---

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateManager.java
Wed Nov 22 08:15:04 2006
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.jcr2spi.observation.InternalEventListener;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
+import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.Event;
 import org.apache.jackrabbit.spi.EventBundle;
@@ -46,20 +47,25 @@
 
     private final Collection eventFilter;
 
-    public WorkspaceItemStateManager(WorkspaceManager wspManager, ItemStateFactory isf, IdFactory
idFactory) {
+    public WorkspaceItemStateManager(WorkspaceManager wspManager,
+                                     CacheBehaviour cacheBehaviour,
+                                     ItemStateFactory isf, IdFactory idFactory) {
         super(isf, idFactory);
-        EventFilter filter = null;
-        try {
-            // todo for now listen to everything
-            filter = wspManager.createEventFilter(Event.ALL_TYPES, Path.ROOT, true, null,
null, false);
-        } catch (UnsupportedRepositoryOperationException e) {
-            // repository does not support observation
+        if (cacheBehaviour == CacheBehaviour.OBSERVATION) {
+            EventFilter filter = null;
+            try {
+                // todo for now listen to everything
+                filter = wspManager.createEventFilter(Event.ALL_TYPES, Path.ROOT, true, null,
null, false);
+            } catch (UnsupportedRepositoryOperationException e) {
+                // spi does not support observation
+            }
+            this.eventFilter = (filter == null) ? Collections.EMPTY_LIST : Collections.singletonList(filter);
+        } else {
+            this.eventFilter = Collections.EMPTY_LIST;
         }
-        this.eventFilter = (filter == null) ? Collections.EMPTY_LIST : Collections.singletonList(filter);
     }
 
     //-------------------------------< InternalEventListener >------------------
-
     /**
      * @see InternalEventListener#getEventFilters()
      */

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java?view=diff&rev=478211&r1=478210&r2=478211
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
Wed Nov 22 08:15:04 2006
@@ -158,7 +158,7 @@
 
     public Collection merge(NodeState nodeState, String workspaceName, boolean bestEffort)
throws RepositoryException {
         NodeState wspState = getWorkspaceState(nodeState);
-        // TODO : needs to be fixed... repository may not support observation
+        // TODO : needs to be fixed... SPI may not support observation
         // TODO find better solution to build the mergeFailed-collection
         EventFilter eventFilter;
         try {



Mime
View raw message