chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r912517 [1/3] - in /incubator/chemistry/trunk/opencmis: opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/...
Date Mon, 22 Feb 2010 08:58:41 GMT
Author: jens
Date: Mon Feb 22 08:58:39 2010
New Revision: 912517

URL: http://svn.apache.org/viewvc?rev=912517&view=rev
Log:
InMemoryProvider:
bugfix versioning: only checked out documents can be modified for versioned documents
add test to update older versions

clean up testing:
- allow tests to use direct implementation of the services or go through client provider layer
- remove all dependencies to client provider from other locations than test initialization

put commonly used functionality for tests and test initialization in a common superclass

Several fixes in Versioning
Refactoring configuration parameters
Documentation

Added:
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/CmisInMemoryProvider.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DummyCallContext.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/AbstractServiceTst.java
Removed:
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigMap.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/MapConfigReader.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/CallContextConfigReader.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/SessionConfigReader.java
Modified:
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/NavigationServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ObjectServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/VersioningServiceImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/CmisInMemorySpi.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryDiscoveryService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryNavigationService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryRepositoryService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryVersioningService.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/RuntimeContext.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/ServiceFactory.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/api/Children.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/api/Content.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/api/DocumentVersion.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/api/StoreManager.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/api/StoredObject.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/api/VersionedDocument.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/AbstractPathImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/DocumentImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/FolderImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/types/PropertyCreationHelper.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/NavigationServiceTest.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/ObjectServiceTest.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/RepositoryServiceTest.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/TypeValidationTest.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/UnitTestTypeSystemCreator.java
    incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/test/java/org/apache/opencmis/inmemory/VersioningTest.java
    incubator/chemistry/trunk/opencmis/src/site/apt/server-inmemory.apt

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/CmisInMemoryProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/CmisInMemoryProvider.java?rev=912517&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/CmisInMemoryProvider.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/CmisInMemoryProvider.java Mon Feb 22 08:58:39 2010
@@ -0,0 +1,126 @@
+/*
+ * 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.opencmis.inmemory;
+
+import java.util.Map;
+
+import org.apache.opencmis.commons.provider.AclService;
+import org.apache.opencmis.commons.provider.DiscoveryService;
+import org.apache.opencmis.commons.provider.MultiFilingService;
+import org.apache.opencmis.commons.provider.NavigationService;
+import org.apache.opencmis.commons.provider.ObjectService;
+import org.apache.opencmis.commons.provider.PolicyService;
+import org.apache.opencmis.commons.provider.RelationshipService;
+import org.apache.opencmis.commons.provider.RepositoryInfoData;
+import org.apache.opencmis.commons.provider.RepositoryService;
+import org.apache.opencmis.commons.provider.VersioningService;
+import org.apache.opencmis.inmemory.storedobj.api.StoreManager;
+import org.apache.opencmis.inmemory.storedobj.impl.StoreManagerFactory;
+import org.apache.opencmis.inmemory.storedobj.impl.StoreManagerImpl;
+
+/**
+ * General class to manage all the services. Directly used for unit test of the
+ * in-memory server, indirectly used for the client provider implementation of
+ * the in-memory provider
+ * 
+ * @author Jens
+ *
+ */
+public class CmisInMemoryProvider {
+
+  protected StoreManager fStoreManager;
+  protected RepositoryService fRepositoryService;
+  protected NavigationService fNavigationService;
+  protected ObjectService fObjectService;
+  protected VersioningService fVersioningService;
+  protected RepositoryInfoData fRepositoryInfo;
+
+  public CmisInMemoryProvider(Map<String, String> cfgParams) {
+    setup (cfgParams);    
+  }
+  
+  protected CmisInMemoryProvider() {  
+  }
+  
+  RepositoryService getRepositoryService() {
+    return fRepositoryService;
+  }
+
+  NavigationService getNavigationService() {
+    return fNavigationService;
+  }
+
+  ObjectService getObjectService() {
+    return fObjectService;    
+  }
+
+  VersioningService getVersioningService() {
+   return fVersioningService; 
+  }
+
+  RelationshipService getRelationshipService() {
+    return null;
+  }
+
+  DiscoveryService getDiscoveryService() {
+    return null;
+  }
+
+  MultiFilingService getMultiFilingService() {
+    return null;
+  }
+
+  AclService getAclService() {
+    return null;
+  }
+
+  PolicyService getPolicyService() {
+    return null;
+  }
+
+  protected void setup(Map<String, String> cfgParams) {
+    String repositoryClassName = (String) cfgParams.get(ConfigConstants.REPOSITORY_CLASS);
+    if (null==repositoryClassName)
+      repositoryClassName = StoreManagerImpl.class.getName();
+    
+    fStoreManager = StoreManagerFactory.createInstance(repositoryClassName);
+    String repositoryId  = (String) cfgParams.get(ConfigConstants.REPOSITORY_ID);
+    
+    // first create repository
+    if (null != repositoryId ) {
+      // then create/initialize type system
+      String typeCreatorClassName = (String) cfgParams.get(ConfigConstants.TYPE_CREATOR_CLASS);
+      fStoreManager.createAndInitRepository(repositoryId, typeCreatorClassName);
+    } else {    
+      // then init repository (note: loads root folder which requires cmis:folder type available)
+      fStoreManager.initRepository(repositoryId);
+    }
+    
+//    String repoInfoCreatorClassName = (String) fSession.get(ConfigConstants.REPOSITORY_INFO_CREATOR_CLASS);
+//    fStoreManager.initRepositoryInfo(repositoryId, repoInfoCreatorClassName);    
+
+    // initialize services
+    fRepositoryService = new RepositoryServiceImpl(fStoreManager);
+    fNavigationService = new NavigationServiceImpl(fStoreManager);
+    fObjectService = new ObjectServiceImpl(fStoreManager);
+    fVersioningService = new VersioningServiceImpl(fStoreManager, fObjectService);    
+  }
+
+  
+}

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ConfigConstants.java Mon Feb 22 08:58:39 2010
@@ -22,8 +22,6 @@
   public static final String REPOSITORY_ID = "InMemoryServer.RepositoryId";
   public static final String TYPE_CREATOR_CLASS = "InMemoryServer.TypesCreatorClass";
   public static final String REPOSITORY_INFO_CREATOR_CLASS = "InMemoryServer.RepositoryInfoCreatorClass";
