You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2014/07/11 17:01:06 UTC

svn commit: r1609721 [1/3] - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ chemistry-opencmis-commons/chemistry-opencmis-commons-api/src...

Author: fmui
Date: Fri Jul 11 15:01:05 2014
New Revision: 1609721

URL: http://svn.apache.org/r1609721
Log:
CMIS-816 + CMIS-818: OpenCMIS server: allow service and wrapper implementations to return custom responses

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ProgressControlCmisService.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/AbstractBindingCmisServiceWrapper.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/DiscoveryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/MultiFilingServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/NavigationServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/PolicyServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RelationshipServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/VersioningServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/PolicyService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AclService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/DiscoveryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/MultiFilingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/NavigationService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/PolicyService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RelationshipService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/RepositoryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/VersioningService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/AbstractServiceCall.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/AbstractCmisServiceWrapper.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AbstractLocalService.java Fri Jul 11 15:01:05 2014
@@ -25,6 +25,8 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
+import org.apache.chemistry.opencmis.commons.server.ProgressControlCmisService;
+import org.apache.chemistry.opencmis.commons.server.ProgressControlCmisService.Progress;
 
 /**
  * Base class for all local clients.
@@ -72,6 +74,36 @@ public abstract class AbstractLocalServi
     }
 
     /**
+     * Determines if the processing should be stopped before the service method
+     * is called.
+     * 
+     * @return {@code true} if the processing should be stopped, {@code false}
+     *         otherwise
+     */
+    protected boolean stopBeforeService(CmisService service) {
+        if (!(service instanceof ProgressControlCmisService)) {
+            return false;
+        }
+
+        return ((ProgressControlCmisService) service).beforeServiceCall() == Progress.STOP;
+    }
+
+    /**
+     * Determines if the processing should be stopped after the service method
+     * is called.
+     * 
+     * @return {@code true} if the processing should be stopped, {@code false}
+     *         otherwise
+     */
+    protected boolean stopAfterService(CmisService service) {
+        if (!(service instanceof ProgressControlCmisService)) {
+            return false;
+        }
+
+        return ((ProgressControlCmisService) service).beforeServiceCall() == Progress.STOP;
+    }
+
+    /**
      * creates a local call context.
      */
     protected CallContext createCallContext(String repositoryId) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/AclServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -44,7 +44,18 @@ public class AclServiceImpl extends Abst
         CmisService service = getService(repositoryId);
 
         try {
-            return service.applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            Acl serviceResult = service
+                    .applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -54,7 +65,17 @@ public class AclServiceImpl extends Abst
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            Acl serviceResult = service.getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -64,7 +85,17 @@ public class AclServiceImpl extends Abst
         CmisService service = getService(repositoryId);
 
         try {
-            return service.applyAcl(repositoryId, objectId, aces, AclPropagation.OBJECTONLY);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            Acl serviceResult = service.applyAcl(repositoryId, objectId, aces, AclPropagation.OBJECTONLY);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/DiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/DiscoveryServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/DiscoveryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/DiscoveryServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -46,8 +46,18 @@ public class DiscoveryServiceImpl extend
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getContentChanges(repositoryId, changeLogToken, includeProperties, filter, includePolicyIds,
-                    includeAcl, maxItems, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectList serviceResult = service.getContentChanges(repositoryId, changeLogToken, includeProperties,
+                    filter, includePolicyIds, includeAcl, maxItems, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -59,8 +69,18 @@ public class DiscoveryServiceImpl extend
         CmisService service = getService(repositoryId);
 
         try {
-            return service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
-                    includeRelationships, renditionFilter, maxItems, skipCount, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectList serviceResult = service.query(repositoryId, statement, searchAllVersions,
+                    includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/MultiFilingServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/MultiFilingServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/MultiFilingServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/MultiFilingServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -41,7 +41,15 @@ public class MultiFilingServiceImpl exte
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.addObjectToFolder(repositoryId, objectId, folderId, allVersions, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -51,7 +59,15 @@ public class MultiFilingServiceImpl exte
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.removeObjectFromFolder(repositoryId, objectId, folderId, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/NavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/NavigationServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/NavigationServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/NavigationServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -51,8 +51,17 @@ public class NavigationServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy, includeAllowableActions,
-                    includeRelationships, renditionFilter, maxItems, skipCount, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+            ObjectList serviceResult = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
+                    includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -64,8 +73,19 @@ public class NavigationServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectInFolderList serviceResult = service.getChildren(repositoryId, folderId, filter, orderBy,
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems,
+                    skipCount, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -77,8 +97,17 @@ public class NavigationServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePathSegment, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+            List<ObjectInFolderContainer> serviceResult = service.getDescendants(repositoryId, folderId, depth, filter,
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -88,7 +117,17 @@ public class NavigationServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getFolderParent(repositoryId, folderId, filter, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectData serviceResult = service.getFolderParent(repositoryId, folderId, filter, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -100,8 +139,17 @@ public class NavigationServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePathSegment, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<ObjectInFolderContainer> serviceResult = service.getFolderTree(repositoryId, folderId, depth, filter,
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -113,8 +161,19 @@ public class NavigationServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getObjectParents(repositoryId, objectId, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includeRelativePathSegment, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<ObjectParentData> serviceResult = service.getObjectParents(repositoryId, objectId, filter,
+                    includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment,
+                    extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/ObjectServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -57,8 +57,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createDocument(repositoryId, properties, folderId, contentStream, versioningState, policies,
-                    addAces, removeAces, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            String serviceResult = service.createDocument(repositoryId, properties, folderId, contentStream,
+                    versioningState, policies, addAces, removeAces, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -70,8 +80,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createDocumentFromSource(repositoryId, sourceId, properties, folderId, versioningState,
-                    policies, addAces, removeAces, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            String serviceResult = service.createDocumentFromSource(repositoryId, sourceId, properties, folderId,
+                    versioningState, policies, addAces, removeAces, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -82,7 +102,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createFolder(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            String serviceResult = service.createFolder(repositoryId, properties, folderId, policies, addAces,
+                    removeAces, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -93,7 +124,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            String serviceResult = service.createPolicy(repositoryId, properties, folderId, policies, addAces,
+                    removeAces, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -104,7 +146,17 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createItem(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+            String serviceResult = service.createItem(repositoryId, properties, folderId, policies, addAces,
+                    removeAces, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -115,7 +167,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            String serviceResult = service.createRelationship(repositoryId, properties, policies, addAces, removeAces,
+                    extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -126,7 +189,16 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.deleteContentStream(repositoryId, objectId, changeToken, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
+
         } finally {
             service.close();
         }
@@ -136,7 +208,16 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.deleteObject(repositoryId, objectId, allVersions, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
+
         } finally {
             service.close();
         }
@@ -147,7 +228,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            FailedToDeleteData serviceResult = service.deleteTree(repositoryId, folderId, allVersions, unfileObjects,
+                    continueOnFailure, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -157,7 +249,17 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getAllowableActions(repositoryId, objectId, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            AllowableActions serviceResult = service.getAllowableActions(repositoryId, objectId, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -168,7 +270,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getContentStream(repositoryId, objectId, streamId, offset, length, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ContentStream serviceResult = service.getContentStream(repositoryId, objectId, streamId, offset, length,
+                    extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -180,8 +293,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships,
-                    renditionFilter, includePolicyIds, includeAcl, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectData serviceResult = service.getObject(repositoryId, objectId, filter, includeAllowableActions,
+                    includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -193,8 +316,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships,
-                    renditionFilter, includePolicyIds, includeAcl, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectData serviceResult = service.getObjectByPath(repositoryId, path, filter, includeAllowableActions,
+                    includeRelationships, renditionFilter, includePolicyIds, includeAcl, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -204,7 +337,17 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getProperties(repositoryId, objectId, filter, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            Properties serviceResult = service.getProperties(repositoryId, objectId, filter, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -215,7 +358,18 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<RenditionData> serviceResult = service.getRenditions(repositoryId, objectId, renditionFilter,
+                    maxItems, skipCount, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -226,7 +380,15 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -237,7 +399,15 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -248,7 +418,15 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.appendContentStream(repositoryId, objectId, changeToken, contentStream, isLastChunk, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -259,7 +437,15 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.updateProperties(repositoryId, objectId, changeToken, properties, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -271,11 +457,20 @@ public class ObjectServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.bulkUpdateProperties(repositoryId, objectIdAndChangeToken, properties, addSecondaryTypeIds,
-                    removeSecondaryTypeIds, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<BulkUpdateObjectIdAndChangeToken> serviceResult = service.bulkUpdateProperties(repositoryId,
+                    objectIdAndChangeToken, properties, addSecondaryTypeIds, removeSecondaryTypeIds, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
     }
-
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/PolicyServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/PolicyServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/PolicyServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -43,7 +43,15 @@ public class PolicyServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.applyPolicy(repositoryId, policyId, objectId, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -54,7 +62,16 @@ public class PolicyServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getAppliedPolicies(repositoryId, objectId, filter, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+            List<ObjectData> serviceResut = service.getAppliedPolicies(repositoryId, objectId, filter, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResut;
         } finally {
             service.close();
         }
@@ -64,7 +81,15 @@ public class PolicyServiceImpl extends A
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.removePolicy(repositoryId, policyId, objectId, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RelationshipServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RelationshipServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RelationshipServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RelationshipServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -46,8 +46,19 @@ public class RelationshipServiceImpl ext
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
-                    relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectList serviceResult = service.getObjectRelationships(repositoryId, objectId,
+                    includeSubRelationshipTypes, relationshipDirection, typeId, filter, includeAllowableActions,
+                    maxItems, skipCount, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RepositoryServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/RepositoryServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -50,7 +50,17 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getRepositoryInfo(repositoryId, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            RepositoryInfo serviceResult = service.getRepositoryInfo(repositoryId, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -60,7 +70,17 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(null);
 
         try {
-            return service.getRepositoryInfos(extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<RepositoryInfo> serviceResult = service.getRepositoryInfos(extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -70,7 +90,17 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getTypeDefinition(repositoryId, typeId, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            TypeDefinition serviceResult = service.getTypeDefinition(repositoryId, typeId, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -81,8 +111,18 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount,
-                    extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            TypeDefinitionList serviceResult = service.getTypeChildren(repositoryId, typeId,
+                    includePropertyDefinitions, maxItems, skipCount, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -93,7 +133,18 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<TypeDefinitionContainer> serviceResult = service.getTypeDescendants(repositoryId, typeId, depth,
+                    includePropertyDefinitions, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -103,7 +154,17 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.createType(repositoryId, type, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            TypeDefinition serviceResult = service.createType(repositoryId, type, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -113,7 +174,17 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.updateType(repositoryId, type, extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            TypeDefinition serviceResult = service.updateType(repositoryId, type, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -123,7 +194,15 @@ public class RepositoryServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.deleteType(repositoryId, typeId, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/VersioningServiceImpl.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/VersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/local/VersioningServiceImpl.java Fri Jul 11 15:01:05 2014
@@ -48,7 +48,16 @@ public class VersioningServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.cancelCheckOut(repositoryId, objectId, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
+
         } finally {
             service.close();
         }
@@ -60,8 +69,16 @@ public class VersioningServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment, policies,
                     addAces, removeAces, extension);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -72,7 +89,15 @@ public class VersioningServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.checkOut(repositoryId, objectId, extension, contentCopied);
+
+            if (stopAfterService(service)) {
+                return;
+            }
         } finally {
             service.close();
         }
@@ -83,8 +108,18 @@ public class VersioningServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getAllVersions(repositoryId, objectId, versionSeriesId, filter, includeAllowableActions,
-                    extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            List<ObjectData> serviceResult = service.getAllVersions(repositoryId, objectId, versionSeriesId, filter,
+                    includeAllowableActions, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -96,9 +131,19 @@ public class VersioningServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
-                    includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
-                    extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            ObjectData serviceResult = service.getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major,
+                    filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds,
+                    includeAcl, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }
@@ -109,8 +154,18 @@ public class VersioningServiceImpl exten
         CmisService service = getService(repositoryId);
 
         try {
-            return service.getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
-                    extension);
+            if (stopBeforeService(service)) {
+                return null;
+            }
+
+            Properties serviceResult = service.getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId,
+                    major, filter, extension);
+
+            if (stopAfterService(service)) {
+                return null;
+            }
+
+            return serviceResult;
         } finally {
             service.close();
         }

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ProgressControlCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ProgressControlCmisService.java?rev=1609721&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ProgressControlCmisService.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ProgressControlCmisService.java Fri Jul 11 15:01:05 2014
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.commons.server;
+
+/**
+ * CmisService classes that implement this interface can control whether the
+ * server framework continues or stops processing of the request.
+ * 
+ * The server framework calls {@link #beforeServiceCall()} before the requested
+ * service method is called and calls {@link #afterServiceCall()} after the
+ * requested service method is called. Both methods return a {@link Progress}
+ * enum value. If the return value is {@link Progress#CONTINUE} , the server
+ * framework continues processing. If the return value is {@link Progress#STOP},
+ * the server framework stops processing.
+ * 
+ * If the service method throws an exception, {@link #afterServiceCall()} is not
+ * called and the server framework or a service wrapper handles the exception.
+ * 
+ * The effect of stopping the processing is binding specific. <b>Dealing with
+ * that requires good knowledge of CMIS, HTTP, and SOAP.</b>
+ * 
+ * If an AtomPub or Browser Binding request is stopped, the framework doesn't
+ * send any HTTP response. It's the responsibility of the {@link CmisService}
+ * class or a service wrapper to generate a CMIS compliant HTTP response. If a
+ * Web Service Binding request is stopped, an additional MessageHandler must be
+ * installed that handles the situation. Otherwise the service sends an invalid
+ * response. If a Local Binding request is stopped, the behavior is undefined.
+ * Custom binding implementations might not support this interface at all.
+ * 
+ * Depending on the binding and the service method, the {@link CmisService}
+ * object is called multiple times. Only the method requested by the client is
+ * accompanied by {@link #beforeServiceCall()} and {@link #afterServiceCall()}
+ * calls. The framework might call other service methods before, after, and in
+ * between these two methods.
+ */
+public interface ProgressControlCmisService extends CmisService {
+
+    public enum Progress {
+        CONTINUE, STOP
+    };
+
+    /**
+     * Called by the server framework before the requested service method is
+     * called.
+     * 
+     * @return {@link Progress#CONTINUE} if the server framework should continue
+     *         processing the request, {@link Progress#STOP} id the server
+     *         framework should stop
+     */
+    Progress beforeServiceCall();
+
+    /**
+     * Called by the server framework after the requested service method has
+     * been called.
+     * 
+     * @return {@link Progress#CONTINUE} if the server framework should continue
+     *         processing the request, {@link Progress#STOP} id the server
+     *         framework should stop
+     */
+    Progress afterServiceCall();
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ProgressControlCmisService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java Fri Jul 11 15:01:05 2014
@@ -68,8 +68,16 @@ public class AclService {
             Boolean onlyBasicPermissions = getBooleanParameter(request, Constants.PARAM_ONLY_BASIC_PERMISSIONS);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             Acl acl = service.getAcl(repositoryId, objectId, onlyBasicPermissions, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (acl == null) {
                 throw new CmisRuntimeException("ACL is null!");
             }
@@ -89,7 +97,7 @@ public class AclService {
     public static class ApplyAcl extends AclServiceCall {
         public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
                 HttpServletResponse response) throws Exception {
-           
+
             // get parameters
             String objectId = getStringParameter(request, Constants.PARAM_ID);
             AclPropagation aclPropagation = getEnumParameter(request, Constants.PARAM_ACL_PROPAGATION,
@@ -114,8 +122,20 @@ public class AclService {
             }
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             Acl acl = service.applyAcl(repositoryId, objectId, aces, aclPropagation);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
+            if (acl == null) {
+                throw new CmisRuntimeException("ACL is null!");
+            }
+
             // set headers
             response.setStatus(HttpServletResponse.SC_CREATED);
             response.setContentType(Constants.MEDIATYPE_ACL);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java Fri Jul 11 15:01:05 2014
@@ -120,9 +120,17 @@ public class DiscoveryService {
             }
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             ObjectList results = service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
                     includeRelationships, renditionFilter, maxItems, skipCount, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (results == null) {
                 throw new CmisRuntimeException("Results are null!");
             }
@@ -234,10 +242,18 @@ public class DiscoveryService {
             BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             Holder<String> changeLogTokenHolder = new Holder<String>(changeLogToken);
             ObjectList changes = service.getContentChanges(repositoryId, changeLogTokenHolder, includeProperties,
                     filter, includePolicyIds, includeAcl, maxItems, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (changes == null) {
                 throw new CmisRuntimeException("Changes are null!");
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java Fri Jul 11 15:01:05 2014
@@ -60,6 +60,10 @@ public class MultiFilingService {
 
             String objectId = parser.getId();
 
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             if (objectId == null && removeFrom == null) {
                 // create unfiled object
                 createUnfiledObject(context, service, repositoryId, request, response, parser);
@@ -69,6 +73,10 @@ public class MultiFilingService {
             // execute
             service.removeObjectFromFolder(repositoryId, objectId, removeFrom, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectId);
             if (objectInfo == null) {
                 throw new CmisRuntimeException("Object Info is missing!");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java Fri Jul 11 15:01:05 2014
@@ -71,10 +71,18 @@ public class NavigationService {
             BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             ObjectInFolderList children = service.getChildren(repositoryId, folderId, filter, orderBy,
                     includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems,
                     skipCount, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (children == null) {
                 throw new CmisRuntimeException("Children are null!");
             }
@@ -209,9 +217,17 @@ public class NavigationService {
             Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             List<ObjectInFolderContainer> descendants = service.getDescendants(repositoryId, folderId, depth, filter,
                     includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (descendants == null) {
                 throw new CmisRuntimeException("Descendants are null!");
             }
@@ -301,9 +317,17 @@ public class NavigationService {
             Boolean includePathSegment = getBooleanParameter(request, Constants.PARAM_PATH_SEGMENT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             List<ObjectInFolderContainer> folderTree = service.getFolderTree(repositoryId, folderId, depth, filter,
                     includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (folderTree == null) {
                 throw new CmisRuntimeException("Folder tree is null!");
             }
@@ -393,9 +417,17 @@ public class NavigationService {
             Boolean includeRelativePathSegment = getBooleanParameter(request, Constants.PARAM_RELATIVE_PATH_SEGMENT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             List<ObjectParentData> parents = service.getObjectParents(repositoryId, objectId, filter,
                     includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (parents == null) {
                 throw new CmisRuntimeException("Parents are null!");
             }
@@ -471,9 +503,17 @@ public class NavigationService {
             BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             ObjectList checkedOut = service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy,
                     includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (checkedOut == null) {
                 throw new CmisRuntimeException("Checked Out list is null!");
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java Fri Jul 11 15:01:05 2014
@@ -103,6 +103,10 @@ public class ObjectService {
             String newObjectId = null;
 
             if (objectId == null) {
+                if (stopBeforeService(service)) {
+                    return;
+                }
+
                 // create
                 ContentStream contentStream = parser.getContentStream();
                 try {
@@ -111,8 +115,16 @@ public class ObjectService {
                 } finally {
                     closeContentStream(contentStream);
                 }
+
+                if (stopAfterService(service)) {
+                    return;
+                }
             } else {
-                if ((sourceFolderId == null) || (sourceFolderId.trim().length() == 0)) {
+                if (stopBeforeService(service)) {
+                    return;
+                }
+
+                if (sourceFolderId == null || sourceFolderId.trim().length() == 0) {
                     // addObjectToFolder
                     service.addObjectToFolder(repositoryId, objectId, folderId, null, null);
                     newObjectId = objectId;
@@ -122,6 +134,10 @@ public class ObjectService {
                     service.moveObject(repositoryId, objectIdHolder, folderId, sourceFolderId, null);
                     newObjectId = objectIdHolder.getValue();
                 }
+
+                if (stopAfterService(service)) {
+                    return;
+                }
             }
 
             ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
@@ -168,9 +184,17 @@ public class ObjectService {
             AtomEntryParser parser = new AtomEntryParser(request.getInputStream(), streamFactory);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             String newObjectId = service.createRelationship(repositoryId, parser.getProperties(),
                     parser.getPolicyIds(), null, null, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             ObjectInfo objectInfo = service.getObjectInfo(repositoryId, newObjectId);
             if (objectInfo == null) {
                 throw new CmisRuntimeException("Object Info is missing!");
@@ -214,8 +238,16 @@ public class ObjectService {
             Boolean allVersions = getBooleanParameter(request, Constants.PARAM_ALL_VERSIONS);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.deleteObjectOrCancelCheckOut(repositoryId, objectId, allVersions, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             response.setStatus(HttpServletResponse.SC_NO_CONTENT);
         }
@@ -238,9 +270,17 @@ public class ObjectService {
             String changeToken = getStringParameter(request, Constants.PARAM_CHANGE_TOKEN);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.deleteContentStream(repositoryId, new Holder<String>(objectId), changeToken == null ? null
                     : new Holder<String>(changeToken), null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             response.setStatus(HttpServletResponse.SC_NO_CONTENT);
         }
@@ -282,6 +322,10 @@ public class ObjectService {
             }
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             Holder<String> objectIdHolder = new Holder<String>(objectId);
             if (Boolean.TRUE.equals(appendFlag)) {
                 service.appendContentStream(repositoryId, objectIdHolder, changeToken == null ? null
@@ -292,6 +336,10 @@ public class ObjectService {
                         : new Holder<String>(changeToken), contentStream, null);
             }
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             String newObjectId = (objectIdHolder.getValue() == null ? objectId : objectIdHolder.getValue());
             String contentLocation = compileUrl(compileBaseUrl(request, repositoryId), RESOURCE_CONTENT, newObjectId);
@@ -345,9 +393,17 @@ public class ObjectService {
             Boolean continueOnFailure = getBooleanParameter(request, Constants.PARAM_CONTINUE_ON_FAILURE);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             FailedToDeleteData ftd = service.deleteTree(repositoryId, folderId, allVersions, unfileObjects,
                     continueOnFailure, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (ftd != null && isNotEmpty(ftd.getIds())) {
                 // print ids that could not be deleted
                 response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
@@ -394,9 +450,12 @@ public class ObjectService {
             Boolean includeAcl = getBooleanParameter(request, Constants.PARAM_ACL);
 
             // execute
-            ObjectData object = null;
+            if (stopBeforeService(service)) {
+                return;
+            }
 
-            if ((returnVersion == ReturnVersion.LATEST) || (returnVersion == ReturnVersion.LASTESTMAJOR)) {
+            ObjectData object = null;
+            if (returnVersion == ReturnVersion.LATEST || returnVersion == ReturnVersion.LASTESTMAJOR) {
                 object = service.getObjectOfLatestVersion(repositoryId, objectId, null,
                         returnVersion == ReturnVersion.LASTESTMAJOR, filter, includeAllowableActions,
                         includeRelationships, renditionFilter, includePolicyIds, includeAcl, null);
@@ -405,6 +464,10 @@ public class ObjectService {
                         includeRelationships, renditionFilter, includePolicyIds, includeAcl, null);
             }
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (object == null) {
                 throw new CmisRuntimeException("Object is null!");
             }
@@ -452,9 +515,17 @@ public class ObjectService {
             Boolean includeAcl = getBooleanParameter(request, Constants.PARAM_ACL);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             ObjectData object = service.getObjectByPath(repositoryId, path, filter, includeAllowableActions,
                     includeRelationships, renditionFilter, includePolicyIds, includeAcl, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (object == null) {
                 throw new CmisRuntimeException("Object is null!");
             }
@@ -495,8 +566,16 @@ public class ObjectService {
             String objectId = getStringParameter(request, Constants.PARAM_ID);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             AllowableActions allowableActions = service.getAllowableActions(repositoryId, objectId, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (allowableActions == null) {
                 throw new CmisRuntimeException("Allowable Actions is null!");
             }
@@ -533,9 +612,17 @@ public class ObjectService {
             BigInteger length = context.getLength();
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             ContentStream content = service.getContentStream(repositoryId, objectId, streamId, offset, length, null);
 
-            if ((content == null) || (content.getStream() == null)) {
+            if (stopAfterService(service)) {
+                return;
+            }
+
+            if (content == null || content.getStream() == null) {
                 throw new CmisRuntimeException("Content stream is null!");
             }
 
@@ -608,6 +695,10 @@ public class ObjectService {
             Holder<String> objectIdHolder = new Holder<String>(objectId);
 
             if ((checkin != null) && (checkin.booleanValue())) {
+                if (stopBeforeService(service)) {
+                    return;
+                }
+
                 ContentStream contentStream = parser.getContentStream();
                 try {
                     service.checkIn(repositoryId, objectIdHolder, major, parser.getProperties(), contentStream,
@@ -615,6 +706,10 @@ public class ObjectService {
                 } finally {
                     closeContentStream(contentStream);
                 }
+
+                if (stopAfterService(service)) {
+                    return;
+                }
             } else {
                 Properties properties = parser.getProperties();
                 String changeToken = null;
@@ -633,8 +728,16 @@ public class ObjectService {
                     changeToken = getStringParameter(request, Constants.PARAM_CHANGE_TOKEN);
                 }
 
+                if (stopBeforeService(service)) {
+                    return;
+                }
+
                 service.updateProperties(repositoryId, objectIdHolder, changeToken == null ? null : new Holder<String>(
                         changeToken), properties, null);
+
+                if (stopAfterService(service)) {
+                    return;
+                }
             }
 
             ObjectInfo objectInfo = service.getObjectInfo(repositoryId, objectIdHolder.getValue());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java Fri Jul 11 15:01:05 2014
@@ -82,8 +82,16 @@ public class PolicyService {
             String filter = getStringParameter(request, Constants.PARAM_FILTER);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             List<ObjectData> policies = service.getAppliedPolicies(repositoryId, objectId, filter, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (policies == null) {
                 throw new CmisRuntimeException("Policies are null!");
             }
@@ -151,8 +159,16 @@ public class PolicyService {
             AtomEntryParser parser = new AtomEntryParser(request.getInputStream(), streamFactory);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.applyPolicy(repositoryId, parser.getId(), objectId, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             ObjectInfo objectInfo = service.getObjectInfo(repositoryId, parser.getId());
             if (objectInfo == null) {
                 throw new CmisRuntimeException("Object Info is missing!");
@@ -198,8 +214,16 @@ public class PolicyService {
             String policyId = getStringParameter(request, Constants.PARAM_POLICY_ID);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.removePolicy(repositoryId, policyId, objectId, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             response.setStatus(HttpServletResponse.SC_NO_CONTENT);
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java Fri Jul 11 15:01:05 2014
@@ -62,10 +62,18 @@ public class RelationshipService {
             BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             ObjectList relationships = service.getObjectRelationships(repositoryId, objectId,
                     includeSubRelationshipTypes, relationshipDirection, typeId, filter, includeAllowableActions,
                     maxItems, skipCount, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             if (relationships == null) {
                 throw new CmisRuntimeException("Relationships are null!");
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java?rev=1609721&r1=1609720&r2=1609721&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java Fri Jul 11 15:01:05 2014
@@ -63,6 +63,10 @@ public class RepositoryService {
             // execute
             List<RepositoryInfo> infoDataList = null;
 
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             if (repositoryId == null) {
                 infoDataList = service.getRepositoryInfos(null);
             } else {
@@ -72,6 +76,10 @@ public class RepositoryService {
                 }
             }
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             response.setStatus(HttpServletResponse.SC_OK);
             response.setContentType(Constants.MEDIATYPE_SERVICE);
@@ -246,9 +254,17 @@ public class RepositoryService {
             BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             TypeDefinitionList typeList = service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
                     maxItems, skipCount, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             BigInteger numItems = (typeList == null ? null : typeList.getNumItems());
             Boolean hasMoreItems = (typeList == null ? null : typeList.hasMoreItems());
 
@@ -344,9 +360,17 @@ public class RepositoryService {
                     false);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             List<TypeDefinitionContainer> typeTree = service.getTypeDescendants(repositoryId, typeId, depth,
                     includePropertyDefinitions, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             String parentTypeId = null;
             String typeName = "Type Children";
 
@@ -425,8 +449,16 @@ public class RepositoryService {
             String typeId = getStringParameter(request, Constants.PARAM_ID);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             TypeDefinition type = service.getTypeDefinition(repositoryId, typeId, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // write XML
             response.setStatus(HttpServletResponse.SC_OK);
             response.setContentType(Constants.MEDIATYPE_ENTRY);
@@ -458,8 +490,16 @@ public class RepositoryService {
             parser.parse(request.getInputStream());
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             TypeDefinition newType = service.createType(repositoryId, parser.getTypeDefinition(), null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
 
@@ -495,8 +535,16 @@ public class RepositoryService {
             parser.parse(request.getInputStream());
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             TypeDefinition newType = service.updateType(repositoryId, parser.getTypeDefinition(), null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
 
@@ -529,8 +577,16 @@ public class RepositoryService {
             String typeId = getStringParameter(request, Constants.PARAM_ID);
 
             // execute
+            if (stopBeforeService(service)) {
+                return;
+            }
+
             service.deleteType(repositoryId, typeId, null);
 
+            if (stopAfterService(service)) {
+                return;
+            }
+
             // set headers
             response.setStatus(HttpServletResponse.SC_NO_CONTENT);
         }