chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1198902 - in /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory: ./ server/ storedobj/impl/
Date Mon, 07 Nov 2011 19:58:34 GMT
Author: jens
Date: Mon Nov  7 19:58:33 2011
New Revision: 1198902

URL: http://svn.apache.org/viewvc?rev=1198902&view=rev
Log:
minor stuff: add logging, avoid an NPE, remove obsolete code

Modified:
    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/server/InMemoryServiceFactoryImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java

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=1198902&r1=1198901&r2=1198902&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
Mon Nov  7 19:58:33 2011
@@ -38,7 +38,8 @@ import org.apache.chemistry.opencmis.inm
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryFolderTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryPolicyTypeDefinition;
 import org.apache.chemistry.opencmis.inmemory.types.InMemoryRelationshipTypeDefinition;
-import org.apache.chemistry.opencmis.server.support.TypeManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Class that manages a type system for a repository types can be added, the
@@ -49,6 +50,7 @@ import org.apache.chemistry.opencmis.ser
  */
 public class TypeManagerImpl implements TypeManagerCreatable {
 
+    private static final Log LOG = LogFactory.getLog(TypeManagerImpl.class.getName());
     /**
      * map from repository id to a types map
      */
@@ -159,6 +161,8 @@ public class TypeManagerImpl implements 
         Map<String, PropertyDefinition<?>> propDefs = typeContainer.getTypeDefinition().getPropertyDefinitions();
         addInheritedProperties(propDefs, parentTypeContainer.getTypeDefinition());
 
+        LOG.info("Adding type definition with name " + cmisType.getLocalName() + " and id
" 
+                + cmisType.getId() + " to repository.");
         // add type to type map
         fTypesMap.put(cmisType.getId(), typeContainer);
     }

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=1198902&r1=1198901&r2=1198902&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
Mon Nov  7 19:58:33 2011
@@ -23,6 +23,7 @@ import java.math.BigInteger;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -35,9 +36,11 @@ import javax.xml.bind.JAXBElement;
 import javax.xml.bind.Unmarshaller;
 
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
 import org.apache.chemistry.opencmis.commons.impl.Converter;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
@@ -211,7 +214,11 @@ public class InMemoryServiceFactoryImpl 
             Unmarshaller u = InMemoryJaxbHelper.createUnmarshaller();
             JAXBElement<TypeDefinitions> types = (JAXBElement<TypeDefinitions>)
u.unmarshal(is);
             for (CmisTypeDefinitionType td: types.getValue().getTypeDefinitions()) {
+                LOG.debug("Found type in file: " + td.getLocalName());
                 typeDef = Converter.convert(td);
+                if (typeDef.getPropertyDefinitions() == null) {
+                    ((AbstractTypeDefinition)typeDef).setPropertyDefinitions( new LinkedHashMap<String,
PropertyDefinition<?>>());
+                }
                 tmc.addTypeDefinition(typeDef);
             }
         } catch (Exception e) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1198902&r1=1198901&r2=1198902&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
Mon Nov  7 19:58:33 2011
@@ -319,45 +319,6 @@ public class StoreManagerImpl implements
         typeManager.initTypeSystem(typeDefs);
     }
 
-    private void initTypeSystemNOP(String repositoryId, String fileName) {
-        TypeManagerImpl typeManager = fMapRepositoryToTypeManager.get(repositoryId);
-        if (null == typeManager) {
-            throw new RuntimeException("Unknown repository " + repositoryId);
-        }
-
-        if (null == fileName) {
-            LOG.warn("No file name for type definitions given, no types will be created.");
-            typeManager.initTypeSystem(null);
-            return;
-        }
-
-        InputStream is = this.getClass().getResourceAsStream("/" + fileName);
-
-        List<TypeDefinition> typeDefs = new  ArrayList<TypeDefinition>();
-        TypeDefinition typeDef = null;
-        if (null == is) {
-            LOG.warn("Resource file with type definitions " + fileName
-                    + " could not be found, no types will be created.");
-            return;
-        }
-
-        try {
-            Unmarshaller u = InMemoryJaxbHelper.createUnmarshaller();
-//            JAXBElement<CmisTypeDefinitionType> type = (JAXBElement<CmisTypeDefinitionType>)
u.unmarshal(is);
-//            typeDef = Converter.convert(type.getValue());
-            JAXBElement<TypeDefinitions> types = (JAXBElement<TypeDefinitions>)
u.unmarshal(is);
-            for (CmisTypeDefinitionType td: types.getValue().getTypeDefinitions()) {
-                typeDef = Converter.convert(td);
-                typeDefs.add(typeDef);
-            }
-
-        } catch (Exception e) {
-            LOG.error("Could not load type definitions from file '" + fileName + "': " +
e);
-        }
-
-        typeManager.initTypeSystem(typeDefs);
-    }
-
     private RepositoryInfo createRepositoryInfo(String repositoryId) {
         ObjectStore objStore = getObjectStore(repositoryId);
         String rootFolderId = objStore.getRootFolder().getId();



Mime
View raw message