]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6375: In the middle of long break from code changes. Committing to prevent...
authorremillet <remillet@yahoo.com>
Thu, 22 Jan 2015 22:57:01 +0000 (14:57 -0800)
committerremillet <remillet@yahoo.com>
Thu, 22 Jan 2015 22:57:01 +0000 (14:57 -0800)
90 files changed:
3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java
3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateRelationsOnDelete.java
3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/workflow/services/QuotesModerationService.java
3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteManagerImpl.java
3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/AbstractQuoteListener.java
3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/DocumentRemovedQuoteEventListener.java
3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/QuoteRemovedEventListener.java
3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java
pom.xml
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountRoleDocumentHandler.java
services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionResource.java
services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionDocumentModelHandler.java
services/authority/service/pom.xml
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java [deleted file]
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java [deleted file]
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java [deleted file]
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/batch/service/src/main/java/org/collectionspace/services/batch/BatchInvocable.java
services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/CreateAndLinkLoanOutBatchJob.java
services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/UpdateObjectLocationBatchJob.java
services/blob/service/pom.xml
services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java
services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java
services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/nuxeo/CollectionObjectDocumentModelHandler.java
services/common/pom.xml
services/common/src/main/java/org/collectionspace/services/common/AbstractCollectionSpaceResourceImpl.java
services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java [moved from services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java with 96% similarity]
services/common/src/main/java/org/collectionspace/services/common/ResourceMap.java
services/common/src/main/java/org/collectionspace/services/common/ResourceMapImpl.java
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/common/document/AbstractMultipartDocumentHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/common/document/MultipartDocumentHandler.java
services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java
services/common/src/main/java/org/collectionspace/services/common/publicitem/PublicItemResource.java
services/common/src/main/java/org/collectionspace/services/common/query/QueryContext.java
services/common/src/main/java/org/collectionspace/services/common/relation/RelationResource.java
services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java
services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java
services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClientFactory.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/LazyAuthorityRefDocList.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/common/src/main/java/org/collectionspace/services/common/workflow/service/nuxeo/WorkflowDocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionInterface.java [moved from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryInstanceInterface.java with 89% similarity]
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java [moved from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryInstanceWrapper.java with 92% similarity]
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java [deleted file]
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoClientEmbedded.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoConnectorEmbedded.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java [new file with mode: 0644]
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java
services/conditioncheck/service/src/main/java/org/collectionspace/services/conditioncheck/ConditioncheckResource.java
services/conditioncheck/service/src/main/java/org/collectionspace/services/conditioncheck/nuxeo/ConditioncheckDocumentModelHandler.java
services/contact/service/src/main/java/org/collectionspace/services/contact/ContactResource.java
services/contact/service/src/main/java/org/collectionspace/services/contact/nuxeo/ContactDocumentModelHandler.java
services/dimension/service/src/main/java/org/collectionspace/services/dimension/DimensionResource.java
services/group/service/src/main/java/org/collectionspace/services/group/GroupResource.java
services/group/service/src/main/java/org/collectionspace/services/group/nuxeo/GroupDocumentModelHandler.java
services/imports/service/src/main/java/org/collectionspace/services/imports/nuxeo/ImportCommand.java
services/imports/service/src/main/java/org/collectionspace/services/imports/nuxeo/ImportsDocumentModelHandler.java
services/intake/service/src/main/java/org/collectionspace/services/intake/IntakeResource.java
services/intake/service/src/main/java/org/collectionspace/services/intake/nuxeo/IntakeDocumentModelHandler.java
services/loanin/service/src/main/java/org/collectionspace/services/loanin/LoaninResource.java
services/loanin/service/src/main/java/org/collectionspace/services/loanin/nuxeo/LoaninDocumentModelHandler.java
services/loanout/service/src/main/java/org/collectionspace/services/loanout/LoanoutResource.java
services/loanout/service/src/main/java/org/collectionspace/services/loanout/nuxeo/LoanoutDocumentModelHandler.java
services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java
services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaDocumentModelHandler.java
services/movement/service/src/main/java/org/collectionspace/services/movement/MovementResource.java
services/movement/service/src/main/java/org/collectionspace/services/movement/nuxeo/MovementDocumentModelHandler.java
services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/ObjectExitResource.java
services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/nuxeo/ObjectExitDocumentModelHandler.java
services/publicitem/service/src/main/java/org/collectionspace/services/publicitem/nuxeo/PublicItemDocumentModelHandler.java
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java
services/report/service/src/main/java/org/collectionspace/services/report/ReportResource.java
services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java
services/servicegroup/service/src/main/java/org/collectionspace/services/servicegroup/ServiceGroupResource.java
services/servicegroup/service/src/main/java/org/collectionspace/services/servicegroup/nuxeo/ServiceGroupDocumentModelHandler.java
services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/ValuationcontrolResource.java
services/valuationcontrol/service/src/main/java/org/collectionspace/services/valuationcontrol/nuxeo/ValuationcontrolDocumentModelHandler.java
services/workflow/service/src/main/java/org/collectionspace/services/workflow/WorkflowResource.java

index 48672cd680b4578db2ef802575f6d1d26d603719..cbb23bd1c89e2164c398528029a134a68dbfee22 100644 (file)
@@ -3,14 +3,18 @@ package org.collectionspace.services.listener;
 import java.util.GregorianCalendar;
 import java.util.HashSet;
 import java.util.Set;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.movement.nuxeo.MovementConstants;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+
 import org.nuxeo.ecm.core.api.ClientException;
-import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.event.Event;
@@ -83,7 +87,7 @@ public abstract class AbstractUpdateObjectLocationValues implements EventListene
         // (The rest of the code flow below is then identical to that which
         // is followed when this document event involves a Movement record.
         String movementCsid = "";
