chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1088666 - in /chemistry/opencmis/trunk/chemistry-opencmis-client: chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runti...
Date Mon, 04 Apr 2011 15:47:02 GMT
Author: fmui
Date: Mon Apr  4 15:47:01 2011
New Revision: 1088666

URL: http://svn.apache.org/viewvc?rev=1088666&view=rev
Log:
CMIS-349: added methods to remove objects from the cache

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/NoCacheImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
Mon Apr  4 15:47:01 2011
@@ -246,6 +246,22 @@ public interface Session {
      */
     CmisObject getObjectByPath(String path, OperationContext context);
 
+    /**
+     * Removes the given object from the cache.
+     * 
+     * @param objectId
+     *            object id
+     */
+    void removeObjectFromCache(ObjectId objectId);
+
+    /**
+     * Removes the given object from the cache.
+     * 
+     * @param objectId
+     *            object id
+     */
+    void removeObjectFromCache(String objectId);
+
     // discovery
 
     /**

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
Mon Apr  4 15:47:01 2011
@@ -268,6 +268,7 @@ public abstract class AbstractCmisObject
         try {
             String objectId = getObjectId();
             getBinding().getObjectService().deleteObject(getRepositoryId(), objectId, allVersions,
null);
+            getSession().removeObjectFromCache(this);
         } finally {
             readUnlock();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/FolderImpl.java
Mon Apr  4 15:47:01 2011
@@ -167,6 +167,10 @@ public class FolderImpl extends Abstract
         FailedToDeleteData failed = getBinding().getObjectService().deleteTree(repositoryId,
objectId, allVersions,
                 unfile, continueOnFailure, null);
 
+        if ((failed == null) || (failed.getIds() == null) || (failed.getIds().isEmpty()))
{
+            getSession().removeObjectFromCache(this);
+        }
+
         return failed.getIds();
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
Mon Apr  4 15:47:01 2011
@@ -431,6 +431,18 @@ public class SessionImpl implements Sess
         return result;
     }
 
+    public void removeObjectFromCache(ObjectId objectId) {
+        if ((objectId == null) || (objectId.getId() == null)) {
+            return;
+        }
+
+        removeObjectFromCache(objectId.getId());
+    }
+
+    public void removeObjectFromCache(String objectId) {
+        cache.remove(objectId);
+    }
+
     public RepositoryInfo getRepositoryInfo() {
         lock.readLock().lock();
         try {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/Cache.java
Mon Apr  4 15:47:01 2011
@@ -48,6 +48,8 @@ public interface Cache extends Serializa
 
     CmisObject getByPath(String path, String cacheKey);
 
+    void remove(String objectId);
+
     void clear();
 
     int getCacheSize();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
Mon Apr  4 15:47:01 2011
@@ -272,6 +272,19 @@ public class CacheImpl implements Cache 
         }
     }
 
+    public void remove(String objectId) {
+        if(objectId == null) {
+            return;
+        }
+
+        lock.writeLock().lock();
+        try {
+            objectMap.remove(objectId);
+        } finally {
+            lock.writeLock().unlock();
+        }
+    }
+
     public int getCacheSize() {
         return this.cacheSize;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/NoCacheImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/NoCacheImpl.java?rev=1088666&r1=1088665&r2=1088666&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/NoCacheImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/NoCacheImpl.java
Mon Apr  4 15:47:01 2011
@@ -52,6 +52,9 @@ public class NoCacheImpl implements Cach
         return null;
     }
 
+    public void remove(String objectId) {
+    }
+
     public void clear() {
     }
 



Mime
View raw message