chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1719450 [2/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-server/chemistry-opencmis-server-inmemory/ chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ chemistry-opencm...
Date Fri, 11 Dec 2015 15:21:32 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryRepositoryServiceImpl.java
Fri Dec 11 15:21:31 2015
@@ -30,6 +30,7 @@ import org.apache.chemistry.opencmis.com
 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.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
@@ -50,7 +51,7 @@ public class InMemoryRepositoryServiceIm
 
         validator.getRepositoryInfo(context, repositoryId, extension);
 
-        RepositoryInfo repoInfo = getRepositoryInfoFromStoreManager(repositoryId);
+        RepositoryInfo repoInfo = getRepositoryInfoFromStoreManager(context, repositoryId);
 
         return repoInfo;
     }
@@ -61,7 +62,7 @@ public class InMemoryRepositoryServiceIm
         List<RepositoryInfo> res = new ArrayList<RepositoryInfo>();
         List<String> repIds = fStoreManager.getAllRepositoryIds();
         for (String repId : repIds) {
-            res.add(fStoreManager.getRepositoryInfo(repId));
+            res.add(fStoreManager.getRepositoryInfo(context, repId));
         }
         return res;
     }
@@ -72,7 +73,7 @@ public class InMemoryRepositoryServiceIm
         validator.getTypeChildren(context, repositoryId, typeId, extension);
 
         boolean inclPropDefs = includePropertyDefinitions == null ? false : includePropertyDefinitions;
-        getRepositoryInfoFromStoreManager(repositoryId); // just to check if
+        getRepositoryInfoFromStoreManager(context, repositoryId); // just to check if
         // repository exists
 
         int skip = skipCount == null ? 0 : skipCount.intValue();
@@ -82,7 +83,8 @@ public class InMemoryRepositoryServiceIm
         List<TypeDefinitionContainer> children;
         if (typeId == null) {
             // spec says that base types must be returned in this case
-            children = fStoreManager.getRootTypes(repositoryId, inclPropDefs);
+            boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
+            children = fStoreManager.getRootTypes(repositoryId, inclPropDefs, cmis11);
         } else {
             children = getTypeDescendants(context, repositoryId, typeId, BigInteger.valueOf(1),
inclPropDefs, null);
         }
@@ -116,7 +118,8 @@ public class InMemoryRepositoryServiceIm
 
         validator.getTypeDefinition(context, repositoryId, typeId, extension);
 
-        TypeDefinitionContainer tc = fStoreManager.getTypeById(repositoryId, typeId);
+        boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
+        TypeDefinitionContainer tc = fStoreManager.getTypeById(repositoryId, typeId, cmis11);
         if (tc != null) {
             return tc.getTypeDefinition();
         } else {
@@ -136,13 +139,14 @@ public class InMemoryRepositoryServiceIm
         }
 
         List<TypeDefinitionContainer> result = null;
+        boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
         if (typeId == null) {
             // spec says that depth must be ignored in this case
-            Collection<TypeDefinitionContainer> tmp = fStoreManager.getTypeDefinitionList(repositoryId,
inclPropDefs);
+            Collection<TypeDefinitionContainer> tmp = fStoreManager.getTypeDefinitionList(repositoryId,
inclPropDefs, cmis11);
             result = new ArrayList<TypeDefinitionContainer>(tmp);
         } else {
             TypeDefinitionContainer tc = fStoreManager.getTypeById(repositoryId, typeId,
inclPropDefs,
-                    depth == null ? -1 : depth.intValue());
+                    depth == null ? -1 : depth.intValue(), cmis11);
             if (tc == null) {
                 throw new CmisInvalidArgumentException("unknown type id: " + typeId);
             } else {
@@ -196,8 +200,8 @@ public class InMemoryRepositoryServiceIm
         typeManager.deleteTypeDefinition(typeId);
     }
 
