chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1515969 [1/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/query/ chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/ja...
Date Tue, 20 Aug 2013 20:58:05 GMT
Author: jens
Date: Tue Aug 20 20:58:05 2013
New Revision: 1515969

URL: http://svn.apache.org/r1515969
Log:
Tools and Utilitiies: Code cleanup
InMemory: minor code cleanup

Modified:
    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/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/InMemoryServiceFactoryImpl.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/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/StoredObjectImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.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-tools/src/main/java/org/apache/chemistry/opencmis/commander/Commander.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/main/ObjGenApp.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/Configurator.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapper.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperExif.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperTika.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/AbstractMetadataParser.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/MetadataParserTika.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/fractal/FractalGenerator.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/repository/MultiThreadedObjectGenerator.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/repository/ObjectGenerator.java

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=1515969&r1=1515968&r2=1515969&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 Tue Aug 20 20:58:05 2013
@@ -83,7 +83,7 @@ public final class PropertyQueryUtil {
             return so.getTypeId();
         }
         if (propertyId.equals(PropertyIds.BASE_TYPE_ID)) {
-            return null; // base type id not available from so;
+            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/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=1515969&r1=1515968&r2=1515969&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 Tue Aug 20 20:58:05 2013
@@ -47,7 +47,7 @@ public class InMemoryMultiFilingServiceI
 
         LOG.debug("Begin addObjectToFolder()");
 
-        if (allVersions != null && null != allVersions && !allVersions.booleanValue()) {
+        if (allVersions != null && !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=1515969&r1=1515968&r2=1515969&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 Tue Aug 20 20:58:05 2013
@@ -63,6 +63,7 @@ import org.slf4j.LoggerFactory;
 
 public class InMemoryNavigationServiceImpl extends InMemoryAbstractServiceImpl {
 
+    private static final int MAX_FOLDERS_IN_GET_DESC = 1000;
     private static final Logger LOG = LoggerFactory.getLogger(InMemoryNavigationServiceImpl.class);
 
     public InMemoryNavigationServiceImpl(StoreManager storeManager) {
@@ -333,8 +334,8 @@ public class InMemoryNavigationServiceIm
         if (maxLevels == -1 || level < maxLevels) {
             String orderBy = PropertyIds.NAME;
             ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
-                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegments, 1000, 0,
-                    folderOnly, false, objectInfos, user);
+                    includeAllowableActions, includeRelationships, renditionFilter, includePathSegments,
+                    MAX_FOLDERS_IN_GET_DESC, 0, folderOnly, false, objectInfos, user);
             childrenOfFolderId = new ArrayList<ObjectInFolderContainer>();
             if (null != children) {
 

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=1515969&r1=1515968&r2=1515969&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 Tue Aug 20 20:58:05 2013
@@ -439,20 +439,20 @@ public class InMemoryServiceFactoryImpl 
                 contentSizeKB = Integer.parseInt(contentSizeKBStr);
             }
 
-            ObjectGenerator.CONTENT_KIND contentKind;
+            ObjectGenerator.ContentKind contentKind;
             if (null == contentKindStr) {
-                contentKind = ObjectGenerator.CONTENT_KIND.LoremIpsumText;
+                contentKind = ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT;
             } else {
                 if (contentKindStr.equals("static/text")) {
-                    contentKind = ObjectGenerator.CONTENT_KIND.StaticText;
+                    contentKind = ObjectGenerator.ContentKind.STATIC_TEXT;
                 } else if (contentKindStr.equals("lorem/text")) {
-                    contentKind = ObjectGenerator.CONTENT_KIND.LoremIpsumText;
+                    contentKind = ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT;
                 } else if (contentKindStr.equals("lorem/html")) {
-                    contentKind = ObjectGenerator.CONTENT_KIND.LoremIpsumHtml;
+                    contentKind = ObjectGenerator.ContentKind.LOREM_IPSUM_HTML;
                 } else if (contentKindStr.equals("fractal/jpeg")) {
-                    contentKind = ObjectGenerator.CONTENT_KIND.ImageFractalJpeg;
+                    contentKind = ObjectGenerator.ContentKind.IMAGE_FRACTAL_JPEG;
                 } else {
-                    contentKind = ObjectGenerator.CONTENT_KIND.StaticText;
+                    contentKind = ObjectGenerator.ContentKind.STATIC_TEXT;
                 }
             }
             // Create a hierarchy of folders and fill it with some documents

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.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/ContentStreamDataImpl.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ContentStreamDataImpl.java Tue Aug 20 20:58:05 2013
@@ -71,6 +71,10 @@ public class ContentStreamDataImpl imple
         totalLength += length;
     }
     
+    private static synchronized void decreaseTotalLength(int length) {
+        totalLength -= length;
+    }
+    
     private static synchronized long getTotalCalls () {
         return totalCalls;
     }
@@ -125,7 +129,7 @@ public class ContentStreamDataImpl imple
 
             // first read existing stream
             contentStream.write(fContent);
-            totalLength -= fLength;
+            decreaseTotalLength(fLength);
 
             // then append new content
             int len = is.read(buffer);
@@ -143,9 +147,10 @@ public class ContentStreamDataImpl imple
             contentStream.close();
             is.close();
         }
-        totalLength += fLength;
-        LOG.debug("setting content stream, total no calls " + ++totalCalls + ".");
-        LOG.debug("setting content stream, new size total " + (totalLength / (SIZE_KB * SIZE_KB)) + "MB.");
+        increaseTotalLength(fLength);
+        increaseTotalCalls();
+        LOG.debug("setting content stream, total no calls " + getTotalCalls() + ".");
+        LOG.debug("setting content stream, new size total " + (getTotalLength() / (SIZE_KB * SIZE_KB)) + "MB.");
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.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/InMemoryServiceValidatorImpl.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java Tue Aug 20 20:58:05 2013
@@ -392,9 +392,8 @@ public class InMemoryServiceValidatorImp
             throw new CmisConstraintException("ACLs on policies are not suported.");
         }
 
-        StoredObject so = super.createPolicy(context, repositoryId, folderId, addAces, removeAces, policyIds, extension);
-        checkAllAccess(repositoryId, context.getUsername(), so);
-        return so;
+        super.createPolicy(context, repositoryId, null, null, null, null, extension);
+        return null;
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.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/ObjectStoreImpl.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Tue Aug 20 20:58:05 2013
@@ -249,7 +249,7 @@ public class ObjectStoreImpl implements 
     // /////////////////////////////////////////
     // private helper methods
 
-    private final void createRootFolder() {
+    private void createRootFolder() {
         FolderImpl rootFolder = new FolderImpl();
         rootFolder.setName("RootFolder");
         rootFolder.setParentId(null);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Tue Aug 20 20:58:05 2013
@@ -37,6 +37,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.data.PropertyData;
 import org.apache.chemistry.opencmis.commons.data.RenditionData;
+import org.apache.chemistry.opencmis.commons.impl.IOUtils;
 import org.apache.chemistry.opencmis.commons.spi.BindingsObjectFactory;
 import org.apache.chemistry.opencmis.inmemory.DataObjectCreator;
 import org.apache.chemistry.opencmis.inmemory.FilterParser;
@@ -519,22 +520,23 @@ public class StoredObjectImpl implements
 
     protected ContentStream getIconFromResourceDir(String name) throws IOException {
 
-        InputStream imageStream = this.getClass().getResourceAsStream(name);
-        ContentStreamDataImpl content = new ContentStreamDataImpl(0);
-        content.setFileName(name);
-        content.setMimeType("image/png");
-
+        InputStream imageStream = StoredObjectImpl.class.getResourceAsStream(name);
         ByteArrayOutputStream ba = new ByteArrayOutputStream();
         byte[] buffer = new byte[BUFFER_SIZE];
         int noBytesRead = 0;
+
         try {
             while ((noBytesRead = imageStream.read(buffer)) >= 0) {
                 ba.write(buffer, 0, noBytesRead);
             }
         } finally {
-            ba.close();
-            imageStream.close();
+            IOUtils.closeQuietly(ba);
+            IOUtils.closeQuietly(imageStream);
         }
+        
+        ContentStreamDataImpl content = new ContentStreamDataImpl(0);
+        content.setFileName(name);
+        content.setMimeType("image/png");
         content.setContent(new ByteArrayInputStream(ba.toByteArray()));
         return content;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/DiscoveryServiceTest.java Tue Aug 20 20:58:05 2013
@@ -60,7 +60,7 @@ public class DiscoveryServiceTest extend
         log.info("starting testQuery() ...");
 
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId, 
-                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
+                ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT);
         gen.setNumberOfDocumentsToCreatePerFolder(3);
         gen.setDocumentTypeId(TEST_DOCUMENT_TYPE_ID);
         gen.setFolderTypeId(TEST_FOLDER_TYPE_ID);
@@ -130,7 +130,7 @@ public class DiscoveryServiceTest extend
         String statement;
         ObjectList res;
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
-                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
+                ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT);
         gen.setNumberOfDocumentsToCreatePerFolder(3);
         gen.setDocumentTypeId(TEST_DOCUMENT_TYPE_ID);
         gen.setFolderTypeId(TEST_FOLDER_TYPE_ID);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/NavigationServiceTest.java Tue Aug 20 20:58:05 2013
@@ -288,7 +288,7 @@ public class NavigationServiceTest exten
     private int createFolderHierachy(int levels, int childrenPerLevel) {
 
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
-                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
+                ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT);
         gen.createFolderHierachy(levels, childrenPerLevel, fRootFolderId);
         int objCount = gen.getObjectsInTotal();
         return objCount;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Tue Aug 20 20:58:05 2013
@@ -491,7 +491,7 @@ public class ObjectServiceTest extends A
         // Create a hierarchy of folders and fill it with some documents
 
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
-                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
+                ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT);
         int levels = 2; // create a hierarchy with two levels
         int childrenPerLevel = 2; // create two folders on each level
 
@@ -618,7 +618,7 @@ public class ObjectServiceTest extends A
     public void testDeleteTree() {
         log.info("starting testDeleteTree() ...");
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
-                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
+                ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT);
         String rootFolderId = createFolder();
         // Set the type id for all created documents:
         gen.setDocumentTypeId(DocumentTypeCreationHelper.getCmisDocumentType().getId());
@@ -1516,7 +1516,7 @@ public class ObjectServiceTest extends A
         final String propertyFilter = PropertyIds.OBJECT_ID + "," + PropertyIds.NAME; 
         String rootFolderId = createFolder();
         ObjectGenerator gen = new ObjectGenerator(fFactory, fNavSvc, fObjSvc, fRepSvc, fRepositoryId,
-                ObjectGenerator.CONTENT_KIND.LoremIpsumText);
+                ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT);
         // Set the type id for all created documents:
         gen.setDocumentTypeId(DocumentTypeCreationHelper.getCmisDocumentType().getId());
         // Set the type id for all created folders:

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java Tue Aug 20 20:58:05 2013
@@ -48,7 +48,10 @@ import org.apache.chemistry.opencmis.com
 /**
  * @author Jens
  */
-public class TypeValidator {
+public final class TypeValidator {
+    
+    private TypeValidator() {        
+    }
 
     public static void validateRequiredSystemProperties(Properties properties) {
         if (properties == null || properties.getProperties() == null) {
@@ -58,7 +61,6 @@ public class TypeValidator {
         if (!properties.getProperties().containsKey(PropertyIds.OBJECT_TYPE_ID)) {
             throw new CmisInvalidArgumentException("Cannot create object, type id is missing");
         }
-
     }
 
     private static boolean isMandatorySystemProperty(String propertyId) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/commander/Commander.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/commander/Commander.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/commander/Commander.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/commander/Commander.java Tue Aug 20 20:58:05 2013
@@ -19,7 +19,11 @@
 package org.apache.chemistry.opencmis.commander;
 
 import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -37,7 +41,7 @@ import org.apache.chemistry.opencmis.com
  * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
  *
  */
-public class Commander {
+public final class Commander {
 
     private static final Map<String, Command> COMMAND_MAP = new LinkedHashMap<String, Command>();
     static {
@@ -46,13 +50,19 @@ public class Commander {
         addCommand(new DeleteCommand());
     }
 
-    private final PrintWriter fPW;
 
     /**
      * Constructor.
      */
-    public Commander(String[] args) {
-        fPW = new PrintWriter(System.out);
+    public static void main(String[] args) {
+        PrintWriter fPW = null;
+        try {
+            fPW = new PrintWriter(new OutputStreamWriter(System.out, "UTF-8"));
+        } catch (UnsupportedEncodingException ex) {
+            System.err.println("Wrong encoding, UTF-8 not supported: " + ex);
+            ex.printStackTrace();
+            return;
+        }
 
         if (args.length < 2) {
             printUsage(fPW);
@@ -76,14 +86,12 @@ public class Commander {
 
             // execute
             command.execute(binding, commandArgs, fPW);
+        } catch (CmisBaseException e) {
+            fPW.println("Exception:");
+            fPW.println(e);
         } catch (Exception e) {
             fPW.println("Exception:");
-
-            if (e instanceof CmisBaseException) {
-                fPW.println(e);
-            } else {
-                e.printStackTrace(fPW);
-            }
+            e.printStackTrace(fPW);
         } finally {
             fPW.flush();
         }
@@ -105,31 +113,38 @@ public class Commander {
 
     /**
      * Creates the provider object
+     * @throws IOException 
+     * @throws  
      */
-    private static CmisBinding createBinding(String configFile) throws Exception {
+    private static CmisBinding createBinding(String configFile) throws IOException {
         Properties properties = new Properties();
-        properties.load(new FileInputStream(configFile));
-
-        Map<String, String> sessionParameters = new HashMap<String, String>();
-
-        for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
-            String key = (String) e.nextElement();
-            String value = properties.getProperty(key);
-            sessionParameters.put(key, value);
-        }
-
-        CmisBindingFactory factory = CmisBindingFactory.newInstance();
-
-        CmisBinding result = null;
-        if (sessionParameters.containsKey(SessionParameter.ATOMPUB_URL)) {
-            result = factory.createCmisAtomPubBinding(sessionParameters);
-        } else if (sessionParameters.containsKey(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE)) {
-            result = factory.createCmisWebServicesBinding(sessionParameters);
-        } else {
-            throw new IllegalArgumentException("Cannot find CMIS binding information in config file!");
+        InputStream is = new FileInputStream(configFile);
+        try {
+            properties.load(is);
+    
+            Map<String, String> sessionParameters = new HashMap<String, String>();
+    
+            for (Enumeration<?> e = properties.propertyNames(); e.hasMoreElements();) {
+                String key = (String) e.nextElement();
+                String value = properties.getProperty(key);
+                sessionParameters.put(key, value);
+            }
+    
+            CmisBindingFactory factory = CmisBindingFactory.newInstance();
+    
+            CmisBinding result = null;
+            if (sessionParameters.containsKey(SessionParameter.ATOMPUB_URL)) {
+                result = factory.createCmisAtomPubBinding(sessionParameters);
+            } else if (sessionParameters.containsKey(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE)) {
+                result = factory.createCmisWebServicesBinding(sessionParameters);
+            } else {
+                throw new IllegalArgumentException("Cannot find CMIS binding information in config file!");
+            }
+    
+            return result;
+        } finally {
+            is.close();
         }
-
-        return result;
     }
 
     /**
@@ -142,11 +157,4 @@ public class Commander {
 
         COMMAND_MAP.put(command.getCommandName().toLowerCase(), command);
     }
-
-    /**
-     * Main.
-     */
-    public static void main(String[] args) {
-        new Commander(args);
-    }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java Tue Aug 20 20:58:05 2013
@@ -33,6 +33,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.data.ContentStream;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
 import org.apache.chemistry.opencmis.tools.mapper.Configurator;
 import org.apache.chemistry.opencmis.tools.mapper.MapperException;
 import org.apache.chemistry.opencmis.tools.mapper.PropertyMapper;
@@ -47,7 +48,7 @@ public class FileCopier {
     private static final Logger LOG = LoggerFactory.getLogger(FileCopier.class.getName());
     // initialize configurator to get parsers and property mappings
     private static final Configurator CFG = Configurator.getInstance();
-    private static int TOTAL_NUM = 0;
+    private static int totalNum = 0;
 
     private Session session;
 
@@ -92,10 +93,11 @@ public class FileCopier {
         Folder parentFolder;
         String id = null;
 
-        if (null == folderId)
+        if (null == folderId) {
             parentFolder = session.getRootFolder();
-        else
+        } else {
             parentFolder = (Folder) session.getObject(folderId);
+        }
 
         try {
             File f = new File(fileName);
@@ -111,14 +113,17 @@ public class FileCopier {
             } else {
                 parser.reset();
                 PropertyMapper mapper = CFG.getPropertyMapper(mimeType);
-                if (null == mapper)
+                if (null == mapper) {
                     throw new MapperException("Unknown mime type (no configuration): " + mimeType);
+                }
                 String typeId = mapper.getMappedTypeId();
-                if (null == typeId)
+                if (null == typeId) {
                     throw new MapperException("No CMIS type configured for mime type" + mimeType);
+                }
                 TypeDefinition td = session.getTypeDefinition(typeId);
-                if (null == td)
+                if (null == td) {
                     throw new MapperException("CMIS type " + typeId + " does not exist on server.");
+                }
 
                 LOG.info("Detected MIME type: " + mimeType + " is mapped to CMIS type id: " + td.getId());
                 parser.extractMetadata(f, td, session);
@@ -129,16 +134,18 @@ public class FileCopier {
             int posLastDot = f.getName().indexOf('.');
             String ext = posLastDot < 0 ? null : f.getName().substring(posLastDot + 1, f.getName().length());
             String overridden = null;
-            if (null != ext && (overridden = CFG.getContentType(ext)) != null)
+            if (null != ext && (overridden = CFG.getContentType(ext)) != null) {
                 mimeType = overridden;
+            }
             long length = f.length();
 
             is = new FileInputStream(fileName);
 
             ContentStream contentStream = session.getObjectFactory()
                     .createContentStream(fileName, length, mimeType, is);
-            if (!properties.containsKey(PropertyIds.NAME))
+            if (!properties.containsKey(PropertyIds.NAME)) {
                 properties.put(PropertyIds.NAME, f.getName().replaceAll(" ", "_"));
+            }
             LOG.debug("uploading document with content lenth: " + contentStream.getLength());
             Document doc = parentFolder.createDocument(properties, contentStream, VersioningState.NONE);
             is.close();
@@ -146,8 +153,10 @@ public class FileCopier {
             id = doc.getId();
             LOG.info("New document created with id: " + id + ", name: " + properties.get(PropertyIds.NAME)
                     + " in folder: " + parentFolder.getId());
-            LOG.debug("total number of creations : " + ++TOTAL_NUM);
-        } catch (Exception e) {
+            LOG.debug("total number of creations : " + ++totalNum);
+        } catch (IOException e) {
+            LOG.error("Failed to create CMIS document.", e);
+        } catch (CmisBaseException e) {
             LOG.error("Failed to create CMIS document.", e);
         } finally {
             if (null != is) {
@@ -165,10 +174,11 @@ public class FileCopier {
     private String createFolderInRepository(String fileName, String parentFolderId) {
         Folder parentFolder;
         String id = null;
-        if (null == parentFolderId)
+        if (null == parentFolderId) {
             parentFolder = session.getRootFolder();
-        else
+        } else {
             parentFolder = (Folder) session.getObject(parentFolderId);
+        }
         Map<String, Object> properties = new HashMap<String, Object>();
         File f = new File(fileName);
         properties.put(PropertyIds.NAME, f.getName().replaceAll(" ", "_"));
@@ -200,20 +210,23 @@ public class FileCopier {
                 mpt.listMetadata(f);
             } else {
                 PropertyMapper mapper = CFG.getPropertyMapper(mimeType);
-                if (null == mapper)
+                if (null == mapper) {
                     throw new MapperException("Unknown mime type (no configuration): " + mimeType);
+                }
                 String typeId = mapper.getMappedTypeId();
-                if (null == typeId)
+                if (null == typeId) {
                     throw new MapperException("No CMIS type configured for mime type" + mimeType);
+                }
 
                 // Session available? if yes do conversion
                 TypeDefinition td = null;
                 if (null != session) {
                     td = session.getTypeDefinition(typeId);
-                    if (null == td)
+                    if (null == td) {
                         throw new MapperException("CMIS type " + typeId + " does not exist on server.");
-                    else
+                    } else {
                         LOG.info("Detected MIME type: " + mimeType + " is mapped to CMIS type id: " + td.getId());
+                    }
                 }
 
                 parser.extractMetadata(f, td, session);
@@ -222,13 +235,13 @@ public class FileCopier {
                     LOG.info("Found metadata tag " + entry.getKey() + "mapped to " + entry.getValue());
                 }
             }
-        } catch (Exception e) {
+        } catch (IOException e) {
             LOG.error("Failed to list metadata", e);
         }
         LOG.debug("Conversion and transfer done.");
     }
 
-    static public void main(String[] args) {
+    public static void main(String[] args) {
         String fileName = args[0];
         LOG.debug("extracting CMIS properties for file " + fileName);
         try {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/main/ObjGenApp.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/main/ObjGenApp.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/main/ObjGenApp.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/main/ObjGenApp.java Tue Aug 20 20:58:05 2013
@@ -18,13 +18,9 @@
  */
 package org.apache.chemistry.opencmis.tools.main;
 
-import java.io.BufferedReader;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -45,11 +41,12 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.tools.filecopy.FileCopier;
 import org.apache.chemistry.opencmis.util.repository.MultiThreadedObjectGenerator;
 import org.apache.chemistry.opencmis.util.repository.ObjectGenerator;
-import org.apache.chemistry.opencmis.util.repository.ObjectGenerator.CONTENT_KIND;
+import org.apache.chemistry.opencmis.util.repository.ObjectGenerator.ContentKind;
 import org.apache.chemistry.opencmis.util.repository.TimeLogger;
 
 public class ObjGenApp {
 
+    private static final int BUFSIZE = 64 * 1024;
     private static final String PROP_USER = SessionParameter.USER;
     private static final String PROP_PASSWORD = SessionParameter.PASSWORD;
     private static final String DEFAULT_USER = "user";
@@ -79,32 +76,30 @@ public class ObjGenApp {
     private static final String FILE_NAME_PATTERN = "FileName";
     private static final String LOCAL_FILE = "File";
     private static final String LOCAL_DIR = "Dir";
-
     private static final String BINDING_ATOM = "atompub";
     private static final String BINDING_WS = "webservices";
     private static final String BINDING_BROWSER = "browser";
 
-    BindingType fBindingType;
-    private CONTENT_KIND fContentKind;
-    CmisBinding binding;
-
-    OptionSpec<String> fCmd;
-    OptionSpec<Integer> fDepth;
-    OptionSpec<Integer> fContentSize;
-    OptionSpec<Integer> fFolderPerFolder;
-    OptionSpec<Integer> fDocsPerFolder;
-    OptionSpec<String> fFolderType;
-    OptionSpec<String> fDocType;
-    OptionSpec<String> fRepoId;
-    OptionSpec<Integer> fCount;
-    OptionSpec<Boolean> fCleanup;
-    OptionSpec<String> fRootFolder;
-    OptionSpec<Integer> fThreads;
-    OptionSpec<String> fFileName;
-    OptionSpec<String> fContentKindStr;
-    OptionSpec<String> fFileNamePattern;
-    OptionSpec<String> fLocalDir;
-    OptionSpec<String> fLocalFile;
+    private BindingType fBindingType;
+    private ContentKind fContentKind;
+    private CmisBinding binding;
+
+    private OptionSpec<String> fCmd;
+    private OptionSpec<Integer> fDepth;
+    private OptionSpec<Integer> fContentSize;
+    private OptionSpec<Integer> fFolderPerFolder;
+    private OptionSpec<Integer> fDocsPerFolder;
+    private OptionSpec<String> fFolderType;
+    private OptionSpec<String> fDocType;
+    private OptionSpec<String> fRepoId;
+    private OptionSpec<Integer> fCount;
+    private OptionSpec<Boolean> fCleanup;
+    private OptionSpec<String> fRootFolder;
+    private OptionSpec<Integer> fThreads;
+    private OptionSpec<String> fContentKindStr;
+    private OptionSpec<String> fFileNamePattern;
+    private OptionSpec<String> fLocalDir;
+    private OptionSpec<String> fLocalFile;
 
     public static void main(String[] args) {
 
@@ -146,8 +141,6 @@ public class ObjGenApp {
                 .describedAs("folder id used as root to create objects (default repository root folder)");
         fThreads = parser.accepts(THREADS).withOptionalArg().ofType(Integer.class).defaultsTo(1)
                 .describedAs("Number of threads to start in parallel");
-        // fFileName =
-        // parser.accepts(FILE).withRequiredArg().ofType(String.class).describedAs("Input File");
         fContentKindStr = parser.accepts(CONTENT_KIND).withOptionalArg().ofType(String.class).defaultsTo("lorem/text")
                 .describedAs("kind of content: static/text, lorem/text, lorem/html, fractal/jpeg");
         fFileNamePattern = parser.accepts(FILE_NAME_PATTERN).withOptionalArg().ofType(String.class)
@@ -162,41 +155,43 @@ public class ObjGenApp {
             usage(parser);
         }
 
-        String binding = getBinding();
+        String bindingStr = getBindingProperty();
 
-        if (binding.equals(BINDING_WS)) {
+        if (bindingStr.equals(BINDING_WS)) {
             fBindingType = BindingType.WEBSERVICES;
-        } else if (binding.equals(BINDING_ATOM)) {
+        } else if (bindingStr.equals(BINDING_ATOM)) {
             fBindingType = BindingType.ATOMPUB;
-        } else if (binding.equals(BINDING_BROWSER)) {
+        } else if (bindingStr.equals(BINDING_BROWSER)) {
             fBindingType = BindingType.BROWSER;
         } else {
-            System.out.println("Error: Unknown binding: " + binding + " allowed values: " + BINDING_WS + " or "
+            System.out.println("Error: Unknown binding: " + bindingStr + " allowed values: " + BINDING_WS + " or "
                     + BINDING_ATOM + " or " + BINDING_BROWSER);
             return;
         }
-
+        
         String kind = options.valueOf(fContentKindStr);
         if (null == kind) {
             if (options.valueOf(fContentSize) > 0) {
-                fContentKind = ObjectGenerator.CONTENT_KIND.StaticText;
+                fContentKind = ObjectGenerator.ContentKind.STATIC_TEXT;
             } else {
                 fContentKind = null;
             }
         } else if (kind.equals("static/text")) {
-            fContentKind = ObjectGenerator.CONTENT_KIND.StaticText;
+            fContentKind = ObjectGenerator.ContentKind.STATIC_TEXT;
         } else if (kind.equals("lorem/text")) {
-            fContentKind = ObjectGenerator.CONTENT_KIND.LoremIpsumText;
+            fContentKind = ObjectGenerator.ContentKind.LOREM_IPSUM_TEXT;
         } else if (kind.equals("lorem/html")) {
-            fContentKind = ObjectGenerator.CONTENT_KIND.LoremIpsumHtml;
+            fContentKind = ObjectGenerator.ContentKind.LOREM_IPSUM_HTML;
         } else if (kind.equals("fractal/jpeg")) {
-            fContentKind = ObjectGenerator.CONTENT_KIND.ImageFractalJpeg;
+            fContentKind = ObjectGenerator.ContentKind.IMAGE_FRACTAL_JPEG;
         } else {
             System.out.println("Unknown content kind: " + options.valueOf(fContentKindStr));
             System.out.println("  must be one of static/text, lorem/text, lorem/html, fractal/jpeg");
             usage(parser);
         }
 
+        initClientBindings();
+        
         if (null == options.valueOf(fCmd)) {
             System.out.println("No command given.");
             usage(parser);
@@ -208,8 +203,6 @@ public class ObjGenApp {
             createFolders(options);
         } else if (options.valueOf(fCmd).equals("RepositoryInfo")) {
             repositoryInfo(options);
-            // } else if (options.valueOf(fCmd).equals("CreateTypes")) {
-            // createTypes(options);
         } else if (options.valueOf(fCmd).equals("CreateFiles")) {
             createFiles(options);
         } else if (options.valueOf(fCmd).equals("CopyFiles")) {
@@ -222,21 +215,6 @@ public class ObjGenApp {
         }
     }
 
-    // private void preInitExpensiveTasks() {
-    // // JAXB initialization is very expensive, count this separate:
-    // TimeLogger logger = new TimeLogger("Initialization");
-    // logger.start();
-    // try {
-    // JaxBHelper.createMarshaller();
-    // }
-    // catch (JAXBException e) {
-    // System.out.print("Failuer in JAXB init: " + e);
-    // e.printStackTrace();
-    // } // dummy call just to get initialized
-    // logger.stop();
-    // logger.printTimes();
-    // }
-
     private static void usage(OptionParser parser) {
         try {
             System.out.println();
@@ -255,7 +233,7 @@ public class ObjGenApp {
             System.out
                     .println("java -D"
                             + PROP_ATOMPUB_URL
-                            + "=http://localhost:8080/opencmis/atom -cp ... "
+                            + "=http://localhost:8080/inmemory/atom -cp ... "
                             + "org.apache.chemistry.opencmis.util.repository.ObjGenApp --Binding=AtomPub --Command=CreateDocument "
                             + "--RepositoryId=A1 --ContentSizeInKB=25 --ContentKind=lorem/text");
             return;
@@ -268,7 +246,7 @@ public class ObjGenApp {
             String documentType, String folderType, int contentSizeInKB, String rootFolderId, boolean doCleanup) {
 
         MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator.prepareForCreateTree(
-                getClientBindings(), repoId, docsPerFolder, foldersPerFolders, depth, documentType, folderType,
+                binding, repoId, docsPerFolder, foldersPerFolders, depth, documentType, folderType,
                 contentSizeInKB, rootFolderId, fContentKind, doCleanup);
         ObjectGenerator gen = runner.getObjectGenerator();
         runner.doCreateTree();
@@ -287,12 +265,12 @@ public class ObjGenApp {
 
         // Step 1: create a root folder for each thread
         MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator
-                .prepareForCreateFolder(getClientBindings(), repoId, folderType, rootFolderId, noThreads, doCleanup);
+                .prepareForCreateFolder(binding, repoId, folderType, rootFolderId, noThreads, doCleanup);
         String[] folderIds = runner.doCreateFolder();
 
         // Step 2: fill each root folder with an object tree
         MultiThreadedObjectGenerator.ObjectGeneratorRunner[] runners = MultiThreadedObjectGenerator
-                .prepareForCreateTreeMT(getClientBindings(), repoId, docsPerFolder, foldersPerFolders, depth,
+                .prepareForCreateTreeMT(binding, repoId, docsPerFolder, foldersPerFolders, depth,
                         documentType, folderType, contentSizeInKB, folderIds, fContentKind, doCleanup);
 
         MultiThreadedObjectGenerator.runMultiThreaded(runners);
@@ -378,7 +356,7 @@ public class ObjGenApp {
             int docCount, boolean doCleanup) {
 
         MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator
-                .prepareForCreateDocument(getClientBindings(), repoId, documentType, contentSizeInKB, rootFolderId,
+                .prepareForCreateDocument(binding, repoId, documentType, contentSizeInKB, rootFolderId,
                         docCount, fContentKind, doCleanup);
         ObjectGenerator gen = runner.getObjectGenerator();
         String[] ids = runner.doCreateDocument();
@@ -402,7 +380,7 @@ public class ObjGenApp {
             String rootFolderId, int docCount, boolean doCleanup) {
 
         MultiThreadedObjectGenerator.ObjectGeneratorRunner[] runners = MultiThreadedObjectGenerator
-                .prepareForCreateDocumentMT(noThreads, getClientBindings(), repoId, documentType, contentSizeInKB,
+                .prepareForCreateDocumentMT(noThreads, binding, repoId, documentType, contentSizeInKB,
                         rootFolderId, docCount, fContentKind, doCleanup);
 
         MultiThreadedObjectGenerator.runMultiThreaded(runners);
@@ -412,7 +390,7 @@ public class ObjGenApp {
     private void createFolders(String repoId, String folderType, String rootFolderId, int noFolders, boolean doCleanup) {
 
         MultiThreadedObjectGenerator.ObjectGeneratorRunner runner = MultiThreadedObjectGenerator
-                .prepareForCreateFolder(getClientBindings(), repoId, folderType, rootFolderId, noFolders, doCleanup);
+                .prepareForCreateFolder(binding, repoId, folderType, rootFolderId, noFolders, doCleanup);
         ObjectGenerator gen = runner.getObjectGenerator();
         String[] ids = runner.doCreateFolder();
         System.out.println();
@@ -434,14 +412,14 @@ public class ObjGenApp {
             boolean doCleanup) {
 
         MultiThreadedObjectGenerator.ObjectGeneratorRunner[] runners = MultiThreadedObjectGenerator
-                .prepareForCreateFolderMT(noThreads, getClientBindings(), repoId, folderType, rootFolderId, noFolders,
+                .prepareForCreateFolderMT(noThreads, binding, repoId, folderType, rootFolderId, noFolders,
                         doCleanup);
         MultiThreadedObjectGenerator.runMultiThreaded(runners);
         System.out.println("Folder creation succeeded.");
     }
 
     private void callRepoInfo(String repositoryId, int count) {
-        RepositoryService repSvc = getClientBindings().getRepositoryService();
+        RepositoryService repSvc = binding.getRepositoryService();
         TimeLogger timeLogger = new TimeLogger("RepoInfoTest");
         RepositoryInfo repoInfo = null;
         for (int i = 0; i < count; i++) {
@@ -483,16 +461,16 @@ public class ObjGenApp {
                 System.out.println("Generating file: " + fileName);
                 if (contentSize > 0) {
                     switch (fContentKind) {
-                    case StaticText:
+                    case STATIC_TEXT:
                         contentStream = objGen.createContentStaticText();
                         break;
-                    case LoremIpsumText:
+                    case LOREM_IPSUM_TEXT:
                         contentStream = objGen.createContentLoremIpsumText();
                         break;
-                    case LoremIpsumHtml:
+                    case LOREM_IPSUM_HTML:
                         contentStream = objGen.createContentLoremIpsumHtml();
                         break;
-                    case ImageFractalJpeg:
+                    case IMAGE_FRACTAL_JPEG:
                         contentStream = objGen.createContentFractalimageJpeg();
                         break;
                     }
@@ -501,7 +479,7 @@ public class ObjGenApp {
                 // write to a file:
                 is = contentStream.getStream();
                 os = new FileOutputStream(fileName);
-                byte[] b = new byte[64 * 1024];
+                byte[] b = new byte[BUFSIZE];
                 int read;
                 while ((read = is.read(b)) != -1) {
                     os.write(b, 0, read);
@@ -545,7 +523,7 @@ public class ObjGenApp {
         System.out.println("Repository id is: " + repoId);
         System.out.println("Folder id used as root: " + options.valueOf(fRootFolder));
 
-        Map<String, String> parameters = getConnectionParameters(getBinding(), repoId);
+        Map<String, String> parameters = getConnectionParameters(getBindingProperty(), repoId);
         FileCopier fc = new FileCopier();
         fc.connect(parameters);
         fc.copyRecursive(name, folderId);
@@ -586,7 +564,7 @@ public class ObjGenApp {
         return parameters;
     }
 
-    private CmisBinding getClientBindings() {
+    private void initClientBindings() {
         if (binding == null) {
             if (fBindingType == BindingType.ATOMPUB) {
                 binding = createAtomBinding(getAtomPubUrl(), getUser(), getPassword());
@@ -598,7 +576,6 @@ public class ObjGenApp {
                 binding = createBrowserBinding(getBrowserUrl(), getUser(), getPassword());
             }
         }
-        return binding;
     }
 
     private static void filLoginParams(Map<String, String> parameters, String user, String password) {
@@ -700,7 +677,7 @@ public class ObjGenApp {
         }
     }
 
-    private static String getBinding() {
+    private static String getBindingProperty() {
         return System.getProperty(PROP_BINDING, DEFAULT_BINDING);
     }
 
@@ -733,47 +710,9 @@ public class ObjGenApp {
                 break;
             } else {
                 customHeaders.put(PROP_CUSTOM + i++, val);
-                // int posCol = val.indexOf(':');
-                // if (posCol <= 0) {
-                // LOG.warn("Ignoring custom header "+ val +
-                // ": no colon found.");
-                // } else {
-                // String headerKey = PROP_CUSTOM + val.substring(0,
-                // posCol).trim();
-                // String headerVal = val.substring(posCol+1).trim();
-                // LOG.debug("Adding custom header " + headerKey + ":" +
-                // headerVal);
-                // customHeaders.put(headerKey, headerVal);
-                // }
             }
         }
         return customHeaders;
     }
 
-    private static void getUrl(String urlStr) {
-        URL url;
-        InputStream is;
-        InputStreamReader isr;
-        BufferedReader r;
-        String str;
-
-        try {
-            System.out.println("Reading URL: " + urlStr);
-            url = new URL(urlStr);
-            is = url.openStream();
-            isr = new InputStreamReader(is);
-            r = new BufferedReader(isr);
-            do {
-                str = r.readLine();
-                if (str != null) {
-                    System.out.println(str);
-                }
-            } while (str != null);
-        } catch (MalformedURLException e) {
-            System.out.println("Must enter a valid URL" + e);
-        } catch (IOException e) {
-            System.out.println("Can not connect" + e);
-        }
-    }
-
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/Configurator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/Configurator.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/Configurator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/Configurator.java Tue Aug 20 20:58:05 2013
@@ -33,15 +33,15 @@ public class Configurator {
 
     private static final Logger LOG = LoggerFactory.getLogger(Configurator.class.getName());
 
-    private static Configurator INSTANCE;
+    private static Configurator instance;
     private static final String PREFIX = "mapping.contentType";
 
     public static Configurator getInstance() {
-        if (null == INSTANCE) {
-            INSTANCE = new Configurator();
+        if (null == instance) {
+            instance = new Configurator();
         }
 
-        return INSTANCE;
+        return instance;
     }
 
     private Properties properties;
@@ -59,7 +59,6 @@ public class Configurator {
 
     // just for unit tests
     Configurator(Properties props) {
-        // contentTypeMapperMap = new HashMap<String, PropertyMapper>();
         this.properties = props;
     }
 
@@ -80,21 +79,6 @@ public class Configurator {
             }
         }
         return parser;
-
-        // for (String contentType : contentTypes) {
-        // if (contentType.equals(mimeType))
-        // return cmisTypeId;
-        // boolean isStar = contentType.endsWith("/*");
-        // if (isStar) {
-        // String generalPartParam = mimeType.substring(0,
-        // mimeType.indexOf('/'));
-        // String generalPartCfg = contentType.substring(0,
-        // mimeType.indexOf('/'));
-        // if (generalPartParam.equals(generalPartCfg))
-        // return cmisTypeId;
-        // }
-        // }
-        // return null;
     }
 
     private void loadProperties() {
@@ -204,8 +188,6 @@ public class Configurator {
                                 // configured
             className = MetadataParserTika.class.getName();
         }
-        // throw new MapperException("Missing parser class in properties: " +
-        // PREFIX + "." + typeKey + ".parserClass");
 
         Object obj = null;
 
@@ -235,8 +217,6 @@ public class Configurator {
         if (null == className) {
             className = PropertyMapperTika.class.getName();
         }
-        // throw new MapperException("Missing property mapper in properties: " +
-        // PREFIX + "." + typeKey + ".mapperClass");
 
         Object obj = null;
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapper.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapper.java Tue Aug 20 20:58:05 2013
@@ -88,6 +88,6 @@ public interface PropertyMapper {
      * @return
      *      array with content types
      */
-    public String[] getContentTypes();
+    String[] getContentTypes();
 
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperExif.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperExif.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperExif.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperExif.java Tue Aug 20 20:58:05 2013
@@ -45,6 +45,8 @@ import com.drew.metadata.jpeg.JpegDirect
 
 public class PropertyMapperExif extends AbstractPropertyMapper {
 
+    private static final int SECS_PER_HOUR = 3600;
+    private static final int SECS_PER_MINUTE = 60;
     private static final Logger LOG = LoggerFactory.getLogger(PropertyMapperExif.class.getName());
     private static final String EXIF_DATE_FORMAT = "yyyy:MM:dd HH:mm:ss";
 
@@ -57,6 +59,7 @@ public class PropertyMapperExif extends 
 
     protected Map<String, Object> propMap;
 
+    @Override
     public boolean initialize(String cfgPrefix, String typeKey, Properties properties) {
         super.initialize(cfgPrefix, typeKey, properties);
         reset();
@@ -82,9 +85,11 @@ public class PropertyMapperExif extends 
         for (String key : keys) {
             if (key.startsWith(prefix)) {
                 String id = key.substring(prefix.length());
-                String cmisPropId = properties.getProperty(key).trim();
-                if (null == cmisPropId)
+                String cmisPropId = properties.getProperty(key);
+                if (null == cmisPropId) {
                     throw new MapperException("Configuration key " + key + " must have a value assigned");
+                }
+                cmisPropId = cmisPropId.trim();
                 LOG.debug("Found mapping for type " + dirKey + " with " + id + " to " + cmisPropId);
                 propMap.put(id, cmisPropId);
             }
@@ -139,8 +144,9 @@ public class PropertyMapperExif extends 
         if (null != propId) {
             if (null != td) {
                 PropertyDefinition<?> pd = td.getPropertyDefinitions().get(propId);
-                if (null == pd)
+                if (null == pd) {
                     throw new MapperException("Unknown property id " + propId + " in type definition " + td.getId());
+                }
                 PropertyType pt = pd.getPropertyType();
                 Object convValue = convertValue(dir, tag, pt);
                 propMap.put(propId, convValue);
@@ -195,8 +201,9 @@ public class PropertyMapperExif extends 
                     }
                     String s = ((String) src);
                     res = s;
-                } else
+                } else {
                     res = null;
+                }
             }
         } else if (ExifDirectory.class.equals(dir.getClass())) {
             // is there a property mapped to this tag?
@@ -219,9 +226,10 @@ public class PropertyMapperExif extends 
                 }
                 if (clazz.equals(Rational.class)) {
                     // expect a CMIS decimal property
-                    if (propType != PropertyType.DECIMAL)
+                    if (propType != PropertyType.DECIMAL) {
                         throw new MapperException("Tag value has type Rational and expected CMIS Decimal, but found: "
                                 + propType + " for tag: " + tag);
+                    }
 
                     if (tag.getTagType() == ExifDirectory.TAG_SHUTTER_SPEED) {
                         // requires special handling, see Tika impl.
@@ -257,7 +265,7 @@ public class PropertyMapperExif extends 
                         DateFormat formatter = new SimpleDateFormat(dateFormat);
                         GregorianCalendar cal;
                         try {
-                            Date date = (Date) formatter.parse((String) src);
+                            Date date = formatter.parse((String) src);
                             // convert date to GreogorianCalendar as CMIS
                             // expects
                             cal = new GregorianCalendar();
@@ -293,9 +301,6 @@ public class PropertyMapperExif extends 
                     res = b;
                 } else {
                     LOG.debug("Tag value has unsupported type: " + clazz.getName() + " for EXIF tag: " + tag);
-                    // throw new
-                    // MapperException("Tag value has unsupported type: " +
-                    // clazz.getName() + " for tag: " + tag);
                 }
             }
         } else if (JpegDirectory.class.equals(dir.getClass())) {
@@ -314,9 +319,10 @@ public class PropertyMapperExif extends 
                 Class<?> clazz = src.getClass();
 
                 if (clazz.equals(Integer.class)) {
-                    if (propType != PropertyType.INTEGER)
+                    if (propType != PropertyType.INTEGER) {
                         throw new MapperException("Tag value has type Integer and expected CMIS Integer, but found: "
                                 + propType + " for tag: " + tag);
+                    }
                     // convert to a long
                     long l = ((Integer) src).longValue();
                     res = l;
@@ -349,7 +355,7 @@ public class PropertyMapperExif extends 
         int deg = components[0].intValue();
         double min = components[1].doubleValue();
         double sec = components[2].doubleValue();
-        Double d = (deg + min / 60 + sec / 3600);
+        Double d = (deg + min / SECS_PER_MINUTE + sec / SECS_PER_HOUR);
         if (d > 0.0 && mustInvert) {
             d = -d;
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperTika.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperTika.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperTika.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperTika.java Tue Aug 20 20:58:05 2013
@@ -45,9 +45,9 @@ public class PropertyMapperTika extends 
     private Map<String, String> tokenizerMap = new HashMap<String, String> (); // tag to tokenizer regexp
 
     public PropertyMapperTika() {
-        reset();
     }
     
+    @Override
     public boolean initialize(String cfgPrefix, String typeKey, Properties properties) {
         super.initialize(cfgPrefix, typeKey, properties);
         buildIdMap(typeKey, properties);
@@ -63,23 +63,27 @@ public class PropertyMapperTika extends 
         return propId;
     }
 
-    public Object convertValue(String key, PropertyDefinition<?> propDef, String strValue) {
+    public Object convertValue(String key, PropertyDefinition<?> propDef, String strValueParam) {
+        String strValue = strValueParam; 
         Object value = null;
         PropertyType pt = propDef.getPropertyType();
         
-        if (null == pt)
+        if (null == pt) {
             value = null;
-        else if (null != strValue && strValue.length() > 0) {
+        } else if (null != strValue && strValue.length() > 0) {
             // Tika has a bug and sometimes fails to parse MP3 tags, then generates '\0' in String
             // see https://issues.apache.org/jira/browse/TIKA-887
             int lastIllegalPos = -1;
             for (int i=0; i<strValue.length(); i++) {
               int c = strValue.codePointAt(i);
-              if (Character.isISOControl(c))
-                  lastIllegalPos = i;                  
+              if (Character.isISOControl(c)) {
+                lastIllegalPos = i;
+            }                  
             }
             if (lastIllegalPos >= 0)
+             {
                 strValue = strValue.substring(lastIllegalPos+1); // use remaining part after illegal char
+            }
 
             switch (pt) {
             case STRING:
@@ -87,38 +91,41 @@ public class PropertyMapperTika extends 
             case URI:
             case ID:
                 
-                if (propDef.getCardinality() == Cardinality.SINGLE)
+                if (propDef.getCardinality() == Cardinality.SINGLE) {
                     value = strValue;
-                else {
+                } else {
                     String tokenizer = tokenizerMap.containsKey(key) ? tokenizerMap.get(key) : "\\W";
                     String[] result = strValue.split(tokenizer);
                     List<String> valList = new ArrayList<String>();
-                    for (String s : result)
+                    for (String s : result) {
                         valList.add(s.trim());
+                    }
                     value = valList;
                 }
                 break;
             case INTEGER:
-                if (propDef.getCardinality() == Cardinality.SINGLE)
+                if (propDef.getCardinality() == Cardinality.SINGLE) {
                     value = Integer.valueOf(strValue);
-                else {
+                } else {
                         String tokenizer = tokenizerMap.containsKey(key) ? tokenizerMap.get(key) : "\\W";
                         String[] result = strValue.split(tokenizer);
                         List<Integer> valList = new ArrayList<Integer>();
-                        for (String s : result)
+                        for (String s : result) {
                             valList.add(Integer.valueOf(s.trim()));
+                        }
                         value = valList;
                     }
                 break;
             case DECIMAL:
-                if (propDef.getCardinality() == Cardinality.SINGLE)
-                    value = Double.valueOf(strValue);                
-                else {
+                if (propDef.getCardinality() == Cardinality.SINGLE) {
+                    value = Double.valueOf(strValue);
+                } else {
                     String tokenizer = tokenizerMap.containsKey(key) ? tokenizerMap.get(key) : "[\\s;:]";                        
                     String[] result = strValue.split(tokenizer);
                         List<Double> valList = new ArrayList<Double>();
-                        for (String s : result)
+                        for (String s : result) {
                             valList.add(Double.valueOf(s.trim()));
+                        }
                         value = valList;
                     }
                 break;
@@ -146,7 +153,6 @@ public class PropertyMapperTika extends 
                     LOG.error("Could not parse date: " + strValue + " (check date format");
                     LOG.error(e.toString(), e);
                     value = null;
-                    e.printStackTrace();
                 }
                 break;
             default:
@@ -164,17 +170,21 @@ public class PropertyMapperTika extends 
         for (String key : keys) {
             if (key.startsWith(prefix)) {
                 String id = key.substring(prefix.length());
-                String cmisPropId = properties.getProperty(key).trim();
-                if (null == cmisPropId)
+                String cmisPropId = properties.getProperty(key);
+                if (null == cmisPropId) {
                     throw new MapperException("Configuration key " + key + " must have a value assigned");
+                }
+                cmisPropId = cmisPropId.trim();
                 LOG.debug("Found mapping for type " + typeKey + " with " + id + " to " + cmisPropId);
                 propMapTags.put(id,  cmisPropId);
             }
             if (key.startsWith(tokenizerPrefix)) {
                 String id = key.substring(tokenizerPrefix.length());
-                String regex = properties.getProperty(key).trim();
-                if (null == regex)
+                String regex = properties.getProperty(key);
+                if (null == regex) {
                     throw new MapperException("Configuration key " + key + " must have a value assigned");
+                }
+                regex = regex.trim();
                 LOG.debug("Found tokenizer mapping for property " + id + " to " + regex);
                 tokenizerMap.put(id, regex);
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/AbstractMetadataParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/AbstractMetadataParser.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/AbstractMetadataParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/AbstractMetadataParser.java Tue Aug 20 20:58:05 2013
@@ -27,8 +27,6 @@ import org.apache.chemistry.opencmis.too
 
 public abstract class AbstractMetadataParser implements MetadataParser {
     
-    // private static final Logger LOG = LoggerFactory.getLogger(AbstractMetadataParser.class.getName());
-
     protected Map<String, Object> cmisProperties;
     protected PropertyMapper mapper = null;
     
@@ -49,8 +47,9 @@ public abstract class AbstractMetadataPa
         cmisProperties = new HashMap<String, Object>();
         mapper.reset();
 
-        if (null == typeId)
+        if (null == typeId) {
             throw new MapperException("No CMIS Type configured in this parser.");
+        }
         cmisProperties.put(PropertyIds.OBJECT_TYPE_ID, typeId);
     }
     

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/MetadataParserTika.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/MetadataParserTika.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/MetadataParserTika.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/MetadataParserTika.java Tue Aug 20 20:58:05 2013
@@ -43,7 +43,6 @@ import org.xml.sax.helpers.DefaultHandle
 public class MetadataParserTika extends AbstractMetadataParser {
 
     private static final Logger LOG = LoggerFactory.getLogger(MetadataParserTika.class.getName());
-    private Session session;
 
     public MetadataParserTika() {
     }
@@ -68,10 +67,13 @@ public class MetadataParserTika extends 
                         if (td != null) {
                             PropertyDefinition<?> propDef = getMappedPropertyDefinition(td.getId(), propertyId, session);                            
                             Object convVal = mapper.convertValue(propertyId, propDef, val);
-                            if (null != convVal)
+                            if (null != convVal) {
                                 cmisProperties.put(propertyId, convVal);
-                        } else
+                            }
+                        }
+                        else {
                             cmisProperties.put(propertyId, val); // omit conversion if no type definition is available
+                        }
                     }
                 }
             }
@@ -82,16 +84,17 @@ public class MetadataParserTika extends 
         }
     }
 
-    private PropertyDefinition<?> getMappedPropertyDefinition(String typeId, String propertyId, Session session) {
-        String typeIdOrg = typeId;
-        while (null != typeId) {
-            TypeDefinition td = session.getTypeDefinition(typeId);
+    private PropertyDefinition<?> getMappedPropertyDefinition(String typeId, String propertyId, Session session) throws MapperException {
+        String typeIdMod = typeId;
+        while (null != typeIdMod) {
+            TypeDefinition td = session.getTypeDefinition(typeIdMod);
             PropertyDefinition<?> propDef = td.getPropertyDefinitions().get(propertyId);
-            if (null != propDef)
+            if (null != propDef) {
                 return propDef;
-            typeId = td.getParentTypeId();
+            }
+            typeIdMod = td.getParentTypeId();
         }
-        throw new MapperException("Mapping error: unknown property "+ propertyId + " in type definition " + typeIdOrg);
+        throw new MapperException("Mapping error: unknown property "+ propertyId + " in type definition " + typeId);
     }    
     
     public void listMetadata(File f) throws MapperException {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java?rev=1515969&r1=1515968&r2=1515969&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalCalculator.java Tue Aug 20 20:58:05 2013
@@ -73,10 +73,11 @@ final class FractalCalculator {
                 double zI = iRangeMin + (imageHeight - y) * delta;
 
                 // Is the point inside the set?
-                if (useJulia)
+                if (useJulia) {
                     noIterations[x][y] = testPointJuliaSet(zR, zI, maxIterations);
-                else
-                    noIterations[x][y] = testPointMandelbrot(zR, zI, maxIterations);            
+                } else {
+                    noIterations[x][y] = testPointMandelbrot(zR, zI, maxIterations);
+                }            
             }
         }
         return noIterations;



Mime
View raw message