-        Enum notificationDocumentType;
+        Enum<EventNotificationDocumentType> notificationDocumentType;
         if (documentMatchesType(docModel, RELATION_DOCTYPE)) {
             if (logger.isTraceEnabled()) {
                 logger.trace("An event involving a Relation document was received by UpdateObjectLocationOnMove ...");
@@ -141,7 +145,9 @@ public abstract class AbstractUpdateObjectLocationValues implements EventListene
             logger.trace("Notification document type=" + notificationDocumentType.name());
         }
 
-        CoreSession coreSession = docEventContext.getCoreSession();
+        // All Nuxeo sessions that get passed around to CollectionSpace code need to be
+        // wrapped inside of a CoreSessionWrapper
+        CoreSessionInterface coreSession = new CoreSessionWrapper(docEventContext.getCoreSession());
         Set<String> collectionObjectCsids = new HashSet<>();
 
         if (notificationDocumentType == EventNotificationDocumentType.RELATION) {
@@ -210,7 +216,7 @@ public abstract class AbstractUpdateObjectLocationValues implements EventListene
      * related to the Movement record.
      */
     private Set<String> getCollectionObjectCsidsRelatedToMovement(String movementCsid,
-            CoreSession coreSession) throws ClientException {
+            CoreSessionInterface coreSession) throws ClientException {
 
         Set<String> csids = new HashSet<>();
 
@@ -314,7 +320,7 @@ public abstract class AbstractUpdateObjectLocationValues implements EventListene
      * @return a document model for the document identified by the supplied
      * CSID.
      */
-    protected static DocumentModel getCurrentDocModelFromCsid(CoreSession session, String collectionObjectCsid) {
+    protected static DocumentModel getCurrentDocModelFromCsid(CoreSessionInterface session, String collectionObjectCsid) {
         DocumentModelList collectionObjectDocModels = null;
         try {
             final String query = "SELECT * FROM "
@@ -365,7 +371,7 @@ public abstract class AbstractUpdateObjectLocationValues implements EventListene
      * @return the most recent Movement record related to the CollectionObject
      * identified by the supplied CSID.
      */
-    protected static DocumentModel getMostRecentMovement(CoreSession session, String collectionObjectCsid)
+    protected static DocumentModel getMostRecentMovement(CoreSessionInterface session, String collectionObjectCsid)
             throws ClientException {
         DocumentModel mostRecentMovementDocModel = null;
         // Get Relation records for Movements related to this CollectionObject.
index 9656ba139527a77c70b90c3122d6969334c0e8ba..9cd7c72a2eb28a8b80884ccd15a3053f0926cb8e 100644 (file)
@@ -3,11 +3,13 @@ package org.collectionspace.services.listener;
 import java.util.ArrayList;
 import java.util.IllegalFormatException;
 import java.util.List;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.collectionspace.services.client.workflow.WorkflowClient;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper;
 import org.nuxeo.ecm.core.api.ClientException;
-import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.impl.LifeCycleFilter;
@@ -73,7 +75,7 @@ public class UpdateRelationsOnDelete implements EventListener {
             LifeCycleFilter workflowStateFilter = new LifeCycleFilter(null, workflowStatesToFilter);
             
             // Perform the filtered query
-            CoreSession session = docModel.getCoreSession();
+            CoreSessionInterface session = new CoreSessionWrapper(docModel.getCoreSession());
             DocumentModelList matchingDocuments;
             try {
                 matchingDocuments = session.query(queryString.toString(), workflowStateFilter);
index 78ed7b0eec9c278a9002a5e2b241625acc48bf37..65953e34c54cf5beb2061b20bc41a9130a64c9a4 100644 (file)
@@ -46,7 +46,7 @@ public interface QuotesModerationService {
      */
     /**
     ProcessInstance getModerationProcess(JbpmService jbpmService,
-            CoreSession session, DocumentModel doc, String commentId)
+            CoreSessionInterface session, DocumentModel doc, String commentId)
             throws ClientException;
             **/
 
index 4deed9bc1699c5973f6feee0466ce6f2125da4ac..91a02d0d7f5e03899ea118ec32239149f4e63db6 100644 (file)
@@ -23,7 +23,6 @@ import java.io.Serializable;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
@@ -35,6 +34,7 @@ import javax.security.auth.login.LoginException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.nuxeo.common.utils.IdUtils;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.ClientRuntimeException;
@@ -103,16 +103,19 @@ public class QuoteManagerImpl implements QuoteManager {
 
     protected CoreSession openCoreSession(String repositoryName)
             throws ClientException {
+       CoreSession result = null;
+       
         try {
-            RepositoryManager repoMgr = Framework.getService(RepositoryManager.class);
-            return repoMgr.getRepository(repositoryName).open();
+               result = CoreInstance.openCoreSession(repositoryName);
         } catch (Exception e) {
             throw new ClientException(e);
         }
+        
+        return result;
     }
 
     protected void closeCoreSession(LoginContext loginContext,
-            CoreSession session) throws ClientException {
+               CoreSession session) throws ClientException {
         if (loginContext != null) {
             try {
                 loginContext.logout();
@@ -121,7 +124,7 @@ public class QuoteManagerImpl implements QuoteManager {
             }
         }
         if (session != null) {
-            CoreInstance.getInstance().close(session);
+               session.close();
         }
     }
 
@@ -132,8 +135,8 @@ public class QuoteManagerImpl implements QuoteManager {
     public List<DocumentModel> getQuotes(DocumentModel docModel)
             throws ClientException {
         RelationManager relationManager;
-        Map<String, Serializable> ctxMap = new HashMap<String, Serializable>();
-        ctxMap.put(ResourceAdapter.CORE_SESSION_ID_CONTEXT_KEY, docModel.getSessionId());
+        Map<String, Object> ctxMap = new HashMap<String, Object>();
+        ctxMap.put(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, docModel.getSessionId());
         try {
             relationManager = getRelationManager();
         } catch (Exception e) {
@@ -570,8 +573,8 @@ public class QuoteManagerImpl implements QuoteManager {
     public List<DocumentModel> getDocumentsForQuote(DocumentModel comment)
             throws ClientException {
         RelationManager relationManager;
-        Map<String, Serializable> ctxMap = new HashMap<String, Serializable>();
-        ctxMap.put(ResourceAdapter.CORE_SESSION_ID_CONTEXT_KEY, comment.getSessionId());
+        Map<String, Object> ctxMap = new HashMap<String, Object>();
+        ctxMap.put(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, comment.getSessionId());
         try {
             relationManager = getRelationManager();
         } catch (Exception e) {
index 32e056c4cec3ace8b19027cea52d0b99d877302b..fe4157b5b70be76876f2e72d24a9d292ed98b47c 100644 (file)
@@ -21,6 +21,7 @@ package org.collectionspace.ecm.platform.quote.listener;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
index a7977bd08e0e209eb7d70c3269da3fdd1db07dc8..7983d1d16399a6b89bdb54e9611806b1c74fdca8 100644 (file)
  * $Id$
  */
 
+/*
+ * An example Nuxeo event listener. 
+ */
+
 package org.collectionspace.ecm.platform.quote.listener;
 
+
+
 import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
index 171acde824b54ba69f88e6d008f3ed3c2b8c08fa..a1a662e4c2bd91a2e3cd63d988a04db42ed09f5f 100644 (file)
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
index c21cd20946b6fdb129ae7800eabbcfc0bd939abc..a424edf2507df5e963c5e01d4d348f508c2c8106 100644 (file)
@@ -1,9 +1,10 @@
 package org.collectionspace.services.nuxeo.extension.thumbnail;
 
+/*
+ * An example Nuxeo event "listener".
+ */
 
-import java.io.IOException;
 import java.io.Serializable;
-import java.security.NoSuchAlgorithmException;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 
@@ -43,7 +44,7 @@ public class AddThumbnailUnrestricted extends UnrestrictedSessionRunner {
      * (non-Javadoc)
      * @see org.nuxeo.ecm.core.api.UnrestrictedSessionRunner#run()
      * 
-     * Creates a new thumbnail image and associates it with the document blob by adding a "Thumnail" facet
+     * Creates a new thumbnail image and associates it with the document blob by adding a "Thumbnail" facet
      * to the document blob.
      */
     @Override
diff --git a/pom.xml b/pom.xml
index 32545c14db5cf4bc8bab2d03ca6e0f63bd2ab3e3..2c94a0cd02b1002356bba069af077f221440a653 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -18,6 +18,7 @@
                <nuxeo.shell.version>${nuxeo.general.release}</nuxeo.shell.version>
                <nuxeo.platform.version>${nuxeo.general.release}</nuxeo.platform.version>
                <nuxeo.core.version>${nuxeo.general.release}</nuxeo.core.version>
+               <chemistry.opencmis.version.nx>0.12.0-NX2</chemistry.opencmis.version.nx>
                <spring.version>3.0.5.RELEASE</spring.version>
                <spring.security.version>3.0.5.RELEASE</spring.security.version>
        </properties>
                                        </executions>
                                </plugin>
 
-                               <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
+                               <!--This plugin's configuration is used to store Eclipse m2e settings 
+                                       only. It has no influence on the Maven build itself. -->
                                <plugin>
                                        <groupId>org.eclipse.m2e</groupId>
                                        <artifactId>lifecycle-mapping</artifactId>
                                </plugin>
                        </plugins>
                </pluginManagement>
-               
+
                <plugins>
-                       <!-- 
-                               This plugin ensures that the required environment variables are set before we perform
-                               any build related tasks.
-                        -->
+                       <!-- This plugin ensures that the required environment variables are set 
+                               before we perform any build related tasks. -->
                        <plugin>
                                <artifactId>maven-antrun-plugin</artifactId>
                                <executions>
                                                </goals>
                                                <configuration>
                                                        <tasks>
-                                                               <fail unless="env.CSPACE_JEESERVER_HOME" message="Required environment variable CSPACE_JEESERVER_HOME has not been set." />
-                                                               <fail unless="env.DB_CSPACE_PASSWORD" message="Required environment variable DB_CSPACE_PASSWORD has not been set." />
-                                                               <fail unless="env.DB_NUXEO_PASSWORD" message="Required environment variable DB_NUXEO_PASSWORD has not been set." />
-                                                               <fail unless="env.DB_READER_PASSWORD" message="Required environment variable DB_READER_PASSWORD has not been set." />
-                                                               <fail unless="env.DB_CSADMIN_PASSWORD" message="Required environment variable DB_CSADMIN_PASSWORD has not been set." />
-                                                               <!--
-                                                                       Fail if these deprecated environment variables are set.
-                                                               -->
-                                                               <fail if="env.DB_USER" message="The deprecated environment variable DB_USER should not be set." />
-                                                               <fail if="env.DB_PASSWORD" message="The deprecated environment variable DB_PASSWORD should not be set.  Ensure that DB_CSADMIN_PASSWORD is set instead." />
-                                                               <fail if="env.DB_PASSWORD_CSPACE" message="The deprecated environment variable DB_PASSWORD_CSPACE should not be set.  Ensure that DB_CSPACE_PASSWORD is set instead." />
-                                                               <fail if="env.DB_PASSWORD_NUXEO" message="The deprecated environment variable DB_PASSWORD_NUXEO should not be set.  Ensure that DB_NUXEO_PASSWORD is set instead." />
+                                                               <fail unless="env.CSPACE_JEESERVER_HOME"
+                                                                       message="Required environment variable CSPACE_JEESERVER_HOME has not been set." />
+                                                               <fail unless="env.DB_CSPACE_PASSWORD"
+                                                                       message="Required environment variable DB_CSPACE_PASSWORD has not been set." />
+                                                               <fail unless="env.DB_NUXEO_PASSWORD"
+                                                                       message="Required environment variable DB_NUXEO_PASSWORD has not been set." />
+                                                               <fail unless="env.DB_READER_PASSWORD"
+                                                                       message="Required environment variable DB_READER_PASSWORD has not been set." />
+                                                               <fail unless="env.DB_CSADMIN_PASSWORD"
+                                                                       message="Required environment variable DB_CSADMIN_PASSWORD has not been set." />
+                                                               <!-- Fail if these deprecated environment variables are set. -->
+                                                               <fail if="env.DB_USER"
+                                                                       message="The deprecated environment variable DB_USER should not be set." />
+                                                               <fail if="env.DB_PASSWORD"
+                                                                       message="The deprecated environment variable DB_PASSWORD should not be set.  Ensure that DB_CSADMIN_PASSWORD is set instead." />
+                                                               <fail if="env.DB_PASSWORD_CSPACE"
+                                                                       message="The deprecated environment variable DB_PASSWORD_CSPACE should not be set.  Ensure that DB_CSPACE_PASSWORD is set instead." />
+                                                               <fail if="env.DB_PASSWORD_NUXEO"
+                                                                       message="The deprecated environment variable DB_PASSWORD_NUXEO should not be set.  Ensure that DB_NUXEO_PASSWORD is set instead." />
                                                        </tasks>
                                                </configuration>
                                        </execution>
index 365965205953477f60122ee3df2d6bbfc8dbdcef..fcaeb487b477e01c8212f14560f09e9015f6cafd 100644 (file)
                        <version>${nuxeo.core.version}</version>            
         </dependency>
         <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
+            <groupId>org.nuxeo.lib.core</groupId>
             <artifactId>nuxeo-core-storage-sql-extensions</artifactId>
                        <version>${nuxeo.core.version}</version>            
         </dependency>
             <artifactId>nuxeo-core-storage-sql-ra</artifactId>
                        <version>${nuxeo.core.version}</version>            
         </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-client</artifactId>
-                       <version>${nuxeo.core.version}</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.jboss.jbossas</groupId>
-                    <artifactId>jboss-as-jbossas-remoting</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <dependency>
             <groupId>org.nuxeo.ecm.core</groupId>
             <artifactId>nuxeo-core-query</artifactId>
index 710359ed3cbc3de84575e2a767cac034cec71184..654b30764c0b2896098ae183f8ec012d874a9c8d 100644 (file)
@@ -62,7 +62,7 @@ import java.util.Set;
 //import org.collectionspace.services.common.FileUtils;
 import org.collectionspace.services.authorization.PermissionResource;
 import org.collectionspace.services.authorization.RoleResource;
-import org.collectionspace.services.common.ResourceBase;               
+import org.collectionspace.services.common.NuxeoBasedResource;         
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ResourceMapHolder;
 import org.collectionspace.services.common.ResourceMapImpl;
@@ -136,7 +136,7 @@ public class CollectionSpaceJaxRsApplication extends Application
 //        singletons.add(new PingResource());
     }
     
-    private void addResourceToMapAndSingletons(ResourceBase resource) {
+    private void addResourceToMapAndSingletons(NuxeoBasedResource resource) {
         singletons.add(resource);
         resourceMap.put(resource.getServiceName(), resource);
     }
index 150978b19041789cd1ae45662c283bfb0e360df3..e38f6939ae8a1a98a94c3af620267ad70994e638 100644 (file)
@@ -26,20 +26,15 @@ package org.collectionspace.services.account.storage;
 import java.util.ArrayList;
 import java.util.List;
 
-//import org.collectionspace.services.authorization.AccountRolesList;
-//import org.collectionspace.services.authorization.AccountRolesList.AccountRoleListItem;
-
 import org.collectionspace.services.common.authorization_mgt.AuthorizationRoleRel;
 import org.collectionspace.services.authorization.AccountRole;
 import org.collectionspace.services.authorization.AccountRoleRel;
 import org.collectionspace.services.authorization.AccountValue;
-import org.collectionspace.services.authorization.PermissionsRolesList;
 import org.collectionspace.services.authorization.RoleValue;
 import org.collectionspace.services.authorization.SubjectType;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.storage.jpa.JpaDocumentHandler;
 
-import org.collectionspace.services.common.document.AbstractDocumentHandlerImpl;
 import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.context.ServiceContextProperties;
index b8a272b24a5f985847ba67c1cc12521a74241859..35114d3cd643c60adb892bde30d31a7f376bb33d 100644 (file)
@@ -29,7 +29,7 @@ import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 
 import org.collectionspace.services.client.AcquisitionClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory;
 @Path(AcquisitionClient.SERVICE_PATH)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public class AcquisitionResource extends ResourceBase {
+public class AcquisitionResource extends NuxeoBasedResource {
 
     /** The logger. */
     final Logger logger = LoggerFactory.getLogger(AcquisitionResource.class);
index f6a2e024573c7be1b977454959343f6701b40051..5843233b0983ffd6eb17a177c61ffc0cb7f5ef22 100644 (file)
 package org.collectionspace.services.acquisition.nuxeo;
 
 import org.collectionspace.services.acquisition.AcquisitionsCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /** AcquisitionDocumentModelHandler
  *  $LastChangedRevision: $
  *  $LastChangedDate: $
  */
 public class AcquisitionDocumentModelHandler
-        extends DocHandlerBase<AcquisitionsCommon> {
+        extends NuxeoDocumentModelHandler<AcquisitionsCommon> {
 }
 
index 7435ca575352af36f900f19c4ea765f013a96a6f..91eadeb8d94fcc61c9feafb22d4465e90d9bcca1 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-                       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <groupId>org.collectionspace.services</groupId>
-        <artifactId>org.collectionspace.services.authority</artifactId>
-        <version>4.2-SNAPSHOT</version>
-    </parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <parent>
+               <groupId>org.collectionspace.services</groupId>
+               <artifactId>org.collectionspace.services.authority</artifactId>
+               <version>4.2-SNAPSHOT</version>
+       </parent>
 
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.collectionspace.services.authority.service</artifactId>
-    <name>services.authority.service</name>
-    <packaging>jar</packaging>
+       <modelVersion>4.0.0</modelVersion>
+       <artifactId>org.collectionspace.services.authority.service</artifactId>
+       <name>services.authority.service</name>
+       <packaging>jar</packaging>
 
-    <dependencies>
-        <!-- CollectionSpace dependencies -->
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.config</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.common-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authentication.service</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authorization.service</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.relation.service</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.relation.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
+       <dependencies>
+               <!-- CollectionSpace dependencies -->
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.config</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.common-api</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.common</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>
+                       <version>${project.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authentication.service</artifactId>
+                       <version>${project.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>
+                       <version>${project.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authorization.service</artifactId>
+                       <version>${project.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.relation.service</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.relation.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
 
 
-        <!-- Utilities -->
+               <!-- Utilities -->
 
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.14</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-jexl</artifactId>
-            <version>2.0.1</version>
-        </dependency>
-        <dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-api</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-log4j12</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>log4j</groupId>
+                       <artifactId>log4j</artifactId>
+                       <version>1.2.14</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.commons</groupId>
+                       <artifactId>commons-jexl</artifactId>
+                       <version>2.0.1</version>
+               </dependency>
+               <dependency>
                        <groupId>commons-codec</groupId>
                        <artifactId>commons-codec</artifactId>
                        <version>1.4</version>
-        </dependency>
+               </dependency>
 
-        <!-- javax -->
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <version>2.5</version>
-            <scope>provided</scope>
-        </dependency>
+               <!-- javax -->
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>javax.security</groupId>
+                       <artifactId>jaas</artifactId>
+                       <version>1.0.01</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>javax.security</groupId>
+                       <artifactId>jacc</artifactId>
+                       <version>1.0</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>mysql</groupId>
+                       <artifactId>mysql-connector-java</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>postgresql</groupId>
+                       <artifactId>postgresql</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>javax.persistence</groupId>
+                       <artifactId>persistence-api</artifactId>
+               </dependency>
 
-        <dependency>
-            <groupId>javax.security</groupId>
-            <artifactId>jaas</artifactId>
-            <version>1.0.01</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.security</groupId>
-            <artifactId>jacc</artifactId>
-            <version>1.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <!--
-            <dependency>
-            <groupId>dom4j</groupId>
-            <artifactId>dom4j</artifactId>
-            <version>1.6.1</version>
-            <scope>provided</scope>
-        </dependency>
-        -->
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-        </dependency>
-                               <dependency>
-                                               <groupId>postgresql</groupId>
-                                               <artifactId>postgresql</artifactId>
-                               </dependency>
-         <dependency>
-            <groupId>javax.persistence</groupId>
-            <artifactId>persistence-api</artifactId>
-        </dependency>
+               <dependency>
+                       <groupId>com.sun.xml.bind</groupId>
+                       <artifactId>jaxb-impl</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.jvnet.jaxb2-commons</groupId>
+                       <artifactId>property-listener-injector</artifactId>
+               </dependency>
 
-        <dependency>
-            <groupId>com.sun.xml.bind</groupId>
-            <artifactId>jaxb-impl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jvnet.jaxb2-commons</groupId>
-            <artifactId>property-listener-injector</artifactId>
-        </dependency>
-               <!--
-        <dependency>
-            <groupId>org.jvnet.jaxb2_commons</groupId>
-            <artifactId>runtime</artifactId>
-        </dependency>
-               -->
+               <!-- jboss -->
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>jaxrs-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-jaxrs</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>tjws</groupId>
+                                       <artifactId>webserver</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-jaxb-provider</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-multipart-provider</artifactId>
+               </dependency>
 
-        <!-- jboss -->
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>jaxrs-api</artifactId>
-        </dependency>        
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-jaxrs</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>tjws</groupId>
-                    <artifactId>webserver</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-jaxb-provider</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-multipart-provider</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-entitymanager</artifactId>
-        </dependency>
-        <!-- jboss -->
-        <dependency>
-            <groupId>jboss</groupId>
-            <artifactId>jbosssx</artifactId>
-            <version>4.2.3.GA</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>jboss</groupId>
-            <artifactId>jboss-remoting</artifactId>
-            <version>2.2.2.SP8</version>
-            <scope>provided</scope>
-        </dependency>
-        <!-- nuxeo -->
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-mimetype-api</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-imaging-core</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-imaging-api</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-filemanager-api</artifactId>
-                 <version>${nuxeo.platform.version}</version>        
-           </dependency>
-        <dependency>
-            <groupId>org.nuxeo.common</groupId>
-            <artifactId>nuxeo-common</artifactId>
-            <version>${nuxeo.core.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.runtime</groupId>
-            <artifactId>nuxeo-runtime</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-api</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-client</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-query</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-schema</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-storage-sql</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-io</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-               <!--
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-facade</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-               -->
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-io</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.runtime</groupId>
-            <artifactId>nuxeo-runtime-osgi</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>4.1.0</version>
-        </dependency>
-    </dependencies>
+               <dependency>
+                       <groupId>org.hibernate</groupId>
+                       <artifactId>hibernate-entitymanager</artifactId>
+               </dependency>
+               <!-- jboss -->
+               <dependency>
+                       <groupId>jboss</groupId>
+                       <artifactId>jbosssx</artifactId>
+                       <version>4.2.3.GA</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>jboss</groupId>
+                       <artifactId>jboss-remoting</artifactId>
+                       <version>2.2.2.SP8</version>
+                       <scope>provided</scope>
+               </dependency>
+               <!-- nuxeo -->
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-mimetype-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-imaging-core</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-imaging-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-filemanager-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.common</groupId>
+                       <artifactId>nuxeo-common</artifactId>
+                       <version>${nuxeo.core.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.runtime</groupId>
+                       <artifactId>nuxeo-runtime</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-query</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-schema</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-storage-sql</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-io</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <!-- <dependency> <groupId>org.nuxeo.ecm.core</groupId> <artifactId>nuxeo-core-facade</artifactId> 
+                       <version>${nuxeo.core.version}</version> </dependency> -->
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-io</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.runtime</groupId>
+                       <artifactId>nuxeo-runtime-osgi</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>4.1.0</version>
+               </dependency>
+       </dependencies>
 </project>
 
index d7354748fc9b49c64d3413a3da38b493e53996a4..ed28be1f3604cfab3eb9cc8c2abccb3cfeddd508 100644 (file)
@@ -34,7 +34,6 @@ import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Request;
@@ -48,7 +47,7 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.ServiceMessages;
@@ -79,14 +78,13 @@ import org.collectionspace.services.config.ClientType;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.lifecycle.TransitionDef;
 import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.workflow.WorkflowCommon;
 import org.jboss.resteasy.util.HttpResponseCodes;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -108,7 +106,7 @@ import org.slf4j.LoggerFactory;
 @Consumes("application/xml")
 @Produces("application/xml")
 public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
-        extends ResourceBase {
+        extends NuxeoBasedResource {
        
        final static String SEARCH_TYPE_TERMSTATUS = "ts";
 
@@ -327,7 +325,7 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
      * Resource. They then call this method on that resource.
      */
     @Override
-       public DocumentModel getDocModelForAuthorityItem(RepositoryInstanceInterface repoSession, RefName.AuthorityItem item) 
+       public DocumentModel getDocModelForAuthorityItem(CoreSessionInterface repoSession, RefName.AuthorityItem item) 
                        throws Exception, DocumentNotFoundException {
        if(item == null) {
                return null;
diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java
deleted file mode 100644 (file)
index ad272c8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.collectionspace.services.common.vocabulary;
-
-public interface IVocabManager {
-       
-       public void exampleMethod(String someParam);
-
-}
diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java
deleted file mode 100644 (file)
index 27d1cfd..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.collectionspace.services.common.vocabulary;
-
-public class VocabManager {
-       static private final IVocabManager vocabManager = new VocabManagerImpl();
-       
-       static public void exampleMethod(String someParam) {
-               vocabManager.exampleMethod(someParam);
-       }
-}
diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java
deleted file mode 100644 (file)
index 655eb12..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.collectionspace.services.common.vocabulary;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-import org.nuxeo.ecm.core.client.NuxeoClient;
-
-//import org.collectionspace.services.nuxeo.client.java.NuxeoConnector;
-import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
-//import org.collectionspace.services.common.query.IQueryManager;
-
-public class VocabManagerImpl implements IVocabManager {
-       
-       private final Logger logger = LoggerFactory
-                       .getLogger(VocabManagerImpl.class);
-       
-       public void exampleMethod(String someParam) {
-       }
-}
index 0887cf267c766c85aabf0afb431a91238f1deddc..6a5656a23fee7659c3e1a2c5bb8d23d2becd0790 100644 (file)
@@ -25,25 +25,20 @@ package org.collectionspace.services.common.vocabulary.nuxeo;
 
 import java.util.Map;
 
-import javax.ws.rs.core.MultivaluedMap;
-
-import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.api.RefName.Authority;
 import org.collectionspace.services.common.api.Tools;
-import org.collectionspace.services.common.context.MultipartServiceContext;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
 import org.collectionspace.services.config.service.ObjectPartType;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,7 +49,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate: $
  */
 public abstract class AuthorityDocumentModelHandler<AuthCommon>
-        extends DocHandlerBase<AuthCommon> {
+        extends NuxeoDocumentModelHandler<AuthCommon> {
 
     private final Logger logger = LoggerFactory.getLogger(AuthorityDocumentModelHandler.class);        
     private String authorityCommonSchemaName;
@@ -150,7 +145,7 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
        String result = null;
        
        DocumentModel docModel = docWrapper.getWrappedObject();
-       ServiceContext ctx = this.getServiceContext();
+       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
        RefName.Authority refname = (RefName.Authority)getRefName(ctx, docModel);
        result = refname.getDisplayName();
        
@@ -159,7 +154,7 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
     
     public String getShortIdentifier(String authCSID, String schemaName) throws Exception {
         String shortIdentifier = null;
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
 
         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
        RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx);
index d8d031d4e7981d6e18768ecf78a81cda743f7639..506f1f12d6a3696a9667f26179b6dbbcd419a8f1 100644 (file)
@@ -43,18 +43,15 @@ import org.collectionspace.services.common.vocabulary.AuthorityResource;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
 import org.collectionspace.services.config.service.ListResultField;
 import org.collectionspace.services.config.service.ObjectPartType;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
-import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentException;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.relation.RelationsCommonList;
-import org.collectionspace.services.relation.RelationsDocListItem;
 import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -77,7 +74,7 @@ import java.util.regex.PatternSyntaxException;
  * $LastChangedDate: $
  */
 public abstract class AuthorityItemDocumentModelHandler<AICommon>
-        extends DocHandlerBase<AICommon> {
+        extends NuxeoDocumentModelHandler<AICommon> {
 
     private final Logger logger = LoggerFactory.getLogger(AuthorityItemDocumentModelHandler.class);
     private String authorityItemCommonSchemaName;
@@ -102,7 +99,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
        String result = null;
        
        DocumentModel docModel = docWrapper.getWrappedObject();
-       ServiceContext ctx = this.getServiceContext();
+       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
        RefName.AuthorityItem refname = (RefName.AuthorityItem)getRefName(ctx, docModel);
        result = refname.getDisplayName();
        
@@ -358,7 +355,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
             }
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient = getRepositoryClient(ctx);
-            RepositoryInstanceInterface repoSession = this.getRepositorySession();
+            CoreSessionInterface repoSession = this.getRepositorySession();
             
             // Update all the existing records that have a field with the old refName in it
             int nUpdated = RefNameServiceUtils.updateAuthorityRefDocs(ctx, repoClient, repoSession,
@@ -473,7 +470,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
                String propertyName,
             String itemcsid) throws Exception {
         AuthorityRefDocList authRefDocList = null;
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
        boolean releaseRepoSession = false;
         
        try {
index 5275e58e35b2206bcc8232b5b342aeaa4a9709f0..724b7093208b7a8f41757f6de4a5ca0fc194698d 100644 (file)
@@ -3,7 +3,7 @@ package org.collectionspace.services.batch;
 import java.util.HashMap;
 import java.util.Set;
 
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.invocable.Invocable;
 
index f0aee5427e07111ec68dc4b64c9b9bbd235a3e2a..8b37cb0462fd48947d611e172e90ed5188c1cf4c 100644 (file)
@@ -32,7 +32,7 @@ import org.collectionspace.services.client.BatchClient;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.context.ServiceContext;
@@ -69,7 +69,7 @@ import javax.ws.rs.core.UriInfo;
 @Path(BatchClient.SERVICE_PATH)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public class BatchResource extends ResourceBase {
+public class BatchResource extends NuxeoBasedResource {
        
        protected final String COMMON_SCHEMA = "batch_common";
 
index 3aa4b552d2d4480d0814c96f53bfcc399e989d0f..ce825c5a0cf1261dc712e767d470e3db61266fea 100644 (file)
@@ -25,71 +25,63 @@ package org.collectionspace.services.batch.nuxeo;
 
 import java.util.List;
 
-import javax.ws.rs.PathParam;
-import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.BatchJAXBSchema;
 import org.collectionspace.services.jaxb.InvocableJAXBSchema;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.collectionspace.services.batch.BatchCommon;
 import org.collectionspace.services.batch.BatchInvocable;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.ResourceMap;
-import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
-import org.collectionspace.services.common.document.DocumentFilter;
-import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.invocable.Invocable;
 import org.collectionspace.services.common.invocable.InvocationContext;
 import org.collectionspace.services.common.invocable.InvocationResults;
 import org.collectionspace.services.common.invocable.Invocable.InvocationError;
+
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class BatchDocumentModelHandler 
-       extends DocHandlerBase<BatchCommon> {
-    private final Logger logger = LoggerFactory.getLogger(BatchDocumentModelHandler.class);
+public class BatchDocumentModelHandler extends NuxeoDocumentModelHandler<BatchCommon> {
+       private final Logger logger = LoggerFactory.getLogger(BatchDocumentModelHandler.class);
 
        protected final int BAD_REQUEST_STATUS = Response.Status.BAD_REQUEST.getStatusCode();
-       
-       public InvocationResults invokeBatchJob(
-                       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-                       String csid,
-                       ResourceMap resourceMap, 
-                       InvocationContext invContext) throws Exception {
-
-               RepositoryInstanceInterface repoSession = null;
+
+       public InvocationResults invokeBatchJob(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String csid,
+                       ResourceMap resourceMap, InvocationContext invContext) throws Exception {
+
+               CoreSessionInterface repoSession = null;
                boolean releaseRepoSession = false;
 
                String invocationMode = invContext.getMode();
                String modeProperty = null;
                boolean checkDocType = true;
-               if(BatchInvocable.INVOCATION_MODE_SINGLE.equalsIgnoreCase(invocationMode)) {
+               if (BatchInvocable.INVOCATION_MODE_SINGLE.equalsIgnoreCase(invocationMode)) {
                        modeProperty = BatchJAXBSchema.SUPPORTS_SINGLE_DOC;
-               } else if(BatchInvocable.INVOCATION_MODE_LIST.equalsIgnoreCase(invocationMode)) {
+               } else if (BatchInvocable.INVOCATION_MODE_LIST.equalsIgnoreCase(invocationMode)) {
                        modeProperty = BatchJAXBSchema.SUPPORTS_DOC_LIST;
-               } else if(BatchInvocable.INVOCATION_MODE_GROUP.equalsIgnoreCase(invocationMode)) {
+               } else if (BatchInvocable.INVOCATION_MODE_GROUP.equalsIgnoreCase(invocationMode)) {
                        modeProperty = BatchJAXBSchema.SUPPORTS_GROUP;
-               } else if(Invocable.INVOCATION_MODE_NO_CONTEXT.equalsIgnoreCase(invocationMode)) {
+               } else if (Invocable.INVOCATION_MODE_NO_CONTEXT.equalsIgnoreCase(invocationMode)) {
                        modeProperty = InvocableJAXBSchema.SUPPORTS_NO_CONTEXT;
                        checkDocType = false;
                } else {
-                       throw new BadRequestException("BatchResource: unknown Invocation Mode: "
-                                       +invocationMode);
+                       throw new BadRequestException("BatchResource: unknown Invocation Mode: " + invocationMode);
                }
 
-               RepositoryJavaClientImpl repoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx);
+               RepositoryJavaClientImpl repoClient = (RepositoryJavaClientImpl) this.getRepositoryClient(ctx);
                repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
@@ -101,22 +93,19 @@ public class BatchDocumentModelHandler
                try {
                        DocumentWrapper<DocumentModel> wrapper = repoClient.getDoc(repoSession, ctx, csid);
                        DocumentModel docModel = wrapper.getWrappedObject();
-                       Boolean supports = (Boolean)docModel.getPropertyValue(modeProperty);
-                       if(!supports) {
+                       Boolean supports = (Boolean) docModel.getPropertyValue(modeProperty);
+                       if (!supports) {
                                throw new BadRequestException("BatchResource: This Batch Job does not support Invocation Mode: "
-                                               +invocationMode);
+                                               + invocationMode);
                        }
-                       if(checkDocType) {
-                               List<String> forDocTypeList = 
-                                               (List<String>)docModel.getPropertyValue(BatchJAXBSchema.FOR_DOC_TYPES);
-                               if(forDocTypeList==null
-                                               || !forDocTypeList.contains(invContext.getDocType())) {
-                                       throw new BadRequestException(
-                                                       "BatchResource: Invoked with unsupported document type: "
-                                                                       +invContext.getDocType());
+                       if (checkDocType) {
+                               List<String> forDocTypeList = (List<String>) docModel.getPropertyValue(BatchJAXBSchema.FOR_DOC_TYPES);
+                               if (forDocTypeList == null || !forDocTypeList.contains(invContext.getDocType())) {
+                                       throw new BadRequestException("BatchResource: Invoked with unsupported document type: "
+                                                       + invContext.getDocType());
                                }
                        }
-                       className = (String)docModel.getPropertyValue(BatchJAXBSchema.BATCH_CLASS_NAME);
+                       className = (String) docModel.getPropertyValue(BatchJAXBSchema.BATCH_CLASS_NAME);
                } catch (PropertyException pe) {
                        if (logger.isDebugEnabled()) {
                                logger.debug("Property exception getting batch values: ", pe);
@@ -137,50 +126,50 @@ public class BatchDocumentModelHandler
                                repoClient.releaseRepositorySession(ctx, repoSession);
                        }
                }
+
                className = className.trim();
                ClassLoader tccl = Thread.currentThread().getContextClassLoader();
                Class<?> c = tccl.loadClass(className);
                // enable validation assertions
                tccl.setClassAssertionStatus(className, true);
-               if(!BatchInvocable.class.isAssignableFrom(c)) {
-                       throw new RuntimeException("BatchResource: Class: "
-                                       +className+" does not implement BatchInvocable!");
+               if (!BatchInvocable.class.isAssignableFrom(c)) {
+                       throw new RuntimeException("BatchResource: Class: " + className + " does not implement BatchInvocable!");
                }
-               BatchInvocable batchInstance = (BatchInvocable)c.newInstance();
+
+               BatchInvocable batchInstance = (BatchInvocable) c.newInstance();
                List<String> modes = batchInstance.getSupportedInvocationModes();
-               if(!modes.contains(invocationMode)) {
-                       throw new BadRequestException(
-                                       "BatchResource: Invoked with unsupported context mode: "
-                                                       +invocationMode);
+               if (!modes.contains(invocationMode)) {
+                       throw new BadRequestException("BatchResource: Invoked with unsupported context mode: " + invocationMode);
                }
+
                batchInstance.setInvocationContext(invContext);
-               if(resourceMap!=null) {
+               
+               if (resourceMap != null) {
                        batchInstance.setResourceMap(resourceMap);
                } else {
                        resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
-                       if(resourceMap!=null) {
+                       if (resourceMap != null) {
                                batchInstance.setResourceMap(resourceMap);
                        } else {
                                logger.warn("BatchResource.invoke did not get a resourceMapHolder in Context!");
                        }
                }
+
                batchInstance.run();
                int status = batchInstance.getCompletionStatus();
-               if(status == Invocable.STATUS_ERROR) {
+               if (status == Invocable.STATUS_ERROR) {
                        InvocationError error = batchInstance.getErrorInfo();
-                       if(error.getResponseCode() == BAD_REQUEST_STATUS) {
-                               throw new BadRequestException(
-                                               "BatchResouce: batchProcess encountered error: "
-                                                               +batchInstance.getErrorInfo());
+                       if (error.getResponseCode() == BAD_REQUEST_STATUS) {
+                               throw new BadRequestException("BatchResouce: batchProcess encountered error: "
+                                               + batchInstance.getErrorInfo());
                        } else {
-                               throw new RuntimeException(
-                                               "BatchResouce: batchProcess encountered error: "
-                                                               +batchInstance.getErrorInfo());
+                               throw new RuntimeException("BatchResouce: batchProcess encountered error: "
+                                               + batchInstance.getErrorInfo());
 
                        }
                }
+
                InvocationResults results = batchInstance.getResults();
                return results;
        }
 }
-
index c13420c0819125ece36ab1627e595deaf1e10bb6..f3e99be9f2d1311f129018dcd6146b23ba7fd5c9 100644 (file)
@@ -8,7 +8,7 @@ import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.batch.BatchInvocable;
 import org.collectionspace.services.client.CollectionSpaceClientUtils;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
 import org.collectionspace.services.common.invocable.InvocationContext;
@@ -134,7 +134,7 @@ public class CreateAndLinkLoanOutBatchJob implements BatchInvocable {
 
                // First, create the Loanout
                // We fetch the resource class by service name
-               ResourceBase resource = resourceMap.get( LoanoutClient.SERVICE_NAME); 
+               NuxeoBasedResource resource = resourceMap.get( LoanoutClient.SERVICE_NAME); 
                Response response = resource.create(resourceMap, null, loanoutPayload);
                if(response.getStatus() != CREATED_STATUS) {
                        completionStatus = STATUS_ERROR;
@@ -160,7 +160,7 @@ public class CreateAndLinkLoanOutBatchJob implements BatchInvocable {
                        +   "<relationshipType>"+RELATION_TYPE+"</relationshipType>"
                        +   "<predicateDisplayName>"+RELATION_PREDICATE_DISP+"</predicateDisplayName>"
                        + "</ns2:relations_common></document>";
-               ResourceBase resource = resourceMap.get(RelationClient.SERVICE_NAME);
+               NuxeoBasedResource resource = resourceMap.get(RelationClient.SERVICE_NAME);
                Response response = resource.create(resourceMap, null, relationPayload);
                if(response.getStatus() != CREATED_STATUS) {
                        completionStatus = STATUS_ERROR;
index d9d722ca6eedb9a44fd580e67f0ad77bd2ff4663..8a80800a01b2414fa270e7287a6e5d0aabc871bd 100644 (file)
@@ -18,7 +18,7 @@ import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.MovementClient;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.workflow.WorkflowClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.api.RefNameUtils;
 import org.collectionspace.services.common.api.Tools;
@@ -130,8 +130,8 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
 
     private InvocationResults updateComputedCurrentLocations(List<String> csids) {
         ResourceMap resourcemap = getResourceMap();
-        ResourceBase collectionObjectResource = resourcemap.get(CollectionObjectClient.SERVICE_NAME);
-        ResourceBase movementResource = resourcemap.get(MovementClient.SERVICE_NAME);
+        NuxeoBasedResource collectionObjectResource = resourcemap.get(CollectionObjectClient.SERVICE_NAME);
+        NuxeoBasedResource movementResource = resourcemap.get(MovementClient.SERVICE_NAME);
         String computedCurrentLocation;
         int numUpdated = 0;
 
@@ -282,7 +282,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
     //
     // Note: any such values must first be exposed in Movement list items,
     // in turn via configuration in Services tenant bindings ("listResultsField").
-    protected int updateCollectionObjectValues(ResourceBase collectionObjectResource,
+    protected int updateCollectionObjectValues(NuxeoBasedResource collectionObjectResource,
             String collectionObjectCsid, AbstractCommonList.ListItem mostRecentMovement,
             ResourceMap resourcemap, int numUpdated)
             throws DocumentException, URISyntaxException {
@@ -377,11 +377,11 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
     // UC Berkeley Botanical Garden v2.4 implementation.
     // #################################################################
     protected PoxPayloadOut findByCsid(String serviceName, String csid) throws URISyntaxException, DocumentException {
-        ResourceBase resource = getResourceMap().get(serviceName);
+        NuxeoBasedResource resource = getResourceMap().get(serviceName);
         return findByCsid(resource, csid);
     }
 
-    protected PoxPayloadOut findByCsid(ResourceBase resource, String csid) throws URISyntaxException, DocumentException {
+    protected PoxPayloadOut findByCsid(NuxeoBasedResource resource, String csid) throws URISyntaxException, DocumentException {
         byte[] response = resource.get(null, createUriInfo(), csid);
         PoxPayloadOut payload = new PoxPayloadOut(response);
         return payload;
@@ -432,7 +432,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
         return value;
     }
 
-    private boolean isRecordDeleted(ResourceBase resource, String collectionObjectCsid)
+    private boolean isRecordDeleted(NuxeoBasedResource resource, String collectionObjectCsid)
             throws URISyntaxException, DocumentException {
         boolean isDeleted = false;
         byte[] workflowResponse = resource.getWorkflow(createUriInfo(), collectionObjectCsid);
@@ -456,7 +456,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
         return uriInfo;
     }
 
-    private AbstractCommonList getRecordsRelatedToCsid(ResourceBase resource, String csid,
+    private AbstractCommonList getRecordsRelatedToCsid(NuxeoBasedResource resource, String csid,
             String relationshipDirection, boolean excludeDeletedRecords) throws URISyntaxException {
         UriInfo uriInfo = createUriInfo();
         uriInfo.getQueryParameters().add(relationshipDirection, csid);
@@ -486,7 +486,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
      * record
      * @throws URISyntaxException
      */
-    private AbstractCommonList getRecordsRelatedToObjectCsid(ResourceBase resource, String csid, boolean excludeDeletedRecords) throws URISyntaxException {
+    private AbstractCommonList getRecordsRelatedToObjectCsid(NuxeoBasedResource resource, String csid, boolean excludeDeletedRecords) throws URISyntaxException {
         return getRecordsRelatedToCsid(resource, csid, IQueryManager.SEARCH_RELATED_TO_CSID_AS_OBJECT, excludeDeletedRecords);
     }
 
@@ -503,11 +503,11 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
      * record
      * @throws URISyntaxException
      */
-    private AbstractCommonList getRecordsRelatedToSubjectCsid(ResourceBase resource, String csid, boolean excludeDeletedRecords) throws URISyntaxException {
+    private AbstractCommonList getRecordsRelatedToSubjectCsid(NuxeoBasedResource resource, String csid, boolean excludeDeletedRecords) throws URISyntaxException {
         return getRecordsRelatedToCsid(resource, csid, IQueryManager.SEARCH_RELATED_TO_CSID_AS_SUBJECT, excludeDeletedRecords);
     }
 
-    private AbstractCommonList getRelatedRecords(ResourceBase resource, String csid, boolean excludeDeletedRecords)
+    private AbstractCommonList getRelatedRecords(NuxeoBasedResource resource, String csid, boolean excludeDeletedRecords)
             throws URISyntaxException, DocumentException {
         AbstractCommonList relatedRecords = new AbstractCommonList();
         AbstractCommonList recordsRelatedToObjectCSID = getRecordsRelatedToObjectCsid(resource, csid, excludeDeletedRecords);
@@ -536,11 +536,11 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
 
     private List<String> getMemberCsidsFromGroup(String serviceName, String groupCsid) throws URISyntaxException, DocumentException {
         ResourceMap resourcemap = getResourceMap();
-        ResourceBase resource = resourcemap.get(serviceName);
+        NuxeoBasedResource resource = resourcemap.get(serviceName);
         return getMemberCsidsFromGroup(resource, groupCsid);
     }
 
-    private List<String> getMemberCsidsFromGroup(ResourceBase resource, String groupCsid) throws URISyntaxException, DocumentException {
+    private List<String> getMemberCsidsFromGroup(NuxeoBasedResource resource, String groupCsid) throws URISyntaxException, DocumentException {
         // The 'resource' type used here identifies the record type of the
         // related records to be retrieved
         AbstractCommonList relatedRecords =
@@ -551,7 +551,7 @@ public class UpdateObjectLocationBatchJob extends AbstractBatchInvocable {
 
     private List<String> getNoContextCsids() throws URISyntaxException {
         ResourceMap resourcemap = getResourceMap();
-        ResourceBase collectionObjectResource = resourcemap.get(CollectionObjectClient.SERVICE_NAME);
+        NuxeoBasedResource collectionObjectResource = resourcemap.get(CollectionObjectClient.SERVICE_NAME);
         UriInfo uriInfo = createUriInfo();
         uriInfo = addFilterToExcludeSoftDeletedRecords(uriInfo);
         AbstractCommonList collectionObjects = collectionObjectResource.getList(uriInfo);
index 849f347dd847073ca3ff881695a9bd56aacfa850..84530b5cacff542e2691df729b3fdc249b5dad99 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-    <parent>
-        <groupId>org.collectionspace.services</groupId>
-        <artifactId>org.collectionspace.services.blob</artifactId>        
-        <version>4.2-SNAPSHOT</version>
-    </parent>
-    
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.collectionspace.services.blob.service</artifactId>
-    <name>services.blob.service</name>
-    <packaging>jar</packaging>       
+       <parent>
+               <groupId>org.collectionspace.services</groupId>
+               <artifactId>org.collectionspace.services.blob</artifactId>
+               <version>4.2-SNAPSHOT</version>
+       </parent>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.config</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.blob.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.publicitem.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        
-        <!-- External dependencies -->        
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-        </dependency>
-        
-      <!-- javax -->
+       <modelVersion>4.0.0</modelVersion>
+       <artifactId>org.collectionspace.services.blob.service</artifactId>
+       <name>services.blob.service</name>
+       <packaging>jar</packaging>
 
-        <dependency>
-            <groupId>javax.security</groupId>
-            <artifactId>jaas</artifactId>
-            <version>1.0.01</version>
-            <scope>provided</scope>
-        </dependency>
+       <dependencies>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.common</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.config</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.blob.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.publicitem.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
 
-        <dependency>
-            <groupId>dom4j</groupId>
-            <artifactId>dom4j</artifactId>
-            <version>1.6.1</version>
-            <scope>provided</scope>
-        </dependency>
-        
-        <!-- jboss -->
+               <!-- External dependencies -->
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.testng</groupId>
+                       <artifactId>testng</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
+               </dependency>
 
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-jaxrs</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>tjws</groupId>
-                    <artifactId>webserver</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-jaxb-provider</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-multipart-provider</artifactId>
-        </dependency>
-        
-        <!-- nuxeo -->
+               <!-- javax -->
 
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-api</artifactId>
-            <exclusions>
-                <exclusion>
-                    <artifactId>jboss-remoting</artifactId>
-                    <groupId>jboss</groupId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-    </dependencies>
-    
-    <build>
-        <finalName>collectionspace-services-blob</finalName>
-    </build>
+               <dependency>
+                       <groupId>javax.security</groupId>
+                       <artifactId>jaas</artifactId>
+                       <version>1.0.01</version>
+                       <scope>provided</scope>
+               </dependency>
+
+               <dependency>
+                       <groupId>dom4j</groupId>
+                       <artifactId>dom4j</artifactId>
+                       <version>1.6.1</version>
+                       <scope>provided</scope>
+               </dependency>
+
+               <!-- jboss -->
+
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-jaxrs</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>tjws</groupId>
+                                       <artifactId>webserver</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-jaxb-provider</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-multipart-provider</artifactId>
+               </dependency>
+
+               <!-- nuxeo -->
+
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-api</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <artifactId>jboss-remoting</artifactId>
+                                       <groupId>jboss</groupId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+       </dependencies>
+
+       <build>
+               <finalName>collectionspace-services-blob</finalName>
+       </build>
 </project>
 
index 5e182268de4a6342dbf2a60b7e2fa51514e3a53f..be4121244b24ee80c7a87d16894a1db85a20d78a 100644 (file)
@@ -25,12 +25,11 @@ package org.collectionspace.services.blob;
 
 import org.collectionspace.services.publicitem.PublicitemsCommon;
 import org.collectionspace.services.client.BlobClient;
-import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PayloadPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.FileUtils;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.blob.BlobInput;
@@ -47,32 +46,27 @@ import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
 import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.Response.ResponseBuilder;
 import javax.ws.rs.core.UriInfo;
 
-import java.io.File;
 import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
-import java.util.UUID;
 
 //FIXME: REM - We should not have Nuxeo dependencies in our resource classes.
 
 @Path(BlobClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class BlobResource extends ResourceBase {
+public class BlobResource extends NuxeoBasedResource {
 
        @Override
     public String getServiceName(){
@@ -121,7 +115,7 @@ public class BlobResource extends ResourceBase {
        return result;
     }
     
-    private InputStream getBlobContent(ServiceContext ctx,
+    private InputStream getBlobContent(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
                String csid, 
                String derivativeTerm, 
                StringBuffer outMimeType) throws CSWebApplicationException {
index 8c0d3a85383d33d09f991ce383d2cb75d9cc006a..8d094ce07a0a5365e0f7a4e58f09b7b3f0c44ed7 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.blob.nuxeo;
 
 import org.collectionspace.services.blob.BlobsCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.client.BlobClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
@@ -40,28 +40,25 @@ import org.collectionspace.services.config.service.ListResultField;
 import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.jaxb.BlobJAXBSchema;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 
-
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.IdRef;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.List;
 import java.util.Map;
-
 import javax.ws.rs.core.MultivaluedMap;
-
 import org.dom4j.Element;
 
 /**
  * The Class BlobDocumentModelHandler.
  */
 public class BlobDocumentModelHandler
-extends DocHandlerBase<BlobsCommon> {
+extends NuxeoDocumentModelHandler<BlobsCommon> {
 
        /** The logger. */
        private final Logger logger = LoggerFactory.getLogger(BlobDocumentModelHandler.class);
@@ -115,7 +112,7 @@ extends DocHandlerBase<BlobsCommon> {
         ObjectPartType partMeta = partsMetaMap.get(metadataLabel);
 
         if (partMeta != null) {
-               RepositoryInstanceInterface repoSession = this.getRepositorySession();
+               CoreSessionInterface repoSession = this.getRepositorySession();
                        if (nuxeoImageID != null && nuxeoImageID.isEmpty() == false) try {
                                IdRef documentRef = new IdRef(nuxeoImageID);
                                DocumentModel docModel = repoSession.getDocument(documentRef);
@@ -139,7 +136,7 @@ extends DocHandlerBase<BlobsCommon> {
                        throws Exception {
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
                BlobInput blobInput = BlobUtil.getBlobInput(ctx); // the blobInput was set by the Blob JAX-RS resource code and put into the service context
-               RepositoryInstanceInterface repoSession = this.getRepositorySession();
+               CoreSessionInterface repoSession = this.getRepositorySession();
                DocumentModel docModel = wrapDoc.getWrappedObject();
                BlobsCommon blobsCommon = this.getCommonPartProperties(docModel);               
                String blobRepositoryId = blobsCommon.getRepositoryId(); //cache the value to pass to the blob retriever
@@ -220,7 +217,7 @@ extends DocHandlerBase<BlobsCommon> {
                        // If blobInput has a file then we just received a multipart/form-data file post or a URI query parameter
                        //
                        DocumentModel documentModel = wrapDoc.getWrappedObject();
-                       RepositoryInstanceInterface repoSession = this.getRepositorySession();
+                       CoreSessionInterface repoSession = this.getRepositorySession();
                
                        BlobsCommon blobsCommon = NuxeoBlobUtils.createBlobInRepository(ctx, repoSession, blobInput, purgeOriginal, true);
                        blobInput.setBlobCsid(documentModel.getName()); //Assumption here is that the documentModel "name" field is storing a CSID
index 7b3228ccdce28cddc5a49907595415130750527f..1daca950e71b632a97f23677e13ee993b9ff79f0 100644 (file)
@@ -28,7 +28,7 @@ package org.collectionspace.services.collectionobject;
 import org.collectionspace.services.client.CollectionObjectClient;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.Profiler;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.relation.RelationsCommonList;
 import org.collectionspace.services.relation.RelationshipType;
@@ -54,7 +54,7 @@ import java.util.List;
 @Path(CollectionObjectClient.SERVICE_PATH_COMPONENT)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class CollectionObjectResource extends ResourceBase {
+public class CollectionObjectResource extends NuxeoBasedResource {
     
     final Logger logger = LoggerFactory.getLogger(CollectionObjectResource.class);
 
index 1bfb82e8b4c5fd3965322d2095549a88e3f69862..073492ac3c7a5caa8320d66d398dff644f5c9185 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.collectionobject.nuxeo;
 
 import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /**
  * CollectionObjectDocumentModelHandler
@@ -33,6 +33,6 @@ import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
  * $LastChangedDate: $
  */
 public class CollectionObjectDocumentModelHandler
-        extends DocHandlerBase<CollectionobjectsCommon> {
+        extends NuxeoDocumentModelHandler<CollectionobjectsCommon> {
 }
 
index 9dc2e63160837dd0ef4a80d0a9d94dcdccf7337f..1b69fb0a04f49de5877bbe28ecba0df1c7e6da47 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <groupId>org.collectionspace.services</groupId>
-        <artifactId>org.collectionspace.services.main</artifactId>
-        <version>4.2-SNAPSHOT</version>
-    </parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <parent>
+               <groupId>org.collectionspace.services</groupId>
+               <artifactId>org.collectionspace.services.main</artifactId>
+               <version>4.2-SNAPSHOT</version>
+       </parent>
 
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.collectionspace.services.common</artifactId>
-    <name>services.common</name>
-    <packaging>jar</packaging>
+       <modelVersion>4.0.0</modelVersion>
+       <artifactId>org.collectionspace.services.common</artifactId>
+       <name>services.common</name>
+       <packaging>jar</packaging>
 
-    <dependencies>
-        <!-- CollectionSpace dependencies -->
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.config</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.3rdparty.nuxeo.thumbnail</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.common-api</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authorization-mgt.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.relation.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.publicitem.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.publicitem.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <!-- 
-        <dependency>
+       <dependencies>
+               <!-- CollectionSpace dependencies -->
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.config</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.3rdparty.nuxeo.thumbnail</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.common-api</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authorization-mgt.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.relation.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.publicitem.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.publicitem.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <!-- <dependency> <groupId>org.collectionspace.services</groupId> <artifactId>org.collectionspace.services.3rdparty.nuxeo.quote-api</artifactId> 
+                       <version>${project.version}</version> </dependency> -->
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.hyperjaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>
+                       <version>${project.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
                        <groupId>org.collectionspace.services</groupId>
-                       <artifactId>org.collectionspace.services.3rdparty.nuxeo.quote-api</artifactId>        
-            <version>${project.version}</version>
-        </dependency>
-         -->
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.hyperjaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.client</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authentication.service</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.authorization.service</artifactId>
-            <version>${project.version}</version>
-        </dependency>
+                       <artifactId>org.collectionspace.services.authentication.service</artifactId>
+                       <version>${project.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                       <artifactId>org.collectionspace.services.authorization.service</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
 
-        <!-- Utilities -->
-        <!-- For NuxeoRESTClient.java class -->
-        <dependency>
-            <groupId>org.restlet</groupId>
-            <artifactId>org.restlet</artifactId>
-            <version>1.0.7</version>
-        </dependency>
-        <dependency>
-            <groupId>com.noelios.restlet</groupId>
-            <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
-            <version>1.0.7</version>
-        </dependency>
-        <dependency>
-            <groupId>com.noelios.restlet</groupId>
-            <artifactId>com.noelios.restlet</artifactId>
-            <version>1.0.7</version>
-        </dependency>
+               <!-- Utilities -->
+               <!-- For NuxeoRESTClient.java class -->
+               <dependency>
+                       <groupId>org.restlet</groupId>
+                       <artifactId>org.restlet</artifactId>
+                       <version>1.0.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.noelios.restlet</groupId>
+                       <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
+                       <version>1.0.7</version>
+               </dependency>
+               <dependency>
+                       <groupId>com.noelios.restlet</groupId>
+                       <artifactId>com.noelios.restlet</artifactId>
+                       <version>1.0.7</version>
+               </dependency>
 
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.14</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-jexl</artifactId>
-            <version>2.0.1</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-dbcp</groupId>
-            <artifactId>commons-dbcp</artifactId>
-            <version>1.3-RC1</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-api</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>slf4j-log4j12</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>log4j</groupId>
+                       <artifactId>log4j</artifactId>
+                       <version>1.2.14</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.commons</groupId>
+                       <artifactId>commons-jexl</artifactId>
+                       <version>2.0.1</version>
+               </dependency>
+               <dependency>
+                       <groupId>commons-dbcp</groupId>
+                       <artifactId>commons-dbcp</artifactId>
+                       <version>1.3-RC1</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
                        <groupId>commons-codec</groupId>
                        <artifactId>commons-codec</artifactId>
                        <version>1.4</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.6</version>
-        </dependency>
-        <dependency>
-               <groupId>org.apache.tomcat</groupId>
-               <artifactId>dbcp</artifactId>
-               <version>6.0.33</version>
-               <scope>provided</scope>
-               </dependency>
+               </dependency>
+               <dependency>
+                       <groupId>commons-lang</groupId>
+                       <artifactId>commons-lang</artifactId>
+                       <version>2.6</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.tomcat</groupId>
+                       <artifactId>dbcp</artifactId>
+                       <version>6.0.33</version>
+                       <scope>provided</scope>
+               </dependency>
                <dependency>
                        <groupId>org.apache.tomcat</groupId>
                        <artifactId>catalina</artifactId>
-               <version>6.0.33</version>
-               <scope>provided</scope>
+                       <version>6.0.33</version>
+                       <scope>provided</scope>
                </dependency>
 
-        <!-- javax -->
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>servlet-api</artifactId>
-            <scope>provided</scope>
-        </dependency>
+               <!-- javax -->
+               <dependency>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
+                       <scope>provided</scope>
+               </dependency>
 
-        <dependency>
-            <groupId>javax.security</groupId>
-            <artifactId>jaas</artifactId>
-            <version>1.0.01</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.security</groupId>
-            <artifactId>jacc</artifactId>
-            <version>1.0</version>
-            <scope>provided</scope>
-        </dependency>
-        <!--
-            <dependency>
-            <groupId>dom4j</groupId>
-            <artifactId>dom4j</artifactId>
-            <version>1.6.1</version>
-            <scope>provided</scope>
-        </dependency>
-        -->
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>provided</scope>
-        </dependency>
-                               <dependency>
-                                               <groupId>postgresql</groupId>
-                                               <artifactId>postgresql</artifactId>
-                                               <scope>provided</scope>
-                               </dependency>
-         <dependency>
-            <groupId>javax.persistence</groupId>
-            <artifactId>persistence-api</artifactId>
-        </dependency>
+               <dependency>
+                       <groupId>javax.security</groupId>
+                       <artifactId>jaas</artifactId>
+                       <version>1.0.01</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>javax.security</groupId>
+                       <artifactId>jacc</artifactId>
+                       <version>1.0</version>
+                       <scope>provided</scope>
+               </dependency>
+               <!-- <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> 
+                       <version>1.6.1</version> <scope>provided</scope> </dependency> -->
+               <dependency>
+                       <groupId>mysql</groupId>
+                       <artifactId>mysql-connector-java</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>postgresql</groupId>
+                       <artifactId>postgresql</artifactId>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>javax.persistence</groupId>
+                       <artifactId>persistence-api</artifactId>
+               </dependency>
 
-        <!-- jboss -->
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>jaxrs-api</artifactId>
-        </dependency>        
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-jaxrs</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>tjws</groupId>
-                    <artifactId>webserver</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-jaxb-provider</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.resteasy</groupId>
-            <artifactId>resteasy-multipart-provider</artifactId>
-        </dependency>
+               <!-- jboss -->
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>jaxrs-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-jaxrs</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>tjws</groupId>
+                                       <artifactId>webserver</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-jaxb-provider</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.jboss.resteasy</groupId>
+                       <artifactId>resteasy-multipart-provider</artifactId>
+               </dependency>
 
-        <dependency>
-            <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-entitymanager</artifactId>
-        </dependency>
-        <!-- jboss -->
-        <dependency>
+               <dependency>
+                       <groupId>org.hibernate</groupId>
+                       <artifactId>hibernate-entitymanager</artifactId>
+               </dependency>
+               <!-- jboss -->
+               <dependency>
                        <groupId>org.jboss.security</groupId>
                        <artifactId>jbosssx</artifactId>
                        <version>2.0.3.SP1</version>
                        <scope>provided</scope>
-       </dependency>
+               </dependency>
                <dependency>
                        <groupId>org.jboss.remoting</groupId>
                        <artifactId>jboss-remoting</artifactId>
                        <scope>provided</scope>
                </dependency>
-        <!-- nuxeo -->
-           <dependency>
-             <groupId>org.nuxeo.lib.runtime</groupId>
-             <artifactId>nuxeo-runtime-launcher</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-mimetype-api</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-mimetype-core</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-types-api</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-types-core</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-imaging-core</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>        
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-imaging-api</artifactId>
-             <version>${nuxeo.platform.version}</version>
-           </dependency>
-           <dependency>
-             <groupId>org.nuxeo.ecm.platform</groupId>
-             <artifactId>nuxeo-platform-filemanager-api</artifactId>
-                 <version>${nuxeo.platform.version}</version>        
-           </dependency>
-        <dependency>
-            <groupId>org.nuxeo.common</groupId>
-            <artifactId>nuxeo-common</artifactId>
-            <version>${nuxeo.core.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.runtime</groupId>
-            <artifactId>nuxeo-runtime</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-api</artifactId>
-        </dependency>
-        <!--
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-client</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        -->
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-query</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-schema</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-storage-sql</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-storage-sql-ra</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-io</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-convert</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-<!-- 
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-            <artifactId>nuxeo-core-facade</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
- -->
-        <dependency>
-            <groupId>org.nuxeo.runtime</groupId>
-            <artifactId>nuxeo-runtime-osgi</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.nuxeo.ecm.core</groupId>
-               <artifactId>nuxeo-opencmis-bindings</artifactId>
-            <version>${nuxeo.core.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.chemistry.opencmis</groupId>
-            <artifactId>chemistry-opencmis-server-bindings</artifactId>
-            <version>0.6.0</version>
-            <classifier>classes</classifier>
-        </dependency>        
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <version>4.1.0</version>
-        </dependency>
+               <!-- nuxeo -->
+               <dependency>
+                       <groupId>org.nuxeo.lib.runtime</groupId>
+                       <artifactId>nuxeo-runtime-launcher</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-mimetype-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-mimetype-core</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-types-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-types-core</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-imaging-core</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-imaging-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.platform</groupId>
+                       <artifactId>nuxeo-platform-filemanager-api</artifactId>
+                       <version>${nuxeo.platform.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.common</groupId>
+                       <artifactId>nuxeo-common</artifactId>
+                       <version>${nuxeo.core.version}</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.runtime</groupId>
+                       <artifactId>nuxeo-runtime</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-api</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-query</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-schema</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-storage-sql</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-storage-sql-ra</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-io</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-core-convert</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <!-- <dependency> <groupId>org.nuxeo.ecm.core</groupId> <artifactId>nuxeo-core-facade</artifactId> 
+                       <version>${nuxeo.core.version}</version> </dependency> -->
+               <dependency>
+                       <groupId>org.nuxeo.runtime</groupId>
+                       <artifactId>nuxeo-runtime-osgi</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.nuxeo.ecm.core</groupId>
+                       <artifactId>nuxeo-opencmis-bindings</artifactId>
+                       <version>${nuxeo.core.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.chemistry.opencmis</groupId>
+                       <artifactId>chemistry-opencmis-server-bindings</artifactId>
+                       <version>${chemistry.opencmis.version.nx}</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>com.sun.xml.ws</groupId>
+                                       <artifactId>jaxws-rt</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               <dependency>
+                       <groupId>org.osgi</groupId>
+                       <artifactId>org.osgi.core</artifactId>
+                       <version>4.1.0</version>
+               </dependency>
 
                <dependency>
-                   <groupId>commons-fileupload</groupId>
-                   <artifactId>commons-fileupload</artifactId>
-                   <version>1.2</version>
-               </dependency>
-        <dependency>
-            <groupId>ch.elca.el4j.modules</groupId>
-            <artifactId>module-xml_merge-common</artifactId>
-            <version>3.1</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.security</groupId>
-            <artifactId>spring-security-acl</artifactId>
-            <version>${spring.security.version}</version>
-            <scope>provided</scope>
-        </dependency>
+                       <groupId>commons-fileupload</groupId>
+                       <artifactId>commons-fileupload</artifactId>
+                       <version>1.2</version>
+               </dependency>
+               <dependency>
+                       <groupId>ch.elca.el4j.modules</groupId>
+                       <artifactId>module-xml_merge-common</artifactId>
+                       <version>3.1</version>
+                       <scope>provided</scope>
+               </dependency>
+               <dependency>
+                       <groupId>commons-io</groupId>
+                       <artifactId>commons-io</artifactId>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework.security</groupId>
+                       <artifactId>spring-security-acl</artifactId>
+                       <version>${spring.security.version}</version>
+                       <scope>provided</scope>
+               </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-aop</artifactId>
                        <version>${spring.version}</version>
-               </dependency>        
-    </dependencies>
+               </dependency>
+       </dependencies>
 
-    <build>
-        <finalName>collectionspace-services-common</finalName>
-       <defaultGoal>install</defaultGoal>
-        <plugins>
-            <plugin>
-                <groupId>org.jvnet.jaxb2.maven2</groupId>
-                <artifactId>maven-jaxb2-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
+       <build>
+               <finalName>collectionspace-services-common</finalName>
+               <defaultGoal>install</defaultGoal>
+               <plugins>
+                       <plugin>
+                               <groupId>org.jvnet.jaxb2.maven2</groupId>
+                               <artifactId>maven-jaxb2-plugin</artifactId>
+                       </plugin>
+               </plugins>
+       </build>
 </project>
 
index e4ff2d08949050d73d207a5d23061277099482da..48e1665633adaebcf33c4c6201d0c62f7de19c85 100644 (file)
@@ -28,7 +28,6 @@ import java.util.List;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
@@ -68,10 +67,10 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
 
     // Fields for default client factory and client
     /** The repository client factory. */
-    private RepositoryClientFactory repositoryClientFactory;
+    private RepositoryClientFactory<IT, OT> repositoryClientFactory;
     
     /** The repository client. */
-    private RepositoryClient repositoryClient;
+    private RepositoryClient<IT, OT> repositoryClient;
     
     /** The storage client. */
     private StorageClient storageClient;
@@ -94,7 +93,7 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
      * Instantiates a new abstract collection space resource.
      */
     public AbstractCollectionSpaceResourceImpl() {
-        repositoryClientFactory = RepositoryClientFactory.getInstance();
+        repositoryClientFactory = (RepositoryClientFactory<IT, OT>) RepositoryClientFactory.getInstance();
     }
 
     /* (non-Javadoc)
@@ -108,7 +107,7 @@ public abstract class AbstractCollectionSpaceResourceImpl<IT, OT>
      * @see org.collectionspace.services.common.CollectionSpaceResource#getRepositoryClient(org.collectionspace.services.common.context.ServiceContext)
      */
     @Override
-    synchronized public RepositoryClient getRepositoryClient(ServiceContext<IT, OT> ctx) {
+    synchronized public RepositoryClient<IT, OT> getRepositoryClient(ServiceContext<IT, OT> ctx) {
         if(repositoryClient != null){
             return repositoryClient;
         }
similarity index 96%
rename from services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java
rename to services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java
index 4ded3611f1f64d6346a43680b0b65705b9cbd82e..de4c957d10ec67c1d6e3888e93fdfce8d2e2369d 100644 (file)
@@ -53,21 +53,21 @@ import org.collectionspace.services.config.service.ListResultField;
 import org.collectionspace.services.config.service.ServiceBindingType;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+
 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
 import org.jboss.resteasy.util.HttpResponseCodes;
+
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-
 
 /**
  * $LastChangedRevision:  $
  * $LastChangedDate:  $
  * Author: Laramie Crocker
  */
-public abstract class ResourceBase
+public abstract class NuxeoBasedResource
         extends AbstractMultiPartCollectionSpaceResourceImpl {
 
     public static final String CREATE = "create";
@@ -332,7 +332,8 @@ public abstract class ResourceBase
         }
     }
 
-    protected AbstractCommonList finish_getList(ServiceContext ctx, DocumentHandler handler) {
+    protected AbstractCommonList finish_getList(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, 
+               DocumentHandler handler) {
         try {
             getRepositoryClient(ctx).getFiltered(ctx, handler); // REM - Side effect of this call sets the handler's common part list value
             return (AbstractCommonList) handler.getCommonPartList();
@@ -503,17 +504,17 @@ public abstract class ResourceBase
      * for all inheriting resource classes. Just use ServiceContext.getResourceMap() to get
      * the map, and pass it in.
      */
-    public static DocumentModel getDocModelForRefName(RepositoryInstanceInterface repoSession, String refName, ResourceMap resourceMap) 
+    public static DocumentModel getDocModelForRefName(CoreSessionInterface repoSession, String refName, ResourceMap resourceMap) 
                        throws Exception, DocumentNotFoundException {
        RefName.AuthorityItem item = RefName.AuthorityItem.parse(refName);
        if(item != null) {
-               ResourceBase resource = resourceMap.get(item.inAuthority.resource);
+               NuxeoBasedResource resource = resourceMap.get(item.inAuthority.resource);
                return resource.getDocModelForAuthorityItem(repoSession, item);
        }
        RefName.Authority authority = RefName.Authority.parse(refName);
        // Handle case of objects refNames, which must be csid based.
        if(authority != null && !Tools.isEmpty(authority.csid)) {
-               ResourceBase resource = resourceMap.get(authority.resource);
+               NuxeoBasedResource resource = resourceMap.get(authority.resource);
             // Ensure we have the right context.
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = 
                        resource.createServiceContext(authority.resource);
@@ -524,15 +525,15 @@ public abstract class ResourceBase
        return null;
     }
 
-    // THis is ugly, but prevents us parsing the refName twice. Once we make refName a little more
+    // This is ugly, but prevents us parsing the refName twice. Once we make refName a little more
     // general, and less Authority(Item) specific, this will look better.
-       public DocumentModel getDocModelForAuthorityItem(RepositoryInstanceInterface repoSession, RefName.AuthorityItem item) 
+       public DocumentModel getDocModelForAuthorityItem(CoreSessionInterface repoSession, RefName.AuthorityItem item) 
                        throws Exception, DocumentNotFoundException {
                logger.warn("Default (ResourceBase) getDocModelForAuthorityItem called - should not happen!");
                return null;
        }
 
-    public DocumentModel getDocModelForRefName(RepositoryInstanceInterface repoSession, String refName) 
+    public DocumentModel getDocModelForRefName(CoreSessionInterface repoSession, String refName) 
                        throws Exception, DocumentNotFoundException {
        return getDocModelForAuthorityItem(repoSession, RefName.AuthorityItem.parse(refName));
     }
@@ -623,7 +624,5 @@ public abstract class ResourceBase
     protected TenantBindingConfigReaderImpl getTenantBindingsReader() {
         return ServiceMain.getInstance().getTenantBindingConfigReader();
     }
-
-
     
 }
index d1d990cb369cd45f613affea54a1e371340c5818..6d1ef8642cc67faf7afd84cdeb92ecbc2b481f5d 100644 (file)
@@ -5,6 +5,6 @@ import java.util.Map;
 /*
  * Maps service names to Resource instances. Use the Service Client Class to get the service name. 
  */
-public interface ResourceMap extends Map<String, ResourceBase> {
+public interface ResourceMap extends Map<String, NuxeoBasedResource> {
 
 }
index a49b6865b9440478d9217dbdd3b80f22945b5d46..ee9dc3036f7ffd0815e37469bd53147edb412909 100644 (file)
@@ -2,6 +2,6 @@ package org.collectionspace.services.common;
 
 import java.util.HashMap;
 
-public class ResourceMapImpl extends HashMap<String, ResourceBase> implements ResourceMap {
+public class ResourceMapImpl extends HashMap<String, NuxeoBasedResource> implements ResourceMap {
 
 }
index db2ee3fbdb830c44392247766c556a01d5bc168a..153b9b6bcf5e21a66e5355d253feae838b32400a 100644 (file)
@@ -761,9 +761,9 @@ public class ServiceMain {
      */
     private synchronized void populateUriTemplateRegistry() {
        if (uriTemplateRegistry.isEmpty()) {
-            ResourceBase resource = null;
+            NuxeoBasedResource resource = null;
             ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class);
-            for (Map.Entry<String, ResourceBase> entry : resourceMap.entrySet()) {
+            for (Map.Entry<String, NuxeoBasedResource> entry : resourceMap.entrySet()) {
                 resource = entry.getValue();
                 Map<UriTemplateRegistryKey, StoredValuesUriTemplate> entries =
                         resource.getUriRegistryEntries();
index 2dae5e072cee05957c17b61d9f3d2e5af04b4155..2d37eb5aaa37ad9010ea8986550d6d79fd4b8998 100644 (file)
@@ -26,13 +26,13 @@ package org.collectionspace.services.common.document;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import java.util.StringTokenizer;
 
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.query.QueryContext;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -161,7 +161,16 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
                 validate(action);
                 prepareDelete();
                 break;
-
+                
+                       case WORKFLOW:
+                               logger.error("Should never get to this code path.  If you did, there is a bug in the code.");
+                               Thread.dumpStack();
+                               break;
+                               
+                       default:
+                               logger.error("Should never get to this code path.  If you did, there is a bug in the code.");
+                               Thread.dumpStack();
+                               break;
         }
     }
 
@@ -225,7 +234,16 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
             case DELETE:
                 handleDelete((DocumentWrapper<WT>) wrapDoc);
                 break;
-
+                
+                       case WORKFLOW:
+                               logger.error("Should never get to this code path.  If you did, there is a bug in the code.");
+                               Thread.dumpStack();
+                               break;
+                               
+                       default:
+                               logger.error("Should never get to this code path.  If you did, there is a bug in the code.");
+                               Thread.dumpStack();
+                               break;
         }
     }
 
@@ -286,6 +304,16 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
             case DELETE:
                 completeDelete((DocumentWrapper<WT>) wrapDoc);
                 break;
+                
+                       case WORKFLOW:
+                               logger.error("Should never get to this code path.  If you did, there is a bug in the code.");
+                               Thread.dumpStack();
+                               break;
+                               
+                       default:
+                               logger.error("Should never get to this code path.  If you did, there is a bug in the code.");
+                               Thread.dumpStack();
+                               break;                
         }
     }
 
index 6436951f4a4e0696ef86ee84ac5fa5d3e3dda30d..64828838937446f2e7540216e788836d45c03248 100644 (file)
  */
 package org.collectionspace.services.common.document;
 
-
-
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * AbstractMultipartDocumentHandler
  *
@@ -43,8 +37,6 @@ public abstract class AbstractMultipartDocumentHandlerImpl<T, TL, WT, WTL>
         extends AbstractDocumentHandlerImpl<T, TL, WT, WTL>
         implements MultipartDocumentHandler<T, TL, WT, WTL> {
 
-    private final Logger logger = LoggerFactory.getLogger(AbstractMultipartDocumentHandlerImpl.class);
-
     public AbstractMultipartDocumentHandlerImpl() {
        //Empty constructor
     }
index 7617e7c68d60ff2150b7f7fed4b8b47f747bc30a..88965eb612651764896734e703001abad624626c 100644 (file)
@@ -17,8 +17,6 @@
  */
 package org.collectionspace.services.common.document;
 
-import org.collectionspace.services.common.document.DocumentHandler.Action;
-
 /**
  * MultipartDocumentHandler is a DocumentHandler provides document processing
  * methods for entities using schema extension that are mapped to multipart
index 4e2b69512db2d87c3915f32d204ad79a89bbe61e..e8e166a4df52062b75e22b49c7caea1f957d8d17 100644 (file)
@@ -28,11 +28,8 @@ package org.collectionspace.services.common.imaging.nuxeo;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
 import java.io.InputStream;
-import java.io.BufferedInputStream;
-import java.io.IOException;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -41,10 +38,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.nuxeo.runtime.api.Framework;
-//import org.nuxeo.runtime.api.ServiceManager;
-//import org.nuxeo.runtime.api.ServiceDescriptor;
-
-//import org.nuxeo.common.utils.FileUtils;
 
 import org.nuxeo.ecm.platform.picture.api.ImageInfo;
 import org.nuxeo.ecm.platform.picture.api.ImagingDocumentConstants;
@@ -58,49 +51,23 @@ import org.nuxeo.ecm.platform.filemanager.service.FileManagerService;
 import org.nuxeo.ecm.platform.filemanager.service.extension.FileImporter;
 import org.nuxeo.ecm.platform.filemanager.utils.FileManagerUtils;
 import org.nuxeo.ecm.platform.types.TypeManager;
-import org.nuxeo.ecm.core.repository.RepositoryDescriptor;
-import org.nuxeo.ecm.core.repository.RepositoryManager;
-import org.nuxeo.ecm.core.repository.RepositoryService;
-import org.nuxeo.ecm.core.storage.sql.BinaryManager;
-import org.nuxeo.ecm.core.storage.sql.DefaultBinaryManager;
-
-/*
- * Keep these commented out import statements as reminders of Nuxeo's blob management
-import org.nuxeo.runtime.model.ComponentManager;
-import org.nuxeo.runtime.model.impl.ComponentManagerImpl;
-import org.nuxeo.ecm.core.api.ejb.DocumentManagerBean;
-import org.nuxeo.ecm.core.storage.sql.RepositoryImpl;
-import org.nuxeo.ecm.core.storage.sql.Repository;
-import org.nuxeo.ecm.core.storage.sql.Binary;
-import org.nuxeo.ecm.core.storage.sql.RepositoryImpl;
-import org.nuxeo.ecm.core.storage.sql.RepositoryResolver;
-import org.nuxeo.ecm.core.storage.sql.coremodel.SQLBlob;
-import org.nuxeo.ecm.core.storage.sql.coremodel.SQLRepository;
-import org.nuxeo.ecm.core.storage.sql.RepositoryDescriptor;
-import org.nuxeo.ecm.core.api.DocumentResolver;
-*/
 
+import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.IdRef;
 import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
 import org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder;
 import org.nuxeo.ecm.core.api.impl.blob.FileBlob;
 import org.nuxeo.ecm.core.api.impl.blob.InputStreamBlob;
-import org.nuxeo.ecm.core.api.impl.blob.StreamingBlob;
-import org.nuxeo.ecm.core.api.impl.blob.ByteArrayBlob;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-import org.nuxeo.ecm.core.api.repository.Repository;
 import org.nuxeo.ecm.core.api.Blob;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentRef;
-import org.nuxeo.ecm.core.event.EventServiceAdmin;
-import org.nuxeo.ecm.core.schema.SchemaManager;
-import org.nuxeo.ecm.core.schema.types.Schema;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-//import org.nuxeo.ecm.core.repository.jcr.testing.RepositoryOSGITestCase;
 
 import org.apache.commons.io.IOUtils;
+
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.FileUtils;
@@ -118,13 +85,12 @@ import org.collectionspace.services.blob.MeasuredPartGroup;
 import org.collectionspace.services.blob.MeasuredPartGroupList;
 import org.collectionspace.services.jaxb.BlobJAXBSchema;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.collectionspace.services.nuxeo.extension.thumbnail.ThumbnailConstants;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.config.service.ListResultField;
 
-
 /**
  * The Class NuxeoBlobUtils.
  */
@@ -186,22 +152,6 @@ public class NuxeoBlobUtils {
        public static final String SCHEMA_IPTC = "iptc";
        public static final String SCHEMA_IMAGE_METADATA = "image_metadata";
 
-       private static final int THUMB_SIZE_HEIGHT = 100;
-       private static final int THUMB_SIZE_WIDTH = 75;
-
-       // static DefaultBinaryManager binaryManager = new DefaultBinaryManager();
-       // //can we get this from Nuxeo? i.e.,
-       // Framework.getService(BinaryManger.class)
-
-       // /** The temp file name. */
-       // static String tempFileName = "sunset.jpg";
-       //
-       // /** The file separator. */
-       // static String fileSeparator = System.getProperty("file.separator");
-       //
-       // /** The cur dir. */
-       // static String curDir = System.getProperty("user.dir");
-
        /**
         * Instantiates a new nuxeo image utils.
         */
@@ -298,7 +248,7 @@ public class NuxeoBlobUtils {
                return result;
        }
 
-       static public CommonList getBlobDerivatives(RepositoryInstanceInterface repoSession,
+       static public CommonList getBlobDerivatives(CoreSessionInterface repoSession,
                        String repositoryId, List<ListResultField> resultsFields, String uri)
                        throws Exception {
                CommonList commonList = new CommonList();
@@ -482,8 +432,8 @@ public class NuxeoBlobUtils {
                                                ThumbnailConstants.THUMBNAIL_PROPERTY_NAME);
                                } catch (ClientException e) {
                                        errorMsg = "Could not extract the name of the thumbnail preview image file.";
-                                       if (logger.isTraceEnabled()) {
-                                               logger.trace(errorMsg, e);
+                                       if (logger.isDebugEnabled()) {
+                                               logger.debug(errorMsg, e);
                                        }
                                }
                                
@@ -498,102 +448,6 @@ public class NuxeoBlobUtils {
                return result;
        }
 
-       /*
-        * This is a prototype method that is not currently used as of 1/1/2012.  However,
-        * it may be useful now that we've transitioned to using an embedded Nuxeo server.
-        */
-       static private File getBlobFile(RepositoryInstanceInterface ri,
-                       DocumentModel documentModel, Blob blob) {
-               DefaultBinaryManager binaryManager = null;
-               RepositoryDescriptor descriptor = null;
-               File file = null;
-
-               try {
-                       RepositoryService repositoryService1 = (RepositoryService) Framework
-                                       .getRuntime().getComponent(RepositoryService.NAME);
-
-                       String repositoryName = documentModel.getRepositoryName();
-                       RepositoryManager repositoryManager = repositoryService1
-                                       .getRepositoryManager();
-                       descriptor = repositoryManager.getDescriptor(repositoryName);
-
-// Keep this code around for future work/enhancements                  
-//                     binaryManager = new DefaultBinaryManager();
-//
-//                     File storageDir = binaryManager.getStorageDir();
-//                     // SQLBlob blob = (SQLBlob)
-//                     // doc.getPropertyValue("schema:blobField");
-//                     File file = binaryManager.getFileForDigest(blob.getDigest(), false);
-
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-
-// Keep this code around for future work/enhancements
-//             try {
-//                     binaryManager.initialize(SQLRepository.getDescriptor(descriptor));
-//             } catch (IOException e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             } catch (Exception e) {
-//                     // TODO Auto-generated catch block
-//                     e.printStackTrace();
-//             }
-
-// Keep this code around for future work/enhancements
-//             File storageDir = binaryManager.getStorageDir();
-//             SQLBlob blob = (SQLBlob)
-//             documentModel.getPropertyValue("schema:blobField");
-//             File file = binaryManager.getFileForDigest(blob.getDigest(), false);
-
-               return file;
-       }
-
-       /**
-        * Returns a schema, given the name of a schema.  Possibly usefule in the future
-        * 
-        * @param schemaName
-        *            a schema name.
-        * @return a schema.
-        */
-       private static Schema getSchemaFromName(String schemaName) {
-               SchemaManager schemaManager = null;
-               try {
-                       schemaManager = Framework.getService(SchemaManager.class);
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-               return schemaManager != null ? schemaManager.getSchema(schemaName)
-                               : null;
-       }
-
-       /**
-        * Gets the blob.  Not in use now, but might be useful in the future.
-        * 
-        * @param nuxeoSession
-        *            the nuxeo session
-        * @param id
-        *            the id
-        * @return the blob
-        */
-       static private Blob getBlob(RepositoryInstanceInterface repoSession, String id) {
-               Blob result = null;
-
-               try {
-                       Repository repository = repoSession.getRepositoryInstance().getRepository();
-                       // binaryManager.initialize(new RepositoryDescriptor());
-                       // binaryManager.getBinary("a4cac052ae0281979f2dcf5ab2e61a6c");
-                       // DocumentResolver.resolveReference(nuxeoSession, documentRef);
-                       // binaryManager = repository.getBinaryManager();
-                       // documentModel.getr
-               } catch (Exception x) {
-                       x.printStackTrace();
-               }
-
-               return result;
-       }
-
     static private Blob checkMimeType(Blob blob, String fullname)
             throws ClientException {
         final String mimeType = blob.getMimeType();
@@ -629,169 +483,10 @@ public class NuxeoBlobUtils {
                return typeService;
        }
 
-       /**
-        * Gets the bytes.
-        * 
-        * @param fis
-        *            the fis
-        * @return the bytes
-        */
-       private static byte[] getBytes(InputStream fis) {
-               ByteArrayOutputStream bos = new ByteArrayOutputStream();
-               byte[] buf = new byte[128 * 1024];
-               try {
-                       for (int readNum; (readNum = fis.read(buf)) != -1;) {
-                               bos.write(buf, 0, readNum);
-                               // no doubt here is 0
-                               /*
-                                * Writes len bytes from the specified byte array starting at
-                                * offset off to this byte array output stream.
-                                */
-                               System.out.println("read " + readNum + " bytes,");
-                       }
-               } catch (IOException ex) {
-                       logger.error(ex.getMessage(), ex);
-               }
-               byte[] bytes = bos.toByteArray();
-               // bytes is the ByteArray we need
-               return bytes;
-       }
-
-       /**
-        * Creates the serializable blob.  We may need this code, do not remove.
-        * 
-        * @param fileInputStream
-        *            the file input stream
-        * @param filename
-        *            the filename
-        * @param mimeType
-        *            the mime type
-        * @return the blob
-        */
-       private static Blob createSerializableBlob(InputStream fileInputStream,
-                       String filename, String mimeType) {
-               Blob blob = null;
-               try {
-                       // persisting the blob makes it possible to read the binary content
-                       // of the request stream several times (mimetype sniffing, digest
-                       // computation, core binary storage)
-                       byte[] bytes = getBytes(fileInputStream);
-                       blob = new ByteArrayBlob(bytes);
-                       // filename
-                       if (filename != null) {
-                               filename = getCleanFileName(filename);
-                       }
-                       blob.setFilename(filename);
-                       // mimetype detection
-                       MimetypeRegistry mimeService = Framework
-                                       .getService(MimetypeRegistry.class);
-                       String detectedMimeType = mimeService
-                                       .getMimetypeFromFilenameAndBlobWithDefault(filename, blob,
-                                                       null);
-                       if (detectedMimeType == null) {
-                               if (mimeType != null) {
-                                       detectedMimeType = mimeType;
-                               } else {
-                                       // default
-                                       detectedMimeType = "application/octet-stream";
-                               }
-                       }
-                       blob.setMimeType(detectedMimeType);
-               } catch (MimetypeDetectionException e) {
-                       logger.error(String.format("could not fetch mimetype for file %s",
-                                       filename), e);
-               } catch (Exception e) {
-                       logger.error("", e);
-               }
-               return blob;
-       }
-
-       /**
-        * Creates a serializable blob from a stream, with filename and mimetype
-        * detection.
-        * 
-        * <p>
-        * Creates an in-memory blob if data is under 64K, otherwise constructs a
-        * serializable FileBlob which stores data in a temporary file on the hard
-        * disk.
-        * </p>
-        * 
-        * @param file
-        *            the input stream holding data
-        * @param filename
-        *            the file name. Will be set on the blob and will used for
-        *            mimetype detection.
-        * @param mimeType
-        *            the detected mimetype at upload. Can be null. Will be verified
-        *            by the mimetype service.
-        * @return the blob
-        */
-       private static Blob createStreamingBlob(File file, String filename,
-                       String mimeType) {
-               Blob blob = null;
-               try {
-                       // persisting the blob makes it possible to read the binary content
-                       // of the request stream several times (mimetype sniffing, digest
-                       // computation, core binary storage)
-                       blob = StreamingBlob.createFromFile(file, mimeType).persist();
-                       // filename
-                       if (filename != null) {
-                               filename = getCleanFileName(filename);
-                       }
-                       blob.setFilename(filename);
-                       // mimetype detection
-                       MimetypeRegistry mimeService = Framework
-                                       .getService(MimetypeRegistry.class);
-                       String detectedMimeType = mimeService
-                                       .getMimetypeFromFilenameAndBlobWithDefault(filename, blob,
-                                                       null);
-                       if (detectedMimeType == null) {
-                               if (mimeType != null) {
-                                       detectedMimeType = mimeType;
-                               } else {
-                                       // default
-                                       detectedMimeType = "application/octet-stream";
-                               }
-                       }
-                       blob.setMimeType(detectedMimeType);
-               } catch (MimetypeDetectionException e) {
-                       logger.error(String.format("could not fetch mimetype for file %s",
-                                       filename), e);
-               } catch (IOException e) {
-                       logger.error("", e);
-               } catch (Exception e) {
-                       logger.error("", e);
-               }
-               return blob;
-       }
-
        private static Blob createNuxeoFileBasedBlob(File file) throws Exception {
                return new FileBlob(file);
        }
 
-       /**
-        * Returns a clean filename, stripping upload path on client side.
-        * <p>
-        * Fixes NXP-544
-        * </p>
-        * 
-        * @param filename
-        *            the filename
-        * @return the clean file name
-        */
-       private static String getCleanFileName(String filename) {
-               String res = null;
-               int lastWinSeparator = filename.lastIndexOf('\\');
-               int lastUnixSeparator = filename.lastIndexOf('/');
-               int lastSeparator = Math.max(lastWinSeparator, lastUnixSeparator);
-               if (lastSeparator != -1) {
-                       res = filename.substring(lastSeparator + 1, filename.length());
-               } else {
-                       res = filename;
-               }
-               return res;
-       }
-
        /**
         * Gets Nuxeo's file manager service.
         * 
@@ -834,51 +529,10 @@ public class NuxeoBlobUtils {
                return result;
        }       
        
-       /**
-        * Gets Nuxeo's file manager service.
-        * 
-        * @return the file manager service
-        * @throws ClientException
-        *             the client exception
-        */
-       private static FileManager getFileManagerServicex() throws ClientException {
-               FileManager result = null;
-               try {
-                       result = Framework.getService(FileManager.class);
-               } catch (Exception e) {
-                       String msg = "Unable to get Nuxeo's FileManager service.";
-                       logger.error(msg, e);
-                       throw new ClientException("msg", e);
-               }
-               return result;
-       }
-       
-       private static EventServiceAdmin getEventServiceAdmin() throws ClientException {
-               EventServiceAdmin result = null;
-               try {
-                       result = Framework.getService(EventServiceAdmin.class);
-               } catch (Exception e) {
-                       String msg = "Unable to get Nuxeo's EventServiceAdmin service.";
-                       logger.error(msg, e);
-                       throw new ClientException("msg", e);
-               }
-               return result;
-       }       
-       
-       private static BinaryManager getBinaryManagerService() throws ClientException {
-               BinaryManager result = null;
-               try {
-                       result = Framework.getService(BinaryManager.class);
-               } catch (Exception e) {
-                       String msg = "Unable to get Nuxeo's BinaryManager service.";
-                       logger.error(msg, e);
-                       throw new ClientException("msg", e);
-               }
-               return result;
-       }
        
-       static private RepositoryInstanceInterface getRepositorySession(ServiceContext ctx, RepositoryClient repositoryClient) {
-               RepositoryInstanceInterface result = null;              
+       static private CoreSessionInterface getRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
+                       RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient) {
+               CoreSessionInterface result = null;             
                RepositoryJavaClientImpl nuxeoClient = (RepositoryJavaClientImpl)repositoryClient;
                
                try {
@@ -890,7 +544,9 @@ public class NuxeoBlobUtils {
                return result;
        }
        
-       static private void releaseRepositorySession(ServiceContext ctx, RepositoryClient repositoryClient, RepositoryInstanceInterface repoSession) throws TransactionException {
+       static private void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
+                       RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient,
+                       CoreSessionInterface repoSession) throws TransactionException {
                RepositoryJavaClientImpl nuxeoClient = (RepositoryJavaClientImpl)repositoryClient;
                nuxeoClient.releaseRepositorySession(ctx, repoSession);
        }
@@ -908,7 +564,7 @@ public class NuxeoBlobUtils {
     }
        
        private static DocumentModel createDocumentFromBlob(
-                       RepositoryInstanceInterface repoSession,
+                       CoreSessionInterface repoSession,
             Blob inputStreamBlob, 
             String blobLocation, 
             boolean overwrite, 
@@ -923,21 +579,20 @@ public class NuxeoBlobUtils {
                        // image derivatives.
                        //
                        result = getFileManager().createDocumentFromBlob(
-                                       repoSession.getRepositoryInstance(), inputStreamBlob, blobLocation, true, blobName);
+                                       repoSession.getCoreSession(), inputStreamBlob, blobLocation, true, blobName);
                } else {
                        //
                        // User Nuxeo's default file importer/adapter explicitly.  This avoids specialized functionality from happening like
                        // image derivative creation.
                        //
-                       String digestAlgorithm = getFileManager()
-                       .getDigestAlgorithm(); // Only call this because we seem to need some way of initializing Nuxeo's FileManager with a call.
+                       String digestAlgorithm = getFileManager().getDigestAlgorithm(); // Only call this because we seem to need some way of initializing Nuxeo's FileManager with a call.
                        
                        FileManagerService fileManagerService = getFileManagerService();
                        inputStreamBlob = checkMimeType(inputStreamBlob, blobName);
 
                        FileImporter defaultFileImporter = fileManagerService.getPluginByName("DefaultFileImporter");
                        result = defaultFileImporter.create(
-                                       repoSession.getRepositoryInstance(), inputStreamBlob, blobLocation, true, blobName, getTypeService());                  
+                                       repoSession.getCoreSession(), inputStreamBlob, blobLocation, true, blobName, getTypeService());                 
                }
                
                return result;
@@ -945,14 +600,14 @@ public class NuxeoBlobUtils {
        
        static public BlobsCommon createBlobInRepository(
                        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-                       RepositoryClient repositoryClient,
+                       RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient,
                        InputStream inputStream,
                        String blobName,
                        boolean useNuxeoAdaptors) throws TransactionException {
                BlobsCommon result = null;
 
                boolean repoSessionCleanup = false;
-               RepositoryInstanceInterface repoSession = (RepositoryInstanceInterface)ctx.getCurrentRepositorySession();
+               CoreSessionInterface repoSession = (CoreSessionInterface)ctx.getCurrentRepositorySession();
                if (repoSession == null) {
                        repoSession = getRepositorySession(ctx, repositoryClient);
                        repoSessionCleanup = true;
@@ -999,7 +654,7 @@ public class NuxeoBlobUtils {
         */
        public static BlobsCommon createBlobInRepository(
                        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-                       RepositoryInstanceInterface repoSession,
+                       CoreSessionInterface repoSession,
                        BlobInput blobInput,
                        boolean purgeOriginal,
                        boolean useNuxeoAdaptors) throws Exception {
@@ -1085,7 +740,7 @@ public class NuxeoBlobUtils {
         *            the mime type
         * @return the string
         */
-       static private BlobsCommon createBlobInRepository(RepositoryInstanceInterface nuxeoSession,
+       static private BlobsCommon createBlobInRepository(CoreSessionInterface nuxeoSession,
                        DocumentModel blobLocation,
                        boolean purgeOriginal,
                        File file,
@@ -1172,14 +827,14 @@ public class NuxeoBlobUtils {
                return result;
        }
 
-       static public BlobOutput getBlobOutput(ServiceContext ctx,
-                       RepositoryClient repositoryClient,
+       static public BlobOutput getBlobOutput(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
+                       RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient,
                        String repositoryId,
                        StringBuffer outMimeType) throws TransactionException {
                BlobOutput result = null;
                
                boolean repoSessionCleanup = false;
-               RepositoryInstanceInterface repoSession = (RepositoryInstanceInterface)ctx.getCurrentRepositorySession();
+               CoreSessionInterface repoSession = (CoreSessionInterface)ctx.getCurrentRepositorySession();
                if (repoSession == null) {
                        repoSession = getRepositorySession(ctx, repositoryClient);
                        repoSessionCleanup = true;
@@ -1244,8 +899,8 @@ public class NuxeoBlobUtils {
         *            the derivative term
         * @return the image
         */
-       static public BlobOutput getBlobOutput(ServiceContext ctx,
-                       RepositoryInstanceInterface repoSession,
+       static public BlobOutput getBlobOutput(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
+                       CoreSessionInterface repoSession,
                        String repositoryId,
                        String derivativeTerm,
                        Boolean getContentFlag,
index e0d80e1977f1bb26c17c808eeda023ee0c48c835..cac53c19d72545acdcc79a26ec6c62097e36733c 100644 (file)
@@ -30,7 +30,7 @@ import org.collectionspace.services.publicitem.PublicitemsCommon;
 import org.collectionspace.services.client.PublicItemClient;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.blob.BlobOutput;
 import org.collectionspace.services.common.context.RemoteServiceContext;
@@ -54,7 +54,7 @@ import javax.ws.rs.core.UriInfo;
 @Path(PublicItemClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class PublicItemResource extends ResourceBase {
+public class PublicItemResource extends NuxeoBasedResource {
 
     final Logger logger = LoggerFactory.getLogger(PublicItemResource.class);
 
index 1e99e9161c16db2ab2a9a5976f007cc2ec051dc0..b660a46c756d598fff75d9cb31c06a87e7524458 100644 (file)
@@ -8,9 +8,6 @@ import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-
 // TODO: Auto-generated Javadoc
 /**
  * The Class QueryContext.
index ee137fe93402cb0642038e103d4023d1d8564014..2a368922e2f6be605ff4a0a654946022be51354c 100644 (file)
@@ -30,7 +30,7 @@ import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentHandler;
@@ -54,7 +54,7 @@ import javax.ws.rs.core.UriInfo;
 @Path("/relations")
 @Consumes("application/xml")
 @Produces("application/xml")
-public class RelationResource extends ResourceBase {
+public class RelationResource extends NuxeoBasedResource {
        public final static String serviceName = "relations";
        final Logger logger = LoggerFactory.getLogger(RelationResource.class);
        
index 74e1a82f3557ecb3d06fac6e31450a1d1b6c1886..94110d4e58ae651222c5d7c304d2447c8fc0cdca 100644 (file)
@@ -14,12 +14,13 @@ import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.repository.RepositoryClient;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
+
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -33,9 +34,9 @@ public class RelationUtils {
      * Performs an NXQL query to find refName references in relationship records.
      */
     private static DocumentModelList findRelationsWithRefName(
-            ServiceContext ctx,
+            ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             String refName,
             String targetField,
             String orderByClause,
@@ -66,7 +67,7 @@ public class RelationUtils {
     public static void updateRefNamesInRelations(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             String targetField,
             String oldRefName,
             String newRefName) throws Exception {
index 35502c21011cb92fdf1fff45b2539871a26963ec..fa9cf3a533d646301017cb3c68c31af121326c88 100644 (file)
@@ -33,7 +33,7 @@ import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.storage.StorageClient;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 //
 // All of these Nuxeo specific classes should not be here.  This is supposed to be
 // a repository-neutral interface.
@@ -132,7 +132,7 @@ public interface RepositoryClient<IT, OT> extends StorageClient {
      * @param where NXQL where clause to get the document
      * @throws DocumentException
      */
-    public String findDocCSID(RepositoryInstanceInterface repoSession, 
+    public String findDocCSID(CoreSessionInterface repoSession, 
             ServiceContext<IT, OT> ctx, String where)
             throws DocumentNotFoundException, DocumentException;
 
index 9d9d508cc253d2c4e94e70be2d31677906163bd0..698e950f5c56f365df1d23972fb5065e85d9ce9f 100644 (file)
@@ -24,6 +24,7 @@
 package org.collectionspace.services.common.repository;
 
 import java.util.Hashtable;
+
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.config.ServicesConfigReaderImpl;
 import org.collectionspace.services.config.RepositoryClientConfigType;
@@ -39,7 +40,7 @@ import org.slf4j.LoggerFactory;
  */
 public class RepositoryClientFactory<IT, OT> {
 
-    private static final RepositoryClientFactory self = new RepositoryClientFactory();
+    private static final RepositoryClientFactory<?, ?> self = new RepositoryClientFactory<Object, Object>();
     final Logger logger = LoggerFactory.getLogger(RepositoryClientFactory.class);
     //clients key=client name, value=repository client
     private Hashtable<String, RepositoryClient<IT, OT>> clients = new Hashtable<String, RepositoryClient<IT, OT>>();
@@ -52,7 +53,7 @@ public class RepositoryClientFactory<IT, OT> {
             String clientName = repositoryClientConfig.getName();
             ClassLoader cloader = Thread.currentThread().getContextClassLoader();
 
-            Class jclazz = cloader.loadClass(clientClassName);
+            Class<?> jclazz = cloader.loadClass(clientClassName);
             RepositoryClient<IT, OT> jclient = (RepositoryClient<IT, OT>)jclazz.newInstance();
             clients.put(clientName, jclient);
 
@@ -61,7 +62,7 @@ public class RepositoryClientFactory<IT, OT> {
         }
     }
 
-    public static RepositoryClientFactory getInstance() {
+    public static RepositoryClientFactory<?, ?> getInstance() {
         return self;
     }
 
index 7a0b85691c56eae268936041184e82a4489e930e..4f97aada403c01bd2d241ffbc336d33e5e342dda 100644 (file)
@@ -12,12 +12,11 @@ import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthRefConfigInfo;
 import org.collectionspace.services.config.service.ServiceBindingType;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 
 import com.google.common.collect.AbstractIterator;
 
@@ -37,7 +36,7 @@ public class LazyAuthorityRefDocList extends DocumentModelListImpl {
        
        private ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx;
        private RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient;
-       private RepositoryInstanceInterface repoSession;
+       private CoreSessionInterface repoSession;
        private List<String> serviceTypes;
        private String refName;
        private String refPropName;
@@ -71,7 +70,7 @@ public class LazyAuthorityRefDocList extends DocumentModelListImpl {
        public LazyAuthorityRefDocList(
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
                RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-               RepositoryInstanceInterface repoSession, List<String> serviceTypes,
+               CoreSessionInterface repoSession, List<String> serviceTypes,
                String refName,
                String refPropName,
                Map<String, ServiceBindingType> queriedServiceBindings,
index 8f1174659105c8ab7213ae6ebf7826b7368983cb..50f0ad31192761d9984d03f5a9cc2f853cb87943 100644 (file)
@@ -35,7 +35,7 @@ import org.nuxeo.ecm.core.api.model.Property;
 import org.nuxeo.ecm.core.api.model.PropertyException;
 import org.nuxeo.ecm.core.api.model.PropertyNotFoundException;
 import org.nuxeo.ecm.core.api.model.impl.primitives.StringProperty;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+import org.nuxeo.ecm.core.api.CoreSession;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -66,8 +66,8 @@ import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.query.QueryManager;
 import org.collectionspace.services.common.relation.RelationUtils;
 import org.collectionspace.services.common.repository.RepositoryClient;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.collectionspace.services.common.security.SecurityUtils;
 import org.collectionspace.services.config.service.ServiceBindingType;
@@ -216,7 +216,7 @@ public class RefNameServiceUtils {
     public static void updateRefNamesInRelations(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             String oldRefName,
             String newRefName) throws Exception {
        //
@@ -230,20 +230,19 @@ public class RefNameServiceUtils {
        RelationUtils.updateRefNamesInRelations(ctx, repoClient, repoSession, IRelationsManager.OBJECT_REFNAME, oldRefName, newRefName);
     }
     
-    public static List<AuthRefConfigInfo> getConfiguredAuthorityRefs(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
-        List<String> authRefFields =
-                ((AbstractServiceContextImpl) ctx).getAllPartsPropertyValues(
-                ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
-        ArrayList<AuthRefConfigInfo> authRefsInfo = new ArrayList<AuthRefConfigInfo>(authRefFields.size());
-        for (String spec : authRefFields) {
-            AuthRefConfigInfo arci = new AuthRefConfigInfo(spec);
-            authRefsInfo.add(arci);
-        }
-        return authRefsInfo;
-    }
+       public static List<AuthRefConfigInfo> getConfiguredAuthorityRefs(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
+               List<String> authRefFields = ((AbstractServiceContextImpl) ctx).getAllPartsPropertyValues(
+                               ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES);
+               ArrayList<AuthRefConfigInfo> authRefsInfo = new ArrayList<AuthRefConfigInfo>(authRefFields.size());
+               for (String spec : authRefFields) {
+                       AuthRefConfigInfo arci = new AuthRefConfigInfo(spec);
+                       authRefsInfo.add(arci);
+               }
+               return authRefsInfo;
+       }
 
     public static AuthorityRefDocList getAuthorityRefDocs(
-               RepositoryInstanceInterface repoSession,
+               CoreSessionInterface repoSession,
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             UriTemplateRegistry uriTemplateRegistry,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
@@ -405,7 +404,7 @@ public class RefNameServiceUtils {
     public static int updateAuthorityRefDocs(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             String oldRefName,
             String newRefName,
             String refPropName) throws Exception {
@@ -479,7 +478,7 @@ public class RefNameServiceUtils {
     private static DocumentModelList findAllAuthorityRefDocs(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-            RepositoryInstanceInterface repoSession, List<String> serviceTypes,
+            CoreSessionInterface repoSession, List<String> serviceTypes,
             String refName,
             String refPropName,
             Map<String, ServiceBindingType> queriedServiceBindings,
@@ -497,7 +496,7 @@ public class RefNameServiceUtils {
     protected static DocumentModelList findAuthorityRefDocs(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient,
-            RepositoryInstanceInterface repoSession, List<String> serviceTypes,
+            CoreSessionInterface repoSession, List<String> serviceTypes,
             String refName,
             String refPropName,
             Map<String, ServiceBindingType> queriedServiceBindings,
@@ -728,7 +727,7 @@ public class RefNameServiceUtils {
                 ilistItem.setUri(uri);
                 try {
                     ilistItem.setWorkflowState(docModel.getCurrentLifeCycleState());
-                    ilistItem.setUpdatedAt(DocHandlerBase.getUpdatedAtAsString(docModel));
+                    ilistItem.setUpdatedAt(NuxeoDocumentModelHandler.getUpdatedAtAsString(docModel));
                 } catch (Exception e) {
                     logger.error("Error getting core values for doc [" + csid + "]: " + e.getLocalizedMessage());
                 }
index 54c9a1f34076fa177e6fbde703d2ea197b29b2b0..1ce127f7a3f9146c28af8233ca5684c5c9e99370 100644 (file)
@@ -35,7 +35,7 @@ import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.workflow.jaxb.WorkflowJAXBSchema;
 import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.lifecycle.TransitionDef;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
 import org.collectionspace.services.workflow.WorkflowCommon;
 import org.nuxeo.ecm.core.api.ClientException;
@@ -44,7 +44,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class WorkflowDocumentModelHandler
-        extends DocHandlerBase<WorkflowCommon> {
+        extends NuxeoDocumentModelHandler<WorkflowCommon> {
 
     /** The logger. */
     private static final Logger logger = LoggerFactory.getLogger(WorkflowDocumentModelHandler.class);
similarity index 89%
rename from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryInstanceInterface.java
rename to services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionInterface.java
index 2537811a2fc1a32beba3b614dd07813a09eaff66..5fbb014db0c2b80edac89618ac147f52717720bd 100644 (file)
@@ -3,17 +3,18 @@ package org.collectionspace.services.nuxeo.client.java;
 import java.security.Principal;
 
 import org.nuxeo.ecm.core.api.ClientException;
+import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.DocumentRef;
 import org.nuxeo.ecm.core.api.Filter;
 import org.nuxeo.ecm.core.api.IterableQueryResult;
 import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+import org.nuxeo.ecm.core.api.impl.LifeCycleFilter;
 
-public interface RepositoryInstanceInterface {
+public interface CoreSessionInterface {
 
-       public RepositoryInstance getRepositoryInstance();
+       public CoreSession getCoreSession();
        
     /**
      * Gets the root document of this repository.
@@ -70,6 +71,17 @@ public interface RepositoryInstanceInterface {
      * @throws ClientException
      */
     public DocumentModelList query(String query, int max) throws ClientException;
+    
+    /**
+     * Executes the given NXQL query and returns the result that matches the
+     * filter.
+     *
+     * @param query the query to execute
+     * @param filter the filter to apply to result
+     * @return the query result
+     * @throws ClientException
+     */
+    public DocumentModelList query(String query, LifeCycleFilter workflowStateFilter);
 
     /**
      * Gets a document model given its reference.
similarity index 92%
rename from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryInstanceWrapper.java
rename to services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java
index 797805a0e30934645540c2c0e7ddd2da95b8107b..95ccdf1ce3136deaf2b3b6f62a7cb16ac5e3c7a2 100644 (file)
@@ -10,18 +10,19 @@ import org.nuxeo.ecm.core.api.Filter;
 import org.nuxeo.ecm.core.api.IterableQueryResult;
 import org.nuxeo.ecm.core.api.NoRollbackOnException;
 import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+import org.nuxeo.ecm.core.api.impl.LifeCycleFilter;
+import org.nuxeo.ecm.core.api.CoreSession;
 
-public class RepositoryInstanceWrapper implements RepositoryInstanceInterface {
+public class CoreSessionWrapper implements CoreSessionInterface {
 
-       private RepositoryInstance repoSession;
+       private CoreSession repoSession;
        
-       public RepositoryInstanceWrapper(RepositoryInstance repoSession) {
+       public CoreSessionWrapper(CoreSession repoSession) {
                this.repoSession = repoSession;
        }
 
        @Override
-       public  RepositoryInstance getRepositoryInstance() {
+       public  CoreSession getCoreSession() {
                return repoSession;
        }
        
@@ -88,6 +89,11 @@ public class RepositoryInstanceWrapper implements RepositoryInstanceInterface {
        public DocumentModelList query(String query) throws ClientException {
                return repoSession.query(query);
        }
+       
+       @Override
+       public DocumentModelList query(String query, LifeCycleFilter workflowStateFilter) {
+               return repoSession.query(query, workflowStateFilter);
+       }
 
     /**
      * Gets a document model given its reference.
diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java
deleted file mode 100644 (file)
index 337a3d3..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- *  This document is a part of the source code and related artifacts
- *  for CollectionSpace, an open source collections management system
- *  for museums and related institutions:
-
- *  http://www.collectionspace.org
- *  http://wiki.collectionspace.org
-
- *  Copyright 2009 University of California at Berkeley
-
- *  Licensed under the Educational Community License (ECL), Version 2.0.
- *  You may not use this file except in compliance with this License.
-
- *  You may obtain a copy of the ECL 2.0 License at
-
- *  https://source.collectionspace.org/collection-space/LICENSE.txt
-
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.collectionspace.services.nuxeo.client.java;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.ws.rs.core.MultivaluedMap;
-
-import org.collectionspace.services.client.CollectionSpaceClient;
-import org.collectionspace.services.client.IQueryManager;
-import org.collectionspace.services.client.IRelationsManager;
-import org.collectionspace.services.common.ReflectionMapper;
-import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
-import org.collectionspace.services.common.api.Tools;
-import org.collectionspace.services.common.config.ServiceConfigUtils;
-import org.collectionspace.services.common.context.AbstractServiceContextImpl;
-import org.collectionspace.services.common.context.ServiceContext;
-import org.collectionspace.services.common.document.DocumentException;
-import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.query.QueryContext;
-import org.collectionspace.services.common.relation.nuxeo.RelationsUtils;
-import org.collectionspace.services.config.service.DocHandlerParams;
-import org.collectionspace.services.config.service.ListResultField;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.nuxeo.client.java.CommonList;
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class is generified by the marker type T,
- * where T is expected to map to something like BlobCommon, MediaCommon, ObjectexitCommon, etc.,
- * and so on for every JAXB-generated schema class.
- *
- * User: laramie
- * $LastChangedRevision:  $
- * $LastChangedDate:  $
- *
- */
-public abstract class DocHandlerBase<T> extends RemoteDocumentModelHandlerImpl<T, AbstractCommonList> {
-
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    private AbstractCommonList commonList;
-    
-    protected static final int NUM_STANDARD_LIST_RESULT_FIELDS = 5;
-    protected static final String STANDARD_LIST_CSID_FIELD = "csid";
-    protected static final String STANDARD_LIST_URI_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_URI;
-    protected static final String STANDARD_LIST_REFNAME_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME;
-    protected static final String STANDARD_LIST_UPDATED_AT_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT;
-    protected static final String STANDARD_LIST_WORKFLOW_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE;
-    protected static final String STANDARD_LIST_MARK_RT_FIELD = "related";
-
-    @Override
-    public AbstractCommonList getCommonPartList() {
-        return commonList;
-    }
-
-    @Override
-       public void setCommonPartList(AbstractCommonList aCommonList) {
-        this.commonList = aCommonList;
-    }
-
-    private T commonPart;
-
-    @Override
-    public T getCommonPart() {
-        return (T)commonPart;
-    }
-
-    @Override
-       public void setCommonPart(T commonPart) {
-        this.commonPart = commonPart;
-    }
-
-
-    /** Subclass DocHandlers may override this method to control exact creation of the common list.
-     *  This class instantiates an AbstractCommonList from the classname returned by getDocHandlerParams().AbstractCommonListClassname.
-     * @return
-     * @throws Exception
-     */
-    public AbstractCommonList createAbstractCommonListImpl() throws Exception {
-        //  String classname = this.commonList.getClass().getName();
-       ServiceContext ctx = this.getServiceContext();
-        String classname = ServiceConfigUtils.getDocHandlerParams(ctx).getAbstractCommonListClassname();
-        if (classname == null){
-            throw new Exception("in createAbstractCommonListImpl. getDocHandlerParams().getAbstractCommonListClassname() is null");
-        }
-        classname = classname.trim();
-        return (AbstractCommonList)(ReflectionMapper.instantiate(classname));
-    }
-
-
-    /** DocHandlerBase calls this method with the CSID as id */
-    public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
-       ServiceContext ctx = this.getServiceContext();
-        return createItemForCommonList(ServiceConfigUtils.getDocHandlerParams(ctx).getCommonListItemClassname(),
-                       docModel, label, id, true);
-    }
-
-    public String getSummaryFields(AbstractCommonList theCommonList) throws DocumentException {
-       ServiceContext ctx = this.getServiceContext();
-        return ServiceConfigUtils.getDocHandlerParams(ctx).getSummaryFields();
-    }
-
-    public void setListItemArrayExtended(boolean isExtended) throws DocumentException {
-       ServiceContext ctx = this.getServiceContext();
-       ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsFields().setExtended(isExtended);
-    }
-    
-    public boolean isListItemArrayExtended() throws DocumentException {
-       ServiceContext ctx = this.getServiceContext();
-               return ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsFields().isExtended();
-    }
-    
-    public List<ListResultField> getListItemsArray() throws DocumentException {
-       ServiceContext ctx = this.getServiceContext();
-        return ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsFields().getListResultField();
-    }
-
-    @Override
-    public T extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-       @Override
-       public void fillCommonPart(T objectexitObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-       protected static String getRefname(DocumentModel docModel) throws Exception {
-               String result = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
-                               CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME);
-               return result;
-       }
-       
-       public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {
-                       GregorianCalendar cal = (GregorianCalendar)
-                                                               docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
-                                                                               CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT);
-                       String updatedAt = GregorianCalendarDateTimeUtils.formatAsISO8601Timestamp(cal);
-                       return updatedAt;
-       }
-
-    @Override
-    public AbstractCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-       CommonList commonList = new CommonList();
-        String markRtSbj = null;
-        RepositoryInstanceInterface repoSession = null;
-       RepositoryJavaClientImpl repoClient = null;
-       RepositoryJavaClientImpl nuxeoRepoClient = null;
-       boolean releaseRepoSession = false;
-       
-       AbstractServiceContextImpl sc = (AbstractServiceContextImpl)getServiceContext();
-       MultivaluedMap<String, String> queryParams = getServiceContext().getQueryParams();
-       markRtSbj = queryParams.getFirst(IQueryManager.MARK_RELATED_TO_CSID_AS_SUBJECT);  // REM - We need to document what this query param is for -i.e., what's its purpose?
-       if(markRtSbj!=null && markRtSbj.isEmpty())
-               markRtSbj = null;
-  
-       try {
-            if(markRtSbj!=null) {
-                       repoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(sc);
-                   nuxeoRepoClient = (RepositoryJavaClientImpl) repoClient;
-                       repoSession = this.getRepositorySession();
-                       if (repoSession == null) {
-                               repoSession = repoClient.getRepositorySession(sc);
-                               releaseRepoSession = true;
-                       }
-            }
-            
-               String commonSchema = getServiceContext().getCommonPartLabel();
-               extractPagingInfo(commonList, wrapDoc);
-               List<ListResultField> resultsFields = getListItemsArray();
-               int nFields = resultsFields.size() + NUM_STANDARD_LIST_RESULT_FIELDS;
-               int baseFields = NUM_STANDARD_LIST_RESULT_FIELDS;
-               if(markRtSbj!=null) {
-                       nFields++;
-                       baseFields++;
-               }
-               String fields[] = new String[nFields]; // REM - Why can't this just be a static array defined once at the top?  Then there'd be no need for these hardcoded "[x]" statements and no need for NUM_STANDARD_LIST_RESULT_FIELDS constant as well. 
-               fields[0] = STANDARD_LIST_CSID_FIELD;
-               fields[1] = STANDARD_LIST_URI_FIELD;
-               fields[2] = STANDARD_LIST_REFNAME_FIELD;
-               fields[3] = STANDARD_LIST_UPDATED_AT_FIELD;
-               fields[4] = STANDARD_LIST_WORKFLOW_FIELD;
-               if(markRtSbj != null) {
-                   fields[5] = STANDARD_LIST_MARK_RT_FIELD;
-               }
-               for(int i = baseFields; i < nFields; i++) {
-                       ListResultField field = resultsFields.get(i - baseFields); 
-                       fields[i] = field.getElement();
-               }
-                       commonList.setFieldsReturned(fields);
-                       Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-                       HashMap<String, Object> item = new HashMap<String, Object>();
-                       while (iter.hasNext()) {
-                               DocumentModel docModel = iter.next();
-                               String id = NuxeoUtils.getCsid(docModel);
-                               item.put(STANDARD_LIST_CSID_FIELD, id);
-                               if (markRtSbj != null) {
-                                       String relationClause = RelationsUtils.buildWhereClause(
-                                                       markRtSbj, null, null, id, null);
-                                       String whereClause = relationClause
-                                                       + IQueryManager.SEARCH_QUALIFIER_AND
-                                                       + NuxeoUtils.buildWorkflowNotDeletedWhereClause();
-                                       QueryContext queryContext = new QueryContext(sc,
-                                                       whereClause);
-                                       queryContext.setDocType(IRelationsManager.DOC_TYPE);
-                                       String query = NuxeoUtils.buildNXQLQuery(sc, queryContext);
-                                       // Search for 1 relation that matches. 1 is enough to fail
-                                       // the filter
-                                       DocumentModelList docList = repoSession.query(query, null,
-                                                       1, 0, false);
-                                       item.put(STANDARD_LIST_MARK_RT_FIELD,
-                                                       docList.isEmpty() ? "false" : "true");
-                               }
-                               String uri = getUri(docModel);
-                               item.put(STANDARD_LIST_URI_FIELD, uri);
-                               item.put(STANDARD_LIST_REFNAME_FIELD, getRefname(docModel));
-                               item.put(STANDARD_LIST_UPDATED_AT_FIELD,
-                                               getUpdatedAtAsString(docModel));
-                               item.put(STANDARD_LIST_WORKFLOW_FIELD,
-                                               docModel.getCurrentLifeCycleState());
-
-                               for (ListResultField field : resultsFields) {
-                                       String schema = field.getSchema();
-                                       if (schema == null || schema.trim().isEmpty()) {
-                                               schema = commonSchema;
-                                       }
-                                       Object value = getListResultValue(docModel, schema, field);
-                                       if (value != null && value instanceof String) { // If it is String that is either null or empty, we set our value to null
-                                               String strValue = (String) value;
-                                               if (strValue.trim().isEmpty() == true) {
-                                                       value = null; // We found an "empty" string value, so just set the value to null so we don't return anything.
-                                               }
-                                       }
-                                       if (value != null) {
-                                               item.put(field.getElement(), value);
-                                       }
-                               }
-                               commonList.addItem(item);
-                               item.clear();
-                       }
-       } catch (Exception e) {
-               if (logger.isDebugEnabled()) {
-                       logger.debug("Caught exception ", e);
-               }
-               throw new DocumentException(e);
-               } finally {
-                       // If we got/aquired a new session then we're responsible for releasing it.
-                       if (releaseRepoSession && repoSession != null) {
-                               repoClient.releaseRepositorySession(sc, repoSession);
-                       }
-       }
-
-       return commonList;
-    }
-
-    // TODO - get rid of this if we can - appears to be unused.
-    @Override
-    public String getQProperty(String prop) throws DocumentException {
-       ServiceContext ctx = this.getServiceContext();
-        return ServiceConfigUtils.getDocHandlerParams(ctx).getSchemaName() + ":" + prop;
-    }
-
-    //============= dublin core handling =======================================
-
-    @Override
-    public void fillAllParts(DocumentWrapper<DocumentModel> wrapDoc, Action action) throws Exception {
-        super.fillAllParts(wrapDoc, action);
-        fillDublinCoreObject(wrapDoc);
-    }
-
-    /**
-     * Fill dublin core object, but only if there are document handler parameters in the service
-     * bindings.
-     *
-     * @param wrapDoc the wrap doc
-     * @throws Exception the exception
-     */
-    // TODO - Remove this? 
-    // This look like it is never used in a sensible way. It just stuffs a static
-    // String that matches the service name into a bogus field.
-    protected void fillDublinCoreObject(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-       DocHandlerParams.Params docHandlerParams = null;
-       try {
-               docHandlerParams = ServiceConfigUtils.getDocHandlerParams(getServiceContext());
-       } catch (Exception e) {
-               logger.warn(e.getMessage());
-       }
-       
-       if (docHandlerParams != null) {
-               String title = docHandlerParams.getDublinCoreTitle();
-               if (Tools.isEmpty(title) == false){
-                       DocumentModel docModel = wrapDoc.getWrappedObject();
-                       docModel.setPropertyValue("dublincore:title", title);
-               }
-       }
-    }
-
-    //================== UTILITY METHODS ================================================
-    public static ReflectionMapper.STATUS callPropertySetterWithXPathValue(DocumentModel docModel,
-                           Object listItem,
-                           String setterName,
-                           String schema,
-                           String xpath)
-                           throws Exception {
-        //Object prop = docModel.getProperty(label, elementName);
-        String value = (String)NuxeoUtils.getXPathValue(docModel, schema, xpath);
-        return ReflectionMapper.callSetter(listItem, setterName, value);
-    }
-
-    public static ReflectionMapper.STATUS callSimplePropertySetter(Object target, String name, Object arg) {
-        return ReflectionMapper.callSetter(target, name, arg);
-    }
-
-    /**   @param commonListClassname is a package-qualified java classname, including inner class $ notation, such as
-     *                             "org.collectionspace.services.objectexit.ObjectexitCommonList$ObjectexitListItem".
-     *    @param includeStdFields set to true to have the method set Uri and Csid automatically, based on id param.
-     */
-    public Object createItemForCommonList(String commonListClassname, DocumentModel docModel, 
-               String schema, String id, boolean includeStdFields) throws Exception {
-        //createItemForCommonList(docModel, label, id);
-        Object item = ReflectionMapper.instantiate(commonListClassname);
-        List<ListResultField> resultsFields = getListItemsArray();
-        for (ListResultField field : resultsFields ){
-               callPropertySetterWithXPathValue(docModel, item, 
-                               field.getSetter(), schema, field.getXpath());
-        }
-        if (includeStdFields){
-               callSimplePropertySetter(item, "setCsid", id);
-               callSimplePropertySetter(item, "setUri", getServiceContextPath() + id);
-        }
-        return item;
-    }
-
-    /** Subclasses should override this method if they don't want to automatically
-     *  call List createItemsList(AbstractCommonList commonList, String listItemMethodName)
-     *  which will use introspection to create a summary list, and will find the primary
-     *  field for you if specified.
-     */
-    public List createItemsList(AbstractCommonList commonList) throws Exception {
-       ServiceContext ctx = this.getServiceContext();
-        return createItemsList(commonList, 
-                       ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsItemMethodName());
-    }
-
-    /** e.g. createItemsList(commonList, "getObjectexitListItem" */
-    public List createItemsList(AbstractCommonList commonList, String listItemMethodName) throws Exception {
-        Class commonListClass = commonList.getClass();
-        Class[] types = new Class[] {};
-        try {
-            Method m = commonListClass.getMethod(listItemMethodName, types);
-            return (List)(ReflectionMapper.fireGetMethod(m, commonList));
-        } catch (NoSuchMethodException nsm){
-            return new ArrayList();
-        }
-    }
-
-
-
-}
-
index b42d52895bbce13a2bbae639a43fe52b14bf1216..14977bac49a5f85e8532d1b23ffcc4c0701f144d 100644 (file)
@@ -29,6 +29,7 @@ import java.util.List;
 import javax.ws.rs.core.MultivaluedMap;
 
 import org.apache.commons.lang.StringUtils;
+
 import org.collectionspace.services.client.Profiler;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.IQueryManager;
@@ -58,13 +59,14 @@ import org.collectionspace.services.lifecycle.StateList;
 import org.collectionspace.services.lifecycle.TransitionDef;
 import org.collectionspace.services.lifecycle.TransitionDefList;
 import org.collectionspace.services.lifecycle.TransitionList;
+
 import org.nuxeo.ecm.core.NXCore;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.nuxeo.ecm.core.lifecycle.LifeCycleService;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -79,7 +81,7 @@ public abstract class DocumentModelHandler<T, TL>
         extends AbstractMultipartDocumentHandlerImpl<T, TL, DocumentModel, DocumentModelList> {
 
     private final Logger logger = LoggerFactory.getLogger(DocumentModelHandler.class);
-    private RepositoryInstanceInterface repositorySession;
+    private CoreSessionInterface repositorySession;
 
     protected String oldRefNameOnUpdate = null;  // FIXME: REM - We should have setters and getters for these
     protected String newRefNameOnUpdate = null;  // FIXME: two fields.
@@ -205,7 +207,8 @@ public abstract class DocumentModelHandler<T, TL>
     }
         
     public RepositoryClient<PoxPayloadIn, PoxPayloadOut> getRepositoryClient(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
-        RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient = RepositoryClientFactory.getInstance().getClient(ctx.getRepositoryClientName());
+        RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient = 
+                       (RepositoryClient<PoxPayloadIn, PoxPayloadOut>) RepositoryClientFactory.getInstance().getClient(ctx.getRepositoryClientName());
         return repositoryClient;
     }
 
@@ -213,7 +216,7 @@ public abstract class DocumentModelHandler<T, TL>
      * getRepositorySession returns Nuxeo Repository Session
      * @return
      */
-    public RepositoryInstanceInterface getRepositorySession() {
+    public CoreSessionInterface getRepositorySession() {
        
         return repositorySession;
     }
@@ -222,7 +225,7 @@ public abstract class DocumentModelHandler<T, TL>
      * setRepositorySession sets repository session
      * @param repoSession
      */
-    public void setRepositorySession(RepositoryInstanceInterface repoSession) {
+    public void setRepositorySession(CoreSessionInterface repoSession) {
         this.repositorySession = repoSession;
     }
 
@@ -410,7 +413,7 @@ public abstract class DocumentModelHandler<T, TL>
        return result;
     }
     
-    protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws ClientException {
+    protected void handleRefNameChanges(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, DocumentModel docModel) throws ClientException {
        // First get the old refName
        this.oldRefNameOnUpdate = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
                        CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME);
index 7dbd1b9fad1594460435b8ce25d57d96c11cd184..0547e446b75549fc4de0706c39272755e7ec13d0 100644 (file)
@@ -23,16 +23,17 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map.Entry;
+import java.security.Principal;
 
 import org.collectionspace.services.common.repository.RepositoryInstanceWrapperAdvice;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
-import org.jboss.remoting.InvokerLocator;
+
 import org.nuxeo.ecm.core.api.repository.Repository;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler;
+import org.nuxeo.ecm.core.api.CoreInstance;
+import org.nuxeo.ecm.core.api.CoreSession;
+import org.nuxeo.ecm.core.api.NuxeoPrincipal;
+import org.nuxeo.ecm.core.api.SystemPrincipal;
 import org.nuxeo.ecm.core.api.repository.RepositoryManager;
-import org.nuxeo.ecm.core.client.DefaultLoginHandler;
-import org.nuxeo.ecm.core.client.LoginHandler;
 import org.nuxeo.runtime.api.Framework;
 import org.nuxeo.runtime.transaction.TransactionHelper;
 
@@ -50,11 +51,7 @@ public final class NuxeoClientEmbedded {
 
        private Logger logger = LoggerFactory.getLogger(NuxeoClientEmbedded.class);
        
-    private LoginHandler loginHandler;
-
-    private final HashMap<String, RepositoryInstanceInterface> repositoryInstances;
-
-    private InvokerLocator locator;
+    private final HashMap<String, CoreSessionInterface> repositoryInstances;
 
     private RepositoryManager repositoryMgr;
 
@@ -65,9 +62,7 @@ public final class NuxeoClientEmbedded {
      * of this constructor is recommended.
      */
     private NuxeoClientEmbedded() {
-        loginHandler = loginHandler == null ? new DefaultLoginHandler()
-                : loginHandler;
-        repositoryInstances = new HashMap<String, RepositoryInstanceInterface>();
+        repositoryInstances = new HashMap<String, CoreSessionInterface>();
     }
     
     public static NuxeoClientEmbedded getInstance() {
@@ -75,18 +70,14 @@ public final class NuxeoClientEmbedded {
     }
 
     public synchronized void tryDisconnect() throws Exception {
-        if (locator == null) {
-            return; // do nothing
-        }
         doDisconnect();
     }
 
     private void doDisconnect() throws Exception {
-        locator = null;
-        // close repository sessions if any
-        Iterator<Entry<String, RepositoryInstanceInterface>> it = repositoryInstances.entrySet().iterator();
+        // close the open Nuxeo repository sessions if any
+        Iterator<Entry<String, CoreSessionInterface>> it = repositoryInstances.entrySet().iterator();
         while (it.hasNext()) {
-            Entry<String, RepositoryInstanceInterface> repo = it.next();
+            Entry<String, CoreSessionInterface> repo = it.next();
             try {
                 repo.getValue().close();
             } catch (Exception e) {
@@ -98,22 +89,6 @@ public final class NuxeoClientEmbedded {
         repositoryMgr = null;
     }
 
-    public synchronized boolean isConnected() {
-        return true;
-    }
-
-    public InvokerLocator getLocator() {
-        return locator;
-    }
-
-    public synchronized LoginHandler getLoginHandler() {
-        return loginHandler;
-    }
-
-    public synchronized void setLoginHandler(LoginHandler loginHandler) {
-        this.loginHandler = loginHandler;
-    }
-
     public RepositoryManager getRepositoryManager() throws Exception {
         if (repositoryMgr == null) {
             repositoryMgr = Framework.getService(RepositoryManager.class);
@@ -142,19 +117,19 @@ public final class NuxeoClientEmbedded {
     /*
      * Open a Nuxeo repo session using the passed in repoDomain and use the default tx timeout period
      */
-    public RepositoryInstanceInterface openRepository(RepositoryDomainType repoDomain) throws Exception {
+    public CoreSessionInterface openRepository(RepositoryDomainType repoDomain) throws Exception {
         return openRepository(repoDomain.getRepositoryName(), -1);
     }
     
     /*
      * Open a Nuxeo repo session using the passed in repoDomain and use the default tx timeout period
      */
-    public RepositoryInstanceInterface openRepository(String repoName) throws Exception {
+    public CoreSessionInterface openRepository(String repoName) throws Exception {
         return openRepository(repoName, -1);
     }    
 
-    public RepositoryInstanceInterface openRepository(String repoName, int timeoutSeconds) throws Exception {
-       RepositoryInstanceInterface result = null;
+    public CoreSessionInterface openRepository(String repoName, int timeoutSeconds) throws Exception {
+       CoreSessionInterface result = null;
        
        //
        // If the called passed in a custom timeout setting, use it to configure Nuxeo's transaction manager.
@@ -200,7 +175,7 @@ public final class NuxeoClientEmbedded {
         // Nuxeo repository so we can check for network related failures and perform a series of retries.
         //
         if (repository != null) {
-            result = getRepositoryInstanceWrapper(repository);
+            result = getCoreSessionWrapper(repository);
                logger.trace(String.format("A new transaction was started on thread '%d' : %s.",
                                Thread.currentThread().getId(), startedTransaction ? "true" : "false"));
                logger.trace(String.format("Added a new repository instance to our repo list.  Current count is now: %d",
@@ -220,39 +195,45 @@ public final class NuxeoClientEmbedded {
     // wrap each call to the Nuxeo repo with code that catches network related errors/exceptions and
     // re-attempts the calls to see if it recovers.
     //
-    private RepositoryInstanceInterface getAOPProxy(RepositoryInstance repositoryInstance) {
-       RepositoryInstanceInterface result = null;
+    private CoreSessionInterface getAOPProxy(CoreSession repositoryInstance) {
+       CoreSessionInterface result = null;
        
        try {
-                       ProxyFactory factory = new ProxyFactory(new RepositoryInstanceWrapper(repositoryInstance));
+                       ProxyFactory factory = new ProxyFactory(new CoreSessionWrapper(repositoryInstance));
                        factory.addAdvice(new RepositoryInstanceWrapperAdvice());
                        factory.setExposeProxy(true);
-                       result = (RepositoryInstanceInterface)factory.getProxy();
+                       result = (CoreSessionInterface)factory.getProxy();
        } catch (Exception e) {
-               logger.error("Could not create AOP proxy for: " + RepositoryInstanceWrapper.class.getName(), e);
+               logger.error("Could not create AOP proxy for: " + CoreSessionWrapper.class.getName(), e);
        }
        
        return result;
     }
     
+       private Principal getSystemPrincipal() {
+               NuxeoPrincipal principal = new SystemPrincipal(null);
+               return principal;
+       }
+
     /*
      * From the Repository object (a description of the repository), get repository instance wrapper.  Our wrapper
      * will using the Spring AOP mechanism to intercept all calls to the repository.  We will wrap all the calls to the
      * Nuxeo repository and check for network related failures.  We will retry all calls to the Nuxeo repo that fail because
      * of network erros.
      */
-    private RepositoryInstanceInterface getRepositoryInstanceWrapper(Repository repository) throws Exception {
-       RepositoryInstanceInterface result = null;
+    private CoreSessionInterface getCoreSessionWrapper(Repository repository) throws Exception {
+       CoreSessionInterface result = null;
                
-       RepositoryInstance repositoryInstance = new RepositoryInstanceHandler(repository).getProxy();  // A Nuxeo repo instance handler proxy
-        if (repositoryInstance != null) {
-               result = this.getAOPProxy(repositoryInstance);  // This is our AOP proxy
+       CoreSession coreSession  = CoreInstance.openCoreSession(repository.getName(), getSystemPrincipal());  // A Nuxeo repo instance handler proxy
+       
+        if (coreSession != null) {
+               result = this.getAOPProxy(coreSession);  // This is our AOP proxy
                if (result != null) {
                        String key = result.getSessionId();
                        repositoryInstances.put(key, result);
                } else {
                        String errMsg = String.format("Could not instantiate a Spring AOP proxy for class '%s'.",
-                                       RepositoryInstanceWrapper.class.getName());
+                                       CoreSessionWrapper.class.getName());
                        logger.error(errMsg);
                        throw new Exception(errMsg);
                }
@@ -265,17 +246,20 @@ public final class NuxeoClientEmbedded {
        return result;
     }
 
-    public void releaseRepository(RepositoryInstanceInterface repo) throws Exception {
-       String key = repo.getSessionId();
+    public void releaseRepository(CoreSessionInterface repoSession) throws Exception {
+       String key = repoSession.getSessionId();
+       String name = repoSession.getRepositoryName();
 
         try {
-               repo.save();
-            repo.close();
+               repoSession.save();
+               repoSession.close();
         } catch (Exception e) {
-               logger.error("Possible data loss.  Could not save and/or release the repository.", e);
+               String errMsg = String.format("Possible data loss.  Could not save and/or close the Nuxeo repository name = '%s'.",
+                               name);
+               logger.error(errMsg, e);
                throw e;
         } finally {
-            RepositoryInstanceInterface wasRemoved = repositoryInstances.remove(key);
+               CoreSessionInterface wasRemoved = repositoryInstances.remove(key);
             if (logger.isTraceEnabled()) {
                if (wasRemoved != null) {
                        logger.trace("Removed a repository instance from our repo list.  Current count is now: "
index 06900aad59087abb90159b66e4118282947646d3..82a0eae0e68898ff6d33a2a7fdbb5579a1835669 100644 (file)
@@ -14,13 +14,12 @@ import org.collectionspace.services.config.RepositoryClientConfigType;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 
-import org.nuxeo.ecm.core.NXCore;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.nuxeo.ecm.core.api.repository.RepositoryManager;
 import org.nuxeo.ecm.core.model.Repository;
 import org.nuxeo.osgi.application.FrameworkBootstrap;
-import org.nuxeo.ecm.core.repository.RepositoryDescriptor;
-import org.nuxeo.ecm.core.repository.RepositoryFactory;
+import org.nuxeo.runtime.api.Framework;
 import org.nuxeo.ecm.core.storage.sql.ra.ConnectionFactoryImpl;
 import org.nuxeo.ecm.core.storage.sql.ra.ManagedConnectionFactoryImpl;
 
@@ -38,19 +37,19 @@ public class NuxeoConnectorEmbedded {
        public final static String NUXEO_SERVER_DIR = JEEServerDeployment.NUXEO_SERVER_DIR;
        private final static String ERROR_CONNECTOR_NOT_INITIALIZED = "NuxeoConnector is not initialized!";
                
-       private final static String CSPACE_JEESERVER_HOME = "CSPACE_CONTAINER";
        private final static String CSPACE_NUXEO_HOME = "CSPACE_NUXEO_HOME";
        
        private static final NuxeoConnectorEmbedded self = new NuxeoConnectorEmbedded();
        private NuxeoClientEmbedded client;
-       private ServletContext servletContext = null;
        private volatile boolean initialized = false; // use volatile for lazy
                                                                                                        // initialization in
                                                                                                        // singleton
-       private RepositoryClientConfigType repositoryClientConfig;
        public FrameworkBootstrap fb;
+       private ServletContext servletContext;
+       private RepositoryClientConfigType repositoryClientConfig;
 
        private NuxeoConnectorEmbedded() {
+               // empty constructor
        }
 
        public final static NuxeoConnectorEmbedded getInstance() {
@@ -152,15 +151,20 @@ public class NuxeoConnectorEmbedded {
                }
        }
        
+       /*
+        * This is a debug-only method.  Use to look at runtime values of Nuxeo internal
+        * data structures.
+        */
        public String getDatabaseName(String repoName) {
                String result = null;
-               
-               try {
-                       this.getRepositoryDescriptor(repoName);
-               } catch (Exception e1) {
-                       // TODO Auto-generated catch block
-                       e1.printStackTrace();
-               }
+
+// TODO: Remove after CSPACE-6375 issue is resolved.
+//             try {
+//                     List<RepositoryDescriptor> repositoryDescriptorList = this.getRepositoryDescriptor(repoName);
+//             } catch (Exception e1) {
+//                     // TODO Auto-generated catch block
+//                     e1.printStackTrace();
+//             }
                
                Repository repository = null;
                try {
@@ -172,7 +176,7 @@ public class NuxeoConnectorEmbedded {
                
                ConnectionFactoryImpl connectionFactory = (ConnectionFactoryImpl)repository;
                ManagedConnectionFactoryImpl managedConnectionFactory = connectionFactory.getManagedConnectionFactory();
-               String serverUrl = managedConnectionFactory.getServerURL();
+               String property = managedConnectionFactory.getProperty();
                
                return result;
        }
@@ -183,7 +187,7 @@ public class NuxeoConnectorEmbedded {
         * @param repoSession
         * @throws java.lang.Exception
         */
-       public void releaseRepositorySession(RepositoryInstanceInterface repoSession)
+       public void releaseRepositorySession(CoreSessionInterface repoSession)
                        throws Exception {
                if (repoSession != null) {
                        getClient().releaseRepository(repoSession);
@@ -200,8 +204,8 @@ public class NuxeoConnectorEmbedded {
         * @return RepositoryInstance
         * @throws java.lang.Exception
         */
-       public RepositoryInstanceInterface getRepositorySession(RepositoryDomainType repoDomain) throws Exception {
-               RepositoryInstanceInterface repoSession = getClient().openRepository(repoDomain);
+       public CoreSessionInterface getRepositorySession(RepositoryDomainType repoDomain) throws Exception {
+               CoreSessionInterface repoSession = getClient().openRepository(repoDomain);
                
                if (logger.isDebugEnabled() && repoSession != null) {
                        logger.debug("getRepositorySession() opened repository session");
@@ -214,37 +218,42 @@ public class NuxeoConnectorEmbedded {
 
     public Repository lookupRepository(String name) throws Exception {
         Repository repo;
+               RepositoryManager repositoryManager = Framework.getService(RepositoryManager.class);
+
         try {
             // needed by glassfish
-            repo = (Repository) new InitialContext().lookup("NXRepository/"
-                    + name);
+            repo = (Repository) new InitialContext().lookup("NXRepository/" + name);
         } catch (NamingException e) {
             try {
                 // needed by jboss
                 repo = (Repository) new InitialContext().lookup("java:NXRepository/"
                         + name);
             } catch (NamingException ee) {
-                repo = (Repository) NXCore.getRepositoryService().getRepositoryManager().getRepository(
+                repo = (Repository) repositoryManager.getRepository(
                         name);
             }
         }
+        
         if (repo == null) {
             throw new IllegalArgumentException("Repository not found: " + name);
         }
+        
         return repo;
     }
     
-    public RepositoryDescriptor getRepositoryDescriptor(String name) throws Exception {
-       RepositoryDescriptor repo = null;
-        Iterable<RepositoryDescriptor> descriptorsList = NXCore.getRepositoryService().getRepositoryManager().getDescriptors();
-        for (RepositoryDescriptor descriptor : descriptorsList) {
-               String homeDir = descriptor.getHomeDirectory();
-               String config = descriptor.getConfigurationFile();
-               RepositoryFactory factor = descriptor.getFactory();
-        }
-
-        return repo;
-    }
+// TODO: Remove after CSPACE-6375 issue is resolved.
+//    public List<RepositoryDescriptor> getRepositoryDescriptor(String name) throws Exception {
+//     RepositoryDescriptor repo = null;
+//             RepositoryManager repositoryManager = Framework.getService(RepositoryManager.class);
+//        Iterable<RepositoryDescriptor> descriptorsList = repositoryManager.getDescriptors();
+//        for (RepositoryDescriptor descriptor : descriptorsList) {
+//             String homeDir = descriptor.getHomeDirectory();
+//             String config = descriptor.getConfigurationFile();
+//             RepositoryFactory factor = descriptor.getFactory();
+//        }
+//
+//        return repo;
+//    }
        
        /**
         * getClient get Nuxeo client for accessing Nuxeo services remotely using
@@ -255,9 +264,7 @@ public class NuxeoConnectorEmbedded {
         */
        public NuxeoClientEmbedded getClient() throws Exception {
                if (initialized == true) {
-                       if (client.isConnected()) {
-                               return client;
-                       }
+                       return client;
                }
                //
                // Nuxeo connection was not initialized
@@ -288,7 +295,7 @@ public class NuxeoConnectorEmbedded {
         */
        public Hashtable<String, String> retrieveWorkspaceIds(RepositoryDomainType repoDomain)
                        throws Exception {
-               RepositoryInstanceInterface repoSession = null;
+               CoreSessionInterface repoSession = null;
                Hashtable<String, String> workspaceIds = new Hashtable<String, String>();
                try {
                        repoSession = getRepositorySession(repoDomain);
diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..830814d
--- /dev/null
@@ -0,0 +1,391 @@
+/**
+ *  This document is a part of the source code and related artifacts
+ *  for CollectionSpace, an open source collections management system
+ *  for museums and related institutions:
+
+ *  http://www.collectionspace.org
+ *  http://wiki.collectionspace.org
+
+ *  Copyright 2009 University of California at Berkeley
+
+ *  Licensed under the Educational Community License (ECL), Version 2.0.
+ *  You may not use this file except in compliance with this License.
+
+ *  You may obtain a copy of the ECL 2.0 License at
+
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.collectionspace.services.nuxeo.client.java;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.IQueryManager;
+import org.collectionspace.services.client.IRelationsManager;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.ReflectionMapper;
+import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
+import org.collectionspace.services.common.api.Tools;
+import org.collectionspace.services.common.config.ServiceConfigUtils;
+import org.collectionspace.services.common.context.AbstractServiceContextImpl;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentException;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.query.QueryContext;
+import org.collectionspace.services.common.relation.nuxeo.RelationsUtils;
+import org.collectionspace.services.config.service.DocHandlerParams;
+import org.collectionspace.services.config.service.ListResultField;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.nuxeo.client.java.CommonList;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is generified by the marker type T,
+ * where T is expected to map to something like BlobCommon, MediaCommon, ObjectexitCommon, etc.,
+ * and so on for every JAXB-generated schema class.
+ *
+ * User: laramie
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ */
+public abstract class NuxeoDocumentModelHandler<T> extends RemoteDocumentModelHandlerImpl<T, AbstractCommonList> {
+
+       /** The logger. */
+       private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+       private AbstractCommonList commonList;
+
+       protected static final int NUM_STANDARD_LIST_RESULT_FIELDS = 5;
+       protected static final String STANDARD_LIST_CSID_FIELD = "csid";
+       protected static final String STANDARD_LIST_URI_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_URI;
+       protected static final String STANDARD_LIST_REFNAME_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME;
+       protected static final String STANDARD_LIST_UPDATED_AT_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT;
+       protected static final String STANDARD_LIST_WORKFLOW_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE;
+       protected static final String STANDARD_LIST_MARK_RT_FIELD = "related";
+
+       @Override
+       public AbstractCommonList getCommonPartList() {
+               return commonList;
+       }
+
+       @Override
+       public void setCommonPartList(AbstractCommonList aCommonList) {
+               this.commonList = aCommonList;
+       }
+
+       private T commonPart;
+
+       @Override
+       public T getCommonPart() {
+               return (T) commonPart;
+       }
+
+       @Override
+       public void setCommonPart(T commonPart) {
+               this.commonPart = commonPart;
+       }
+
+       /**
+        * Subclass DocHandlers may override this method to control exact creation of the common list.
+        * This class instantiates an AbstractCommonList from the classname returned by getDocHandlerParams().AbstractCommonListClassname.
+        * 
+        * @return
+        * @throws Exception
+        */
+       public AbstractCommonList createAbstractCommonListImpl() throws Exception {
+               // String classname = this.commonList.getClass().getName();
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               String classname = ServiceConfigUtils.getDocHandlerParams(ctx).getAbstractCommonListClassname();
+               if (classname == null) {
+                       throw new Exception(
+                                       "in createAbstractCommonListImpl. getDocHandlerParams().getAbstractCommonListClassname() is null");
+               }
+               classname = classname.trim();
+               return (AbstractCommonList) (ReflectionMapper.instantiate(classname));
+       }
+
+       /** DocHandlerBase calls this method with the CSID as id */
+       public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               return createItemForCommonList(ServiceConfigUtils.getDocHandlerParams(ctx).getCommonListItemClassname(),
+                               docModel, label, id, true);
+       }
+
+       public String getSummaryFields(AbstractCommonList theCommonList) throws DocumentException {
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               return ServiceConfigUtils.getDocHandlerParams(ctx).getSummaryFields();
+       }
+
+       public void setListItemArrayExtended(boolean isExtended) throws DocumentException {
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsFields().setExtended(isExtended);
+       }
+
+       public boolean isListItemArrayExtended() throws DocumentException {
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               return ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsFields().isExtended();
+       }
+
+       public List<ListResultField> getListItemsArray() throws DocumentException {
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               return ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsFields().getListResultField();
+       }
+
+       @Override
+       public T extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+               throw new UnsupportedOperationException();
+       }
+
+       @Override
+       public void fillCommonPart(T objectexitObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+               throw new UnsupportedOperationException();
+       }
+
+       protected static String getRefname(DocumentModel docModel) throws Exception {
+               String result = (String) docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
+                               CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME);
+               return result;
+       }
+
+       public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {
+               GregorianCalendar cal = (GregorianCalendar) docModel.getProperty(
+                               CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
+                               CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT);
+               String updatedAt = GregorianCalendarDateTimeUtils.formatAsISO8601Timestamp(cal);
+               return updatedAt;
+       }
+
+       @Override
+       public AbstractCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
+               CommonList commonList = new CommonList();
+               String markRtSbj = null;
+               CoreSessionInterface repoSession = null;
+               RepositoryJavaClientImpl repoClient = null;
+               boolean releaseRepoSession = false;
+
+               AbstractServiceContextImpl ctx = (AbstractServiceContextImpl) getServiceContext();
+               MultivaluedMap<String, String> queryParams = getServiceContext().getQueryParams();
+               markRtSbj = queryParams.getFirst(IQueryManager.MARK_RELATED_TO_CSID_AS_SUBJECT);
+               if (markRtSbj != null && markRtSbj.isEmpty())
+                       markRtSbj = null;
+
+               try {
+                       if (markRtSbj != null) {
+                               repoClient = (RepositoryJavaClientImpl) this.getRepositoryClient(ctx);
+                               RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl) repoClient;
+                               repoSession = this.getRepositorySession();
+                               if (repoSession == null) {
+                                       repoSession = repoClient.getRepositorySession(ctx);
+                                       releaseRepoSession = true;
+                               }
+                       }
+
+                       String commonSchema = getServiceContext().getCommonPartLabel();
+                       extractPagingInfo(commonList, wrapDoc);
+                       List<ListResultField> resultsFields = getListItemsArray();
+                       int nFields = resultsFields.size() + NUM_STANDARD_LIST_RESULT_FIELDS;
+                       int baseFields = NUM_STANDARD_LIST_RESULT_FIELDS;
+                       if (markRtSbj != null) {
+                               nFields++;
+                               baseFields++;
+                       }
+                       
+                       String fields[] = new String[nFields]; // REM - Why can't this just be a static array defined once at the top? Then there'd be no need for these hardcoded "[x]" statements and no need for NUM_STANDARD_LIST_RESULT_FIELDS constant as well.
+                       fields[0] = STANDARD_LIST_CSID_FIELD;
+                       fields[1] = STANDARD_LIST_URI_FIELD;
+                       fields[2] = STANDARD_LIST_REFNAME_FIELD;
+                       fields[3] = STANDARD_LIST_UPDATED_AT_FIELD;
+                       fields[4] = STANDARD_LIST_WORKFLOW_FIELD;
+                       
+                       if (markRtSbj != null) {
+                               fields[5] = STANDARD_LIST_MARK_RT_FIELD;
+                       }
+                       
+                       for (int i = baseFields; i < nFields; i++) {
+                               ListResultField field = resultsFields.get(i - baseFields);
+                               fields[i] = field.getElement();
+                       }
+                       commonList.setFieldsReturned(fields);
+                       Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
+                       HashMap<String, Object> item = new HashMap<String, Object>();
+                       while (iter.hasNext()) {
+                               DocumentModel docModel = iter.next();
+                               String id = NuxeoUtils.getCsid(docModel);
+                               item.put(STANDARD_LIST_CSID_FIELD, id);
+                               if (markRtSbj != null) {
+                                       String relationClause = RelationsUtils.buildWhereClause(markRtSbj, null, null, id, null);
+                                       String whereClause = relationClause + IQueryManager.SEARCH_QUALIFIER_AND
+                                                       + NuxeoUtils.buildWorkflowNotDeletedWhereClause();
+                                       QueryContext queryContext = new QueryContext(ctx, whereClause);
+                                       queryContext.setDocType(IRelationsManager.DOC_TYPE);
+                                       String query = NuxeoUtils.buildNXQLQuery(ctx, queryContext);
+                                       // Search for 1 relation that matches. 1 is enough to fail
+                                       // the filter
+                                       DocumentModelList docList = repoSession.query(query, null, 1, 0, false);
+                                       item.put(STANDARD_LIST_MARK_RT_FIELD, docList.isEmpty() ? "false" : "true");
+                               }
+                               String uri = getUri(docModel);
+                               item.put(STANDARD_LIST_URI_FIELD, uri);
+                               item.put(STANDARD_LIST_REFNAME_FIELD, getRefname(docModel));
+                               item.put(STANDARD_LIST_UPDATED_AT_FIELD, getUpdatedAtAsString(docModel));
+                               item.put(STANDARD_LIST_WORKFLOW_FIELD, docModel.getCurrentLifeCycleState());
+
+                               for (ListResultField field : resultsFields) {
+                                       String schema = field.getSchema();
+                                       if (schema == null || schema.trim().isEmpty()) {
+                                               schema = commonSchema;
+                                       }
+                                       Object value = getListResultValue(docModel, schema, field);
+                                       if (value != null && value instanceof String) { // If it is String that is either null or empty, we set our value to null
+                                               String strValue = (String) value;
+                                               if (strValue.trim().isEmpty() == true) {
+                                                       value = null; // We found an "empty" string value, so just set the value to null so we don't return anything.
+                                               }
+                                       }
+                                       if (value != null) {
+                                               item.put(field.getElement(), value);
+                                       }
+                               }
+                               commonList.addItem(item);
+                               item.clear();
+                       }
+               } catch (Exception e) {
+                       if (logger.isDebugEnabled()) {
+                               logger.debug("Caught exception ", e);
+                       }
+                       throw new DocumentException(e);
+               } finally {
+                       // If we got/aquired a new session then we're responsible for releasing it.
+                       if (releaseRepoSession && repoSession != null) {
+                               repoClient.releaseRepositorySession(ctx, repoSession);
+                       }
+               }
+
+               return commonList;
+       }
+
+       // TODO - get rid of this if we can - appears to be unused.
+       @Override
+       public String getQProperty(String prop) throws DocumentException {
+               ServiceContext ctx = this.getServiceContext();
+               return ServiceConfigUtils.getDocHandlerParams(ctx).getSchemaName() + ":" + prop;
+       }
+
+       // ============= dublin core handling =======================================
+
+       @Override
+       public void fillAllParts(DocumentWrapper<DocumentModel> wrapDoc, Action action) throws Exception {
+               super.fillAllParts(wrapDoc, action);
+               fillDublinCoreObject(wrapDoc);
+       }
+
+       /**
+        * Fill dublin core object, but only if there are document handler parameters in the service
+        * bindings.
+        *
+        * @param wrapDoc
+        *            the wrap doc
+        * @throws Exception
+        *             the exception
+        */
+       // TODO - Remove this?
+       // This look like it is never used in a sensible way. It just stuffs a static
+       // String that matches the service name into a bogus field.
+       protected void fillDublinCoreObject(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+               DocHandlerParams.Params docHandlerParams = null;
+               try {
+                       docHandlerParams = ServiceConfigUtils.getDocHandlerParams(getServiceContext());
+               } catch (Exception e) {
+                       logger.warn(e.getMessage());
+               }
+
+               if (docHandlerParams != null) {
+                       String title = docHandlerParams.getDublinCoreTitle();
+                       if (Tools.isEmpty(title) == false) {
+                               DocumentModel docModel = wrapDoc.getWrappedObject();
+                               docModel.setPropertyValue("dublincore:title", title);
+                       }
+               }
+       }
+
+       // ================== UTILITY METHODS ================================================
+       public static ReflectionMapper.STATUS callPropertySetterWithXPathValue(DocumentModel docModel, Object listItem,
+                       String setterName, String schema, String xpath) throws Exception {
+               // Object prop = docModel.getProperty(label, elementName);
+               String value = (String) NuxeoUtils.getXPathValue(docModel, schema, xpath);
+               return ReflectionMapper.callSetter(listItem, setterName, value);
+       }
+
+       public static ReflectionMapper.STATUS callSimplePropertySetter(Object target, String name, Object arg) {
+               return ReflectionMapper.callSetter(target, name, arg);
+       }
+
+       /**
+        * @param commonListClassname
+        *            is a package-qualified java classname, including inner class $ notation, such as
+        *            "org.collectionspace.services.objectexit.ObjectexitCommonList$ObjectexitListItem".
+        * @param includeStdFields
+        *            set to true to have the method set Uri and Csid automatically, based on id param.
+        */
+       public Object createItemForCommonList(String commonListClassname, DocumentModel docModel, String schema, String id,
+                       boolean includeStdFields) throws Exception {
+               // createItemForCommonList(docModel, label, id);
+               Object item = ReflectionMapper.instantiate(commonListClassname);
+               List<ListResultField> resultsFields = getListItemsArray();
+               for (ListResultField field : resultsFields) {
+                       callPropertySetterWithXPathValue(docModel, item, field.getSetter(), schema, field.getXpath());
+               }
+               if (includeStdFields) {
+                       callSimplePropertySetter(item, "setCsid", id);
+                       callSimplePropertySetter(item, "setUri", getServiceContextPath() + id);
+               }
+               
+               return item;
+       }
+
+       /**
+        * Subclasses should override this method if they don't want to automatically
+        * call List createItemsList(AbstractCommonList commonList, String listItemMethodName)
+        * which will use introspection to create a summary list, and will find the primary
+        * field for you if specified.
+        */
+       public List createItemsList(AbstractCommonList commonList) throws Exception {
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
+               return createItemsList(commonList, ServiceConfigUtils.getDocHandlerParams(ctx).getListResultsItemMethodName());
+       }
+
+       /** e.g. createItemsList(commonList, "getObjectexitListItem" */
+       public List createItemsList(AbstractCommonList commonList, String listItemMethodName) throws Exception {
+               Class commonListClass = commonList.getClass();
+               Class[] types = new Class[] {};
+               try {
+                       Method m = commonListClass.getMethod(listItemMethodName, types);
+                       return (List) (ReflectionMapper.fireGetMethod(m, commonList));
+               } catch (NoSuchMethodException nsm) {
+                       return new ArrayList();
+               }
+       }
+
+}
index 6cc3b95a0b60f6ed457b49d6174ba472741955c5..39060c28d12d6a7d965986b7605b8a658a092b4b 100644 (file)
@@ -30,7 +30,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
@@ -50,7 +49,7 @@ import org.collectionspace.services.client.Profiler;
 import org.collectionspace.services.client.RelationClient;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.authorityref.AuthorityRefList;
 import org.collectionspace.services.common.config.ServiceConfigUtils;
 import org.collectionspace.services.common.context.JaxRsContext;
@@ -80,11 +79,13 @@ import org.collectionspace.services.relation.RelationsCommon;
 import org.collectionspace.services.relation.RelationsCommonList;
 import org.collectionspace.services.relation.RelationsDocListItem;
 import org.collectionspace.services.relation.RelationshipType;
+
 import org.dom4j.Element;
+
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -124,7 +125,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
        
        private String getRefnameDisplayName(DocumentModel docModel) { // Look in the tenant bindings to see what field should be our display name for our refname value
                String result = null;
-               ServiceContext ctx = this.getServiceContext();
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
                
        DocHandlerParams.Params params = null;
        try {
@@ -152,7 +153,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
        
        DocHandlerParams.Params params = null;
        try {
-               ServiceContext ctx = this.getServiceContext();
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
                        params = ServiceConfigUtils.getDocHandlerParams(ctx);
                        Boolean bool = params.isSupportsHierarchy();
                        if (bool != null) {
@@ -175,7 +176,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
        
        DocHandlerParams.Params params = null;
        try {
-               ServiceContext ctx = this.getServiceContext();
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
                        params = ServiceConfigUtils.getDocHandlerParams(ctx);
                        Boolean bool = params.isSupportsVersioning();
                        if (bool != null) {
@@ -619,7 +620,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                boolean releaseRepoSession = false;
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
                RepositoryJavaClientImpl repoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx);
-               RepositoryInstanceInterface repoSession = this.getRepositorySession();
+               CoreSessionInterface repoSession = this.getRepositorySession();
                if (repoSession == null) {
                        repoSession = repoClient.getRepositorySession(ctx);
                        releaseRepoSession = true;
@@ -1265,7 +1266,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
                                logger.trace("Fetching CSID for child with only refname: "+newChildRefName);
                             }
                                DocumentModel newChildDocModel = 
-                                       ResourceBase.getDocModelForRefName(this.getRepositorySession(), 
+                                       NuxeoBasedResource.getDocModelForRefName(this.getRepositorySession(), 
                                                        newChildRefName, getServiceContext().getResourceMap());
                                newChildCsid = getCsid(newChildDocModel);
                                }
@@ -1318,7 +1319,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
      *   and sets URI correctly for related items.
      *   Operates directly on the items in the list.  Does not change the list ordering, does not add or remove any items.
      */
-    protected void fixupInboundListItems(ServiceContext ctx,
+    protected void fixupInboundListItems(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             List<RelationsCommonList.RelationListItem> inboundList,
             DocumentModel docModel,
             String itemCSID) throws Exception {
@@ -1405,8 +1406,8 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
     // since a save on Create might fail, and we would not want to create relations for something
     // that may not be created...
     private void handleRelationsPayload(DocumentWrapper<DocumentModel> wrapDoc, boolean fUpdate) throws Exception {
-        ServiceContext ctx = getServiceContext();
-        PoxPayloadIn input = (PoxPayloadIn) ctx.getInput();
+       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
+        PoxPayloadIn input = ctx.getInput();
         DocumentModel documentModel = (wrapDoc.getWrappedObject());
         String itemCsid = documentModel.getName();
 
@@ -1419,7 +1420,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
         //now we add part for relations list
         //ServiceContext ctx = getServiceContext();
         //PayloadOutputPart foo = (PayloadOutputPart) ctx.getProperty(RelationClient.SERVICE_COMMON_LIST_NAME);
-        ((PoxPayloadOut) ctx.getOutput()).addPart(payloadOutputPart);
+        ctx.getOutput().addPart(payloadOutputPart);
     }
 
     /**
@@ -1431,7 +1432,7 @@ public abstract class   RemoteDocumentModelHandlerImpl<T, TL>
         if (hasRefNameUpdate() == true) {
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
             RepositoryClient<PoxPayloadIn, PoxPayloadOut> repoClient = getRepositoryClient(ctx);
-            RepositoryInstanceInterface repoSession = this.getRepositorySession();
+            CoreSessionInterface repoSession = this.getRepositorySession();
             
             // Update all the relationship records that referred to the old refName
             RefNameServiceUtils.updateRefNamesInRelations(ctx, repoClient, repoSession,
index 0b8cdc93d6c55c834bb518c24bf61d2f9c347b9a..6d4f231b6475a36be0e240cde53ba3498e76c215 100644 (file)
@@ -32,19 +32,21 @@ import java.util.UUID;
 import javax.sql.rowset.CachedRowSet;
 import javax.ws.rs.core.MultivaluedMap;
 
+import org.collectionspace.services.lifecycle.TransitionDef;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.Profiler;
 import org.collectionspace.services.client.workflow.WorkflowClient;
+
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.query.QueryContext;
 import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.common.storage.JDBCTools;
 import org.collectionspace.services.common.storage.PreparedStatementSimpleBuilder;
-import org.collectionspace.services.lifecycle.TransitionDef;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentFilter;
@@ -54,8 +56,25 @@ import org.collectionspace.services.common.document.DocumentHandler.Action;
 import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.document.DocumentWrapperImpl;
 import org.collectionspace.services.common.document.TransactionException;
+import org.collectionspace.services.common.CSWebApplicationException;
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.api.Tools;
+import org.collectionspace.services.common.config.ConfigUtils;
+import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
+import org.collectionspace.services.common.config.TenantBindingUtils;
+import org.collectionspace.services.common.storage.PreparedStatementBuilder;
+
+import org.collectionspace.services.config.tenant.TenantBindingType;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 
+//
+// CSPACE-5036 - How to make CMISQL queries from Nuxeo
+//
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+import org.apache.chemistry.opencmis.commons.server.CallContext;
+import org.apache.chemistry.opencmis.server.impl.CallContextImpl;
+import org.apache.chemistry.opencmis.server.shared.ThresholdOutputStreamFactory;
+
 import org.nuxeo.common.utils.IdUtils;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -67,22 +86,9 @@ import org.nuxeo.ecm.core.api.DocumentRef;
 import org.nuxeo.ecm.core.api.IdRef;
 import org.nuxeo.ecm.core.api.PathRef;
 import org.nuxeo.runtime.transaction.TransactionRuntimeException;
-
-//
-// CSPACE-5036 - How to make CMISQL queries from Nuxeo
-//
-import org.apache.chemistry.opencmis.commons.server.CallContext;
-import org.apache.chemistry.opencmis.server.impl.CallContextImpl;
-import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ServiceMain;
-import org.collectionspace.services.common.api.Tools;
-import org.collectionspace.services.common.config.ConfigUtils;
-import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
-import org.collectionspace.services.common.config.TenantBindingUtils;
-import org.collectionspace.services.common.storage.PreparedStatementBuilder;
-import org.collectionspace.services.config.tenant.TenantBindingType;
+import org.nuxeo.ecm.core.opencmis.bindings.NuxeoCmisServiceFactory;
 import org.nuxeo.ecm.core.opencmis.impl.server.NuxeoCmisService;
-import org.nuxeo.ecm.core.opencmis.impl.server.NuxeoRepository;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -121,7 +127,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
         //Empty constructor
     }
 
-    public void assertWorkflowState(ServiceContext ctx,
+    public void assertWorkflowState(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             DocumentModel docModel) throws DocumentNotFoundException, ClientException {
         MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
         if (queryParams != null) {
@@ -178,7 +184,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
                     + " check if the workspace exists in the Nuxeo repository");
         }
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.CREATE);
             repoSession = getRepositorySession(ctx);
@@ -240,7 +246,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
                     "RepositoryJavaClient.get: handler is missing");
         }
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.GET);
             repoSession = getRepositorySession(ctx);
@@ -291,7 +297,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     public void get(ServiceContext ctx, DocumentHandler handler)
             throws DocumentNotFoundException, TransactionException, DocumentException {
         QueryContext queryContext = new QueryContext(ctx, handler);
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
 
         try {
             handler.prepare(Action.GET);
@@ -332,7 +338,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     }
 
     public DocumentWrapper<DocumentModel> getDoc(
-               RepositoryInstanceInterface repoSession,
+               CoreSessionInterface repoSession,
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             String csid) throws DocumentNotFoundException, DocumentException {
         DocumentWrapper<DocumentModel> wrapDoc = null;
@@ -371,7 +377,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     public DocumentWrapper<DocumentModel> getDoc(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             String csid) throws DocumentNotFoundException, TransactionException, DocumentException {
-       RepositoryInstanceInterface repoSession = null;
+       CoreSessionInterface repoSession = null;
         DocumentWrapper<DocumentModel> wrapDoc = null;
 
         try {
@@ -400,7 +406,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     }
 
     public DocumentWrapper<DocumentModel> findDoc(
-               RepositoryInstanceInterface repoSession,
+               CoreSessionInterface repoSession,
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             String whereClause)
             throws DocumentNotFoundException, DocumentException {
@@ -454,7 +460,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             String whereClause)
             throws DocumentNotFoundException, TransactionException, DocumentException {
-       RepositoryInstanceInterface repoSession = null;
+       CoreSessionInterface repoSession = null;
         DocumentWrapper<DocumentModel> wrapDoc = null;
 
         try {
@@ -487,7 +493,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * @return the CollectionSpace ID (CSID) of the requested document
      */
     @Override
-    public String findDocCSID(RepositoryInstanceInterface repoSession,
+    public String findDocCSID(CoreSessionInterface repoSession,
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String whereClause)
             throws DocumentNotFoundException, TransactionException, DocumentException {
         String csid = null;
@@ -521,7 +527,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
 
     public DocumentWrapper<DocumentModelList> findDocs(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             List<String> docTypes,
             String whereClause,
             String orderByClause,
@@ -577,7 +583,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     public DocumentWrapper<DocumentModelList> findDocs(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
             DocumentHandler handler,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             List<String> docTypes)
             throws DocumentNotFoundException, DocumentException {
         DocumentWrapper<DocumentModelList> wrapDoc = null;
@@ -636,7 +642,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             String whereClause,
             int pageSize, int pageNum, boolean computeTotal)
             throws DocumentNotFoundException, TransactionException, DocumentException {
-       RepositoryInstanceInterface repoSession = null;
+       CoreSessionInterface repoSession = null;
         DocumentWrapper<DocumentModelList> wrapDoc = null;
 
         try {
@@ -674,7 +680,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
                     "RepositoryJavaClient.getAll: handler is missing");
         }
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.GET_ALL);
             repoSession = getRepositorySession(ctx);
@@ -731,7 +737,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
                     + " check if the workspace exists in the Nuxeo repository.");
         }
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.GET_ALL);
             repoSession = getRepositorySession(ctx);
@@ -766,12 +772,12 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
 
     public DocumentWrapper<DocumentModel> getDocFromCsid(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             String csid)
             throws Exception {
         DocumentWrapper<DocumentModel> result = null;
 
-        result = new DocumentWrapperImpl(NuxeoUtils.getDocFromCsid(ctx, repoSession, csid));
+        result = new DocumentWrapperImpl<DocumentModel>(NuxeoUtils.getDocFromCsid(ctx, repoSession, csid));
 
         return result;
     }
@@ -788,7 +794,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
             String csid)
             throws Exception {
         DocumentWrapper<DocumentModel> result = null;
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             repoSession = getRepositorySession(ctx);
             result = getDocFromCsid(ctx, repoSession, csid);
@@ -823,25 +829,29 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     /*
      * See CSPACE-5036 - How to make CMISQL queries from Nuxeo
      */
-    private IterableQueryResult makeCMISQLQuery(RepositoryInstanceInterface repoSession, String query, QueryContext queryContext) throws DocumentException {
+    private IterableQueryResult makeCMISQLQuery(CoreSessionInterface repoSession, String query, QueryContext queryContext) throws DocumentException {
         IterableQueryResult result = null;
-
-        // the NuxeoRepository should be constructed only once, then cached
-        // (its construction is expensive)
+        /** Threshold over which temporary files are not kept in memory. */
+        final int THRESHOLD = 1024 * 1024;
+        
         try {
-            NuxeoRepository repo = new NuxeoRepository(
-                    repoSession.getRepositoryName(), repoSession
-                    .getRootDocument().getId());
-            logger.debug("Repository ID:" + repo.getId() + " Root folder:"
-                    + repo.getRootFolderId());
+            logger.debug(String.format("Performing a CMIS query on Nuxeo repository named %s",
+                       repoSession.getRepositoryName()));
 
+            ThresholdOutputStreamFactory streamFactory = ThresholdOutputStreamFactory.newInstance(
+                    null, THRESHOLD, -1, false);
             CallContextImpl callContext = new CallContextImpl(
-                    CallContext.BINDING_LOCAL, repo.getId(), false);
-            callContext.put(CallContext.USERNAME, repoSession.getPrincipal()
-                    .getName());
-            NuxeoCmisService cmisService = new NuxeoCmisService(repo,
-                    callContext, repoSession.getRepositoryInstance());
-
+                    CallContext.BINDING_LOCAL,
+                    CmisVersion.CMIS_1_1,
+                    repoSession.getRepositoryName(),
+                    null, // ServletContext
+                    null, // HttpServletRequest
+                    null, // HttpServletResponse
+                    new NuxeoCmisServiceFactory(),
+                    streamFactory);
+            callContext.put(CallContext.USERNAME, repoSession.getPrincipal().getName());
+            
+            NuxeoCmisService cmisService = new NuxeoCmisService(repoSession.getCoreSession());
             result = repoSession.queryAndFetch(query, "CMISQL", cmisService);
         } catch (ClientException e) {
             // TODO Auto-generated catch block
@@ -874,7 +884,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
         }
         QueryContext queryContext = new QueryContext(ctx, handler);
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.GET_ALL);
             repoSession = getRepositorySession(ctx); //Keeps a refcount here for the repository session so you need to release this when finished
@@ -943,7 +953,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * @return a list of document models matching the search criteria.
      * @throws Exception 
      */
-    private DocumentModelList getFilteredJDBC(RepositoryInstanceInterface repoSession, ServiceContext ctx, 
+    private DocumentModelList getFilteredJDBC(CoreSessionInterface repoSession, ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, 
             DocumentHandler handler) throws Exception {
         DocumentModelList result = new DocumentModelListImpl();
 
@@ -1210,7 +1220,8 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     }
     
 
-    private DocumentModelList getFilteredCMIS(RepositoryInstanceInterface repoSession, ServiceContext ctx, DocumentHandler handler, QueryContext queryContext)
+    private DocumentModelList getFilteredCMIS(CoreSessionInterface repoSession, 
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, DocumentHandler handler, QueryContext queryContext)
             throws DocumentNotFoundException, DocumentException {
 
         DocumentModelList result = new DocumentModelListImpl();
@@ -1322,7 +1333,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
                     "RepositoryJavaClient.update: document handler is missing.");
         }
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.UPDATE);
             repoSession = getRepositorySession(ctx);
@@ -1388,14 +1399,14 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * @param ctx service context under which this method is invoked
      * @param repoSession
      * @param docModel the document to save
-     * @param fSaveSession if TRUE, will call CoreSession.save() to save
+     * @param fSaveSession if TRUE, will call CoreSessionInterface.save() to save
      * accumulated changes.
      * @throws ClientException
      * @throws DocumentException
      */
     public void saveDocWithoutHandlerProcessing(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             DocumentModel docModel,
             boolean fSaveSession)
             throws ClientException, DocumentException {
@@ -1421,14 +1432,14 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * @param ctx service context under which this method is invoked
      * @param repoSession a repository session
      * @param docModelList a list of document models
-     * @param fSaveSession if TRUE, will call CoreSession.save() to save
+     * @param fSaveSession if TRUE, will call CoreSessionInterface.save() to save
      * accumulated changes.
      * @throws ClientException
      * @throws DocumentException
      */
     public void saveDocListWithoutHandlerProcessing(
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-            RepositoryInstanceInterface repoSession,
+            CoreSessionInterface repoSession,
             DocumentModelList docList,
             boolean fSaveSession)
             throws ClientException, DocumentException {
@@ -1467,7 +1478,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
         if (logger.isDebugEnabled()) {
             logger.debug("Deleting document with CSID=" + id);
         }
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             handler.prepare(Action.DELETE);
             repoSession = getRepositorySession(ctx);
@@ -1516,7 +1527,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
 
     @Override
     public String createDomain(RepositoryDomainType repositoryDomain) throws Exception {
-       RepositoryInstanceInterface repoSession = null;
+       CoreSessionInterface repoSession = null;
         String domainId = null;
         try {
             //
@@ -1574,7 +1585,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     @Override
     public String getDomainId(RepositoryDomainType repositoryDomain) throws Exception {
         String domainId = null;
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
 
         String repoName = repositoryDomain.getRepositoryName();
         String domainStorageName = repositoryDomain.getStorageName();
@@ -1604,7 +1615,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     /*
      * Returns the workspaces root directory for a given domain.
      */
-    private DocumentModel getWorkspacesRoot(RepositoryInstanceInterface repoSession,
+    private DocumentModel getWorkspacesRoot(CoreSessionInterface repoSession,
             String domainName) throws Exception {
         DocumentModel result = null;
 
@@ -1635,7 +1646,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      */
     @Override
     public String createWorkspace(RepositoryDomainType repositoryDomain, String workspaceName) throws Exception {
-       RepositoryInstanceInterface repoSession = null;
+       CoreSessionInterface repoSession = null;
         String workspaceId = null;
         try {
             String repoName = repositoryDomain.getRepositoryName();
@@ -1682,9 +1693,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
     public String getWorkspaceId(String tenantDomain, String workspaceName) throws Exception {
         String workspaceId = null;
 
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
-            repoSession = getRepositorySession((ServiceContext) null);
+            repoSession = getRepositorySession((ServiceContext<PoxPayloadIn, PoxPayloadOut>) null);
             DocumentRef docRef = new PathRef(
                     "/" + tenantDomain
                     + "/" + NuxeoUtils.Workspaces
@@ -1707,11 +1718,11 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
         return workspaceId;
     }
 
-    public RepositoryInstanceInterface getRepositorySession(ServiceContext ctx) throws Exception {
+    public CoreSessionInterface getRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) throws Exception {
         return getRepositorySession(ctx, ctx.getRepositoryName());
     }
 
-    public RepositoryInstanceInterface getRepositorySession(String repoName) throws Exception {
+    public CoreSessionInterface getRepositorySession(String repoName) throws Exception {
         return getRepositorySession(null, repoName);
     }
 
@@ -1722,8 +1733,8 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * @return the repository session
      * @throws Exception the exception
      */
-    public RepositoryInstanceInterface getRepositorySession(ServiceContext ctx, String repoName) throws Exception {
-       RepositoryInstanceInterface repoSession = null;
+    public CoreSessionInterface getRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String repoName) throws Exception {
+       CoreSessionInterface repoSession = null;
 
         Profiler profiler = new Profiler("getRepositorySession():", 2);
         profiler.start();
@@ -1732,7 +1743,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
         //
         if (ctx != null) {
             repoName = ctx.getRepositoryName(); // Notice we are overriding the passed in 'repoName' since we have a valid service context passed in to us
-            repoSession = (RepositoryInstanceInterface) ctx.getCurrentRepositorySession(); // Look to see if one exists in the context before creating one
+            repoSession = (CoreSessionInterface) ctx.getCurrentRepositorySession(); // Look to see if one exists in the context before creating one
         } else if (repoName == null || repoName.trim().isEmpty()) {
             String errMsg = String.format("We can't get a connection to the Nuxeo repo because the service context passed in was null and no repository name was passed in either.");
             logger.error(errMsg);
@@ -1773,7 +1784,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      *
      * @param repoSession the repo session
      */
-    public void releaseRepositorySession(ServiceContext ctx, RepositoryInstanceInterface repoSession) throws TransactionException {
+    public void releaseRepositorySession(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, CoreSessionInterface repoSession) throws TransactionException {
         try {
             NuxeoClientEmbedded client = NuxeoConnectorEmbedded.getInstance().getClient();
             // release session
@@ -1879,7 +1890,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient<PoxPayloadIn,
      * @return true if a restriction on tenant ID is required in the query;
      * false if a restriction is not required.
      */
-    private boolean restrictJDBCQueryByTenantID(TenantBindingType tenantBinding, ServiceContext ctx) {
+    private boolean restrictJDBCQueryByTenantID(TenantBindingType tenantBinding, ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
         boolean restrict = true;
         // If data for the current service, in the current tenant, is isolated
         // within its own separate, per-tenant repository, as contrasted with
index b7c5127522c4061927527d1f55975a9510d953f5..1ef9a9dd91d2886c8b58c30b3992043ed99fe78e 100644 (file)
@@ -41,15 +41,15 @@ import org.collectionspace.services.common.document.DocumentFilter;
 import org.collectionspace.services.common.document.DocumentUtils;
 import org.collectionspace.services.common.query.QueryContext;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentException;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+
 import org.dom4j.Document;
 import org.dom4j.io.SAXReader;
+
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.ClientException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.nuxeo.ecm.core.api.Blob;
-import org.nuxeo.ecm.core.api.ConnectionException;
 import org.nuxeo.ecm.core.api.CoreSession;
 import org.nuxeo.ecm.core.api.DocumentRef;
 import org.nuxeo.ecm.core.api.IdRef;
@@ -62,10 +62,10 @@ import org.nuxeo.ecm.core.io.impl.DocumentPipeImpl;
 import org.nuxeo.ecm.core.io.impl.plugins.SingleDocumentReader;
 import org.nuxeo.ecm.core.io.impl.plugins.XMLDocumentWriter;
 import org.nuxeo.ecm.core.schema.SchemaManager;
-import org.nuxeo.ecm.core.search.api.client.querymodel.descriptor.QueryModelDescriptor;
-import org.nuxeo.ecm.core.storage.sql.Binary;
+import org.nuxeo.ecm.core.storage.binary.Binary;
 import org.nuxeo.ecm.core.storage.sql.coremodel.SQLBlob;
 import org.nuxeo.runtime.api.Framework;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -138,10 +138,10 @@ public class NuxeoUtils {
        Set<String> result = null;
        
        try {
-                       Field f = docModel.getClass().getDeclaredField("facets");
-                       f.setAccessible(true);
-                       result = (Set<String>) f.get(docModel);
-                       f.setAccessible(false);
+                       Field field = docModel.getClass().getDeclaredField("facets");
+                       field.setAccessible(true);
+                       result = (Set<String>) field.get(docModel);
+                       field.setAccessible(false);
        } catch (Exception e) {
                logger.error("Could not remove facet from DocumentModel instance: " + docModel.getId(), e);
        }
@@ -220,7 +220,7 @@ public class NuxeoUtils {
      * @return
      * @throws DocumentException
      */
-    public static Document getDocument(RepositoryInstanceInterface repoSession, DocumentModel nuxeoDoc)
+    public static Document getDocument(CoreSessionInterface repoSession, DocumentModel nuxeoDoc)
             throws DocumentException {
         Document doc = null;
         DocumentWriter writer = null;
@@ -230,7 +230,7 @@ public class NuxeoUtils {
         try {
             baos = new ByteArrayOutputStream();
             //nuxeo io.impl begin
-            reader = new SingleDocumentReader(repoSession.getRepositoryInstance(), nuxeoDoc);
+            reader = new SingleDocumentReader(repoSession.getCoreSession(), nuxeoDoc);
             writer = new XMLDocumentWriter(baos);
             DocumentPipe pipe = new DocumentPipeImpl();
             //nuxeo io.impl end
@@ -280,7 +280,7 @@ public class NuxeoUtils {
      *
      * @throws DocumentException the document exception
      */
-    public static Document getDocument(RepositoryInstanceInterface repoSession, String csid)
+    public static Document getDocument(CoreSessionInterface repoSession, String csid)
             throws DocumentException {
         Document result = null;
 
@@ -303,7 +303,7 @@ public class NuxeoUtils {
      * @throws ClientException the client exception
      */
     public static DocumentModel getWorkspaceModel(
-               RepositoryInstanceInterface repoSession, String workspaceName)
+               CoreSessionInterface repoSession, String workspaceName)
             throws DocumentException, IOException, ClientException {
         DocumentModel result = null;
         //FIXME: commented out as this does not work without tenant qualification
@@ -330,7 +330,7 @@ public class NuxeoUtils {
      * @throws DocumentException the document exception
      */
     public static DocumentModel getDocumentModel(
-               RepositoryInstanceInterface repoSession, String nuxeoId)
+               CoreSessionInterface repoSession, String nuxeoId)
             throws DocumentException {
         DocumentModel result = null;
 
@@ -475,7 +475,7 @@ public class NuxeoUtils {
      * @return an NXQL query
      * @throws Exception if supplied values in the query are invalid.
      */
-    static public final String buildNXQLQuery(ServiceContext ctx, QueryContext queryContext) throws Exception {
+    static public final String buildNXQLQuery(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, QueryContext queryContext) throws Exception {
         StringBuilder query = new StringBuilder("SELECT * FROM ");
         // Since we have a tenant qualification in the WHERE clause, we do not need 
         // tenant-specific doc types
@@ -486,7 +486,7 @@ public class NuxeoUtils {
         return query.toString();
     }
     
-    static public final String buildCMISQuery(ServiceContext ctx, QueryContext queryContext) throws Exception {
+    static public final String buildCMISQuery(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, QueryContext queryContext) throws Exception {
         StringBuilder query = new StringBuilder("SELECT * FROM ");
 
         /*
@@ -536,7 +536,7 @@ public class NuxeoUtils {
     
     static public DocumentModel getDocFromCsid(
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
-               RepositoryInstanceInterface repoSession,
+               CoreSessionInterface repoSession,
                String csid) throws Exception {
            DocumentModel result = null;
        
@@ -586,7 +586,7 @@ public class NuxeoUtils {
      * @param id
      * @return PathRef
      */
-    public static DocumentRef createPathRef(ServiceContext ctx, String id) {
+    public static DocumentRef createPathRef(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String id) {
         return new PathRef("/" + ctx.getRepositoryDomainStorageName() +
                 "/" + Workspaces +
                 "/" + ctx.getRepositoryWorkspaceName() +
@@ -621,40 +621,25 @@ public class NuxeoUtils {
         return id;
     }
     
-    public static boolean documentExists(RepositoryInstanceInterface repoSession,
+    /**
+     * Return the string literal in a form ready to embed in an NXQL statement.
+     *
+     * @param s
+     * @return
+     */
+    public static String prepareStringLiteral(String s) {
+        return "'" + s.replaceAll("'", "\\\\'") + "'";
+    }
+    
+    public static boolean documentExists(CoreSessionInterface repoSession,
                String csid) throws ClientException {
                boolean result = false;
                
-               /*
-                * This is the code that Nuxeo support suggested, however it will not work with their
-                * remote API's -it only works locally.
-               
-                               String qname = QueryModelDescriptor.prepareStringLiteral(csid);
-                               String statement = String.format(
-                                               "SELECT ecm:uuid FROM Document WHERE ecm:name = %s", qname);
-                               ResultSetQueryResult res = (ResultSetQueryResult) repoSession
-                                               .queryAndFetch(statement, "NXQL");
-                               result = res.hasNext();
-                               if (result = false) {
-                                       if (logger.isDebugEnabled() == true) {
-                                               logger.debug("Existance check failed for document with CSID = " + csid);
-                                       }
-                               } else {
-                                       //String uuid = (String) res.next().get(NXQL.ECM_UUID);
-                               }
-               */
-               
-               /*
-                * Until I hear back from Nuxeo, we can use the following code:
-                */
-               String qname = QueryModelDescriptor.prepareStringLiteral(csid);
                String statement = String.format(
-                               "SELECT ecm:uuid FROM Document WHERE ecm:name = %s", qname);
-//             ResultSetQueryResult res = (ResultSetQueryResult) repoSession
-//                             .queryAndFetch(statement, "NXQL");
-               DocumentModelList  res = repoSession.query(statement, 1/*return no more than 1*/);//, "NXQL");
+                               "SELECT ecm:uuid FROM Document WHERE ecm:name = %s", prepareStringLiteral(csid));
+               final int RETURN_ONE_ROW = 1; // Return no more than 1 row
+               DocumentModelList  res = repoSession.query(statement, RETURN_ONE_ROW);
 
-//             result = res.hasNext();
                result = res.iterator().hasNext();
                if (result = false) {
                        if (logger.isDebugEnabled() == true) {
@@ -680,7 +665,7 @@ public class NuxeoUtils {
     }
 
     
-    public static String getTenantQualifiedDocType(ServiceContext ctx, String docType) throws Exception {
+    public static String getTenantQualifiedDocType(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx, String docType) throws Exception {
        String result = docType;
        
                String tenantQualifiedDocType = ctx.getTenantQualifiedDoctype(docType);
@@ -691,7 +676,7 @@ public class NuxeoUtils {
        return result;
     }
 
-    public static String getTenantQualifiedDocType(ServiceContext ctx) throws NuxeoDocumentException {
+    public static String getTenantQualifiedDocType(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) throws NuxeoDocumentException {
        String result = null;
 
        try {
index 921c4d2873f77621192aed2b45e28e0845a68f74..23165d90f4eab3d6c2ba03e6973d572c3a5f2f20 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.conditioncheck;
 
 import org.collectionspace.services.client.ConditioncheckClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 @Path(ConditioncheckClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class ConditioncheckResource extends ResourceBase {
+public class ConditioncheckResource extends NuxeoBasedResource {
 
     final Logger logger = LoggerFactory.getLogger(ConditioncheckResource.class);
 
index 240320db5959cfa1d92415e27fef2ff36aaca31a..2dadc85631ae55860395cc461e6393c9064bb5ff 100644 (file)
 package org.collectionspace.services.conditioncheck.nuxeo;
 
 import org.collectionspace.services.conditioncheck.ConditionchecksCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /** ConditioncheckDocumentModelHandler
  */
 public class ConditioncheckDocumentModelHandler
-        extends DocHandlerBase<ConditionchecksCommon> {
+        extends NuxeoDocumentModelHandler<ConditionchecksCommon> {
 }
index 5b95e14c29ea8ea20a3d56ed377f97ca57ae33f2..30cf88b99c7059163951f8f2c3d643dfc719fe3b 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.contact;
 
 import org.collectionspace.services.client.ContactClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 @Path(ContactClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class ContactResource   extends ResourceBase {
+public class ContactResource   extends NuxeoBasedResource {
     final Logger logger = LoggerFactory.getLogger(ContactResource.class);
     
     @Override
index 55d9a5cabace49ba065194decca86510c1a0f02d..eb12ee287ba83fbe5a6fe2102505a331a1673d18 100644 (file)
@@ -30,7 +30,7 @@ import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.contact.ContactJAXBSchema;
 import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.contact.ContactsCommon;
 
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
  * The Class ContactDocumentModelHandler.
  */
 public class ContactDocumentModelHandler
-        extends DocHandlerBase<ContactsCommon> {
+        extends NuxeoDocumentModelHandler<ContactsCommon> {
 
     private final Logger logger = LoggerFactory.getLogger(ContactDocumentModelHandler.class);
     private static final String COMMON_PART_LABEL = "contacts_common";
index 096af4c5e0180836af072e7995536d7306c295dd..4fe8590dd8e02127a1a63c5a9d7c61f93deb8c07 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.dimension;
 
 import org.collectionspace.services.client.DimensionClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 @Path(DimensionClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class DimensionResource extends ResourceBase {
+public class DimensionResource extends NuxeoBasedResource {
 
     final Logger logger = LoggerFactory.getLogger(DimensionResource.class);
 
index 3f856be97c1f8bd5000caf50d08ddb320c873107..cfd933231d0a8ac0fe930ea61d00889e921988e2 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.group;
 
 import org.collectionspace.services.client.GroupClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Path;
@@ -33,7 +33,7 @@ import javax.ws.rs.Produces;
 @Path(GroupClient.SERVICE_PATH)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public class GroupResource extends ResourceBase {
+public class GroupResource extends NuxeoBasedResource {
 
     @Override
     public String getServiceName(){
index e39abbb7a49aef592a3e85ce061641de348dbc7f..61760f19c7d0f6f3f16a3a9f54d9374ed587f5d8 100644 (file)
  */
 package org.collectionspace.services.group.nuxeo;
 
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.group.GroupsCommon;
 
 public class GroupDocumentModelHandler 
-       extends DocHandlerBase<GroupsCommon> {
+       extends NuxeoDocumentModelHandler<GroupsCommon> {
 }
 
index 2d943836dc990ac150b78651a53351a432dbae48..6754b5e2206d5ffd262ce34d1266bedce8362802 100644 (file)
@@ -6,13 +6,11 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.TreeSet;
 
-import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.nuxeo.client.java.NuxeoClientEmbedded;
 import org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentRef;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.nuxeo.ecm.core.io.DocumentPipe;
 import org.nuxeo.ecm.core.io.DocumentReader;
 import org.nuxeo.ecm.core.io.DocumentTranslationMap;
@@ -32,7 +30,7 @@ public class ImportCommand {
         File file = new File(src);
         ///cspace way of configuring client and auth:
         NuxeoClientEmbedded client = NuxeoConnectorEmbedded.getInstance().getClient();
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
         try {
             repoSession = client.openRepository(repoName, timeOut);
             if (logger.isDebugEnabled()) {
@@ -51,7 +49,7 @@ public class ImportCommand {
         }
     }
 
-    String importTree(RepositoryInstanceInterface repoSession, File file, String toPath) throws Exception {
+    String importTree(CoreSessionInterface repoSession, File file, String toPath) throws Exception {
         Exception failed = null;
         DocumentReader reader = null;
         DocumentWriter writer = null;
@@ -67,7 +65,7 @@ public class ImportCommand {
                 logger.info("importTree reading file: " + file + (file != null ? " exists? " + file.exists() : " file param is null"));
             }
             reader = new LoggedXMLDirectoryReader(file);  //our overload of XMLDirectoryReader.
-            writer = new DocumentModelWriter(repoSession.getRepositoryInstance(), toPath, 10);
+            writer = new DocumentModelWriter(repoSession.getCoreSession(), toPath, 10);
             DocumentPipe pipe = new DocumentPipeImpl(10);
             // pipe.addTransformer(transformer);
             pipe.setReader(reader);
@@ -75,7 +73,7 @@ public class ImportCommand {
             DocumentTranslationMap dtm = pipe.run();
             Map<DocumentRef, DocumentRef> documentRefs = dtm.getDocRefMap(); // FIXME: Should be checking for null here!
             dump.append("<importedRecords>");
-            for (Map.Entry entry : documentRefs.entrySet()) {
+            for (Map.Entry<DocumentRef, DocumentRef> entry : documentRefs.entrySet()) {
                 keyDocRef = (DocumentRef) entry.getKey();
                 valueDocRef = (DocumentRef) entry.getValue();
                 if (keyDocRef == null || valueDocRef == null) {
index 27a24f33437bd16178d01828dbc429afa4cb7d1b..5875bcdd32edb97822226b24b977fbdca4d3ba22 100644 (file)
  */
 package org.collectionspace.services.imports.nuxeo;
 
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.imports.ImportsCommon;
 
 public class ImportsDocumentModelHandler 
-       extends DocHandlerBase<ImportsCommon> {
+       extends NuxeoDocumentModelHandler<ImportsCommon> {
 }
 
index 910ee0bbc89d9f2eb55ceb65425352862a81f3bb..10f8d5b5103b56d3c859e14d670d9d4e91cdc273 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.intake;
 
 import org.collectionspace.services.client.IntakeClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 @Path(IntakeClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class IntakeResource extends ResourceBase {
+public class IntakeResource extends NuxeoBasedResource {
     
     final Logger logger = LoggerFactory.getLogger(IntakeResource.class);
 
index be75254cf44761434e91c267c259b7faeaf73174..204c327779fb1db3c6440dcfacd6e387012828ce 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.intake.nuxeo;
 
 import org.collectionspace.services.intake.IntakesCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /**
  * IntakeDocumentModelHandler
@@ -33,6 +33,6 @@ import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
  * $LastChangedDate: $
  */
 public class IntakeDocumentModelHandler
-        extends DocHandlerBase<IntakesCommon> {
+        extends NuxeoDocumentModelHandler<IntakesCommon> {
 }
 
index d270c7c64f2f14d757a4780f6a0ec64e8fafcf1e..adf161b5e8a9b220905e64474980fb0a2ab65c3d 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.loanin;
 
 import org.collectionspace.services.client.LoaninClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 @Path(LoaninClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class LoaninResource extends ResourceBase {
+public class LoaninResource extends NuxeoBasedResource {
 
     final Logger logger = LoggerFactory.getLogger(LoaninResource.class);
 
index d3244a9aa2d5316e80ed17905a2e788d9c44e455..01095fd88b0daeb22206cd0099ce3f414503bb22 100644 (file)
 package org.collectionspace.services.loanin.nuxeo;
 
 import org.collectionspace.services.loanin.LoansinCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /** LoaninDocumentModelHandler
  *  $LastChangedRevision$
  *  $LastChangedDate$
  */
 public class LoaninDocumentModelHandler
-        extends DocHandlerBase<LoansinCommon> {
+        extends NuxeoDocumentModelHandler<LoansinCommon> {
 }
 
index dd7ae6561e0ba4c1a76f8256e5e30ff22391eb73..74d2b93b6dc99f91dc8b1c61495d09d339aea9fe 100644 (file)
@@ -23,7 +23,7 @@
  */
 package org.collectionspace.services.loanout;
 
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,7 +36,7 @@ import javax.ws.rs.Produces;
 //@Path(LoanoutClient.SERVICE_PATH_COMPONENT)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class LoanoutResource extends ResourceBase {
+public class LoanoutResource extends NuxeoBasedResource {
 
     private final static String serviceName = "loansout";
     
index cb9c88a12eec1dfdfb3f4e8a1a2086781e954507..fc649a7186a68604d18b340d7d3836b63bca73dc 100644 (file)
 package org.collectionspace.services.loanout.nuxeo;
 
 import org.collectionspace.services.loanout.LoansoutCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /**
  * The Class LoanoutDocumentModelHandler.
  */
 public class LoanoutDocumentModelHandler
-        extends DocHandlerBase<LoansoutCommon> {
+        extends NuxeoDocumentModelHandler<LoansoutCommon> {
  
 }
 
index 9580ff4dd562120391a151a68cf008ac2053850a..9f2c18a6c0c8e7e784648b5d017fa699af5613f4 100644 (file)
@@ -31,7 +31,7 @@ import org.collectionspace.services.client.MediaClient;
 import org.collectionspace.services.client.PayloadOutputPart;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.blob.BlobInput;
@@ -60,7 +60,7 @@ import javax.ws.rs.core.UriInfo;
 @Path(MediaClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class MediaResource extends ResourceBase {
+public class MediaResource extends NuxeoBasedResource {
     final Logger logger = LoggerFactory.getLogger(MediaResource.class);
     final static MediaClient mediaClient = new MediaClient();
 
index 9389ba30ddcc1818b09c4fcba75864cbdbb9b3d9..4b6995e1aeb40af15fa66050cd5ff916f12e04f2 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.media.nuxeo;
 
 import org.collectionspace.services.MediaJAXBSchema;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.client.BlobClient;
 import org.collectionspace.services.common.blob.BlobInput;
 import org.collectionspace.services.common.blob.BlobUtil;
@@ -43,7 +43,7 @@ import javax.ws.rs.core.MultivaluedMap;
  * The Class MediaDocumentModelHandler.
  */
 public class MediaDocumentModelHandler
-        extends DocHandlerBase<MediaCommon> {
+        extends NuxeoDocumentModelHandler<MediaCommon> {
 
     //==============================================================================
 
index 75172b9198cf795947aea7072d852f508e8d601f..f535861ca742150b9637d4dc639115ed8c477c97 100644 (file)
@@ -27,7 +27,7 @@ import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.MovementClient;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentHandler;
@@ -49,7 +49,7 @@ import javax.ws.rs.core.MultivaluedMap;
 @Path(MovementClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class MovementResource extends ResourceBase {
+public class MovementResource extends NuxeoBasedResource {
 
     final Logger logger = LoggerFactory.getLogger(MovementResource.class);
 
index 8d0d62fa5edd3c2041606c7f28deac16bc496975..b45afbcc636a21b81659f53498f13a76c801108d 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.movement.nuxeo;
 
 import org.collectionspace.services.movement.MovementsCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate$
  */
 public class MovementDocumentModelHandler
-        extends DocHandlerBase<MovementsCommon> {
+        extends NuxeoDocumentModelHandler<MovementsCommon> {
 
     final Logger logger = LoggerFactory.getLogger(MovementDocumentModelHandler.class);
 }
index 3027f33ff7b58e0a0afe2b657099b5ad28d915ff..a808e1da1806a961f5f7534519d145b8e5a41c2a 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.objectexit;
 
 import org.collectionspace.services.client.ObjectExitClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Path;
@@ -33,7 +33,7 @@ import javax.ws.rs.Produces;
 @Path(ObjectExitClient.SERVICE_PATH)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public class ObjectExitResource extends ResourceBase {
+public class ObjectExitResource extends NuxeoBasedResource {
 
     @Override
     public String getServiceName(){
index 11093d97a20a940227341f82c1dc13caa8bbcced..0d5ad493b2fe1ca6a0d246eebdece6f2e437753d 100644 (file)
  */
 package org.collectionspace.services.objectexit.nuxeo;
 
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.objectexit.ObjectexitCommon;
 
 public class ObjectExitDocumentModelHandler 
-       extends DocHandlerBase<ObjectexitCommon> {
+       extends NuxeoDocumentModelHandler<ObjectexitCommon> {
 }
 
index ea889b92e98761045ab212ec500b9ccf92cb399d..6b77c8bd5284a02cbf6a54b0e78bb581c425b6cb 100644 (file)
@@ -29,7 +29,7 @@ import org.collectionspace.services.PublicitemsCommonJAXBSchema;
 import org.collectionspace.services.publicitem.PublicitemsCommon;
 import org.collectionspace.services.client.PublicItemClient;
 import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.nuxeo.ecm.core.api.DocumentModel;
 
 /** PublicItemDocumentModelHandler
@@ -37,7 +37,7 @@ import org.nuxeo.ecm.core.api.DocumentModel;
  *  $LastChangedDate$
  */
 public class PublicItemDocumentModelHandler
-        extends DocHandlerBase<PublicitemsCommon> {
+        extends NuxeoDocumentModelHandler<PublicitemsCommon> {
        
        @Override
        public void fillAllParts(DocumentWrapper<DocumentModel> wrapDoc, Action action) throws Exception {
index 2d34e46baa42891e3e37e051440adc6a22240eab..def69bf10e530a4b36c1ffdf479cad6a373a88fb 100644 (file)
@@ -29,10 +29,9 @@ import java.net.HttpURLConnection;
 
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ServiceException;
 import org.collectionspace.services.common.ServiceMain;
-import org.collectionspace.services.common.api.RefName;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
@@ -48,27 +47,18 @@ import org.collectionspace.services.relation.RelationsCommon;
 import org.collectionspace.services.relation.RelationsCommonList;
 import org.collectionspace.services.relation.RelationsCommonList.RelationListItem;
 import org.collectionspace.services.relation.RelationsDocListItem;
-
-// HACK HACK HACK
 import org.collectionspace.services.client.CollectionSpaceClient;
-import org.collectionspace.services.client.PersonAuthorityClient;
-import org.collectionspace.services.client.CitationAuthorityClient;
-import org.collectionspace.services.client.OrgAuthorityClient;
-import org.collectionspace.services.client.LocationAuthorityClient;
-import org.collectionspace.services.client.TaxonomyAuthorityClient;
-import org.collectionspace.services.client.PlaceAuthorityClient;
-import org.collectionspace.services.client.WorkAuthorityClient;
-import org.collectionspace.services.client.ConceptAuthorityClient;
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.config.service.ServiceBindingType;
 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
+
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
 import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -101,7 +91,7 @@ public class RelationDocumentModelHandler
        DocumentModel relationDocModel = wrapDoc.getWrappedObject();
        String errMsg = ERROR_TERMS_IN_WORKFLOWSTATE + workflowState;
                        
-       RepositoryInstanceInterface repoSession = this.getRepositorySession();
+       CoreSessionInterface repoSession = this.getRepositorySession();
         try {
                        DocumentModel subjectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, SUBJ_DOC_MODEL);
                        DocumentModel objectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, OBJ_DOC_MODEL);
@@ -177,8 +167,7 @@ public class RelationDocumentModelHandler
         // we will also set those.
         // Note that this introduces another caching problem... 
         DocumentModel relationDocModel = wrapDoc.getWrappedObject();
-        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
-        RepositoryInstanceInterface repoSession = this.getRepositorySession();
+        CoreSessionInterface repoSession = this.getRepositorySession();
         
         DocumentModel subjectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, SUBJ_DOC_MODEL);
         DocumentModel objectDocModel = getSubjectOrObjectDocModel(repoSession, relationDocModel, OBJ_DOC_MODEL);
@@ -230,7 +219,7 @@ public class RelationDocumentModelHandler
     public RelationsCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
         RelationsCommonList relList = this.extractPagingInfo(new RelationsCommonList(), wrapDoc);
         relList.setFieldsReturned("subjectCsid|relationshipType|predicateDisplayName|relationshipMetaType|objectCsid|uri|csid|subject|object");
-        ServiceContext ctx = getServiceContext();
+        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
         String serviceContextPath = getServiceContextPath();
 
         TenantBindingConfigReaderImpl tReader = ServiceMain.getInstance().getTenantBindingConfigReader();
@@ -376,7 +365,7 @@ public class RelationDocumentModelHandler
     private final boolean OBJ_DOC_MODEL = false;
     
     private DocumentModel getSubjectOrObjectDocModel(
-               RepositoryInstanceInterface repoSession,
+               CoreSessionInterface repoSession,
                DocumentModel relationDocModel,
                boolean fSubject) throws Exception {
        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
@@ -405,7 +394,7 @@ public class RelationDocumentModelHandler
             try {
                refName = (String) relationDocModel.getProperty(commonPartLabel, 
                                (fSubject?RelationJAXBSchema.SUBJECT_REFNAME:RelationJAXBSchema.OBJECT_REFNAME));
-               docModel = ResourceBase.getDocModelForRefName(repoSession, refName, ctx.getResourceMap());
+               docModel = NuxeoBasedResource.getDocModelForRefName(repoSession, refName, ctx.getResourceMap());
             } catch (Exception e) {
                 throw new InvalidDocumentException(
                         "Relation record must have a CSID or refName to identify the object of the relation.", e);
index 566d4e3b9f216e43cdca0d0ee4137f20117e0a08..c9526b603db08246507325b214f4bf2fb6d3d651 100644 (file)
@@ -33,7 +33,7 @@ import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
 import org.collectionspace.services.client.ReportClient;
 import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.context.ServiceContext;
@@ -65,7 +65,7 @@ import javax.ws.rs.core.Response.ResponseBuilder;
 @Consumes("application/xml")
 @Produces("application/xml")
 //@Produces("application/xml;charset=UTF-8")
-public class ReportResource extends ResourceBase {
+public class ReportResource extends NuxeoBasedResource {
     private static String REPOSITORY_NAME = JDBCTools.NUXEO_DATASOURCE_NAME;
     private static String REPORTS_FOLDER = "reports";
     private static String CSID_LIST_SEPARATOR = ",";
index eb291dfec2b9a7489dc135d62ad2469ecc84bede..1748a7a249c81ce7f940f7da895094208c95afe0 100644 (file)
@@ -37,7 +37,6 @@ import java.util.Map;
 
 import javax.ws.rs.core.MediaType;
 import javax.naming.NamingException;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 
 import net.sf.jasperreports.engine.JRException;
@@ -45,7 +44,6 @@ import net.sf.jasperreports.engine.JRExporter;
 import net.sf.jasperreports.engine.JRExporterParameter;
 import net.sf.jasperreports.engine.JRParameter;
 import net.sf.jasperreports.engine.JasperCompileManager;
-import net.sf.jasperreports.engine.JasperExportManager;
 import net.sf.jasperreports.engine.JasperFillManager;
 import net.sf.jasperreports.engine.JasperPrint;
 import net.sf.jasperreports.engine.export.JRCsvExporter;
@@ -57,7 +55,6 @@ import net.sf.jasperreports.engine.export.ooxml.JRDocxExporter;
 import net.sf.jasperreports.engine.export.ooxml.JRPptxExporter;
 import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;
 
-import org.bouncycastle.crypto.RuntimeCryptoException;
 import org.collectionspace.services.ReportJAXBSchema;
 import org.collectionspace.services.report.ReportsCommon;
 import org.collectionspace.services.client.PoxPayloadIn;
@@ -68,7 +65,6 @@ import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.api.JEEServerDeployment;
 import org.collectionspace.services.common.api.FileTools;
 import org.collectionspace.services.common.api.Tools;
-import org.collectionspace.services.common.config.ConfigReader;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
@@ -77,13 +73,12 @@ import org.collectionspace.services.common.invocable.Invocable;
 import org.collectionspace.services.common.invocable.InvocationContext;
 import org.collectionspace.services.common.storage.JDBCTools;
 import org.collectionspace.services.jaxb.InvocableJAXBSchema;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.jfree.util.Log;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -93,7 +88,7 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: $
  * $LastChangedDate: $
  */
-public class ReportDocumentModelHandler extends DocHandlerBase<ReportsCommon> {
+public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler<ReportsCommon> {
     private final Logger logger = LoggerFactory.getLogger(ReportDocumentModelHandler.class);
     private static String REPORTS_FOLDER = "reports";
     private static String CSID_LIST_SEPARATOR = ",";
@@ -109,7 +104,7 @@ public class ReportDocumentModelHandler extends DocHandlerBase<ReportsCommon> {
                        InvocationContext invContext,
                        StringBuffer outMimeType,
                        StringBuffer outReportFileName) throws Exception {
-               RepositoryInstanceInterface repoSession = null;
+               CoreSessionInterface repoSession = null;
                boolean releaseRepoSession = false;
 
                String invocationMode = invContext.getMode();
@@ -400,7 +395,7 @@ public class ReportDocumentModelHandler extends DocHandlerBase<ReportsCommon> {
     private Connection getConnection() throws NamingException, SQLException {
        Connection result = null;
        
-       ServiceContext ctx = this.getServiceContext();
+       ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
        try {
                String repositoryName = ctx.getRepositoryName();
                if (repositoryName != null && repositoryName.trim().isEmpty() == false) {
index 3b6d27ab5134d92ca930ff91b7441c8379b25aa2..6303557421254c08e00dc41ebecab45b7a9c5704 100644 (file)
@@ -35,33 +35,22 @@ import org.collectionspace.services.client.ServiceGroupClient;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
 import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
 import org.collectionspace.services.common.context.MultipartServiceContextFactory;
-import org.collectionspace.services.common.context.RemoteServiceContextFactory;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.context.ServiceContextFactory;
-import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentFilter;
-import org.collectionspace.services.common.document.DocumentHandler;
-import org.collectionspace.services.common.document.DocumentNotFoundException;
-import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.common.query.QueryManager;
-import org.collectionspace.services.common.repository.RepositoryClient;
-import org.collectionspace.services.common.repository.RepositoryClientFactory;
 import org.collectionspace.services.config.service.ServiceBindingType;
 import org.collectionspace.services.config.service.ServiceObjectType;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.servicegroup.nuxeo.ServiceGroupDocumentModelHandler;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,7 +59,6 @@ import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
@@ -79,7 +67,7 @@ import javax.ws.rs.core.UriInfo;
 @Path(ServiceGroupClient.SERVICE_PATH)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public class ServiceGroupResource extends AbstractCollectionSpaceResourceImpl {
+public class ServiceGroupResource extends AbstractCollectionSpaceResourceImpl<PoxPayloadIn, PoxPayloadOut> {
 
     protected final Logger logger = LoggerFactory.getLogger(this.getClass());
     
@@ -103,7 +91,7 @@ public class ServiceGroupResource extends AbstractCollectionSpaceResourceImpl {
 
     @Override
     //public Class<ServicegroupsCommon> getCommonPartClass() {
-    public Class getCommonPartClass() {
+    public Class<?> getCommonPartClass() {
        try {
             return Class.forName("org.collectionspace.services.servicegroup.ServicegroupsCommon");//.class;
         } catch (ClassNotFoundException e){
@@ -166,7 +154,7 @@ public class ServiceGroupResource extends AbstractCollectionSpaceResourceImpl {
             @Context UriInfo ui,
             @PathParam("csid") String groupname) {
         PoxPayloadOut result = null;
-        ensureCSID(groupname, ResourceBase.READ);
+        ensureCSID(groupname, NuxeoBasedResource.READ);
         try {
                ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
             TenantBindingConfigReaderImpl tReader =
@@ -220,7 +208,7 @@ public class ServiceGroupResource extends AbstractCollectionSpaceResourceImpl {
     public AbstractCommonList getItems(
             @Context UriInfo ui,
             @PathParam("csid") String serviceGroupName) {
-        ensureCSID(serviceGroupName, ResourceBase.READ);
+        ensureCSID(serviceGroupName, NuxeoBasedResource.READ);
         AbstractCommonList list = null;
         try {
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
index 257dc729ab789dbf8feea877b3c10ad9a9c61936..37b8ab39b2d02f0a5dc3909b88de443611da53a3 100644 (file)
@@ -29,19 +29,18 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Response;
 
-import org.collectionspace.services.ServiceGroupListItemJAXBSchema;
 import org.collectionspace.services.nuxeo.client.java.CommonList;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
-import org.collectionspace.services.nuxeo.client.java.RepositoryInstanceInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.PoxPayloadIn;
 import org.collectionspace.services.client.PoxPayloadOut;
+
 import org.collectionspace.services.common.CSWebApplicationException;
 import org.collectionspace.services.common.ServiceMain;
 import org.collectionspace.services.common.ServiceMessages;
@@ -49,29 +48,26 @@ import org.collectionspace.services.common.StoredValuesUriTemplate;
 import org.collectionspace.services.common.UriTemplateFactory;
 import org.collectionspace.services.common.UriTemplateRegistry;
 import org.collectionspace.services.common.UriTemplateRegistryKey;
-import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
 import org.collectionspace.services.common.context.ServiceBindingUtils;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentFilter;
-import org.collectionspace.services.common.document.DocumentNotFoundException;
 import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.query.QueryManager;
-import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.common.security.SecurityUtils;
+
 import org.collectionspace.services.config.service.ServiceBindingType;
 import org.collectionspace.services.config.service.ServiceObjectType;
 import org.collectionspace.services.servicegroup.ServicegroupsCommon;
+
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.model.PropertyException;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ServiceGroupDocumentModelHandler 
-       extends DocHandlerBase<ServicegroupsCommon> {
+       extends NuxeoDocumentModelHandler<ServicegroupsCommon> {
        
     protected final Logger logger = LoggerFactory.getLogger(this.getClass());
     
@@ -85,7 +81,7 @@ public class ServiceGroupDocumentModelHandler
                List<String> serviceGroupNames) throws Exception {
         CommonList commonList = new CommonList();
         AbstractCommonList list = (AbstractCommonList)commonList;
-        RepositoryInstanceInterface repoSession = null;
+        CoreSessionInterface repoSession = null;
        boolean releaseRepoSession = false;
         
        try { 
index 31de133f6d33f6d5d5a775ff120b0fb91d0304c6..b16335fe984ed544fe494329c10dc5e42b94e52a 100644 (file)
@@ -24,7 +24,7 @@
 package org.collectionspace.services.valuationcontrol;
 
 import org.collectionspace.services.client.ValuationcontrolClient;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@ import javax.ws.rs.Produces;
 @Path(ValuationcontrolClient.SERVICE_PATH)
 @Consumes("application/xml")
 @Produces("application/xml")
-public class ValuationcontrolResource extends ResourceBase {
+public class ValuationcontrolResource extends NuxeoBasedResource {
 
     final Logger logger = LoggerFactory.getLogger(ValuationcontrolResource.class);
 
index 7c53a691048949342f64ac417f12853ce89f3977..2df7759897d6d1e0d16da27e93fe9591aeb3d673 100644 (file)
 package org.collectionspace.services.valuationcontrol.nuxeo;
 
 import org.collectionspace.services.valuationcontrol.ValuationcontrolsCommon;
-import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 
 /** ValuationcontrolDocumentModelHandler
  */
 public class ValuationcontrolDocumentModelHandler
-        extends DocHandlerBase<ValuationcontrolsCommon> {
+        extends NuxeoDocumentModelHandler<ValuationcontrolsCommon> {
 }
index 19a8af56286daa55c102ab10ae4185191753f5a0..2830de30142274bcb46c67621d9b58ba68ecb987 100644 (file)
@@ -25,7 +25,7 @@ package org.collectionspace.services.workflow;
 
 import org.collectionspace.services.client.workflow.WorkflowClient;
 import org.collectionspace.services.common.CSWebApplicationException;
-import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.NuxeoBasedResource;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.ServiceMessages;
 import org.collectionspace.services.jaxb.AbstractCommonList;
@@ -45,7 +45,7 @@ import javax.ws.rs.core.UriInfo;
 @Path(WorkflowClient.SERVICE_PATH)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public class WorkflowResource extends ResourceBase {
+public class WorkflowResource extends NuxeoBasedResource {
 
     @Override
     public String getServiceName(){