-    private RepositoryInfo getRepositoryInfoFromStoreManager(String repositoryId) {
-        RepositoryInfo repoInfo = fStoreManager.getRepositoryInfo(repositoryId);
+    private RepositoryInfo getRepositoryInfoFromStoreManager(CallContext context, String
repositoryId) {
+        RepositoryInfo repoInfo = fStoreManager.getRepositoryInfo(context, repositoryId);
         if (null == repoInfo || !repoInfo.getId().equals(repositoryId)) {
             throw new CmisInvalidArgumentException("Unknown repository: " + repositoryId);
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
Fri Dec 11 15:21:31 2015
@@ -51,7 +51,7 @@ import org.apache.chemistry.opencmis.inm
 public class InMemoryService extends AbstractCmisService {
 
     private final StoreManager storeManager; // singleton root of everything
-
+    private final CallContext callContext;
     private final InMemoryRepositoryServiceImpl fRepSvc;
     private final InMemoryObjectServiceImpl fObjSvc;
     private final InMemoryNavigationServiceImpl fNavSvc;
@@ -66,8 +66,9 @@ public class InMemoryService extends Abs
         return storeManager;
     }
 
-    public InMemoryService(StoreManager sm) {
+    public InMemoryService(StoreManager sm, CallContext ctx) {
         storeManager = sm;
+        callContext = ctx;
         fRepSvc = new InMemoryRepositoryServiceImpl(storeManager);
         fNavSvc = new InMemoryNavigationServiceImpl(storeManager);
         fObjSvc = new InMemoryObjectServiceImpl(storeManager);
@@ -80,11 +81,7 @@ public class InMemoryService extends Abs
     }
 
     public CallContext getCallContext() {
-        return InMemoryServiceContext.getCallContext();
-    }
-
-    public void setCallContext(CallContext context) {
-        InMemoryServiceContext.setCallContext(context);
+        return callContext;
     }
 
     // --- repository service ---
@@ -92,7 +89,6 @@ public class InMemoryService extends Abs
     @Override
     public void close() {
         super.close();
-        setCallContext(null);
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
Fri Dec 11 15:21:31 2015
@@ -147,28 +147,19 @@ public class InMemoryServiceFactoryImpl
     public CmisService getService(CallContext context) {
         LOG.debug("start getService()");
         CallContext contextToUse = context;
-        // Attach the CallContext to a thread local context that can be
-        // accessed from everywhere
         // Some unit tests set their own context. So if we find one then we use
         // this one and ignore the provided one. Otherwise we set a new context.
         if (fUseOverrideCtx && null != overrideCtx) {
             contextToUse = overrideCtx;
         }
 
-        InMemoryService inMemoryService = InMemoryServiceContext.getCmisService();
-        if (inMemoryService == null) {
-            LOG.debug("Creating new InMemoryService instance!");
-            ConformanceCmisServiceWrapper wrapperService;
-            inMemoryService = new InMemoryService(storeManager);
-            wrapperService = new ConformanceCmisServiceWrapper(inMemoryService, DEFAULT_MAX_ITEMS_TYPES,
-                    DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
-            InMemoryServiceContext.setWrapperService(wrapperService);
-        }
-
-        inMemoryService.setCallContext(contextToUse);
+        LOG.debug("Creating new InMemoryService instance!");
+        ConformanceCmisServiceWrapper wrapperService;
+        InMemoryService inMemoryService = new InMemoryService(storeManager, contextToUse);
+        wrapperService = new ConformanceCmisServiceWrapper(inMemoryService, DEFAULT_MAX_ITEMS_TYPES,
+        		DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
 
-        LOG.debug("stop getService()");
-        return inMemoryService;
+        return inMemoryService; // wrapperService;
     }
 
     @Override
@@ -197,7 +188,6 @@ public class InMemoryServiceFactoryImpl
         if (null != cleanManager) {
             cleanManager.stopCleanRepositoryJob();
         }
-        InMemoryServiceContext.setWrapperService(null);
     }
 
     public StoreManager getStoreManger() {
@@ -402,13 +392,17 @@ public class InMemoryServiceFactoryImpl
         String doFillRepositoryStr = parameters.get(ConfigConstants.USE_REPOSITORY_FILER);
         String contentKindStr = parameters.get(ConfigConstants.CONTENT_KIND);
         boolean doFillRepository = doFillRepositoryStr == null ? false : Boolean.parseBoolean(doFillRepositoryStr);
+        // Simulate a runtime context with configuration parameters
+        // Attach the CallContext to a thread local context that can be
+        // accessed from everywhere
+        DummyCallContext ctx = new DummyCallContext();
 
         if (doFillRepository) {
 
             // create an initial temporary service instance to fill the
             // repository
 
-            InMemoryService svc = new InMemoryService(storeManager);
+            InMemoryService svc = new InMemoryService(storeManager, ctx);
 
             BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
 
@@ -493,10 +487,6 @@ public class InMemoryServiceFactoryImpl
                 gen.setFolderPropertiesToGenerate(propsToSet);
             }
 
-            // Simulate a runtime context with configuration parameters
-            // Attach the CallContext to a thread local context that can be
-            // accessed from everywhere
-            DummyCallContext ctx = new DummyCallContext();
             // create thread local storage and attach call context
             getService(ctx);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
Fri Dec 11 15:21:31 2015
@@ -31,6 +31,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.DocumentTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisConstraintException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
@@ -55,12 +56,10 @@ import org.apache.chemistry.opencmis.ser
 public class InMemoryVersioningServiceImpl extends InMemoryAbstractServiceImpl {
 
     private InMemoryObjectServiceImpl fObjectService;
-    private AtomLinkInfoProvider fAtomLinkProvider;
 
     public InMemoryVersioningServiceImpl(StoreManager storeManager, InMemoryObjectServiceImpl
objectService) {
         super(storeManager);
         fObjectService = objectService;
-        fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
     }
 
     public void cancelCheckOut(CallContext context, String repositoryId, String objectId,
ExtensionsData extension) {
@@ -129,7 +128,7 @@ public class InMemoryVersioningServiceIm
         // additional information:
         if (context.isObjectInfoRequired()) {
             ObjectInfoImpl objectInfo = new ObjectInfoImpl();
-            fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfo);
+            fAtomLinkProvider.fillInformationForAtomLinks(context, repositoryId, so, objectInfo);
             objectInfos.addObjectInfo(objectInfo);
         }
     }
@@ -139,7 +138,8 @@ public class InMemoryVersioningServiceIm
 
         StoredObject so = validator.checkOut(context, repositoryId, objectId, extension,
contentCopied);
 
-        TypeDefinition typeDef = getTypeDefinition(repositoryId, so);
+        boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
+        TypeDefinition typeDef = getTypeDefinition(repositoryId, so, cmis11);
         if (!typeDef.getBaseTypeId().equals(BaseTypeId.CMIS_DOCUMENT)) {
             throw new CmisNotSupportedException("Only documents can be checked-out.");
         } else if (!((DocumentTypeDefinition) typeDef).isVersionable()) {
@@ -180,7 +180,7 @@ public class InMemoryVersioningServiceIm
         // additional information:
         if (context.isObjectInfoRequired()) {
             ObjectInfoImpl objectInfo = new ObjectInfoImpl();
-            fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, pwc, objectInfo);
+            fAtomLinkProvider.fillInformationForAtomLinks(context, repositoryId, pwc, objectInfo);
             objectInfos.addObjectInfo(objectInfo);
         }
     }
@@ -228,7 +228,7 @@ public class InMemoryVersioningServiceIm
         // provide information for Atom links for version series:
         if (context.isObjectInfoRequired()) {
             ObjectInfoImpl objectInfo = new ObjectInfoImpl();
-            fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfo);
+            fAtomLinkProvider.fillInformationForAtomLinks(context, repositoryId, so, objectInfo);
             objectInfos.addObjectInfo(objectInfo);
         }
 
@@ -265,7 +265,7 @@ public class InMemoryVersioningServiceIm
         // provide information for Atom links for version series:
         if (context.isObjectInfoRequired()) {
             ObjectInfoImpl objectInfo = new ObjectInfoImpl();
-            fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfo);
+            fAtomLinkProvider.fillInformationForAtomLinks(context, repositoryId, so, objectInfo);
             objectInfos.addObjectInfo(objectInfo);
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoreManager.java
Fri Dec 11 15:21:31 2015
@@ -26,6 +26,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.server.support.TypeManager;
 
@@ -91,9 +92,11 @@ public interface StoreManager {
      * @param includePropertyDefinitions
      *            indicates whether to include property definitions in returned
      *            type
+     * @param cmis11
+     *            true if for CMIS version 1.1 false if for 1.0
      * @return map with type definition
      */
-    Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
boolean includePropertyDefinitions);
+    Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
boolean includePropertyDefinitions, boolean cmis11);
 
     /**
      * Retrieve a type definition for a give repository and type id.
@@ -102,9 +105,13 @@ public interface StoreManager {
      *            id of repository
      * @param typeId
      *            id of type definition
+     * @param cmis11
+     *            true if for CMIS version 1.1 false if for 1.0
+     * @param cmis11
+     *            true if for CMIS version 1.1 false if for 1.0
      * @return type definition
      */
-    TypeDefinitionContainer getTypeById(String repositoryId, String typeId);
+    TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean cmis11);
 
     /**
      * Retrieve a type definition for a give repository and type id with or
@@ -119,10 +126,12 @@ public interface StoreManager {
      *            type
      * @param depth
      *            limit depth of type hierarchy in return (-1 means unlimited)
+     * @param cmis11
+     *            true if for CMIS version 1.1 false if for 1.0
      * @return type definition
      */
     TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean includePropertyDefinitions,
-            int depth);
+            int depth, boolean cmis11);
 
     /**
      * Retrieve a factory to create CMIS data structures used as containers.
@@ -140,18 +149,22 @@ public interface StoreManager {
      *            id of repository
      * @param inclPropDefs
      *            true to include property definitions, false otherwise
+     * @param cmis11
+     *            true if for CMIS version 1.1 false if for 1.0
      * @return list of root types
      */
-    List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean inclPropDefs);
+    List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean inclPropDefs,
boolean cmis11);
 
     /**
      * Retrieve the repository information for a repository.
      * 
+     * @param CallContext
+     *            call context of the corresponding call
      * @param repositoryId
      *            id of repository
      * @return repository information
      */
