chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1514297 [1/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org...
Date Thu, 15 Aug 2013 14:31:21 GMT
Author: jens
Date: Thu Aug 15 14:31:20 2013
New Revision: 1514297

URL: http://svn.apache.org/r1514297
Log:
InMemory Code Cleanup

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigConstants.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/PropertyQueryUtil.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAclService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryVersioningServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/DocumentVersionImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/FolderImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ImageThumbnailGenerator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAce.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryAcl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DefaultTypeSystemCreator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeDefinitions.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/webapp/WEB-INF/classes/repository.properties
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigConstants.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/ConfigConstants.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigConstants.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigConstants.java Thu Aug 15 14:31:20 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.chemistry.opencmis.inmemory;
 
-public class ConfigConstants {
+public final class ConfigConstants {
     public static final String REPOSITORY_ID = "InMemoryServer.RepositoryId";
     public static final String TYPE_XML = "InMemoryServer.TypeDefinitionsFile";
     public static final String TYPE_CREATOR_CLASS = "InMemoryServer.TypesCreatorClass";

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.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/ConfigurationSettings.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/ConfigurationSettings.java Thu Aug 15 14:31:20 2013
@@ -20,16 +20,17 @@ package org.apache.chemistry.opencmis.in
 
 import java.util.Map;
 
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ConfigurationSettings {
+public final class ConfigurationSettings {
 
     private static final Logger LOG = LoggerFactory.getLogger(ConfigurationSettings.class.getName());
 
     private static ConfigurationSettings singleInstance;
 
-    final Map<String, String> parameters;
+    private final Map<String, String> parameters;
 
     private ConfigurationSettings(Map<String, String> parameters) {
         this.parameters = parameters;
@@ -42,7 +43,7 @@ public class ConfigurationSettings {
     public static String getConfigurationValueAsString(String key) {
         if (null == singleInstance) {
             LOG.error("ConfigurationSettings are not initialized. Initialize before reading values");
-            throw new RuntimeException("ConfigurationSettings are not initialized.");
+            throw new CmisRuntimeException("ConfigurationSettings are not initialized.");
         }
         return singleInstance.getConfigurationValueIntern(key);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.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/DataObjectCreator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/DataObjectCreator.java Thu Aug 15 14:31:20 2013
@@ -18,7 +18,6 @@
  */
 package org.apache.chemistry.opencmis.inmemory;
 
-import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -55,9 +54,7 @@ import org.apache.chemistry.opencmis.ser
  * @author Jens A collection of utility functions to fill the data objects used
  *         as return values for the service object calls
  */
-public class DataObjectCreator {
-
-    public static BigInteger MINUS_ONE = BigInteger.valueOf(-1L);
+public final class DataObjectCreator {
 
     // Utility class
     private DataObjectCreator() {
@@ -170,7 +167,6 @@ public class DataObjectCreator {
     public static Acl fillACL(StoredObject so) {
         AccessControlListImpl acl = new AccessControlListImpl();
         List<Ace> aces = new ArrayList<Ace>();
-        // TODO to be completed if ACLs are implemented
         acl.setAces(aces);
         return acl;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.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/NameValidator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/NameValidator.java Thu Aug 15 14:31:20 2013
@@ -19,7 +19,7 @@
 
 package org.apache.chemistry.opencmis.inmemory;
 
-public class NameValidator {
+public final class NameValidator {
 
     public static final String ERROR_ILLEGAL_ID = "Id contains illegal characters, allowed are 'a'..'z', 'A'..'Z', '0'..'9', '-', '_'";
     public static final String ERROR_ILLEGAL_NAME = "Name contains illegal characters, not allowed are '/', '\\', ':', '\"', '*'. '?', '<','>', '|'";

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.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/TypeManagerImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeManagerImpl.java Thu Aug 15 14:31:20 2013
@@ -114,8 +114,7 @@ public class TypeManagerImpl implements 
             createCmisDefaultTypes();
 
         // merge all types from the list and build the correct hierachy with
-        // children
-        // and property lists
+        // children and property lists
         if (null != typesList) {
             for (TypeDefinition typeDef : typesList) {
                 addTypeDefinition(typeDef, true);
@@ -208,7 +207,6 @@ public class TypeManagerImpl implements 
         if (null != typeDefinition.getPropertyDefinitions())
          {
             addInheritedPropertyDefinitions(propDefs, typeDefinition.getPropertyDefinitions());
-        // propDefs.putAll(typeDefinition.getPropertyDefinitions());
         }
 
         TypeDefinitionContainer parentTypeContainer = fTypesMap.get(typeDefinition.getParentTypeId());
@@ -237,17 +235,6 @@ public class TypeManagerImpl implements 
 
     private static boolean isRootType(TypeDefinitionContainer c) {
         return (c.getTypeDefinition().getId().equals(c.getTypeDefinition().getBaseTypeId().value()));
-//        if (c.getTypeDefinition().equals(InMemoryFolderTypeDefinition.getRootFolderType())
-//                || c.getTypeDefinition().equals(InMemoryDocumentTypeDefinition.getRootDocumentType())
-//                || c.getTypeDefinition().equals(InMemoryRelationshipTypeDefinition.getRootRelationshipType())
-//                || c.getTypeDefinition().equals(InMemoryPolicyTypeDefinition.getRootPolicyType())
-//                || c.getTypeDefinition().equals(InMemoryItemTypeDefinition.getRootItemType()) // CMIS 1.1
-//                || c.getTypeDefinition().equals(InMemorySecondaryTypeDefinition.getRootSecondaryType()) // CMIS 1.1
-//                ) {
-//            return true;
-//        } else {
-//            return false;
-//        }
     }
 
     private static PropertyDefinition<?> clonePropertyDefinition(PropertyDefinition<?> src) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.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/TypeValidator.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/TypeValidator.java Thu Aug 15 14:31:20 2013
@@ -31,15 +31,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.FolderTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.ItemTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PolicyTypeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyBooleanDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDateTimeDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyDecimalDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyHtmlDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyIdDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyIntegerDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyStringDefinition;
-import org.apache.chemistry.opencmis.commons.definitions.PropertyUriDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.SecondaryTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
@@ -58,14 +50,6 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ItemTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
-import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.SecondaryTypeDefinitionImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeMutabilityImpl;
@@ -82,7 +66,10 @@ public class TypeValidator {
     
     private static final Object CMIS_USER = "cmis:user";
 
-	public static void checkType(TypeManager tm, TypeDefinition td) {
+	private TypeValidator() {	    
+	}
+	
+    public static void checkType(TypeManager tm, TypeDefinition td) {
 
 	    if(null == td) {
 	        throw new CmisInvalidArgumentException("Cannot add type, because the type defintion is null.");  
@@ -101,7 +88,7 @@ public class TypeValidator {
         checkTypeId(tm, td.getId());
         checkTypeQueryName(tm, td.getQueryName());
         checkTypeLocalName(tm, td.getLocalName());
-        checkBaseAndParentType(tm, td);
+        checkBaseAndParentType(td);
         
         if (null != td.getPropertyDefinitions())
             TypeValidator.checkProperties(tm, td.getPropertyDefinitions().values());        
@@ -405,7 +392,7 @@ public class TypeValidator {
         }
     }
 
-    private static void checkBaseAndParentType(TypeManager tm, TypeDefinition td) {
+    private static void checkBaseAndParentType(TypeDefinition td) {
         if (null == td.getBaseTypeId()) 
             throw new CmisInvalidArgumentException("You cannot create a type without a base type id: " + td.getId());
         if (null == td.getParentTypeId()) 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.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/query/InMemoryQueryProcessor.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/InMemoryQueryProcessor.java Thu Aug 15 14:31:20 2013
@@ -219,7 +219,6 @@ public class InMemoryQueryProcessor {
                         result = ((Comparable<Object>) propVal1).compareTo(propVal2);
                     }
                 } else {
-                    // String funcName = ((FunctionReference) sel).getName();
                     // evaluate function here, currently ignore
                     result = 0;
                 }
@@ -245,9 +244,7 @@ public class InMemoryQueryProcessor {
      *            object stored in the in-memory repository
      */
     private void match(StoredObject so, String user, boolean searchAllVersions) {
-        // log.debug("checkMatch() for object: " + so.getId());
         // first check if type is matching...
-
         // as we don't support joins take first type
         String queryName = queryObj.getTypes().values().iterator().next(); 
 
@@ -303,8 +300,8 @@ public class InMemoryQueryProcessor {
 
         @Override
         public Boolean walkNot(Tree opNode, Tree node) {
-            boolean matches = walkPredicate(node);
-            return !matches;
+            boolean hasMatched = walkPredicate(node);
+            return !hasMatched;
         }
 
         @Override
@@ -551,8 +548,6 @@ public class InMemoryQueryProcessor {
         protected Integer compareTo(Tree leftChild, Tree rightChild) {
             Object rVal = walkExpr(rightChild);
 
-            // log.debug("retrieve node from where: " +
-            // System.identityHashCode(leftChild) + " is " + leftChild);
             ColumnReference colRef = getColumnReference(leftChild);
             PropertyDefinition<?> pd = colRef.getPropertyDefinition();
             Object val = PropertyQueryUtil.getProperty(so, colRef.getPropertyId(), pd);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/PropertyQueryUtil.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/query/PropertyQueryUtil.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/PropertyQueryUtil.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/PropertyQueryUtil.java Thu Aug 15 14:31:20 2013
@@ -29,7 +29,6 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Document;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Folder;
-import org.apache.chemistry.opencmis.inmemory.storedobj.api.ObjectStore;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Policy;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.Relationship;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
@@ -37,6 +36,9 @@ import org.apache.chemistry.opencmis.inm
 
 public class PropertyQueryUtil {
     
+    private PropertyQueryUtil() {        
+    }
+    
     public static Object getProperty(StoredObject so, String propertyId, PropertyDefinition<?> pd) {
         ContentStream content = null;
         DocumentVersion ver = null;
@@ -74,7 +76,7 @@ public class PropertyQueryUtil {
             return so.getTypeId();
         }
         if (propertyId.equals(PropertyIds.BASE_TYPE_ID)) {
-            return null; // TOODO: return so.getBaseTypeId());
+            return null; // base type id not available from so;
         }
         if (propertyId.equals(PropertyIds.CREATED_BY)) {
             return so.getCreatedBy();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.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/AbstractServiceImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AbstractServiceImpl.java Thu Aug 15 14:31:20 2013
@@ -22,6 +22,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.Properties;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
@@ -94,7 +95,7 @@ public class AbstractServiceImpl {
         String typeId = (String) properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID).getFirstValue();
         TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
         if (typeDefC == null) {
-            throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
+            throw new CmisInvalidArgumentException("Cannot create object, a type with id " + typeId + " is unknown");
         }
 
         return typeDefC.getTypeDefinition();
@@ -151,8 +152,7 @@ public class AbstractServiceImpl {
 
     protected void checkIsVersionableObject(StoredObject so) {
         if (!(so instanceof VersionedDocument || so instanceof DocumentVersion)) {
-            throw new RuntimeException(
-                    "Object is of a versionable type but not instance of VersionedDocument or DocumentVersion.");
+            throw new CmisInvalidArgumentException("Object " + so.getId() + " must of a versionable type.");
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.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/AtomLinkInfoProvider.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/AtomLinkInfoProvider.java Thu Aug 15 14:31:20 2013
@@ -265,7 +265,7 @@ public class AtomLinkInfoProvider {
             if (null != listObjects) {
                 for (ObjectData object : listObjects) {
                     objectInfo = new ObjectInfoImpl();
-                    fillInformationForAtomLinks(repositoryId, object, objectInfo);
+                    fillInformationForAtomLinks(object, objectInfo);
                     objectInfos.addObjectInfo(objectInfo);
                 }
             }
@@ -273,7 +273,7 @@ public class AtomLinkInfoProvider {
 
     }
 
-    private void fillInformationForAtomLinks(String repositoryId, ObjectData od, ObjectInfoImpl objectInfo) {
+    private void fillInformationForAtomLinks(ObjectData od, ObjectInfoImpl objectInfo) {
             objectInfo.setObject(od); 
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.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/BaseServiceValidatorImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/BaseServiceValidatorImpl.java Thu Aug 15 14:31:20 2013
@@ -41,6 +41,10 @@ import org.apache.chemistry.opencmis.inm
 
 public class BaseServiceValidatorImpl implements CmisServiceValidator {
 
+    protected static final String UNKNOWN_OBJECT_ID = "Unknown object id: ";
+    protected static final String UNKNOWN_REPOSITORY_ID = "Unknown repository id: ";
+    protected static final String OBJECT_ID_CANNOT_BE_NULL = "Object Id cannot be null.";
+    protected static final String REPOSITORY_ID_CANNOT_BE_NULL = "Repository Id cannot be null.";
     protected final StoreManager fStoreManager;
 
     public BaseServiceValidatorImpl(StoreManager sm) {
@@ -60,23 +64,23 @@ public class BaseServiceValidatorImpl im
      */
     protected StoredObject checkStandardParameters(String repositoryId, String objectId) {
         if (null == repositoryId) {
-            throw new CmisInvalidArgumentException("Repository Id cannot be null.");
+            throw new CmisInvalidArgumentException(REPOSITORY_ID_CANNOT_BE_NULL);
         }
 
         if (null == objectId) {
-            throw new CmisInvalidArgumentException("Object Id cannot be null.");
+            throw new CmisInvalidArgumentException(OBJECT_ID_CANNOT_BE_NULL);
         }
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
         if (objStore == null) {
-            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+            throw new CmisObjectNotFoundException(UNKNOWN_REPOSITORY_ID + repositoryId);
         }
 
         StoredObject so = objStore.getObjectById(objectId);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         return so;
@@ -84,7 +88,7 @@ public class BaseServiceValidatorImpl im
 
     protected StoredObject checkStandardParametersByPath(String repositoryId, String path, String user) {
         if (null == repositoryId) {
-            throw new CmisInvalidArgumentException("Repository Id cannot be null.");
+            throw new CmisInvalidArgumentException(REPOSITORY_ID_CANNOT_BE_NULL);
         }
 
         if (null == path) {
@@ -94,7 +98,7 @@ public class BaseServiceValidatorImpl im
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
         if (objStore == null) {
-            throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+            throw new CmisObjectNotFoundException(UNKNOWN_REPOSITORY_ID + repositoryId);
         }
 
         StoredObject so = objStore.getObjectByPath(path, user);
@@ -111,7 +115,7 @@ public class BaseServiceValidatorImpl im
         StoredObject so = null;
 
         if (null == repositoryId) {
-            throw new CmisInvalidArgumentException("Repository Id cannot be null.");
+            throw new CmisInvalidArgumentException(REPOSITORY_ID_CANNOT_BE_NULL);
         }
 
         if (null != objectId) {
@@ -119,13 +123,13 @@ public class BaseServiceValidatorImpl im
             ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
             if (objStore == null) {
-                throw new CmisObjectNotFoundException("Unknown repository id: " + repositoryId);
+                throw new CmisObjectNotFoundException(UNKNOWN_REPOSITORY_ID + repositoryId);
             }
 
             so = objStore.getObjectById(objectId);
 
             if (so == null) {
-                throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+                throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
             }
         }
 
@@ -135,13 +139,13 @@ public class BaseServiceValidatorImpl im
     protected StoredObject checkExistingObjectId(ObjectStore objStore, String objectId) {
 
         if (null == objectId) {
-            throw new CmisInvalidArgumentException("Object Id cannot be null.");
+            throw new CmisInvalidArgumentException(OBJECT_ID_CANNOT_BE_NULL);
         }
 
         StoredObject so = objStore.getObjectById(objectId);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         return so;
@@ -149,13 +153,13 @@ public class BaseServiceValidatorImpl im
 
     protected void checkRepositoryId(String repositoryId) {
         if (null == repositoryId) {
-            throw new CmisInvalidArgumentException("Repository Id cannot be null.");
+            throw new CmisInvalidArgumentException(REPOSITORY_ID_CANNOT_BE_NULL);
         }
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
         if (objStore == null) {
-            throw new CmisInvalidArgumentException("Unknown repository id: " + repositoryId);
+            throw new CmisInvalidArgumentException(UNKNOWN_REPOSITORY_ID + repositoryId);
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.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/InMemoryAbstractServiceImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAbstractServiceImpl.java Thu Aug 15 14:31:20 2013
@@ -50,7 +50,6 @@ public class InMemoryAbstractServiceImpl
         this.fStoreManager = storeManager;
         this.validator = validator;
         this.fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
-
     }
 
     protected InMemoryAbstractServiceImpl(StoreManager storeManager) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAclService.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/InMemoryAclService.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAclService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryAclService.java Thu Aug 15 14:31:20 2013
@@ -62,11 +62,11 @@ public class InMemoryAclService extends 
         return acl;
     }
 
-    public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces, Acl removeAces, AclPropagation aclPropagation,
+    public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aclAdd, Acl aclRemove, AclPropagation aclPropagation,
             ExtensionsData extension, ObjectInfoHandler objectInfos) {
 
-    	addAces  = TypeValidator.expandAclMakros(context.getUsername(), addAces);
-    	removeAces  = TypeValidator.expandAclMakros(context.getUsername(), removeAces);
+        Acl addAces  = TypeValidator.expandAclMakros(context.getUsername(), aclAdd);
+        Acl removeAces  = TypeValidator.expandAclMakros(context.getUsername(), aclRemove);
         
     	StoredObject so = validator.applyAcl(context, repositoryId, objectId, aclPropagation, extension);
         Acl acl = fStoreManager.getObjectStore(repositoryId).applyAcl(so, addAces, removeAces, aclPropagation, context.getUsername());
@@ -79,9 +79,9 @@ public class InMemoryAclService extends 
         return acl;       
     }
     
-    public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
+    public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl acesParam, AclPropagation aclPropagation) {
         
-    	aces  = TypeValidator.expandAclMakros(context.getUsername(), aces);
+        Acl aces  = TypeValidator.expandAclMakros(context.getUsername(), acesParam);
 
     	StoredObject so = validator.applyAcl(context, repositoryId, objectId);
         return fStoreManager.getObjectStore(repositoryId).applyAcl(so, aces, aclPropagation, context.getUsername());        

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.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/InMemoryDiscoveryServiceImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryDiscoveryServiceImpl.java Thu Aug 15 14:31:20 2013
@@ -30,12 +30,14 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer;
 import org.apache.chemistry.opencmis.commons.data.ObjectList;
+import org.apache.chemistry.opencmis.commons.data.PolicyIdList;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
 import org.apache.chemistry.opencmis.commons.enums.ChangeType;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChangeEventInfoDataImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyIdListImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
@@ -49,15 +51,8 @@ public class InMemoryDiscoveryServiceImp
     
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryDiscoveryServiceImpl.class);
 
-    final InMemoryNavigationServiceImpl fNavigationService; // real implementation of
-    // the service
-    final InMemoryRepositoryServiceImpl fRepositoryService;
-
-    public InMemoryDiscoveryServiceImpl(StoreManager storeManager, InMemoryRepositoryServiceImpl repSvc,
-            InMemoryNavigationServiceImpl navSvc) {
+    public InMemoryDiscoveryServiceImpl(StoreManager storeManager) {
         super(storeManager);
-        fNavigationService = navSvc;
-        fRepositoryService = repSvc;
     }
 
     public ObjectList getContentChanges(CallContext context, String repositoryId, Holder<String> changeLogToken,
@@ -82,8 +77,9 @@ public class InMemoryDiscoveryServiceImp
         changeEventInfo.setChangeTime(new GregorianCalendar());
         odImpl.setChangeEventInfo(changeEventInfo);
         if (includePolicyIds != null && includePolicyIds) {
-            // TODO set policies
-            // odImpl.setPolicyIds(policyIds)
+            PolicyIdList policies = new PolicyIdListImpl();
+            // TODO fill list
+            odImpl.setPolicyIds(policies);
         }
         lod.add(odImpl);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.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/InMemoryMultiFilingServiceImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryMultiFilingServiceImpl.java Thu Aug 15 14:31:20 2013
@@ -51,7 +51,7 @@ public class InMemoryMultiFilingServiceI
 
         StoredObject[] sos = validator.addObjectToFolder(context, repositoryId, objectId, folderId, allVersions, extension);
 
-        if (allVersions != null && allVersions.booleanValue() == false) {
+        if (allVersions != null && null != allVersions && !allVersions.booleanValue()) {
             throw new CmisNotSupportedException(
                     "Cannot add object to folder, version specific filing is not supported.");
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.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/InMemoryNavigationServiceImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryNavigationServiceImpl.java Thu Aug 15 14:31:20 2013
@@ -330,9 +330,6 @@ public class InMemoryNavigationServiceIm
             Boolean includePathSegments, int level, int maxLevels, boolean folderOnly, ObjectInfoHandler objectInfos,
             String user) {
 
-        // log.info("getDescendantsIntern: " + folderId + ", in level " + level
-        // + ", max levels " + maxLevels);
-
         List<ObjectInFolderContainer> childrenOfFolderId = null;
         if (maxLevels == -1 || level < maxLevels) {
             String orderBy = PropertyIds.NAME;
@@ -411,7 +408,6 @@ public class InMemoryNavigationServiceIm
         parent.setRelationships(DataObjectCreator.getRelationships(tm, objStore, includeRelationships, parentFolder, user));
         
         if (includeAllowableActions != null && includeAllowableActions) {
-            //  AllowableActions allowableActions = DataObjectCreator.fillAllowableActions(spo, user);
           	AllowableActions allowableActions = parentFolder.getAllowableActions(user);
           	parent.setAllowableActions(allowableActions);
           }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.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/InMemoryObjectServiceImpl.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryObjectServiceImpl.java Thu Aug 15 14:31:20 2013
@@ -44,6 +44,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.RelationshipTypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
+import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
 import org.apache.chemistry.opencmis.commons.enums.Cardinality;
 import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
@@ -88,6 +89,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class InMemoryObjectServiceImpl extends InMemoryAbstractServiceImpl {
+    private static final String UNKNOWN_USER = "unknown";
+    private static final String UNKNOWN_OBJECT_ID = "Unknown object id: ";
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryServiceFactoryImpl.class.getName());
 
     public InMemoryObjectServiceImpl(StoreManager storeManager) {
@@ -121,7 +124,7 @@ public class InMemoryObjectServiceImpl e
                 BigInteger.valueOf(-1), null);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + sourceId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + sourceId);
         }
 
         // build properties collection
@@ -248,7 +251,7 @@ public class InMemoryObjectServiceImpl e
         StoredObject so = validator.deleteContentStream(context, repositoryId, objectId, extension);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         if (so.getChangeToken() != null && (changeToken == null || !so.getChangeToken().equals(changeToken.getValue())))
@@ -281,23 +284,16 @@ public class InMemoryObjectServiceImpl e
     }
 
     public FailedToDeleteData deleteTree(CallContext context, String repositoryId, String folderId,
-            Boolean allVersions, UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
+            Boolean allVers, UnfileObject unfile, Boolean continueOnFail, ExtensionsData extension) {
 
         LOG.debug("start deleteTree()");
+        boolean allVersions = (null == allVers ? true : allVers);
+        UnfileObject unfileObjects = (null == unfile ? UnfileObject.DELETE : unfile);
+        boolean continueOnFailure = (null == continueOnFail ? false : continueOnFail);
         StoredObject so = validator.deleteTree(context, repositoryId, folderId, allVersions, unfileObjects, extension);
         List<String> failedToDeleteIds = new ArrayList<String>();
         FailedToDeleteDataImpl result = new FailedToDeleteDataImpl();
-
-        if (null == allVersions) {
-            allVersions = true;
-        }
-        if (null == unfileObjects) {
-            unfileObjects = UnfileObject.DELETE;
-        }
-        if (null == continueOnFailure) {
-            continueOnFailure = false;
-        }
-
+        
         ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
 
         if (null == so) {
@@ -337,12 +333,10 @@ public class InMemoryObjectServiceImpl e
         fStoreManager.getObjectStore(repositoryId);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         String user = context.getUsername();
-        // AllowableActions allowableActions =
-        // DataObjectCreator.fillAllowableActions(so, user);
         AllowableActions allowableActions = so.getAllowableActions(user);
         LOG.debug("stop getAllowableActions()");
         return allowableActions;
@@ -355,7 +349,7 @@ public class InMemoryObjectServiceImpl e
         StoredObject so = validator.getContentStream(context, repositoryId, objectId, streamId, extension);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         if (!(so instanceof Content) && objectId.endsWith("-rendition")) {
@@ -383,7 +377,7 @@ public class InMemoryObjectServiceImpl e
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         String user = context.getUsername();
@@ -453,7 +447,7 @@ public class InMemoryObjectServiceImpl e
         ObjectStore objectStore = fStoreManager.getObjectStore(repositoryId);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         // build properties collection
@@ -471,7 +465,7 @@ public class InMemoryObjectServiceImpl e
         StoredObject so = validator.getRenditions(context, repositoryId, objectId, extension);
 
         if (so == null) {
-            throw new CmisObjectNotFoundException("Unknown object id: " + objectId);
+            throw new CmisObjectNotFoundException(UNKNOWN_OBJECT_ID + objectId);
         }
 
         List<RenditionData> renditions = so.getRenditions(renditionFilter, maxItems == null ? 0 : maxItems.longValue(),
@@ -561,13 +555,11 @@ public class InMemoryObjectServiceImpl e
     }
 
     public void setContentStream(CallContext context, String repositoryId, Holder<String> objectId,
-            Boolean overwriteFlag, Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
+            Boolean overwrite, Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
 
         LOG.debug("start setContentStream()");
+        boolean overwriteFlag = (overwrite == null ? true : overwrite);
         Content content;
-        if (null == overwriteFlag) {
-            overwriteFlag = Boolean.TRUE;
-        }
 
         StoredObject so = validator.setContentStream(context, repositoryId, objectId, overwriteFlag, extension);
 
@@ -733,7 +725,7 @@ public class InMemoryObjectServiceImpl e
         if (hasUpdatedProp) {
             // set user, creation date, etc.
             if (user == null) {
-                user = "unknown";
+                user = UNKNOWN_USER;
             }
             so.updateSystemBasePropertiesWhenModified(properties.getProperties(), user);
             // set changeToken
@@ -749,12 +741,8 @@ public class InMemoryObjectServiceImpl e
         }
 
         if (null != acl) {
-            // TODO
             LOG.warn("Setting ACLs is currently not supported by this implementation, acl is ignored");
-            // if implemented add this call:
-            // fAclService.appyAcl(context, repositoryId, acl, null,
-            // AclPropagation.OBJECTONLY,
-            // extension);
+            objStore.applyAcl(so, acl, AclPropagation.OBJECTONLY, user);
         }
 
         TypeManager tm = fStoreManager.getTypeManager(repositoryId);
@@ -838,8 +826,8 @@ public class InMemoryObjectServiceImpl e
             String folderId, ContentStream contentStream, VersioningState versioningState, List<String> policies,
             Acl addACEs, Acl removeACEs, ExtensionsData extension) {
 
-        addACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addACEs);
-        removeACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
+        Acl aclAdd = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addACEs);
+        Acl aclRemove = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
                 removeACEs);
 
         validator.createDocument(context, repositoryId, folderId, policies, extension);
@@ -857,7 +845,7 @@ public class InMemoryObjectServiceImpl e
         String name = (String) pd.getFirstValue();
 
         // validate ACL
-        TypeValidator.validateAcl(typeDef, addACEs, removeACEs);
+        TypeValidator.validateAcl(typeDef, aclAdd, aclRemove);
 
         Folder folder = null;
         if (null != folderId) {
@@ -905,11 +893,11 @@ public class InMemoryObjectServiceImpl e
 
         // set user, creation date, etc.
         if (user == null) {
-            user = "unknown";
+            user = UNKNOWN_USER;
         }
 
         StoredObject so = null;
-
+        ContentStream contentStreamNew = contentStream;
         // check if content stream parameters are set and if not set some
         // defaults
         if (null != contentStream
@@ -929,18 +917,18 @@ public class InMemoryObjectServiceImpl e
                 cs.setMimeType(contentStream.getMimeType());
             }
             cs.setExtensions(contentStream.getExtensions());
-            contentStream = cs;
+            contentStreamNew = cs;
         }
 
         // Now we are sure to have document type definition:
         if (((DocumentTypeDefinition) typeDef).isVersionable()) {
             DocumentVersion version = objectStore.createVersionedDocument(name, propMap, user, folder, policies,
-                    addACEs, removeACEs, contentStream, versioningState);
+                    aclAdd, aclRemove, contentStreamNew, versioningState);
             so = version; // return the version and not the version series to
                           // caller
         } else {
-            Document doc = objectStore.createDocument(name, propMap, user, folder, policies, addACEs, removeACEs);
-            doc.setContent(contentStream, false);
+            Document doc = objectStore.createDocument(name, propMap, user, folder, policies, aclAdd, aclRemove);
+            doc.setContent(contentStreamNew, false);
             so = doc;
         }
 
@@ -953,7 +941,8 @@ public class InMemoryObjectServiceImpl e
         addACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addACEs);
         removeACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
                 removeACEs);
-
+        Properties propertiesNew = properties;
+        
         validator.createFolder(context, repositoryId, folderId, policies, extension);
         TypeValidator.validateRequiredSystemProperties(properties);
         String user = context.getUsername();
@@ -980,14 +969,14 @@ public class InMemoryObjectServiceImpl e
             throw new CmisInvalidArgumentException("Cannot create a folder, with a non-folder type: " + typeDef.getId());
         }
 
-        Map<String, PropertyData<?>> propMap = properties.getProperties();
+        Map<String, PropertyData<?>> propMap = propertiesNew.getProperties();
         Map<String, PropertyData<?>> propMapNew = setDefaultProperties(typeDef, propMap);
-        if (propMapNew != propMap) {
-            properties = new PropertiesImpl(propMapNew.values());
+        if (propMapNew != propMap) { // NOSONAR
+            propertiesNew = new PropertiesImpl(propMapNew.values());
         }
 
         boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
-        validateProperties(repositoryId, null, properties, false, cmis11);
+        validateProperties(repositoryId, null, propertiesNew, false, cmis11);
 
         // validate ACL
         TypeValidator.validateAcl(typeDef, addACEs, removeACEs);
@@ -1009,11 +998,11 @@ public class InMemoryObjectServiceImpl e
         }
 
         if (user == null) {
-            user = "unknown";
+            user = UNKNOWN_USER;
         }
 
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
-        Folder newFolder = objStore.createFolder(folderName, properties.getProperties(), user, parent, policies,
+        Folder newFolder = objStore.createFolder(folderName, propertiesNew.getProperties(), user, parent, policies,
                 addACEs, removeACEs);
         LOG.debug("stop createFolder()");
         return newFolder;
@@ -1022,11 +1011,14 @@ public class InMemoryObjectServiceImpl e
     private StoredObject createPolicyIntern(CallContext context, String repositoryId, Properties properties,
             String folderId, List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
 
-        validator.createPolicy(context, repositoryId, folderId, addAces, removeAces, policies, extension);
+        Acl aclAdd = addAces;
+        Acl aclRemove = removeAces;
+        
+        validator.createPolicy(context, repositoryId, folderId, aclAdd, aclRemove, policies, extension);
 
-        addAces = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addAces);
-        removeAces = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
-                removeAces);
+        aclAdd = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), aclAdd);
+        aclRemove = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
+                aclRemove);
 
         String user = context.getUsername();
         Map<String, PropertyData<?>> propMap = properties.getProperties();
@@ -1043,15 +1035,15 @@ public class InMemoryObjectServiceImpl e
     }
 
     private StoredObject createRelationshipIntern(CallContext context, String repositoryId, Properties properties,
-            List<String> policies, Acl addACEs, Acl removeACEs, ExtensionsData extension) {
+            List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
 
         TypeValidator.validateRequiredSystemProperties(properties);
 
         String user = context.getUsername();
 
-        addACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addACEs);
-        removeACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
-                removeACEs);
+        Acl aclAdd = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addAces);
+        Acl aclRemove = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
+                removeAces);
 
         // get required properties
         PropertyData<?> pd = properties.getProperties().get(PropertyIds.SOURCE_ID);
@@ -1085,7 +1077,7 @@ public class InMemoryObjectServiceImpl e
         validateProperties(repositoryId, null, properties, false, cmis11);
 
         // validate ACL
-        TypeValidator.validateAcl(typeDef, addACEs, removeACEs);
+        TypeValidator.validateAcl(typeDef, aclAdd, aclRemove);
 
         // validate the allowed types of the relationship
         ObjectStore objStore = fStoreManager.getObjectStore(repositoryId);
@@ -1101,22 +1093,19 @@ public class InMemoryObjectServiceImpl e
         pd = propMap.get(PropertyIds.NAME);
         String name = (String) pd.getFirstValue();
 
-        // StoredObject storedObject = objStore.createRelationship(
-        // relationObjects[0], relationObjects[1],
-        // propMap, user, addACEs, removeACEs);
         StoredObject storedObject = objStore.createRelationship(name, relationObjects[0], relationObjects[1], propMap,
-                user, addACEs, removeACEs);
+                user, aclAdd, aclRemove);
         return storedObject;
     }
 
     private StoredObject createItemIntern(CallContext context, String repositoryId, Properties properties,
-            String folderId, List<String> policies, Acl addACEs, Acl removeACEs, ExtensionsData extension) {
+            String folderId, List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension) {
 
-        validator.createItem(context, repositoryId, properties, folderId, policies, addACEs, removeACEs, extension);
+        validator.createItem(context, repositoryId, properties, folderId, policies, addAces, removeAces, extension);
 
-        addACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addACEs);
-        removeACEs = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
-                removeACEs);
+        Acl aclAdd = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addAces);
+        Acl aclRemove = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
+                removeAces);
 
         validator.createDocument(context, repositoryId, folderId, policies, extension);
 
@@ -1133,7 +1122,7 @@ public class InMemoryObjectServiceImpl e
         String name = (String) pd.getFirstValue();
 
         // validate ACL
-        TypeValidator.validateAcl(typeDef, addACEs, removeACEs);
+        TypeValidator.validateAcl(typeDef, aclAdd, aclRemove);
 
         Folder folder = null;
         if (null != folderId) {
@@ -1163,25 +1152,26 @@ public class InMemoryObjectServiceImpl e
             throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME + " Name is: " + name);
         }
 
+        Properties propertiesNew = properties;
         // set properties that are not set but have a default:
         Map<String, PropertyData<?>> propMapNew = setDefaultProperties(typeDef, propMap);
-        if (propMapNew != propMap) {
+        if (propMapNew != propMap) { // NOSONAR
             properties = new PropertiesImpl(propMapNew.values());
             propMap = propMapNew;
         }
 
         boolean cmis11 = context.getCmisVersion() != CmisVersion.CMIS_1_0;
-        validateProperties(repositoryId, null, properties, false, cmis11);
+        validateProperties(repositoryId, null, propertiesNew, false, cmis11);
 
         // set user, creation date, etc.
         if (user == null) {
-            user = "unknown";
+            user = UNKNOWN_USER;
         }
 
         StoredObject so = null;
 
         // Now we are sure to have document type definition:
-        so = objectStore.createItem(name, propMap, user, folder, policies, addACEs, removeACEs);
+        so = objectStore.createItem(name, propMap, user, folder, policies, aclAdd, aclRemove);
         return so;
     }
 
@@ -1189,14 +1179,15 @@ public class InMemoryObjectServiceImpl e
         String sourceId = sourceFolder.getId();
         String targetId = targetFolder.getId();
         
+        Folder folder = targetFolder;
         while (targetId != null) {
             if (targetId.equals(sourceId)) {
                 return true;
             }
-            List<String>parentIds = ((ObjectStoreFiling)objStore).getParentIds(targetFolder, user);
+            List<String>parentIds = ((ObjectStoreFiling)objStore).getParentIds(folder, user);
             targetId = parentIds == null || parentIds.isEmpty() ? null : parentIds.get(0);    
             if (null != targetId) {
-                targetFolder = (Folder) objStore.getObjectById(targetId);
+                folder = (Folder) objStore.getObjectById(targetId);
             }
         }
         return false;
@@ -1261,6 +1252,7 @@ public class InMemoryObjectServiceImpl e
 
     private Map<String, PropertyData<?>> setDefaultProperties(TypeDefinition typeDef,
             Map<String, PropertyData<?>> properties) {
+        Map<String, PropertyData<?>> propertiesReturn = properties;
         Map<String, PropertyDefinition<?>> propDefs = typeDef.getPropertyDefinitions();
         boolean hasCopied = false;
 
@@ -1269,22 +1261,17 @@ public class InMemoryObjectServiceImpl e
             List<?> defaultVal = propDef.getDefaultValue();
             if (defaultVal != null && null == properties.get(propId)) {
                 if (!hasCopied) {
-                    properties = new HashMap<String, PropertyData<?>>(properties); // copy
-                                                                                   // because
-                                                                                   // it
-                                                                                   // is
-                                                                                   // an
-                                                                                   // unmodified
-                                                                                   // collection
+                    // copy because it is an unmodified collection
+                    propertiesReturn = new HashMap<String, PropertyData<?>>(properties); 
                     hasCopied = true;
                 }
                 Object value = propDef.getCardinality() == Cardinality.SINGLE ? defaultVal.get(0) : defaultVal;
                 PropertyData<?> pd = fStoreManager.getObjectFactory().createPropertyData(propDef, value);
                 // set property:
-                properties.put(propId, pd);
+                propertiesReturn.put(propId, pd);
             }
         }
-        return properties;
+        return propertiesReturn;
     }
 
     private void validateProperties(String repositoryId, StoredObject so, Properties properties,

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=1514297&r1=1514296&r2=1514297&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 Thu Aug 15 14:31:20 2013
@@ -20,7 +20,6 @@ package org.apache.chemistry.opencmis.in
 
 import java.math.BigInteger;
 import java.util.List;
-import java.util.Map;
 
 import org.apache.chemistry.opencmis.commons.data.Acl;
 import org.apache.chemistry.opencmis.commons.data.AllowableActions;
@@ -48,13 +47,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class InMemoryService extends AbstractCmisService {
 
-    private static final Logger LOG = LoggerFactory.getLogger(InMemoryService.class.getName());
-
     private final StoreManager storeManager; // singleton root of everything
 
     private final InMemoryRepositoryServiceImpl fRepSvc;
@@ -71,13 +66,13 @@ public class InMemoryService extends Abs
         return storeManager;
     }
 
-    public InMemoryService(Map<String, String> parameters, StoreManager sm) {
+    public InMemoryService(StoreManager sm) {
         storeManager = sm;
         fRepSvc = new InMemoryRepositoryServiceImpl(storeManager);
         fNavSvc = new InMemoryNavigationServiceImpl(storeManager);
         fObjSvc = new InMemoryObjectServiceImpl(storeManager);
         fVerSvc = new InMemoryVersioningServiceImpl(storeManager, fObjSvc);
-        fDisSvc = new InMemoryDiscoveryServiceImpl(storeManager, fRepSvc, fNavSvc);
+        fDisSvc = new InMemoryDiscoveryServiceImpl(storeManager);
         fMultiSvc = new InMemoryMultiFilingServiceImpl(storeManager);
         fRelSvc = new InMemoryRelationshipServiceImpl(storeManager, fRepSvc);
         fPolSvc = new InMemoryPolicyServiceImpl(storeManager);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.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/InMemoryServiceContext.java?rev=1514297&r1=1514296&r2=1514297&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceContext.java Thu Aug 15 14:31:20 2013
@@ -25,13 +25,13 @@ import org.apache.chemistry.opencmis.ser
  * Helper class to associate context information with each incoming call
  *
  */
-public class InMemoryServiceContext {
+public final class InMemoryServiceContext {
     
     private static class ContextHolder {
         private CmisServiceWrapper<InMemoryService> wrapper;
         private CallContext callContext;
 
-        ContextHolder(CmisServiceWrapper<InMemoryService> wrapper) {
+        private ContextHolder(CmisServiceWrapper<InMemoryService> wrapper) {
             this.wrapper = wrapper;
         }
 

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=1514297&r1=1514296&r2=1514297&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 Thu Aug 15 14:31:20 2013
@@ -73,7 +73,7 @@ public class InMemoryServiceFactoryImpl 
     private static final BigInteger DEFAULT_MAX_ITEMS_TYPES = BigInteger.valueOf(100);
     private static final BigInteger DEFAULT_DEPTH_OBJECTS = BigInteger.valueOf(2);
     private static final BigInteger DEFAULT_DEPTH_TYPES = BigInteger.valueOf(-1);
-    private static CallContext OVERRIDE_CTX;
+    private static CallContext overrideCtx;
 
     private Map<String, String> inMemoryServiceParameters;
     private boolean fUseOverrideCtx = false;
@@ -88,8 +88,7 @@ public class InMemoryServiceFactoryImpl 
     @Override
     public void init(Map<String, String> parameters) {
         LOG.info("Initializing in-memory repository...");
-
-        System.out.println(parameters);
+        LOG.debug("Init paramaters: " + parameters);
 
         inMemoryServiceParameters = parameters;
         String overrideCtx = parameters.get(ConfigConstants.OVERRIDE_CALL_CONTEXT);
@@ -126,9 +125,11 @@ public class InMemoryServiceFactoryImpl 
 
         parameters.put(ConfigConstants.DEPLOYMENT_TIME, strDate);
 
-        initStorageManager(parameters);
+        boolean created = initStorageManager(parameters);
 
-        fillRepositoryIfConfigured(parameters);
+        if (created) {
+            fillRepositoryIfConfigured(parameters);
+        }
 
         Long cleanInterval = ConfigurationSettings
                 .getConfigurationValueAsLong(ConfigConstants.CLEAN_REPOSITORY_INTERVAL);
@@ -140,7 +141,7 @@ public class InMemoryServiceFactoryImpl 
     }
 
     public static void setOverrideCallContext(CallContext ctx) {
-        OVERRIDE_CTX = ctx;
+        overrideCtx = ctx;
     }
 
     @Override
@@ -151,15 +152,15 @@ public class InMemoryServiceFactoryImpl 
         // 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 != OVERRIDE_CTX) {
-            context = OVERRIDE_CTX;
+        if (fUseOverrideCtx && null != overrideCtx) {
+            context = overrideCtx;
         }
 
         InMemoryService inMemoryService = InMemoryServiceContext.getCmisService();
         if (inMemoryService == null) {
             LOG.debug("Creating new InMemoryService instance!");
             CmisServiceWrapper<InMemoryService> wrapperService;
-            inMemoryService = new InMemoryService(inMemoryServiceParameters, storeManager);
+            inMemoryService = new InMemoryService(storeManager);
             wrapperService = new CmisServiceWrapper<InMemoryService>(inMemoryService, DEFAULT_MAX_ITEMS_TYPES,
                     DEFAULT_DEPTH_TYPES, DEFAULT_MAX_ITEMS_OBJECTS, DEFAULT_DEPTH_OBJECTS);
             InMemoryServiceContext.setWrapperService(wrapperService);
@@ -168,7 +169,7 @@ public class InMemoryServiceFactoryImpl 
         inMemoryService.setCallContext(context);
 
         LOG.debug("stop getService()");
-        return inMemoryService; // wrapperService;
+        return inMemoryService;
     }
 
     @Override
@@ -204,8 +205,9 @@ public class InMemoryServiceFactoryImpl 
         return storeManager;
     }
 
-    private void initStorageManager(Map<String, String> parameters) {
+    private boolean initStorageManager(Map<String, String> parameters) {
         // initialize in-memory management
+        boolean created = false;
         String repositoryClassName = (String) parameters.get(ConfigConstants.REPOSITORY_CLASS);
         if (null == repositoryClassName) {
             repositoryClassName = StoreManagerImpl.class.getName();
@@ -231,6 +233,7 @@ public class InMemoryServiceFactoryImpl 
             } else {
                 String typeCreatorClassName = parameters.get(ConfigConstants.TYPE_CREATOR_CLASS);
                 storeManager.createAndInitRepository(repositoryId, typeCreatorClassName);
+                created = true;
             }
         }
 
@@ -248,7 +251,7 @@ public class InMemoryServiceFactoryImpl 
                 LOG.warn("Type Definitions are configured in XML file but type manager cannot create types. Type definitions are ignored.");
             }
         }
-
+        return created;
     }
 
     private void importTypesFromFile(TypeManagerCreatable tmc, String typeDefsFileName) {
@@ -394,8 +397,6 @@ public class InMemoryServiceFactoryImpl 
             }
         }
 
-        // List<String> allAvailableRepositories =
-        // storeManager.getAllRepositoryIds();
         String repositoryId = parameters.get(ConfigConstants.REPOSITORY_ID);
         String doFillRepositoryStr = parameters.get(ConfigConstants.USE_REPOSITORY_FILER);
         String contentKindStr = parameters.get(ConfigConstants.CONTENT_KIND);
@@ -406,7 +407,7 @@ public class InMemoryServiceFactoryImpl 
             // create an initial temporary service instance to fill the
             // repository
 
-            InMemoryService svc = new InMemoryService(inMemoryServiceParameters, storeManager);
+            InMemoryService svc = new InMemoryService(storeManager);
 
             BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
 
@@ -506,8 +507,7 @@ public class InMemoryServiceFactoryImpl 
                 // Dump the tree
                 gen.dumpFolder(rootFolderId, "*");
             } catch (Exception e) {
-                LOG.error("Could not create folder hierarchy with documents. " + e);
-                e.printStackTrace();
+                LOG.error("Could not create folder hierarchy with documents. ", e);
             }
             destroy();
         } // if
@@ -517,7 +517,7 @@ public class InMemoryServiceFactoryImpl 
     class CleanManager {
 
         private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
-        ScheduledFuture<?> cleanerHandle = null;
+        private ScheduledFuture<?> cleanerHandle = null;
 
         public void startCleanRepositoryJob(long intervalInMinutes) {
 

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=1514297&r1=1514296&r2=1514297&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 Thu Aug 15 14:31:20 2013
@@ -46,17 +46,11 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.storedobj.api.VersionedDocument;
 import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
 import org.apache.chemistry.opencmis.server.support.TypeManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class InMemoryVersioningServiceImpl extends InMemoryAbstractServiceImpl {
 
-    private static final Logger LOG = LoggerFactory.getLogger(InMemoryVersioningServiceImpl.class.getName());
-
-    final InMemoryObjectServiceImpl fObjectService; // real implementation of
-                                                    // the
-    // service
-    final AtomLinkInfoProvider fAtomLinkProvider;
+    private InMemoryObjectServiceImpl fObjectService; 
+    private AtomLinkInfoProvider fAtomLinkProvider;
 
     public InMemoryVersioningServiceImpl(StoreManager storeManager, InMemoryObjectServiceImpl objectService) {
         super(storeManager);
@@ -79,26 +73,26 @@ public class InMemoryVersioningServiceIm
             fStoreManager.getObjectStore(repositoryId).deleteObject(verDoc.getId(), true, user);
     }
 
-    public void checkIn(CallContext context, String repositoryId, Holder<String> objectId, Boolean major,
-            Properties properties, ContentStream contentStream, String checkinComment, List<String> policies,
+    public void checkIn(CallContext context, String repositoryId, Holder<String> objectId, Boolean majorParam,
+            Properties properties, ContentStream contentStreamParam, String checkinComment, List<String> policies,
             Acl addAces, Acl removeAces, ExtensionsData extension, ObjectInfoHandler objectInfos) {
 
-        addAces = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addAces);
-        removeAces = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
+        Acl aclAdd = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(), addAces);
+        Acl aclRemove = org.apache.chemistry.opencmis.inmemory.TypeValidator.expandAclMakros(context.getUsername(),
                 removeAces);
 
-        StoredObject so = validator.checkIn(context, repositoryId, objectId, addAces, removeAces, policies, extension);
+        StoredObject so = validator.checkIn(context, repositoryId, objectId, aclAdd, aclRemove, policies, extension);
 
         String user = context.getUsername();
         VersionedDocument verDoc = testHasProperCheckedOutStatus(so, user);
 
         // check if the contentStream is a usable object or ignore it otherwise
-        // Note Bworser binding sets an empty object
+        // Note Browser binding sets an empty object
+        ContentStream contentStream = contentStreamParam;
         if (contentStream != null && contentStream.getStream() == null)
             contentStream = null;
 
-        if (null == major) 
-            major = true;
+        boolean major = (null == majorParam ? true : majorParam);
         
         verDoc.checkIn(major, properties, contentStream, checkinComment, policies, user);
         verDoc.updateSystemBasePropertiesWhenModified(null, context.getUsername());
@@ -168,24 +162,19 @@ public class InMemoryVersioningServiceIm
         // and objectId is null
         StoredObject so;
         List<ObjectData> res = new ArrayList<ObjectData>();
-        if (null == versionSeriesId)
-            versionSeriesId = objectId;
-        if (null == versionSeriesId)
-            throw new CmisInvalidArgumentException("getAllVersions requires a version series id, but it was null.");
-        so = validator.getAllVersions(context, repositoryId, objectId, versionSeriesId, extension);
-
-        if (null == objectId)
-            objectId = versionSeriesId;
+        String id = versionSeriesId;
+        if (null == versionSeriesId) {
+            if (null == objectId)
+                throw new CmisInvalidArgumentException("getAllVersions requires a version series id, but it was null.");
+            id = objectId;
+        }
+        so = validator.getAllVersions(context, repositoryId, objectId, id, extension);
 
         if (!(so instanceof VersionedDocument)) {
             if (!(so instanceof DocumentVersion))
                 throw new CmisInvalidArgumentException("getAllVersions requires an id of a versioned document.");
             so = ((DocumentVersion) so).getParentDocument();
         }
-        // ObjectData objData = getObject(context, repositoryId, so.getId(),
-        // filter, includeAllowableActions,
-        // IncludeRelationships.NONE,extension, objectInfos);
-        // res.add(objData);
 
         VersionedDocument verDoc = (VersionedDocument) so;
         res = new ArrayList<ObjectData>();



Mime
View raw message