-  public static final String USERNAME = "InMemoryServer.User";
-  public static final String PASSWORD = "InMemoryServer.Password";
   public static final String REPOSITORY_CLASS = "InMemoryServer.Class";
 
   // Helper constants that allow to fill a repository with data on initialization

Added: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DummyCallContext.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DummyCallContext.java?rev=912517&view=auto
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DummyCallContext.java (added)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/DummyCallContext.java Mon Feb 22 08:58:39 2010
@@ -0,0 +1,40 @@
+package org.apache.opencmis.inmemory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.opencmis.server.spi.CallContext;
+
+public class DummyCallContext implements CallContext {
+  private Map<String, String> fParameter = new HashMap<String, String>();
+
+  public DummyCallContext() {
+    fParameter.put( USERNAME, "TestUser");
+    fParameter.put( PASSWORD, "secret");
+    fParameter.put( LOCALE, "en");
+  }
+  
+  public String get(String key) {
+    return fParameter.get(key);
+  }
+
+  public String getBinding() {
+    return BINDING_ATOMPUB;
+  }
+
+  public String getLocale() {
+    return get(LOCALE);
+  }
+
+  public String getPassword() {
+    return get(PASSWORD);
+  }
+
+  public String getUsername() {
+    return get(USERNAME);
+  }
+
+  public void put(String key, String value) {
+    fParameter.put(key, value);
+  }
+}

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/NavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/NavigationServiceImpl.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/NavigationServiceImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/NavigationServiceImpl.java Mon Feb 22 08:58:39 2010
@@ -43,6 +43,7 @@
 import org.apache.opencmis.commons.provider.ObjectList;
 import org.apache.opencmis.commons.provider.ObjectParentData;
 import org.apache.opencmis.commons.provider.PropertiesData;
+import org.apache.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.opencmis.inmemory.storedobj.api.Folder;
 import org.apache.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.apache.opencmis.inmemory.storedobj.api.Path;
@@ -65,7 +66,7 @@
   }
 
   /* (non-Javadoc)
-   * @see org.apache.opencmis.client.provider.NavigationService#getCheckedOutDocs(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.math.BigInteger, java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.opencmis.client.provider.NavigationService#getCheckedOutDocs(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, org.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.math.BigInteger, java.math.BigInteger, org.opencmis.client.provider.ExtensionsData)
    */
   public ObjectList getCheckedOutDocs(String repositoryId, String folderId, String filter,
       String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
@@ -94,7 +95,9 @@
       for (ObjectInFolderData child: children.getObjects()) {
         ObjectData obj = child.getObject();
         StoredObject so = fStoreManager.getObjectStore(repositoryId).getObjectById(obj.getId());
-        if (so instanceof VersionedDocument && ((VersionedDocument)so).isCheckedOut())
+        log.info("Checked out: children:" + obj.getId());
+        if (so instanceof DocumentVersion && ((DocumentVersion)so).getParentDocument().isCheckedOut())
+//        if (so instanceof VersionedDocument && ((VersionedDocument)so).isCheckedOut())
           odList.add(obj);
       }
     }