-    RepositoryInfo getRepositoryInfo(String repositoryId);
+    RepositoryInfo getRepositoryInfo(CallContext context, String repositoryId);
 
     /**
      * Retrieve the type manager for a given repository.
@@ -184,8 +197,10 @@ public interface StoreManager {
      * Execute a query against the repository (same parameter as the discovery
      * service query method.
      * 
+     * @param callContext
+     *            call context of this query
      * @param user
-     *            user execuing the query
+     *            user executing the query
      * @param repositoryId
      *            id of repository
      * @param statement
@@ -204,7 +219,7 @@ public interface StoreManager {
      *            items to skip
      * @return list of objects matching the query
      */
-    ObjectList query(String user, String repositoryId, String statement, Boolean searchAllVersions,
+    ObjectList query(CallContext callContext, String user, String repositoryId, String statement,
Boolean searchAllVersions,
             Boolean includeAllowableActions, IncludeRelationships includeRelationships, String
renditionFilter,
             BigInteger maxItems, BigInteger skipCount);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/api/StoredObject.java
Fri Dec 11 15:21:31 2015
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.chemistry.opencmis.commons.data.AllowableActions;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 
 /**
@@ -276,11 +277,13 @@ public interface StoredObject {
     /**
      * get the allowable actions of the object.
      * 
+     * @param context
+     *            call context of this call
      * @param user
      *            user requesting allowable actions
      * @return allowable actions of this object for the use
      */
-    AllowableActions getAllowableActions(String user);
+    AllowableActions getAllowableActions(CallContext context, String user);
 
     /**
      * check if the document can generate a renditions and rendition is visible

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
Fri Dec 11 15:21:31 2015
@@ -61,11 +61,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.TypeCreator;
 import org.apache.chemistry.opencmis.inmemory.TypeManagerImpl;
 import org.apache.chemistry.opencmis.inmemory.query.InMemoryQueryProcessor;
-import org.apache.chemistry.opencmis.inmemory.server.InMemoryServiceContext;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.CmisServiceValidator;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
@@ -163,13 +163,12 @@ public class StoreManagerImpl implements
     }
 
     @Override
-    public TypeDefinitionContainer getTypeById(String repositoryId, String typeId) {
+    public TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean
cmis11) {
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
             throw new CmisObjectNotFoundException(UNKNOWN_REPOSITORY + repositoryId);
         }
 
-        boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
         TypeDefinitionContainer tdc = typeManager.getTypeById(typeId);
         if (null != tdc && !cmis11) {
             TypeDefinition td = tdc.getTypeDefinition();
@@ -189,7 +188,7 @@ public class StoreManagerImpl implements
 
     @Override
     public TypeDefinitionContainer getTypeById(String repositoryId, String typeId, boolean
includePropertyDefinitions,
-            int depthParam) {
+            int depthParam, boolean cmis11) {
         int depth = depthParam;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
@@ -197,7 +196,6 @@ public class StoreManagerImpl implements
         }
 
         TypeDefinitionContainer tc = typeManager.getTypeById(typeId);
-        boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
 
         if (tc != null) {
             if (depth == -1) {
@@ -218,17 +216,17 @@ public class StoreManagerImpl implements
 
     @Override
     public Collection<TypeDefinitionContainer> getTypeDefinitionList(String repositoryId,
-            boolean includePropertyDefinitions) {
+            boolean includePropertyDefinitions, boolean cmis11) {
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
             throw new CmisInvalidArgumentException(UNKNOWN_REPOSITORY + repositoryId);
         }
-        Collection<TypeDefinitionContainer> typeColl = getRootTypes(repositoryId, includePropertyDefinitions);
+        Collection<TypeDefinitionContainer> typeColl = getRootTypes(repositoryId, includePropertyDefinitions,
cmis11);
         return typeColl;
     }
 
     @Override
-    public List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean
includePropertyDefinitions) {
+    public List<TypeDefinitionContainer> getRootTypes(String repositoryId, boolean
includePropertyDefinitions, boolean cmis11) {
         List<TypeDefinitionContainer> result;
         TypeManager typeManager = fMapRepositoryToTypeManager.get(repositoryId);
         if (null == typeManager) {
@@ -237,7 +235,6 @@ public class StoreManagerImpl implements
         List<TypeDefinitionContainer> rootTypes = typeManager.getRootTypes();
 
         // remove cmis:item and cmis:secondary for CMIS 1.0
-        boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
         if (!cmis11) {
             rootTypes = new ArrayList<TypeDefinitionContainer>(rootTypes);
             TypeDefinitionContainer tcItem = null, tcSecondary = null;
@@ -280,13 +277,13 @@ public class StoreManagerImpl implements
 	}
     
     @Override
-    public RepositoryInfo getRepositoryInfo(String repositoryId) {
+    public RepositoryInfo getRepositoryInfo(CallContext context, String repositoryId) {
         ObjectStore sm = fMapRepositoryToObjectStore.get(repositoryId);
         if (null == sm) {
             return null;
         }
-
-        RepositoryInfo repoInfo = createRepositoryInfo(repositoryId);
+        boolean cmis11 = context.getCmisVersion().equals(CmisVersion.CMIS_1_1);
+        RepositoryInfo repoInfo = createRepositoryInfo(repositoryId, cmis11);
         return repoInfo;
     }
 
@@ -348,8 +345,7 @@ public class StoreManagerImpl implements
     }
 
     @SuppressWarnings("serial")
-    private RepositoryInfo createRepositoryInfo(String repositoryId) {
-        boolean cmis11 = InMemoryServiceContext.getCallContext().getCmisVersion() != CmisVersion.CMIS_1_0;
+    private RepositoryInfo createRepositoryInfo(String repositoryId, boolean cmis11) {
         ObjectStore objStore = getObjectStore(repositoryId);
         String rootFolderId = objStore.getRootFolder().getId();
         // repository info
@@ -574,13 +570,13 @@ public class StoreManagerImpl implements
     }
 
     @Override
-    public ObjectList query(String user, String repositoryId, String statement, Boolean searchAllVersions,
+    public ObjectList query(CallContext callContext, String user, String repositoryId, String
statement, Boolean searchAllVersions,
             Boolean includeAllowableActions, IncludeRelationships includeRelationships, String
renditionFilter,
             BigInteger maxItems, BigInteger skipCount) {
         TypeManager tm = getTypeManager(repositoryId);
         ObjectStore objectStore = getObjectStore(repositoryId);
 
-        InMemoryQueryProcessor queryProcessor = new InMemoryQueryProcessor(getStore(repositoryId));
+        InMemoryQueryProcessor queryProcessor = new InMemoryQueryProcessor(getStore(repositoryId),
callContext);
         ObjectList objList = queryProcessor.query(tm, objectStore, user, repositoryId, statement,
searchAllVersions,
                 includeAllowableActions, includeRelationships, renditionFilter, maxItems,
skipCount);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
Fri Dec 11 15:21:31 2015
@@ -37,6 +37,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.impl.IOUtils;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
@@ -503,8 +504,8 @@ public class StoredObjectImpl implements
     }
 
     @Override
-    public AllowableActions getAllowableActions(String user) {
-        AllowableActions actions = DataObjectCreator.fillAllowableActions(this, user);
+    public AllowableActions getAllowableActions(CallContext context, String user) {
+        AllowableActions actions = DataObjectCreator.fillAllowableActions(context, this,
user);
         return actions;
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
Fri Dec 11 15:21:31 2015
@@ -69,6 +69,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriImpl;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
@@ -404,7 +405,7 @@ public final class PropertyCreationHelpe
         }
     }
 
-    public static ObjectData getObjectData(TypeManager tm, ObjectStore objectStore, StoredObject
so, String filter,
+    public static ObjectData getObjectData(CallContext context, TypeManager tm, ObjectStore
objectStore, StoredObject so, String filter,
             String user, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
             String renditionFilter, Boolean includePolicyIds, Boolean includeACL, ExtensionsData
extension) {
 
@@ -420,7 +421,7 @@ public final class PropertyCreationHelpe
 
         // fill output object
         if (null != includeAllowableActions && includeAllowableActions) {
-            AllowableActions allowableActions = so.getAllowableActions(user);
+            AllowableActions allowableActions = so.getAllowableActions(context, user);
             od.setAllowableActions(allowableActions);
         }
 
@@ -442,7 +443,7 @@ public final class PropertyCreationHelpe
         }
 
         if (null != includeRelationships && includeRelationships != IncludeRelationships.NONE)
{
-            od.setRelationships(DataObjectCreator.fillRelationships(tm, objectStore, includeRelationships,
so, user));
+            od.setRelationships(DataObjectCreator.fillRelationships(context, tm, objectStore,
includeRelationships, so, user));
         }
 
         if (null != includePolicyIds && includePolicyIds) {
@@ -459,7 +460,7 @@ public final class PropertyCreationHelpe
         return od;
     }
 
-    public static ObjectData getObjectDataQueryResult(TypeManager tm, ObjectStore objectStore,
+    public static ObjectData getObjectDataQueryResult(CallContext context, TypeManager tm,
ObjectStore objectStore,
             TypeDefinition primaryType, StoredObject so, String user, Map<String, String>
requestedProperties,
             Map<String, String> requestedFuncs, List<TypeDefinition> secondaryTypes,
Boolean includeAllowableActions,
             IncludeRelationships includeRelationships, String renditionFilter) {
@@ -472,7 +473,7 @@ public final class PropertyCreationHelpe
 
         // fill output object
         if (null != includeAllowableActions && includeAllowableActions) {
-            AllowableActions allowableActions = so.getAllowableActions(user);
+            AllowableActions allowableActions = so.getAllowableActions(context, user);
             od.setAllowableActions(allowableActions);
         }
 
@@ -483,7 +484,7 @@ public final class PropertyCreationHelpe
         od.setIsExactAcl(true);
 
         if (null != includeRelationships && includeRelationships != IncludeRelationships.NONE)
{
-            od.setRelationships(DataObjectCreator.fillRelationships(tm, objectStore, includeRelationships,
so, user));
+            od.setRelationships(DataObjectCreator.fillRelationships(context, tm, objectStore,
includeRelationships, so, user));
         }
 
         List<RenditionData> renditions = objectStore.getRenditions(so, renditionFilter,
0, 0);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/specexamples/SpecExamples.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/specexamples/SpecExamples.java?rev=1719450&r1=1719449&r2=1719450&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/specexamples/SpecExamples.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/specexamples/SpecExamples.java
Fri Dec 11 15:21:31 2015
@@ -87,7 +87,7 @@ public class SpecExamples {
     private static final String TOPLEVEL_TYPE = "DocumentTopLevel";
     private static final String VERSIONED_TYPE = "VersionableType";
     private static final String VERSIONED_PROP = "VersionedStringProp";
-    private static final String LOGDIR = System.getProperty("java.io.tmpdir");// +
+    private static final String LOGDIR = "/Users/d058463/temp/cmis"; //System.getProperty("java.io.tmpdir");//
+
     // File.separator;
     private static final String ROOT_URL = "http://localhost:8080/inmemory";
     private static final String ROOT_URL_OASIS = "http://www.example.com:8080/inmemory";
@@ -341,7 +341,7 @@ public class SpecExamples {
 
     private void getContentChanges(String token) {
         LOG.debug("getContentChanges");
-        Holder<String> changeLogToken = new Holder<String>("token");
+        Holder<String> changeLogToken = new Holder<String>("token-000010");
         discSvc.getContentChanges(repositoryId, changeLogToken, false, "*", false, false,
null, null);
         renameFiles("getContentChanges");
         LOG.debug("getContentChanges() done.");




Mime
View raw message