chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1574843 - in /chemistry/opencmis/trunk: chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/ chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/open...
Date Thu, 06 Mar 2014 11:33:53 GMT
Author: fmui
Date: Thu Mar  6 11:33:53 2014
New Revision: 1574843

URL: http://svn.apache.org/r1574843
Log:
CMIS-764: pluggable CMIS service wrappers (clean up) 

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManagerTest.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManager.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java?rev=1574843&r1=1574842&r2=1574843&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/AbstractBridgeServiceFactory.java Thu Mar  6 11:33:53 2014
@@ -27,6 +27,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.server.support.CmisServiceWrapper;
+import org.apache.chemistry.opencmis.server.support.wrapper.CallContextAwareCmisService;
+import org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper;
 
 public abstract class AbstractBridgeServiceFactory extends AbstractServiceFactory {
 
@@ -45,7 +47,7 @@ public abstract class AbstractBridgeServ
     private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(1000);
     private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(10);
 
-    private ThreadLocal<CmisServiceWrapper<FilterCmisService>> threadLocalService = new ThreadLocal<CmisServiceWrapper<FilterCmisService>>();
+    private ThreadLocal<CallContextAwareCmisService> threadLocalService = new ThreadLocal<CallContextAwareCmisService>();
 
     private Map<String, String> parameters;
 
@@ -110,16 +112,16 @@ public abstract class AbstractBridgeServ
 
     @Override
     public CmisService getService(CallContext context) {
-        CmisServiceWrapper<FilterCmisService> wrapperService = threadLocalService.get();
-        if (wrapperService == null) {
-            wrapperService = new CmisServiceWrapper<FilterCmisService>(createService(context), defaultTypesMaxItems,
+        CallContextAwareCmisService service = threadLocalService.get();
+        if (service == null) {
+            service = new ConformanceCmisServiceWrapper(createService(context), defaultTypesMaxItems,
                     defaultTypesDepth, defaultMaxItems, defaultDepth);
-            threadLocalService.set(wrapperService);
+            threadLocalService.set(service);
         }
 
-        wrapperService.getWrappedService().setCallContext(context);
+        service.setCallContext(context);
 
-        return wrapperService;
+        return service;
     }
 
     /**

Modified: chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java?rev=1574843&r1=1574842&r2=1574843&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-bridge/chemistry-opencmis-bridge/src/main/java/org/apache/chemistry/opencmis/bridge/FilterCmisService.java Thu Mar  6 11:33:53 2014
@@ -60,11 +60,13 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
 import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
 import org.apache.chemistry.opencmis.commons.spi.VersioningService;
+import org.apache.chemistry.opencmis.server.support.wrapper.CallContextAwareCmisService;
 
 /**
  * Forwards incoming calls to a CMIS repository.
  */
-public abstract class FilterCmisService extends AbstractCmisService implements Serializable {
+public abstract class FilterCmisService extends AbstractCmisService implements CallContextAwareCmisService,
+        Serializable {
 
     private static final long serialVersionUID = 1L;
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java?rev=1574843&r1=1574842&r2=1574843&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrServiceFactory.java Thu Mar  6 11:33:53 2014
@@ -41,7 +41,7 @@ import org.apache.chemistry.opencmis.jcr
 import org.apache.chemistry.opencmis.jcr.impl.DefaultFolderTypeHandler;
 import org.apache.chemistry.opencmis.jcr.impl.DefaultUnversionedDocumentTypeHandler;
 import org.apache.chemistry.opencmis.jcr.type.JcrTypeHandlerManager;
-import org.apache.chemistry.opencmis.server.support.CmisServiceWrapper;
+import org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -82,11 +82,12 @@ public class JcrServiceFactory extends A
 
     @Override
     public CmisService getService(CallContext context) {
-        CmisServiceWrapper<JcrService> serviceWrapper = new CmisServiceWrapper<JcrService>(createJcrService(
-                jcrRepository, context), DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS,
-                DEFAULT_DEPTH_OBJECTS);
+        JcrService service = createJcrService(jcrRepository, context);
+        service.setCallContext(context);
+        
+        ConformanceCmisServiceWrapper serviceWrapper = new ConformanceCmisServiceWrapper(service, 
+                DEFAULT_MAX_ITEMS_TYPES, DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
 
-        serviceWrapper.getWrappedService().setCallContext(context);
         return serviceWrapper;
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java?rev=1574843&r1=1574842&r2=1574843&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java Thu Mar  6 11:33:53 2014
@@ -21,1236 +21,28 @@
 package org.apache.chemistry.opencmis.server.support;
 
 import java.math.BigInteger;
-import java.util.List;
 
-import org.apache.chemistry.opencmis.commons.PropertyIds;
-import org.apache.chemistry.opencmis.commons.data.Acl;
-import org.apache.chemistry.opencmis.commons.data.AllowableActions;
-import org.apache.chemistry.opencmis.commons.data.BulkUpdateObjectIdAndChangeToken;
-import org.apache.chemistry.opencmis.commons.data.ContentStream;
-import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
-import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData;
-import org.apache.chemistry.opencmis.commons.data.ObjectData;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
-import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
-import org.apache.chemistry.opencmis.commons.data.ObjectList;
-import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
-import org.apache.chemistry.opencmis.commons.data.Properties;
-import org.apache.chemistry.opencmis.commons.data.PropertyData;
-import org.apache.chemistry.opencmis.commons.data.RenditionData;
-import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
-import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
-import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
-import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
-import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
-import org.apache.chemistry.opencmis.commons.enums.VersioningState;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
-import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
-import org.apache.chemistry.opencmis.commons.spi.Holder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.apache.chemistry.opencmis.server.support.wrapper.ConformanceCmisServiceWrapper;
 
 /**
  * Service wrapper.
+ * 
+ * @deprecated use {@link ConformanceCmisServiceWrapper} instead
  */
-public class CmisServiceWrapper<T extends CmisService> implements CmisService {
-
-    public static final BigInteger MINUS_ONE = BigInteger.valueOf(-1);
-
-    private static final Logger LOG = LoggerFactory.getLogger(CmisServiceWrapper.class);
-
-    private BigInteger defaultTypesMaxItems = null;
-    private BigInteger defaultTypesDepth = MINUS_ONE;
-
-    private BigInteger defaultMaxItems = null;
-    private BigInteger defaultDepth = MINUS_ONE;
-
-    private final T service;
+public class CmisServiceWrapper<T extends CmisService> extends ConformanceCmisServiceWrapper {
 
     /**
      * Constructor.
      */
     public CmisServiceWrapper(T service, BigInteger defaultTypesMaxItems, BigInteger defaultTypesDepth,
             BigInteger defaultMaxItems, BigInteger defaultDepth) {
-        if (service == null) {
-            throw new IllegalArgumentException("Service must be set!");
-        }
-
-        this.service = service;
-
-        this.defaultTypesMaxItems = defaultTypesMaxItems;
-        this.defaultTypesDepth = defaultTypesDepth;
-        this.defaultMaxItems = defaultMaxItems;
-        this.defaultDepth = defaultDepth;
-    }
-
-    // --- wrapper operations ---
-
-    /**
-     * Set the default maxItems.
-     */
-    protected void setDefaultTypesMaxItems(BigInteger defaultTypesMaxItems) {
-        this.defaultTypesMaxItems = defaultTypesMaxItems;
-    }
-
-    /**
-     * Set the default depth.
-     */
-    protected void setDefaultTypesDepth(BigInteger defaultTypesDepth) {
-        this.defaultTypesDepth = defaultTypesDepth;
-    }
-
-    /**
-     * Set the default maxItems.
-     */
-    protected void setDefaultMaxItems(BigInteger defaultMaxItems) {
-        this.defaultMaxItems = defaultMaxItems;
-    }
-
-    /**
-     * Set the default depth.
-     */
-    protected void setDefaultDepth(BigInteger defaultDepth) {
-        this.defaultDepth = defaultDepth;
-    }
-
-    /**
-     * Converts the given exception into a CMIS exception.
-     */
-    protected CmisBaseException createCmisException(Exception e) {
-        if (e == null) {
-            // should never happen
-            // if it happens its the fault of the framework...
-
-            return new CmisRuntimeException("Unknown exception!");
-        } else if (e instanceof CmisBaseException) {
-            return (CmisBaseException) e;
-        } else {
-            // should not happen if the connector works correctly
-            // it's alarming enough to log the exception
-            LOG.warn(e.toString(), e);
-
-            return new CmisRuntimeException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * Throws an exception if the given id is <code>null</code> or empty.
-     */
-    protected void checkId(String name, String id) {
-        if (id == null) {
-            throw new CmisInvalidArgumentException(name + " must be set!");
-        }
-
-        if (id.length() == 0) {
-            throw new CmisInvalidArgumentException(name + " must not be empty!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given ids are all <code>null</code> or empty.
-     */
-    protected void checkIds(String name, String... ids) {
-        for (String id : ids) {
-            if (id != null && id.length() > 0) {
-                return;
-            }
-        }
-
-        throw new CmisInvalidArgumentException(name + " must be set!");
-    }
-
-    /**
-     * Throws an exception if the given holder or id is <code>null</code> or
-     * empty.
-     */
-    protected void checkHolderId(String name, Holder<String> holder) {
-        if (holder == null) {
-            throw new CmisInvalidArgumentException(name + " must be set!");
-        }
-
-        checkId(name, holder.getValue());
-    }
-
-    /**
-     * Throws an exception if the repository id is <code>null</code> or empty.
-     */
-    protected void checkRepositoryId(String repositoryId) {
-        checkId("Repository Id", repositoryId);
-    }
-
-    /**
-     * Throws an exception if the given path is <code>null</code> or invalid.
-     */
-    protected void checkPath(String name, String path) {
-        if (path == null) {
-            throw new CmisInvalidArgumentException(name + " must be set!");
-        }
-
-        if (path.length() == 0) {
-            throw new CmisInvalidArgumentException(name + " must not be empty!");
-        }
-
-        if (path.charAt(0) != '/') {
-            throw new CmisInvalidArgumentException(name + " must start with '/'!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given properties set is <code>null</code>.
-     */
-    protected void checkProperties(Properties properties) {
-        if (properties == null) {
-            throw new CmisInvalidArgumentException("Properties must be set!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given property isn't set or of the wrong type.
-     */
-    protected void checkProperty(Properties properties, String propertyId, Class<?> clazz) {
-        if (properties.getProperties() == null) {
-            throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!");
-        }
-
-        PropertyData<?> property = properties.getProperties().get(propertyId);
-        if (property == null) {
-            throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!");
-        }
-
-        Object value = property.getFirstValue();
-        if (value == null) {
-            throw new CmisInvalidArgumentException("Property " + propertyId + " must have a value!");
-        }
-
-        if (!clazz.isAssignableFrom(value.getClass())) {
-            throw new CmisInvalidArgumentException("Property " + propertyId + " has the wrong type!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given content object is <code>null</code>.
-     */
-    protected void checkContentStream(ContentStream content) {
-        if (content == null) {
-            throw new CmisInvalidArgumentException("Content must be set!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given query statement is <code>null</code> or
-     * empty.
-     */
-    protected void checkQueryStatement(String statement) {
-        if (statement == null) {
-            throw new CmisInvalidArgumentException("Statement must be set!");
-        }
-
-        if (statement.length() == 0) {
-            throw new CmisInvalidArgumentException("Statement must not be empty!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given type definition is <code>null</code>.
-     */
-    protected void checkTypeDefinition(TypeDefinition typeDef) {
-        if (typeDef == null) {
-            throw new CmisInvalidArgumentException("Type definition must be set!");
-        }
-    }
-
-    /**
-     * Throws an exception if the given list is <code>null</code> or empty.
-     */
-    protected void checkList(String name, List<?> list) {
-        if (list == null) {
-            throw new CmisInvalidArgumentException(name + " must be set!");
-        }
-
-        if (list.isEmpty()) {
-            throw new CmisInvalidArgumentException(name + " must not be empty!");
-        }
+        super(service, defaultTypesMaxItems, defaultTypesDepth, defaultMaxItems, defaultDepth);
     }
 
-    /**
-     * Returns <code>true</code> if <code>value</code> is <code>null</code>.
-     */
-    protected Boolean getDefaultTrue(Boolean value) {
-        if (value == null) {
-            return Boolean.TRUE;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns <code>false</code> if <code>value</code> is <code>null</code>.
-     */
-    protected Boolean getDefaultFalse(Boolean value) {
-        if (value == null) {
-            return Boolean.FALSE;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the <code>IncludeRelationships.NONE</code> if <code>value</code>
-     * is <code>null</code>.
-     */
-    protected IncludeRelationships getDefault(IncludeRelationships value) {
-        if (value == null) {
-            return IncludeRelationships.NONE;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the <code>VersioningState.MAJOR</code> if <code>value</code> is
-     * <code>null</code>.
-     */
-    protected VersioningState getDefault(VersioningState value) {
-        if (value == null) {
-            return VersioningState.MAJOR;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the <code>UnfileObjects.DELETE</code> if <code>value</code> is
-     * <code>null</code>.
-     */
-    protected UnfileObject getDefault(UnfileObject value) {
-        if (value == null) {
-            return UnfileObject.DELETE;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the <code>AclPropagation.REPOSITORYDETERMINED</code> if
-     * <code>value</code> is <code>null</code>.
-     */
-    protected AclPropagation getDefault(AclPropagation value) {
-        if (value == null) {
-            return AclPropagation.REPOSITORYDETERMINED;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the <code>RelationshipDirection.SOURCE</code> if
-     * <code>value</code> is <code>null</code> .
-     */
-    protected RelationshipDirection getDefault(RelationshipDirection value) {
-        if (value == null) {
-            return RelationshipDirection.SOURCE;
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the <code>"cmis:none"</code> if <code>value</code> is
-     * <code>null</code>.
-     */
-    protected String getDefaultRenditionFilter(String value) {
-        if ((value == null) || (value.length() == 0)) {
-            return "cmis:none";
-        }
-
-        return value;
-    }
-
-    /**
-     * Returns the default maxItems if <code>maxItems</code> ==
-     * <code>null</code>, throws an exception if <code>maxItems</code> &lt; 0,
-     * returns <code>maxItems</code> otherwise.
-     */
-    protected BigInteger getTypesMaxItems(BigInteger maxItems) {
-        if (maxItems == null) {
-            return defaultTypesMaxItems;
-        }
-
-        if (maxItems.compareTo(BigInteger.ZERO) == -1) {
-            throw new CmisInvalidArgumentException("maxItems must not be negative!");
-        }
-
-        return maxItems;
-    }
-
-    /**
-     * Checks the depth parameter if it complies with CMIS specification and
-     * returns the default value if <code>depth</code> is <code>null</code>.
-     */
-    protected BigInteger getTypesDepth(BigInteger depth) {
-        if (depth == null) {
-            return defaultTypesDepth;
-        }
-
-        if (depth.compareTo(BigInteger.ZERO) == 0) {
-            throw new CmisInvalidArgumentException("depth must not be 0!");
-        }
-
-        if (depth.compareTo(MINUS_ONE) == -1) {
-            throw new CmisInvalidArgumentException("depth must not be <-1!");
-        }
-
-        return depth;
-    }
-
-    /**
-     * Returns the default maxItems if <code>maxItems</code> ==
-     * <code>null</code>, throws an exception if <code>maxItems</code> &lt; 0,
-     * returns <code>maxItems</code> otherwise.
-     */
-    protected BigInteger getMaxItems(BigInteger maxItems) {
-        if (maxItems == null) {
-            return defaultMaxItems;
-        }
-
-        if (maxItems.compareTo(BigInteger.ZERO) == -1) {
-            throw new CmisInvalidArgumentException("maxItems must not be negative!");
-        }
-
-        return maxItems;
-    }
-
-    /**
-     * Returns 0 if <code>skipCount</code> == <code>null</code>, throws an
-     * exception if <code>skipCount</code> &lt; 0, returns
-     * <code>skipCount</code> otherwise.
-     */
-    protected BigInteger getSkipCount(BigInteger skipCount) {
-        if (skipCount == null) {
-            return BigInteger.ZERO;
-        }
-
-        if (skipCount.compareTo(BigInteger.ZERO) == -1) {
-            throw new CmisInvalidArgumentException("skipCount must not be negative!");
-        }
-
-        return skipCount;
-    }
-
-    /**
-     * Checks the depth parameter if it complies with CMIS specification and
-     * returns the default value if <code>depth</code> is <code>null</code>.
-     */
-    protected BigInteger getDepth(BigInteger depth) {
-        if (depth == null) {
-            return defaultDepth;
-        }
-
-        if (depth.compareTo(BigInteger.ZERO) == 0) {
-            throw new CmisInvalidArgumentException("depth must not be 0!");
-        }
-
-        if (depth.compareTo(MINUS_ONE) == -1) {
-            throw new CmisInvalidArgumentException("depth must not be <-1!");
-        }
-
-        return depth;
-    }
-
-    /**
-     * Throws an exception if the given value is negative.
-     */
-    protected void checkNullOrPositive(String name, BigInteger value) {
-        if (value == null) {
-            return;
-        }
-
-        if (value.compareTo(BigInteger.ZERO) == -1) {
-            throw new CmisInvalidArgumentException(name + " must not be negative!");
-        }
-    }
-
-    // --- service operations ---
-
+    @Override
+    @SuppressWarnings("unchecked")
     public T getWrappedService() {
-        return service;
-    }
-
-    public ObjectInfo getObjectInfo(String repositoryId, String objectId) {
-        return service.getObjectInfo(repositoryId, objectId);
-    }
-
-    public void close() {
-        service.close();
-    }
-
-    // --- repository service ---
-
-    public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-
-        try {
-            return service.getRepositoryInfo(repositoryId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
-        try {
-            return service.getRepositoryInfos(extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
-            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        includePropertyDefinitions = getDefaultFalse(includePropertyDefinitions);
-        maxItems = getTypesMaxItems(maxItems);
-        skipCount = getSkipCount(skipCount);
-
-        try {
-            return service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount,
-                    extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Type Id", typeId);
-
-        try {
-            return service.getTypeDefinition(repositoryId, typeId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth,
-            Boolean includePropertyDefinitions, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        includePropertyDefinitions = getDefaultFalse(includePropertyDefinitions);
-        depth = getTypesDepth(depth);
-
-        try {
-            return service.getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public TypeDefinition createType(String repositoryId, TypeDefinition type, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkTypeDefinition(type);
-
-        try {
-            return service.createType(repositoryId, type, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public TypeDefinition updateType(String repositoryId, TypeDefinition type, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkTypeDefinition(type);
-
-        try {
-            return service.updateType(repositoryId, type, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void deleteType(String repositoryId, String typeId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Type Id", typeId);
-
-        try {
-            service.deleteType(repositoryId, typeId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- navigation service ---
-
-    public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter, String orderBy,
-            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        maxItems = getMaxItems(maxItems);
-        skipCount = getSkipCount(skipCount);
-
-        try {
-            return service.getCheckedOutDocs(repositoryId, folderId, filter, orderBy, includeAllowableActions,
-                    includeRelationships, renditionFilter, maxItems, skipCount, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
-            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-            Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Folder Id", folderId);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includePathSegment = getDefaultFalse(includePathSegment);
-        maxItems = getMaxItems(maxItems);
-        skipCount = getSkipCount(skipCount);
-
-        try {
-            return service.getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId, BigInteger depth,
-            String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-            String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Folder Id", folderId);
-        depth = getDepth(depth);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includePathSegment = getDefaultFalse(includePathSegment);
-
-        try {
-            return service.getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePathSegment, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Folder Id", folderId);
-
-        try {
-            return service.getFolderParent(repositoryId, folderId, filter, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId, BigInteger depth,
-            String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-            String renditionFilter, Boolean includePathSegment, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Folder Id", folderId);
-        depth = getDepth(depth);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includePathSegment = getDefaultFalse(includePathSegment);
-
-        try {
-            return service.getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includePathSegment, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
-            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-            Boolean includeRelativePathSegment, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includeRelativePathSegment = getDefaultFalse(includeRelativePathSegment);
-
-        try {
-            return service.getObjectParents(repositoryId, objectId, filter, includeAllowableActions,
-                    includeRelationships, renditionFilter, includeRelativePathSegment, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- object service ---
-
-    public String create(String repositoryId, Properties properties, String folderId, ContentStream contentStream,
-            VersioningState versioningState, List<String> policies, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkProperties(properties);
-        checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
-        versioningState = getDefault(versioningState);
-
-        try {
-            return service.create(repositoryId, properties, folderId, contentStream, versioningState, policies,
-                    extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public String createDocument(String repositoryId, Properties properties, String folderId,
-            ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
-            Acl removeAces, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkProperties(properties);
-        checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
-        versioningState = getDefault(versioningState);
-
-        try {
-            return service.createDocument(repositoryId, properties, folderId, contentStream, versioningState, policies,
-                    addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
-            String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Source Id", sourceId);
-        versioningState = getDefault(versioningState);
-
-        try {
-            return service.createDocumentFromSource(repositoryId, sourceId, properties, folderId, versioningState,
-                    policies, addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
-            Acl addAces, Acl removeAces, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkProperties(properties);
-        checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
-        checkId("Folder Id", folderId);
-
-        try {
-            return service.createFolder(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
-            Acl addAces, Acl removeAces, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkProperties(properties);
-        checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
-
-        try {
-            return service.createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public String createItem(String repositoryId, Properties properties, String folderId, List<String> policies,
-            Acl addAces, Acl removeAces, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkProperties(properties);
-        checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
-
-        try {
-            return service.createItem(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
-            Acl removeAces, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkProperties(properties);
-        checkProperty(properties, PropertyIds.OBJECT_TYPE_ID, String.class);
-        // checkProperty(properties, PropertyIds.SOURCE_ID, String.class);
-        // checkProperty(properties, PropertyIds.TARGET_ID, String.class);
-
-        try {
-            return service.createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-
-        try {
-            service.deleteContentStream(repositoryId, objectId, changeToken, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        allVersions = getDefaultTrue(allVersions);
-
-        try {
-            service.deleteObject(repositoryId, objectId, allVersions, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void deleteObjectOrCancelCheckOut(String repositoryId, String objectId, Boolean allVersions,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        allVersions = getDefaultTrue(allVersions);
-
-        try {
-            service.deleteObjectOrCancelCheckOut(repositoryId, objectId, allVersions, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
-            UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Folder Id", folderId);
-        allVersions = getDefaultTrue(allVersions);
-        unfileObjects = getDefault(unfileObjects);
-        continueOnFailure = getDefaultFalse(continueOnFailure);
-
-        try {
-            return service.deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-
-        try {
-            return service.getAllowableActions(repositoryId, objectId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
-            BigInteger length, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        checkNullOrPositive("Offset", offset);
-        checkNullOrPositive("Length", length);
-
-        try {
-            return service.getContentStream(repositoryId, objectId, streamId, offset, length, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
-            IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
-            Boolean includeAcl, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includePolicyIds = getDefaultFalse(includePolicyIds);
-        includeAcl = getDefaultFalse(includeAcl);
-
-        try {
-            return service.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships,
-                    renditionFilter, includePolicyIds, includeAcl, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
-            IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
-            Boolean includeAcl, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkPath("Path", path);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includePolicyIds = getDefaultFalse(includePolicyIds);
-        includeAcl = getDefaultFalse(includeAcl);
-
-        try {
-            return service.getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships,
-                    renditionFilter, includePolicyIds, includeAcl, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-
-        try {
-            return service.getProperties(repositoryId, objectId, filter, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
-            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        maxItems = getMaxItems(maxItems);
-        skipCount = getSkipCount(skipCount);
-
-        try {
-            return service.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-        checkId("Target Folder Id", targetFolderId);
-
-        try {
-            service.moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
-            Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-        overwriteFlag = getDefaultTrue(overwriteFlag);
-        checkContentStream(contentStream);
-
-        try {
-            service.setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void appendContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
-            ContentStream contentStream, boolean isLastChunk, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-        checkContentStream(contentStream);
-
-        try {
-            service.appendContentStream(repositoryId, objectId, changeToken, contentStream, isLastChunk, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
-            Properties properties, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-        checkProperties(properties);
-
-        try {
-            service.updateProperties(repositoryId, objectId, changeToken, properties, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(String repositoryId,
-            List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken, Properties properties,
-            List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkList("Object Id list", objectIdAndChangeToken);
-        checkProperties(properties);
-
-        try {
-            return service.bulkUpdateProperties(repositoryId, objectIdAndChangeToken, properties, addSecondaryTypeIds,
-                    removeSecondaryTypeIds, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- versioning service ---
-
-    public void cancelCheckOut(String repositoryId, String objectId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-
-        try {
-            service.cancelCheckOut(repositoryId, objectId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void checkIn(String repositoryId, Holder<String> objectId, Boolean major, Properties properties,
-            ContentStream contentStream, String checkinComment, List<String> policies, Acl addAces, Acl removeAces,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-        major = getDefaultTrue(major);
-
-        try {
-            service.checkIn(repositoryId, objectId, major, properties, contentStream, checkinComment, policies,
-                    addAces, removeAces, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void checkOut(String repositoryId, Holder<String> objectId, ExtensionsData extension,
-            Holder<Boolean> contentCopied) {
-        checkRepositoryId(repositoryId);
-        checkHolderId("Object Id", objectId);
-
-        try {
-            service.checkOut(repositoryId, objectId, extension, contentCopied);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ObjectData getObjectOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
-            Boolean major, String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
-            String renditionFilter, Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkIds("Version Series Id", objectId, versionSeriesId);
-        major = getDefaultFalse(major);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        includePolicyIds = getDefaultFalse(includePolicyIds);
-        includeAcl = getDefaultFalse(includeAcl);
-
-        try {
-            return service.getObjectOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
-                    includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl,
-                    extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public Properties getPropertiesOfLatestVersion(String repositoryId, String objectId, String versionSeriesId,
-            Boolean major, String filter, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkIds("Version Series Id", objectId, versionSeriesId);
-        major = getDefaultFalse(major);
-
-        try {
-            return service.getPropertiesOfLatestVersion(repositoryId, objectId, versionSeriesId, major, filter,
-                    extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<ObjectData> getAllVersions(String repositoryId, String objectId, String versionSeriesId, String filter,
-            Boolean includeAllowableActions, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkIds("Version Series Id", objectId, versionSeriesId);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-
-        try {
-            return service.getAllVersions(repositoryId, objectId, versionSeriesId, filter, includeAllowableActions,
-                    extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- discovery service ---
-
-    public ObjectList getContentChanges(String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
-            String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        includeProperties = getDefaultFalse(includeProperties);
-        includePolicyIds = getDefaultFalse(includePolicyIds);
-        includeAcl = getDefaultFalse(includeAcl);
-        maxItems = getMaxItems(maxItems);
-
-        try {
-            return service.getContentChanges(repositoryId, changeLogToken, includeProperties, filter, includePolicyIds,
-                    includeAcl, maxItems, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public ObjectList query(String repositoryId, String statement, Boolean searchAllVersions,
-            Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
-            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkQueryStatement(statement);
-        searchAllVersions = getDefaultFalse(searchAllVersions);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        includeRelationships = getDefault(includeRelationships);
-        renditionFilter = getDefaultRenditionFilter(renditionFilter);
-        maxItems = getMaxItems(maxItems);
-        skipCount = getSkipCount(skipCount);
-
-        try {
-            return service.query(repositoryId, statement, searchAllVersions, includeAllowableActions,
-                    includeRelationships, renditionFilter, maxItems, skipCount, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- multi filing service ---
-
-    public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        checkId("Folder Id", folderId);
-        allVersions = getDefaultTrue(allVersions);
-
-        try {
-            service.addObjectToFolder(repositoryId, objectId, folderId, allVersions, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-
-        try {
-            service.removeObjectFromFolder(repositoryId, objectId, folderId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- relationship service ---
-
-    public ObjectList getObjectRelationships(String repositoryId, String objectId, Boolean includeSubRelationshipTypes,
-            RelationshipDirection relationshipDirection, String typeId, String filter, Boolean includeAllowableActions,
-            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        includeSubRelationshipTypes = getDefaultFalse(includeSubRelationshipTypes);
-        relationshipDirection = getDefault(relationshipDirection);
-        includeAllowableActions = getDefaultFalse(includeAllowableActions);
-        maxItems = getMaxItems(maxItems);
-        skipCount = getSkipCount(skipCount);
-
-        try {
-            return service.getObjectRelationships(repositoryId, objectId, includeSubRelationshipTypes,
-                    relationshipDirection, typeId, filter, includeAllowableActions, maxItems, skipCount, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- ACL service ---
-
-    public Acl applyAcl(String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        aclPropagation = getDefault(aclPropagation);
-
-        try {
-            return service.applyAcl(repositoryId, objectId, aces, aclPropagation);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl removeAces,
-            AclPropagation aclPropagation, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        aclPropagation = getDefault(aclPropagation);
-
-        try {
-            return service.applyAcl(repositoryId, objectId, addAces, removeAces, aclPropagation, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public Acl getAcl(String repositoryId, String objectId, Boolean onlyBasicPermissions, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-        onlyBasicPermissions = getDefaultTrue(onlyBasicPermissions);
-
-        try {
-            return service.getAcl(repositoryId, objectId, onlyBasicPermissions, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    // --- policy service ---
-
-    public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Policy Id", policyId);
-        checkId("Object Id", objectId);
-
-        try {
-            service.applyPolicy(repositoryId, policyId, objectId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
-            ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Object Id", objectId);
-
-        try {
-            return service.getAppliedPolicies(repositoryId, objectId, filter, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
-    }
-
-    public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
-        checkRepositoryId(repositoryId);
-        checkId("Policy Id", policyId);
-        checkId("Object Id", objectId);
-
-        try {
-            service.removePolicy(repositoryId, policyId, objectId, extension);
-        } catch (Exception e) {
-            throw createCmisException(e);
-        }
+        return (T) super.getWrappedService();
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManager.java?rev=1574843&r1=1574842&r2=1574843&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManager.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManager.java Thu Mar  6 11:33:53 2014
@@ -19,7 +19,6 @@
 package org.apache.chemistry.opencmis.server.support.wrapper;
 
 import java.lang.reflect.Constructor;
-import java.util.LinkedList;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TreeMap;
@@ -39,10 +38,15 @@ public class CmisServiceWrapperManager {
 
     private static final String PARAMS_SERVICE_WRAPPER_PREFIX = "servicewrapper.";
 
-    private final LinkedList<WrapperDefinition> wrapperDefinitions;
+    private WrapperDefinition outerMost;
+    private WrapperDefinition innerMost;
 
+    /**
+     * Constructor.
+     */
     public CmisServiceWrapperManager() {
-        wrapperDefinitions = new LinkedList<WrapperDefinition>();
+        outerMost = null;
+        innerMost = null;
     }
 
     /**
@@ -54,7 +58,14 @@ public class CmisServiceWrapperManager {
      *            wrapper parameters
      */
     public void addOuterWrapper(Class<? extends AbstractCmisServiceWrapper> wrapperClass, Object... params) {
-        wrapperDefinitions.addLast(new WrapperDefinition(wrapperClass, params));
+        WrapperDefinition wd = new WrapperDefinition(wrapperClass, params);
+        if (outerMost == null) {
+            outerMost = wd;
+            innerMost = wd;
+        } else {
+            outerMost.setOuterWrapper(wd);
+            outerMost = wd;
+        }
 
         LOG.debug("Added outer service wrapper: {}", wrapperClass.getName());
     }
@@ -68,7 +79,14 @@ public class CmisServiceWrapperManager {
      *            wrapper parameters
      */
     public void addInnerWrapper(Class<? extends AbstractCmisServiceWrapper> wrapperClass, Object... params) {
-        wrapperDefinitions.addFirst(new WrapperDefinition(wrapperClass, params));
+        WrapperDefinition wd = new WrapperDefinition(wrapperClass, params);
+        if (innerMost == null) {
+            outerMost = wd;
+            innerMost = wd;
+        } else {
+            innerMost.setInnerWrapper(wd);
+            innerMost = wd;
+        }
 
         LOG.debug("Added inner service wrapper: {}", wrapperClass.getName());
     }
@@ -76,10 +94,22 @@ public class CmisServiceWrapperManager {
     /**
      * Gets wrapper settings from the service factory parameters and adds them
      * to the wrappers.
+     * <p>
+     * The factory parameters properties file should look like this:
+     * 
+     * <pre>
+     * servicewrapper.1=com.example.my.SimpleWrapper
+     * servicewrapper.2=com.example.my.AdvancedWrapper,1,cmis:documents
+     * servicewrapper.2=com.example.my.DebuggingWrapper,testRepositoryId
+     * </pre>
+     * 
+     * Syntax:
+     * {@code servicewrapper.&lt;position>=&lt;classname>[,parameter1[,parameter2[...]]]}
      * 
      * @param parameters
      *            service factory parameters
      */
+    @SuppressWarnings("unchecked")
     public void addWrappersFromServiceFactoryParameters(Map<String, String> parameters) {
         if (parameters == null) {
             return;
@@ -92,7 +122,7 @@ public class CmisServiceWrapperManager {
             if (key.startsWith(PARAMS_SERVICE_WRAPPER_PREFIX) && entry.getKey() != null) {
                 int index = 0;
                 try {
-                    Integer.valueOf(key.substring(PARAMS_SERVICE_WRAPPER_PREFIX.length()));
+                    index = Integer.valueOf(key.substring(PARAMS_SERVICE_WRAPPER_PREFIX.length()));
                 } catch (NumberFormatException e) {
                     throw new CmisRuntimeException("Invalid service wrapper configuration: " + key, e);
                 }
@@ -120,8 +150,8 @@ public class CmisServiceWrapperManager {
                         throw new CmisRuntimeException("More than one service wrapper at the same position: " + index);
                     }
 
-                    LOG.debug("Found wrapper [{}] {} ({})", index, wrapperClass.getName(),
-                            params == null ? "" : params.toString());
+                    LOG.trace("Found wrapper at index {}: {}{}", index, wrapperClass.getName(), params == null ? ""
+                            : params.toString());
 
                     wrappers.put(index, new WrapperDefinition(
                             (Class<? extends AbstractCmisServiceWrapper>) wrapperClass, params));
@@ -129,9 +159,26 @@ public class CmisServiceWrapperManager {
             }
         }
 
-        for (WrapperDefinition def : wrappers.values()) {
-            wrapperDefinitions.add(def);
-            LOG.debug("Added outer service wrapper: {}", def.getWrapperClass().getName());
+        if (!wrappers.isEmpty()) {
+            WrapperDefinition first = null;
+            WrapperDefinition prev = null;
+            for (WrapperDefinition def : wrappers.values()) {
+                def.setOuterWrapper(prev);
+                prev = def;
+                if (first == null) {
+                    first = def;
+                }
+
+                LOG.debug("Added service wrapper: {}", def.getWrapperClass().getName());
+            }
+
+            if (outerMost == null) {
+                outerMost = first;
+                innerMost = prev;
+            } else {
+                outerMost.setOuterWrapper(prev);
+                outerMost = first;
+            }
         }
     }
 
@@ -139,8 +186,13 @@ public class CmisServiceWrapperManager {
      * Removes the outer-most wrapper.
      */
     public void removeOuterWrapper() {
-        if (!wrapperDefinitions.isEmpty()) {
-            wrapperDefinitions.removeLast();
+        if (outerMost != null) {
+            outerMost = outerMost.getInnerWrapper();
+            if (outerMost == null) {
+                innerMost = null;
+            } else {
+                outerMost.setOuterWrapper(null);
+            }
         }
     }
 
@@ -148,8 +200,13 @@ public class CmisServiceWrapperManager {
      * Removes the inner-most wrapper.
      */
     public void removeInnerWrapper() {
-        if (!wrapperDefinitions.isEmpty()) {
-            wrapperDefinitions.removeFirst();
+        if (innerMost != null) {
+            innerMost = innerMost.getOuterWrapper();
+            if (innerMost == null) {
+                outerMost = null;
+            } else {
+                innerMost.setInnerWrapper(null);
+            }
         }
     }
 
@@ -163,8 +220,10 @@ public class CmisServiceWrapperManager {
     public CmisService wrap(CmisService service) {
         CmisService result = service;
 
-        for (WrapperDefinition def : wrapperDefinitions) {
+        WrapperDefinition def = innerMost;
+        while (def != null) {
             result = def.createWrapperObject(result);
+            def = def.getOuterWrapper();
         }
 
         return result;
@@ -172,19 +231,17 @@ public class CmisServiceWrapperManager {
 
     @Override
     public String toString() {
-        StringBuilder sb = new StringBuilder("[ ");
+        StringBuilder sb = new StringBuilder();
 
-        int i = 0;
-        for (WrapperDefinition def : wrapperDefinitions) {
-            if (i > 0) {
-                sb.append(",");
-            }
+        WrapperDefinition def = outerMost;
+        while (def != null) {
 
-            sb.append(i);
-            sb.append(": ");
-            sb.append(def.getWrapperClass().getName());
+            sb.append('[');
+            sb.append(def.toString());
+            sb.append(']');
+
+            def = def.getInnerWrapper();
         }
-        sb.append("]");
 
         return sb.toString();
     }
@@ -200,6 +257,9 @@ public class CmisServiceWrapperManager {
         private final Constructor<? extends AbstractCmisServiceWrapper> wrapperConstructor;
         private final Object[] params;
 
+        private WrapperDefinition outer;
+        private WrapperDefinition inner;
+
         public WrapperDefinition(Class<? extends AbstractCmisServiceWrapper> wrapperClass, Object... params) {
             this.wrapperClass = wrapperClass;
             this.params = params;
@@ -231,5 +291,40 @@ public class CmisServiceWrapperManager {
                         + e.toString(), e);
             }
         }
+
+        public void setOuterWrapper(WrapperDefinition wrapper) {
+            outer = wrapper;
+            if (wrapper != null) {
+                wrapper.inner = this;
+            }
+        }
+
+        public WrapperDefinition getOuterWrapper() {
+            return outer;
+        }
+
+        public void setInnerWrapper(WrapperDefinition wrapper) {
+            inner = wrapper;
+            if (wrapper != null) {
+                wrapper.outer = this;
+            }
+        }
+
+        public WrapperDefinition getInnerWrapper() {
+            return inner;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder(wrapperClass.getName());
+            if (params != null) {
+                for (int i = 0; i < params.length; i++) {
+                    sb.append(',');
+                    sb.append(params[i]);
+                }
+            }
+
+            return sb.toString();
+        }
     }
 }

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManagerTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManagerTest.java?rev=1574843&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManagerTest.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManagerTest.java Thu Mar  6 11:33:53 2014
@@ -0,0 +1,214 @@
+/*
+ *
+ * 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.server.support.wrapper;
+
+import static org.junit.Assert.assertTrue;
+
+import java.math.BigInteger;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList;
+import org.apache.chemistry.opencmis.commons.data.ObjectParentData;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
+import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.impl.server.AbstractCmisService;
+import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.junit.Test;
+
+public class CmisServiceWrapperManagerTest {
+
+    @Test
+    public void testWrapperManager() {
+        CmisServiceWrapperManager manager = new CmisServiceWrapperManager();
+
+        manager.addOuterWrapper(SimpleLoggingCmisServiceWrapper.class);
+        manager.addOuterWrapper(ConformanceCmisServiceWrapper.class, -1, 100, -1, 1000);
+        manager.addOuterWrapper(SimpleLoggingCmisServiceWrapper.class, "outer");
+        manager.addInnerWrapper(SimpleLoggingCmisServiceWrapper.class, "inner");
+
+        DummyService service = new DummyService();
+        CmisService wrapperedService = manager.wrap(service);
+        assertTrue(wrapperedService instanceof AbstractCmisServiceWrapper);
+
+        AbstractCmisServiceWrapper wrapper = (AbstractCmisServiceWrapper) wrapperedService;
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof ConformanceCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        assertTrue(wrapper.getWrappedService() instanceof DummyService);
+
+        // removing outer wrapper
+        manager.removeOuterWrapper();
+
+        service = new DummyService();
+        wrapperedService = manager.wrap(service);
+
+        assertTrue(wrapperedService instanceof AbstractCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapperedService;
+        assertTrue(wrapper instanceof ConformanceCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        assertTrue(wrapper.getWrappedService() instanceof DummyService);
+
+        // removing inner wrapper
+        manager.removeInnerWrapper();
+
+        service = new DummyService();
+        wrapperedService = manager.wrap(service);
+
+        assertTrue(wrapperedService instanceof AbstractCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapperedService;
+        assertTrue(wrapper instanceof ConformanceCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        assertTrue(wrapper.getWrappedService() instanceof DummyService);
+    }
+
+    @Test
+    public void testWrapperManagerFromParameters() {
+        Map<String, String> parameters = new HashMap<String, String>();
+
+        parameters.put("dummy", "something");
+
+        parameters.put("servicewrapper.1", SimpleLoggingCmisServiceWrapper.class.getName() + ",1");
+        parameters.put("servicewrapper.2", ConformanceCmisServiceWrapper.class.getName() + ",2");
+        parameters.put("servicewrapper.3", SimpleLoggingCmisServiceWrapper.class.getName() + ",3");
+        parameters.put("servicewrapper.4", SimpleLoggingCmisServiceWrapper.class.getName() + ",4");
+
+        CmisServiceWrapperManager manager = new CmisServiceWrapperManager();
+        manager.addWrappersFromServiceFactoryParameters(parameters);
+
+        DummyService service = new DummyService();
+        CmisService wrapperedService = manager.wrap(service);
+        assertTrue(wrapperedService instanceof AbstractCmisServiceWrapper);
+
+        AbstractCmisServiceWrapper wrapper = (AbstractCmisServiceWrapper) wrapperedService;
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof ConformanceCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        assertTrue(wrapper.getWrappedService() instanceof DummyService);
+
+        // removing outer wrapper
+        manager.removeOuterWrapper();
+
+        service = new DummyService();
+        wrapperedService = manager.wrap(service);
+
+        assertTrue(wrapperedService instanceof AbstractCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapperedService;
+        assertTrue(wrapper instanceof ConformanceCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        assertTrue(wrapper.getWrappedService() instanceof DummyService);
+
+        // removing inner wrapper
+        manager.removeInnerWrapper();
+
+        service = new DummyService();
+        wrapperedService = manager.wrap(service);
+
+        assertTrue(wrapperedService instanceof AbstractCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapperedService;
+        assertTrue(wrapper instanceof ConformanceCmisServiceWrapper);
+
+        wrapper = (AbstractCmisServiceWrapper) wrapper.getWrappedService();
+        assertTrue(wrapper instanceof SimpleLoggingCmisServiceWrapper);
+
+        assertTrue(wrapper.getWrappedService() instanceof DummyService);
+    }
+
+    private static class DummyService extends AbstractCmisService {
+
+        @Override
+        public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
+            return null;
+        }
+
+        @Override
+        public TypeDefinitionList getTypeChildren(String repositoryId, String typeId,
+                Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+            return null;
+        }
+
+        @Override
+        public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) {
+            return null;
+        }
+
+        @Override
+        public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter, String orderBy,
+                Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+                Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
+            return null;
+        }
+
+        @Override
+        public List<ObjectParentData> getObjectParents(String repositoryId, String objectId, String filter,
+                Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+                Boolean includeRelativePathSegment, ExtensionsData extension) {
+            return null;
+        }
+
+        @Override
+        public ObjectData getObject(String repositoryId, String objectId, String filter,
+                Boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
+                Boolean includePolicyIds, Boolean includeAcl, ExtensionsData extension) {
+            return null;
+        }
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/wrapper/CmisServiceWrapperManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message