@@ -106,7 +109,7 @@
   }
 
   /* (non-Javadoc)
-   * @see org.apache.opencmis.client.provider.NavigationService#getChildren(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, java.math.BigInteger, java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.opencmis.client.provider.NavigationService#getChildren(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, org.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, java.math.BigInteger, java.math.BigInteger, org.opencmis.client.provider.ExtensionsData)
    */
   public ObjectInFolderList getChildren(String repositoryId, String folderId, String filter,
       String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
@@ -126,7 +129,7 @@
   }
   
   /* (non-Javadoc)
-   * @see org.apache.opencmis.client.provider.NavigationService#getDescendants(java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.opencmis.client.provider.NavigationService#getDescendants(java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String, java.lang.Boolean, org.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, org.opencmis.client.provider.ExtensionsData)
    */
   public List<ObjectInFolderContainer> getDescendants(String repositoryId, String folderId,
       BigInteger depth, String filter, Boolean includeAllowableActions,
@@ -153,7 +156,7 @@
   }
 
   /* (non-Javadoc)
-   * @see org.apache.opencmis.client.provider.NavigationService#getFolderTree(java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.opencmis.client.provider.NavigationService#getFolderTree(java.lang.String, java.lang.String, java.math.BigInteger, java.lang.String, java.lang.Boolean, org.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, org.opencmis.client.provider.ExtensionsData)
    */
   public List<ObjectInFolderContainer> getFolderTree(String repositoryId, String folderId,
       BigInteger depth, String filter, Boolean includeAllowableActions,
@@ -163,10 +166,10 @@
     log.debug("start getFolderTree()");
     checkStandardParameters(repositoryId, folderId);
 
-    if (depth == null || depth.intValue() == 0)
+    if (depth != null && depth.intValue() == 0)
       throw new CmisInvalidArgumentException("A zero depth is not allowed for getFolderTree().");
     
-    int levels = depth.intValue();
+    int levels = depth == null ? 2: depth.intValue();
     int level = 0;
     List<ObjectInFolderContainer> result = getDescendantsIntern(repositoryId, folderId,
             filter, includeAllowableActions, includeRelationships, renditionFilter,
@@ -176,7 +179,7 @@
   }
   
   /* (non-Javadoc)
-   * @see org.apache.opencmis.client.provider.NavigationService#getFolderParent(java.lang.String, java.lang.String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.opencmis.client.provider.NavigationService#getFolderParent(java.lang.String, java.lang.String, java.lang.String, org.opencmis.client.provider.ExtensionsData)
    */
   public ObjectData getFolderParent(String repositoryId, String folderId, String filter,
       ExtensionsData extension) {
@@ -200,7 +203,7 @@
   }
 
   /* (non-Javadoc)
-   * @see org.apache.opencmis.client.provider.NavigationService#getObjectParents(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, org.apache.opencmis.client.provider.ExtensionsData)
+   * @see org.opencmis.client.provider.NavigationService#getObjectParents(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, org.opencmis.commons.enums.IncludeRelationships, java.lang.String, java.lang.Boolean, org.opencmis.client.provider.ExtensionsData)
    */
   public List<ObjectParentData> getObjectParents(String repositoryId, String objectId,
       String filter, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
@@ -297,9 +300,8 @@
       ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
           includeAllowableActions, includeRelationships, renditionFilter, includePathSegments, 1000, 0, folderOnly);
       
+      childrenOfFolderId = new ArrayList<ObjectInFolderContainer>();
       if (null != children) {        
-        if (children.getObjects().size() > 0)
-          childrenOfFolderId = new ArrayList<ObjectInFolderContainer>();
 
         for (ObjectInFolderData child : children.getObjects()) {      
           ObjectInFolderContainerImpl oifc = new ObjectInFolderContainerImpl();

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ObjectServiceImpl.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ObjectServiceImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/ObjectServiceImpl.java Mon Feb 22 08:58:39 2010
@@ -65,6 +65,7 @@
 import org.apache.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
 import org.apache.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
 import org.apache.opencmis.inmemory.types.PropertyCreationHelper;
+import org.apache.opencmis.server.spi.CallContext;
 
 public class ObjectServiceImpl extends AbstractServiceImpl implements ObjectService {
   private static Log log = LogFactory.getLog(ObjectService.class);
@@ -78,13 +79,13 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#createDocument(java.lang.String,
-   * org.apache.opencmis.client.provider.PropertiesData, java.lang.String,
-   * org.apache.opencmis.client.provider.ContentStreamData,
-   * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#createDocument(java.lang.String,
+   * org.opencmis.client.provider.PropertiesData, java.lang.String,
+   * org.opencmis.client.provider.ContentStreamData,
+   * org.opencmis.commons.enums.VersioningState, java.util.List,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public String createDocument(String repositoryId, PropertiesData properties, String folderId,
       ContentStreamData contentStream, VersioningState versioningState, List<String> policies,
@@ -126,7 +127,7 @@
     TypeValidator.validateProperties(typeDef, properties, true);
 
     // set user, creation date, etc.
-    String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+    String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
     if (user == null)
       user = "unknown";
     
@@ -143,21 +144,17 @@
       version.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);
       version.setCustomProperties(properties.getProperties());
       version.persist();
-      verDoc.persist();
       resId = version.getId(); // return the version and not the version series to caller
     } else {
       Document doc = fStoreManager.getObjectStore(repositoryId).createDocument(name);
       doc.setContent(contentStream, false);
       // add document to folder
-      folder.addChildDocument(doc); // sets parent in doc
       doc.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);
       doc.setCustomProperties(properties.getProperties());
-      doc.persist(); // first persist document, only if this succeeds persist folder with added child
+      folder.addChildDocument(doc); // sets parent in doc
       resId = doc.getId();
     }
         
-    folder.persist();
-
     // versioningState, policies, addACEs, removeACEs, extension are ignored for
     // now.
     log.debug("stop createDocument()");
@@ -168,13 +165,13 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#createDocumentFromSource(java
+   * org.opencmis.client.provider.ObjectService#createDocumentFromSource(java
    * .lang.String, java.lang.String,
-   * org.apache.opencmis.client.provider.PropertiesData, java.lang.String,
-   * org.apache.opencmis.commons.enums.VersioningState, java.util.List,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.PropertiesData, java.lang.String,
+   * org.opencmis.commons.enums.VersioningState, java.util.List,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public String createDocumentFromSource(String repositoryId, String sourceId,
       PropertiesData properties, String folderId, VersioningState versioningState,
@@ -222,11 +219,11 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#createFolder(java.lang.String,
-   * org.apache.opencmis.client.provider.PropertiesData, java.lang.String,
-   * java.util.List, org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#createFolder(java.lang.String,
+   * org.opencmis.client.provider.PropertiesData, java.lang.String,
+   * java.util.List, org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public String createFolder(String repositoryId, PropertiesData properties, String folderId,
       List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
@@ -274,14 +271,12 @@
       ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
       Folder newFolder = objStore.createFolder(folderName);
       // set default system attributes
-      String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+      String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
       if (user == null)
         user = "unknown";
       newFolder.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);
       newFolder.setCustomProperties(properties.getProperties());
       parent.addChildFolder(newFolder);
-      newFolder.persist();
-      parent.persist();
       log.debug("stop createFolder()");
       return newFolder.getId();
     } catch (Exception e) {
@@ -293,11 +288,11 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#createPolicy(java.lang.String,
-   * org.apache.opencmis.client.provider.PropertiesData, java.lang.String,
-   * java.util.List, org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#createPolicy(java.lang.String,
+   * org.opencmis.client.provider.PropertiesData, java.lang.String,
+   * java.util.List, org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public String createPolicy(String repositoryId, PropertiesData properties, String folderId,
       List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
@@ -313,11 +308,11 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#createRelationship(java.lang
-   * .String, org.apache.opencmis.client.provider.PropertiesData, java.util.List,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.AccessControlList,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#createRelationship(java.lang
+   * .String, org.opencmis.client.provider.PropertiesData, java.util.List,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.AccessControlList,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public String createRelationship(String repositoryId, PropertiesData properties,
       List<String> policies, AccessControlList addACEs, AccessControlList removeACEs,
@@ -333,10 +328,10 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#deleteContentStream(java.lang
-   * .String, org.apache.opencmis.client.provider.Holder,
-   * org.apache.opencmis.client.provider.Holder,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#deleteContentStream(java.lang
+   * .String, org.opencmis.client.provider.Holder,
+   * org.opencmis.client.provider.Holder,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public void deleteContentStream(String repositoryId, Holder<String> objectId,
       Holder<String> changeToken, ExtensionsData extension) {
@@ -349,11 +344,11 @@
     if (so == null)
       throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
 
-    if (!(so instanceof Document))
+    if (!(so instanceof Content))
       throw new CmisObjectNotFoundException("Id" + objectId
           + " does not refer to a document, but only documents can have content");
 
-    ((Document) so).setContent(null, true);
+    ((Content) so).setContent(null, true);
     log.debug("stop deleteContentStream()");
   }
 
@@ -361,9 +356,9 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#deleteObject(java.lang.String,
+   * org.opencmis.client.provider.ObjectService#deleteObject(java.lang.String,
    * java.lang.String, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public void deleteObject(String repositoryId, String objectId, Boolean allVersions,
       ExtensionsData extension) {
@@ -386,10 +381,10 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#deleteTree(java.lang.String,
+   * org.opencmis.client.provider.ObjectService#deleteTree(java.lang.String,
    * java.lang.String, java.lang.Boolean,
-   * org.apache.opencmis.commons.enums.UnfileObject, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.commons.enums.UnfileObject, java.lang.Boolean,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
       UnfileObjects unfileObject, Boolean continueOnFailure, ExtensionsData extension) {
@@ -436,8 +431,8 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#getAllowableActions(java.lang
-   * .String, java.lang.String, org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#getAllowableActions(java.lang
+   * .String, java.lang.String, org.opencmis.client.provider.ExtensionsData)
    */
   public AllowableActionsData getAllowableActions(String repositoryId, String objectId,
       ExtensionsData extension) {
@@ -458,9 +453,9 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#getContentStream(java.lang.String
+   * org.opencmis.client.provider.ObjectService#getContentStream(java.lang.String
    * , java.lang.String, java.lang.String, java.math.BigInteger,
-   * java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+   * java.math.BigInteger, org.opencmis.client.provider.ExtensionsData)
    */
   public ContentStreamData getContentStream(String repositoryId, String objectId, String streamId,
       BigInteger offset, BigInteger length, ExtensionsData extension) {
@@ -485,11 +480,11 @@
   /*
    * (non-Javadoc)
    * 
-   * @see org.apache.opencmis.client.provider.ObjectService#getObject(java.lang.String,
+   * @see org.opencmis.client.provider.ObjectService#getObject(java.lang.String,
    * java.lang.String, java.lang.String, java.lang.Boolean,
-   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+   * org.opencmis.commons.enums.IncludeRelationships, java.lang.String,
    * java.lang.Boolean, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public ObjectData getObject(String repositoryId, String objectId, String filter,
       Boolean includeAllowableActions, IncludeRelationships includeRelationships,
@@ -515,11 +510,11 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#getObjectByPath(java.lang.String
+   * org.opencmis.client.provider.ObjectService#getObjectByPath(java.lang.String
    * , java.lang.String, java.lang.String, java.lang.Boolean,
-   * org.apache.opencmis.commons.enums.IncludeRelationships, java.lang.String,
+   * org.opencmis.commons.enums.IncludeRelationships, java.lang.String,
    * java.lang.Boolean, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public ObjectData getObjectByPath(String repositoryId, String path, String filter,
       Boolean includeAllowableActions, IncludeRelationships includeRelationships,
@@ -564,9 +559,9 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#getRenditions(java.lang.String,
+   * org.opencmis.client.provider.ObjectService#getRenditions(java.lang.String,
    * java.lang.String, java.lang.String, java.math.BigInteger,
-   * java.math.BigInteger, org.apache.opencmis.client.provider.ExtensionsData)
+   * java.math.BigInteger, org.opencmis.client.provider.ExtensionsData)
    */
   public List<RenditionData> getRenditions(String repositoryId, String objectId,
       String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
@@ -581,9 +576,9 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#moveObject(java.lang.String,
-   * org.apache.opencmis.client.provider.Holder, java.lang.String, java.lang.String,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#moveObject(java.lang.String,
+   * org.opencmis.client.provider.Holder, java.lang.String, java.lang.String,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId,
       String sourceFolderId, ExtensionsData extension) {
@@ -638,11 +633,11 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#setContentStream(java.lang.String
-   * , org.apache.opencmis.client.provider.Holder, java.lang.Boolean,
-   * org.apache.opencmis.client.provider.Holder,
-   * org.apache.opencmis.client.provider.ContentStreamData,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#setContentStream(java.lang.String
+   * , org.opencmis.client.provider.Holder, java.lang.Boolean,
+   * org.opencmis.client.provider.Holder,
+   * org.opencmis.client.provider.ContentStreamData,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
       Holder<String> changeToken, ContentStreamData contentStream, ExtensionsData extension) {
@@ -662,13 +657,13 @@
       content = ((Document) so);
     else if (so instanceof DocumentVersion) {
       // something that is versionable check the proper status of the object
-      String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+      String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
       testHasProperCheckedOutStatus(so, user);
       content = (DocumentVersion) so;
     } else
       throw new IllegalArgumentException("Content cannot be set on this object (must be document or version)");
 
-    if (!overwriteFlag && content.getContent() != null)
+    if (!overwriteFlag && content.getContent(0, -1) != null)
       throw new CmisConstraintException(
           "cannot overwrite existing content if overwrite flag is not set");
 
@@ -680,10 +675,10 @@
    * (non-Javadoc)
    * 
    * @see
-   * org.apache.opencmis.client.provider.ObjectService#updateProperties(java.lang.String
-   * , org.apache.opencmis.client.provider.Holder, org.apache.opencmis.client.provider.Holder,
-   * org.apache.opencmis.client.provider.PropertiesData,
-   * org.apache.opencmis.client.provider.ExtensionsData)
+   * org.opencmis.client.provider.ObjectService#updateProperties(java.lang.String
+   * , org.opencmis.client.provider.Holder, org.opencmis.client.provider.Holder,
+   * org.opencmis.client.provider.PropertiesData,
+   * org.opencmis.client.provider.ExtensionsData)
    */
   public void updateProperties(String repositoryId, Holder<String> objectId,
       Holder<String> changeToken, PropertiesData properties, ExtensionsData extension) {
@@ -701,10 +696,10 @@
     
     // if the object is a versionable object it must be checked-out
     if (so instanceof VersionedDocument || so instanceof DocumentVersion) {
-      String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
-      VersionedDocument verDoc = testIsNotCheckedOutBySomeoneElse(so, user); 
-      isCheckedOut = verDoc.isCheckedOut();
-      // so = verDoc; TODO
+      String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
+      //VersionedDocument verDoc = testIsNotCheckedOutBySomeoneElse(so, user); 
+      testHasProperCheckedOutStatus(so, user);
+      isCheckedOut = true;
     }
 
     Map<String, PropertyData<?>> oldProperties = so.getProperties();
@@ -767,7 +762,7 @@
 
     if (hasUpdatedOtherProps) {
       // set user, creation date, etc.
-      String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+      String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
 
       if (user == null)
         user = "unknown";
@@ -829,9 +824,9 @@
   private ContentStreamData getContentStream(StoredObject so, String streamId, BigInteger offset,
       BigInteger length) {
 
-    Long lOffset = offset == null ? null : offset.longValue();
-    Long lLength = length == null ? null : length.longValue();
-    ContentStreamData csd = ((Content) so).getContent();
+    long lOffset = offset == null ? 0 : offset.longValue();
+    long lLength = length == null ? -1 : length.longValue();
+    ContentStreamData csd = ((Content) so).getContent(lOffset, lLength);
     return csd;
   }
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/VersioningServiceImpl.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/VersioningServiceImpl.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/VersioningServiceImpl.java Mon Feb 22 08:58:39 2010
@@ -45,6 +45,7 @@
 import org.apache.opencmis.inmemory.storedobj.api.StoredObject;
 import org.apache.opencmis.inmemory.storedobj.api.VersionedDocument;
 import org.apache.opencmis.inmemory.types.PropertyCreationHelper;
+import org.apache.opencmis.server.spi.CallContext;
 
 public class VersioningServiceImpl extends AbstractServiceImpl implements VersioningService {
   
@@ -63,7 +64,7 @@
     ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
     StoredObject so = objectStore.getObjectById(objectId);
     
-    String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+    String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
     VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
     verDoc.cancelCheckOut(user);
@@ -78,7 +79,7 @@
     ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
     StoredObject so = objectStore.getObjectById(objectId.getValue());
 
-    String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+    String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
     VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
     DocumentVersion  pwc = verDoc.getPwc();
@@ -113,15 +114,15 @@
     
     if (so instanceof DocumentVersion) {
       // get document the version is contained in to c
-      content = ((DocumentVersion) so).getContent();
+      content = ((DocumentVersion) so).getContent(0, -1);
     } else {
-      content = ((VersionedDocument) so).getLatestVersion(false).getContent();
+      content = ((VersionedDocument) so).getLatestVersion(false).getContent(0, -1);
     }
     
     if (verDoc.isCheckedOut())
       throw new CmisUpdateConflictException("Document " + objectId.getValue() + " is already checked out.");
     
-    String user = RuntimeContext.getRuntimeConfigValue(ConfigConstants.USERNAME);
+    String user = RuntimeContext.getRuntimeConfigValue(CallContext.USERNAME);
     checkHasUser(user);    
     
     DocumentVersion pwc = verDoc.checkOut(content, user);
@@ -140,7 +141,7 @@
 
     VersionedDocument verDoc = (VersionedDocument)so;
     List<ObjectData> res = new ArrayList<ObjectData> ();
-    List<DocumentVersion> versions = verDoc.getAllVersions(filter);
+    List<DocumentVersion> versions = verDoc.getAllVersions();
     for (DocumentVersion version : versions) {
       ObjectData objData = getObject(repositoryId, version.getId(), filter, includeAllowableActions, extension);
       res.add(objData);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/CmisInMemorySpi.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/CmisInMemorySpi.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/CmisInMemorySpi.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/clientprovider/CmisInMemorySpi.java Mon Feb 22 08:58:39 2010
@@ -18,6 +18,9 @@
  */
 package org.apache.opencmis.inmemory.clientprovider;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.opencmis.client.provider.spi.CmisSpi;
 import org.apache.opencmis.client.provider.spi.Session;
 import org.apache.opencmis.commons.provider.AclService;
@@ -30,13 +33,13 @@
 import org.apache.opencmis.commons.provider.RepositoryInfoData;
 import org.apache.opencmis.commons.provider.RepositoryService;
 import org.apache.opencmis.commons.provider.VersioningService;
+import org.apache.opencmis.inmemory.CmisInMemoryProvider;
 import org.apache.opencmis.inmemory.ConfigConstants;
 import org.apache.opencmis.inmemory.NavigationServiceImpl;
 import org.apache.opencmis.inmemory.ObjectServiceImpl;
 import org.apache.opencmis.inmemory.RepositoryServiceImpl;
 import org.apache.opencmis.inmemory.VersioningServiceImpl;
 import org.apache.opencmis.inmemory.storedobj.api.StoreManager;
-import org.apache.opencmis.inmemory.storedobj.impl.SessionConfigReader;
 import org.apache.opencmis.inmemory.storedobj.impl.StoreManagerFactory;
 import org.apache.opencmis.inmemory.storedobj.impl.StoreManagerImpl;
 
@@ -47,16 +50,10 @@
  * @author Jens
  * 
  */
-public class CmisInMemorySpi implements CmisSpi {
+public class CmisInMemorySpi extends CmisInMemoryProvider implements CmisSpi {
 
   // private static Log log = LogFactory.getLog(CmisInMemorySpi.class);
   private Session fSession;
-  private RepositoryService fRepositoryService;
-  private NavigationService fNavigationService;
-  private ObjectService fObjectService;
-  private VersioningService fVersioningService;
-  private RepositoryInfoData fRepositoryInfo;
-  private StoreManager fStoreManager;
   
   CmisInMemorySpi(Session session) { // package visibility
     fSession = session;
@@ -196,35 +193,19 @@
   // ---- internal ----
     
   private void setup() {
-    String repositoryClassName = (String) fSession.get(ConfigConstants.REPOSITORY_CLASS);
-    if (null==repositoryClassName)
-      repositoryClassName = StoreManagerImpl.class.getName();
-    
-    fStoreManager = StoreManagerFactory.createInstance(repositoryClassName);
-    SessionConfigReader cfgReader = new SessionConfigReader(fSession);
-    fStoreManager.setConfigReader(cfgReader);
-    String repositoryId  = (String) fSession.get(ConfigConstants.REPOSITORY_ID);
+    Map<String, String> cfgParams = new HashMap<String, String>();
+    String[] configParamKeys = {ConfigConstants.REPOSITORY_CLASS, ConfigConstants.REPOSITORY_ID, 
+        ConfigConstants.TYPE_CREATOR_CLASS };
+
     
-    // first create repository
-    if (null != repositoryId ) {
-      fStoreManager.createRepository(repositoryId);
+    for (String key : configParamKeys) {
+      String value = (String) fSession.get(key);
+      if (null != value)
+        cfgParams.put(key, value);
     }
     
-    // then create/initialize type system
-    String typeCreatorClassName = (String) fSession.get(ConfigConstants.TYPE_CREATOR_CLASS);
-    fStoreManager.initTypeSystem(repositoryId, typeCreatorClassName);
-
-    // then init repository (note: loads root folder which requires cmis:folder type available)
-    fStoreManager.initRepository(repositoryId, true);
-
-    String repoInfoCreatorClassName = (String) fSession.get(ConfigConstants.REPOSITORY_INFO_CREATOR_CLASS);
-    fStoreManager.initRepositoryInfo(repositoryId, repoInfoCreatorClassName);    
-
-    // initialize services
-    fRepositoryService = new RepositoryServiceImpl(fStoreManager);
-    fNavigationService = new NavigationServiceImpl(fStoreManager);
-    fObjectService = new ObjectServiceImpl(fStoreManager);
-    fVersioningService = new VersioningServiceImpl(fStoreManager, fObjectService);    
+
+    super.setup(cfgParams);
   }
 
   

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/AtomLinkInfoProvider.java Mon Feb 22 08:58:39 2010
@@ -27,11 +27,13 @@
 import org.apache.opencmis.commons.provider.ObjectInFolderList;
 import org.apache.opencmis.commons.provider.ObjectList;
 import org.apache.opencmis.commons.provider.ObjectParentData;
-import org.apache.opencmis.inmemory.storedobj.api.Document;
+import org.apache.opencmis.inmemory.storedobj.api.Content;
+import org.apache.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.opencmis.inmemory.storedobj.api.ObjectStore;
+import org.apache.opencmis.inmemory.storedobj.api.Path;
 import org.apache.opencmis.inmemory.storedobj.api.StoreManager;
 import org.apache.opencmis.inmemory.storedobj.api.StoredObject;
-import org.apache.opencmis.inmemory.storedobj.api.Path;
+import org.apache.opencmis.inmemory.storedobj.api.VersionedDocument;
 import org.apache.opencmis.server.spi.ObjectInfoHolder;
 import org.apache.opencmis.server.spi.ObjectInfoImpl;
 
@@ -67,7 +69,8 @@
     
     ObjectInfoImpl objInfo = new ObjectInfoImpl();
     ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
-    StoredObject so = objectStore.getObjectById(objectId);    
+    StoredObject so = objectStore.getObjectById(objectId);   
+
     TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, so.getTypeId()).getTypeDefinition();
     
     // Fill all setters:
@@ -79,17 +82,33 @@
     objInfo.setTypeId(so.getTypeId());
     objInfo.setBaseType(typeDef.getBaseId());
     
-    // versioning information: currently only non-versioned documents supported by in-memory provider
-    objInfo.setIsCurrentVersion (true); 
-    objInfo.setHasVersionHistory(false);
-    objInfo.setWorkingCopyId(null);
-    objInfo.setWorkingCopyOriginalId(null);
-    
-    if (so instanceof Document) {
-      Document doc = ((Document)so);
-      objInfo.setHasContent(doc.getContent() != null);
-      objInfo.setContentType(doc.getContent() != null ? doc.getContent().getMimeType() : null);
-      objInfo.setFileName(doc.getContent() != null ? doc.getContent().getFilename() : null);
+    // versioning information: 
+    if (so instanceof DocumentVersion) {
+      DocumentVersion ver = (DocumentVersion) so;
+      DocumentVersion pwc = ver.getParentDocument().getPwc();
+      objInfo.setIsCurrentVersion (ver == ver.getParentDocument().getLatestVersion(false)); 
+      objInfo.setHasVersionHistory(true);
+      objInfo.setWorkingCopyId(pwc==null ? null : pwc.getId());
+      objInfo.setWorkingCopyOriginalId(pwc==null ? null : pwc.getId());
+    } else if (so instanceof VersionedDocument) {
+      VersionedDocument doc = (VersionedDocument) so;
+      DocumentVersion pwc = doc.getPwc();
+      objInfo.setIsCurrentVersion (false); 
+      objInfo.setHasVersionHistory(true);
+      objInfo.setWorkingCopyId(pwc==null ? null : pwc.getId());
+      objInfo.setWorkingCopyOriginalId(pwc==null ? null : pwc.getId());      
+    } else { // unversioned document
+      objInfo.setIsCurrentVersion (true); 
+      objInfo.setHasVersionHistory(false);
+      objInfo.setWorkingCopyId(null);
+      objInfo.setWorkingCopyOriginalId(null);
+    }
+    
+    if (so instanceof Content) {
+      Content cont = ((Content)so);
+      objInfo.setHasContent(cont.getContent(0, -1) != null);
+      objInfo.setContentType(cont.getContent(0, -1) != null ? cont.getContent(0, -1).getMimeType() : null);
+      objInfo.setFileName(cont.getContent(0, -1) != null ? cont.getContent(0, -1).getFilename() : null);
     } else {
       objInfo.setHasContent(false);
       objInfo.setContentType(null);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryDiscoveryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryDiscoveryService.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryDiscoveryService.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryDiscoveryService.java Mon Feb 22 08:58:39 2010
@@ -62,7 +62,7 @@
     // dummy implementation using hard coded values
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     RepositoryInfoData rep = fRepositoryService.getRepositoryInfo(repositoryId, null);
     String rootFolderId = rep.getRootFolderId();
@@ -108,7 +108,7 @@
     // dummy implementation using hard coded values
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     // use descendants of root folder as result
     RepositoryInfoData rep = fRepositoryService.getRepositoryInfo(repositoryId, null);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryNavigationService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryNavigationService.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryNavigationService.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryNavigationService.java Mon Feb 22 08:58:39 2010
@@ -38,7 +38,6 @@
 public class InMemoryNavigationService implements CmisNavigationService  {
   StoreManager fStoreManager;
   NavigationService fNavigationService; // real implementation of the service
-  CallContextConfigReader fCfgReader = null;
   AtomLinkInfoProvider fAtomLinkProvider;
   
   InMemoryNavigationService(StoreManager storeManager) {
@@ -53,7 +52,7 @@
       BigInteger skipCount, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
     
     ObjectList res = fNavigationService.getCheckedOutDocs(repositoryId, folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, maxItems, skipCount, extension);
     
@@ -70,7 +69,7 @@
       ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
     
     ObjectInFolderList res = fNavigationService.getChildren(repositoryId, folderId, filter, orderBy, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, maxItems, skipCount, extension);
     
@@ -87,7 +86,7 @@
       Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     List<ObjectInFolderContainer> res = fNavigationService.getDescendants(repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension);
     
@@ -101,7 +100,7 @@
       String filter, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     ObjectData res = fNavigationService.getFolderParent(repositoryId, folderId, filter, extension);
 
@@ -118,7 +117,7 @@
       Boolean includePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     List<ObjectInFolderContainer> res = fNavigationService.getFolderTree(repositoryId, folderId, depth, filter, includeAllowableActions, includeRelationships, renditionFilter, includePathSegment, extension);
     
@@ -134,7 +133,7 @@
       Boolean includeRelativePathSegment, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     List<ObjectParentData> res = fNavigationService.getObjectParents(repositoryId, objectId, filter, includeAllowableActions, includeRelationships, renditionFilter, includeRelativePathSegment, extension);
     

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectService.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectService.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryObjectService.java Mon Feb 22 08:58:39 2010
@@ -40,8 +40,13 @@
 import org.apache.opencmis.commons.provider.PropertiesData;
 import org.apache.opencmis.commons.provider.PropertyData;
 import org.apache.opencmis.commons.provider.RenditionData;
+import org.apache.opencmis.commons.provider.VersioningService;
 import org.apache.opencmis.inmemory.ObjectServiceImpl;
+import org.apache.opencmis.inmemory.VersioningServiceImpl;
+import org.apache.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.opencmis.inmemory.storedobj.api.StoreManager;
+import org.apache.opencmis.inmemory.storedobj.api.StoredObject;
+import org.apache.opencmis.inmemory.storedobj.api.VersionedDocument;
 import org.apache.opencmis.inmemory.types.InMemoryDocumentTypeDefinition;
 import org.apache.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
 import org.apache.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
@@ -54,14 +59,15 @@
   private static final Log LOG = LogFactory.getLog(ServiceFactory.class.getName());
 
   StoreManager fStoreManager;
+  VersioningService fVersioningService; // real implementation of the service
   ObjectService fObjectService; // real implementation of the service
-  CallContextConfigReader fCfgReader = null;
   AtomLinkInfoProvider fAtomLinkProvider;
 
   InMemoryObjectService(StoreManager storeManager) {
     fStoreManager = storeManager;
     fObjectService = new ObjectServiceImpl(fStoreManager);
     fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
+    fVersioningService = new VersioningServiceImpl(fStoreManager, fObjectService);
   }
   
   ObjectService getObjectService() {
@@ -74,7 +80,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.createDocument(repositoryId, properties, folderId, contentStream,
         versioningState, policies, addAces, removeAces, extension);
@@ -86,7 +92,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.createDocumentFromSource(repositoryId, sourceId, properties, folderId,
         versioningState, policies, addAces, removeAces, extension);
@@ -97,7 +103,7 @@
       AccessControlList removeAces, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.createFolder(repositoryId, properties, folderId, policies, addAces,
         removeAces, extension);
@@ -108,7 +114,7 @@
       AccessControlList removeAces, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.createPolicy(repositoryId, properties, folderId, policies, addAces,
         removeAces, extension);
@@ -119,14 +125,14 @@
       AccessControlList removeAces, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.createRelationship(repositoryId, properties, policies, addAces,
         removeAces, extension);
   }
 
   /* (non-Javadoc)
-   * @see org.apache.opencmis.server.spi.CmisObjectService#create(org.apache.opencmis.server.spi.CallContext, java.lang.String, org.apache.opencmis.client.provider.PropertiesData, java.lang.String, org.apache.opencmis.client.provider.ContentStreamData, org.apache.opencmis.commons.enums.VersioningState, org.apache.opencmis.client.provider.ExtensionsData, org.apache.opencmis.server.spi.ObjectInfoHolder)
+   * @see org.opencmis.server.spi.CmisObjectService#create(org.opencmis.server.spi.CallContext, java.lang.String, org.opencmis.client.provider.PropertiesData, java.lang.String, org.opencmis.client.provider.ContentStreamData, org.opencmis.commons.enums.VersioningState, org.opencmis.client.provider.ExtensionsData, org.opencmis.server.spi.ObjectInfoHolder)
    * 
    * An additional create call compared to the ObjectService from the CMIS spec.
    * This one is needed because the Atom binding in the server implementation does 
@@ -139,7 +145,7 @@
       ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
     
     if (null==properties || null==properties.getProperties())
         throw new RuntimeException("Cannot create object, without properties.");
@@ -183,7 +189,7 @@
       Holder<String> objectId, Holder<String> changeToken, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     fObjectService.deleteContentStream(repositoryId, objectId, changeToken, extension);
   }
@@ -192,9 +198,20 @@
       Boolean allVersions, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
-    fObjectService.deleteObject(repositoryId, objectId, allVersions, extension);
+    StoredObject so = fStoreManager.getObjectStore(repositoryId).getObjectById(objectId);
+    boolean mustCancelCheckout = false;
+    if (so instanceof DocumentVersion) {
+      mustCancelCheckout = ((DocumentVersion)so).getParentDocument().isCheckedOut();
+    } else if (so instanceof VersionedDocument) {
+      mustCancelCheckout = ((VersionedDocument)so).isCheckedOut();      
+    }
+    
+    if (mustCancelCheckout)
+      fVersioningService.cancelCheckOut(repositoryId, objectId, extension);
+    else
+      fObjectService.deleteObject(repositoryId, objectId, allVersions, extension);
   }
 
   public FailedToDeleteData deleteTree(CallContext context, String repositoryId, String folderId,
@@ -202,7 +219,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.deleteTree(repositoryId, folderId, allVersions, unfileObjects,
         continueOnFailure, extension);
@@ -212,7 +229,7 @@
       String objectId, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.getAllowableActions(repositoryId, objectId, extension);
   }
@@ -222,7 +239,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.getContentStream(repositoryId, objectId, streamId, offset, length,
         extension);
@@ -234,7 +251,7 @@
       ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     ObjectData res = fObjectService.getObject(repositoryId, objectId, filter,
         includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds,
@@ -254,7 +271,7 @@
       ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     ObjectData res = fObjectService.getObjectByPath(repositoryId, path, filter,
         includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds,
@@ -271,7 +288,7 @@
       String filter, ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     PropertiesData res = fObjectService.getProperties(repositoryId, objectId, filter, extension);
 
@@ -283,7 +300,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fObjectService.getRenditions(repositoryId, objectId, renditionFilter, maxItems,
         skipCount, extension);
@@ -294,7 +311,7 @@
       ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     fObjectService.moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
 
@@ -315,7 +332,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     fObjectService.setContentStream(repositoryId, objectId, overwriteFlag, changeToken,
         contentStream, extension);
@@ -326,7 +343,7 @@
       ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     if (null!=properties)
       fObjectService.updateProperties(repositoryId, objectId, changeToken, properties, extension);

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryRepositoryService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryRepositoryService.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryRepositoryService.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryRepositoryService.java Mon Feb 22 08:58:39 2010
@@ -45,7 +45,7 @@
       ExtensionsData extension) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
     
     return fRepositoryService.getRepositoryInfo(repositoryId, extension);
   }
@@ -53,7 +53,7 @@
   public List<RepositoryInfoData> getRepositoryInfos(CallContext context, ExtensionsData extension) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fRepositoryService.getRepositoryInfos(extension);
   }
@@ -63,7 +63,7 @@
       ExtensionsData extension) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fRepositoryService.getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension);
   }
@@ -72,7 +72,7 @@
       String typeId, ExtensionsData extension) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fRepositoryService.getTypeDefinition(repositoryId, typeId, extension);
   }
@@ -81,7 +81,7 @@
       String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     return fRepositoryService.getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension);
   }

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryVersioningService.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryVersioningService.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryVersioningService.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/InMemoryVersioningService.java Mon Feb 22 08:58:39 2010
@@ -43,7 +43,6 @@
   StoreManager fStoreManager;
   VersioningService fVersioningService; // real implementation of the service
   ObjectService fObjectService; // real implementation of the service
-  CallContextConfigReader fCfgReader = null;
   AtomLinkInfoProvider fAtomLinkProvider;
 
   public InMemoryVersioningService(StoreManager storeManager, ObjectService objectService) {
@@ -58,7 +57,7 @@
       ExtensionsData extension) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     fVersioningService.cancelCheckOut(repositoryId, objectId, extension);
 
@@ -70,7 +69,7 @@
       AccessControlList removeAces, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     fVersioningService.checkIn(repositoryId, objectId, major, properties, contentStream,
         checkinComment, policies, addAces, removeAces, extension);
@@ -90,14 +89,20 @@
       ExtensionsData extension, Holder<Boolean> contentCopied, ObjectInfoHolder objectInfos) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     fVersioningService.checkOut(repositoryId, objectId, extension, contentCopied);
     
     // To be able to provide all Atom links in the response we need additional information:
     fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, objectId.getValue(), objectInfos);
 
-    return null;
+    ObjectData objData = null; 
+    if (context.getBinding().equals(CallContext.BINDING_ATOMPUB)) {
+      objData = fObjectService.getObject(repositoryId, objectId.getValue(), "*", false,
+          IncludeRelationships.NONE, null, false, false, extension);      
+    }
+    
+    return objData;
   }
 
   public List<ObjectData> getAllVersions(CallContext context, String repositoryId,
@@ -105,7 +110,7 @@
       ExtensionsData extension, ObjectInfoHolder objectInfos) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     List<ObjectData> res = fVersioningService.getAllVersions(repositoryId, versionSeriesId, filter, includeAllowableActions, extension);
     
@@ -123,7 +128,7 @@
       Boolean includeAcl, ExtensionsData extension, ObjectInfoHolder objectInfos) {
 
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     ObjectData res = fVersioningService.getObjectOfLatestVersion(repositoryId, versionSeriesId, major, filter,
         includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds,
@@ -139,7 +144,7 @@
       String versionSeriesId, Boolean major, String filter, ExtensionsData extension) {
     
     // Attach the CallContext to a thread local context that can be accessed from everywhere
-    RuntimeContext.getRuntimeConfig().attachCfg(new CallContextConfigReader(context));
+    RuntimeContext.getRuntimeConfig().attachCfg(context);
 
     PropertiesData res = fVersioningService.getPropertiesOfLatestVersion(repositoryId, versionSeriesId, major, filter, extension);
 

Modified: incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/RuntimeContext.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/RuntimeContext.java?rev=912517&r1=912516&r2=912517&view=diff
==============================================================================
--- incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/RuntimeContext.java (original)
+++ incubator/chemistry/trunk/opencmis/opencmis-server/opencmis-server-inmemory/src/main/java/org/apache/opencmis/inmemory/server/RuntimeContext.java Mon Feb 22 08:58:39 2010
@@ -18,7 +18,7 @@
  */
 package org.apache.opencmis.inmemory.server;
 
-import org.apache.opencmis.inmemory.ConfigMap;
+import org.apache.opencmis.server.spi.CallContext;
 
 
 /**
@@ -29,10 +29,10 @@
  *
  */
 public class RuntimeContext {
-  public static class ThreadLocalRuntimeConfig extends ThreadLocal<ConfigMap> {    
+  public static class ThreadLocalRuntimeConfig extends ThreadLocal<CallContext> {    
 
-    public void attachCfg(ConfigMap cfgMap) {
-      set(cfgMap);      
+    public void attachCfg(CallContext ctx) {
+      set(ctx);      
     }
 
     public synchronized String getConfigValue(String key) {



Mime
View raw message