]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6935: Refactor some of the Java client classes to be more useful for call...
authorremillet <remillet@yahoo.com>
Sun, 3 Apr 2016 03:18:19 +0000 (20:18 -0700)
committerremillet <remillet@yahoo.com>
Sun, 3 Apr 2016 03:18:19 +0000 (20:18 -0700)
45 files changed:
services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java
services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityItemListItemJAXBSchema.java
services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityJAXBSchema.java
services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityListItemJAXBSchema.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/nuxeo/AuthorityDocumentModelHandler.java
services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java
services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/AuthorityClientImpl.java
services/client/src/main/java/org/collectionspace/services/client/GenericAuthorityClientImpl.java [new file with mode: 0644]
services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java
services/client/src/main/java/org/collectionspace/services/client/test/AbstractServiceTestImpl.java
services/collectionobject/client/src/main/java/org/collectionspace/services/client/CollectionObjectClient.java
services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java
services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java
services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java
services/common/src/main/java/org/collectionspace/services/common/document/DocumentHandler.java
services/common/src/main/java/org/collectionspace/services/common/storage/StorageClient.java
services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java
services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java
services/conditioncheck/client/src/main/java/org/collectionspace/services/client/ConditioncheckClient.java
services/config/src/main/resources/service.xsd
services/conservation/client/src/main/java/org/collectionspace/services/client/ConservationClient.java
services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java
services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java
services/exhibition/client/src/main/java/org/collectionspace/services/client/ExhibitionClient.java
services/group/client/src/main/java/org/collectionspace/services/client/GroupClient.java
services/index/client/pom.xml
services/index/jaxb/.gitignore [new file with mode: 0644]
services/index/jaxb/pom.xml
services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexJAXBSchema.java [new file with mode: 0644]
services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexListItemJAXBSchema.java [new file with mode: 0644]
services/index/jaxb/src/main/resources/indexes-common.xsd [moved from services/jaxb/src/main/resources/index_common.xsd with 60% similarity]
services/index/pom.xml
services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java
services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java
services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyItemJAXBSchema.java
services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyJAXBSchema.java [new file with mode: 0644]

index 52814b637e8a73e57691ac54579c3e9017ba227d..328e349bef9ad3af5c9a8e49dc8d5d50b1bdfa79 100644 (file)
@@ -1,11 +1,13 @@
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.acquisition.AcquisitionsCommon;
+
 /**
  * An AcquisitionClient.
 
  * @version $Revision:$
  */
-public class AcquisitionClient extends AbstractCommonListPoxServiceClientImpl<AcquisitionProxy> {
+public class AcquisitionClient extends AbstractCommonListPoxServiceClientImpl<AcquisitionProxy, AcquisitionsCommon> {
        public static final String SERVICE_NAME = "acquisitions";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index 6814288f6f05852a744be0c2223b8a1d6e2026c5..e12f0b6516a5c86f7f7d081d40f3881a733ef395 100644 (file)
@@ -29,5 +29,6 @@ public interface AuthorityItemListItemJAXBSchema {
        final static String REF_NAME = "refName";
        final static String SHORT_IDENTIFIER = "shortIdentifier";
        final static String CSID = "csid";
+    final static String REV = "rev";   
        final static String URI = "url";
 }
index 77bea46367c9776f6c5e0219b3d1c1dd55ceae6e..d3cfd7127286ac52ee2e8589c72f375457b4a4f3 100644 (file)
  */
 package org.collectionspace.services.common.vocabulary;
 
-/**
- * @author pschmitz
- *
- */
 public interface AuthorityJAXBSchema {
        final static String DISPLAY_NAME = "displayName";
-       final static String SHORT_IDENTIFIER = "shortIdentifier";
        final static String REF_NAME = "refName";
+       final static String SHORT_IDENTIFIER = "shortIdentifier";
        final static String VOCAB_TYPE = "vocabType";
        final static String CSID = "csid";
     final static String REV = "rev";
index 2cd5ae704ba51e9b90351f902cdfa1b85774e490..a4d1280966895794c0e56a679505d24cec2a70f3 100644 (file)
@@ -29,5 +29,6 @@ public interface AuthorityListItemJAXBSchema {
        final static String SHORT_IDENTIFIER = "shortIdentifier";
        final static String VOCAB_TYPE = "vocabType";
        final static String CSID = "csid";
+    final static String REV = "rev";
        final static String URI = "url";
 }
index 60818cd0b883efadfbfd3558dbbb9a353b5314e2..b59d5606ed5b4390cdd7e661bc97377975c0f607 100644 (file)
                        <artifactId>org.collectionspace.services.client</artifactId>
                        <version>${project.version}</version>
                </dependency>
+               <dependency>
+                       <groupId>org.collectionspace.services</groupId>
+                   <artifactId>org.collectionspace.services.vocabulary.client</artifactId>
+                       <version>${project.version}</version>
+               </dependency>           
                <dependency>
                        <groupId>org.collectionspace.services</groupId>
                        <artifactId>org.collectionspace.services.common</artifactId>
index cd67fd3aa0dd9dde841c9d0fce4743de7b65d51a..96abf6c08522fa4f546e214ad7d32a8fc1d0b3a2 100644 (file)
@@ -83,6 +83,10 @@ import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentFilter;
 import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
 import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.collectionspace.services.workflow.WorkflowCommon;
+
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.SpecifierForm;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
+
 import org.jboss.resteasy.util.HttpResponseCodes;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;
@@ -127,22 +131,6 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
        
     final Logger logger = LoggerFactory.getLogger(AuthorityResource.class);
 
-    public enum SpecifierForm {
-
-        CSID, URN_NAME
-    };
-
-    public class Specifier {
-
-        public SpecifierForm form;
-        public String value;
-
-        Specifier(SpecifierForm form, String value) {
-            this.form = form;
-            this.value = value;
-        }
-    }
-
     protected Specifier getSpecifier(String specifierIn, String method, String op) throws CSWebApplicationException {
         if (logger.isDebugEnabled()) {
             logger.debug("getSpecifier called by: " + method + " with specifier: " + specifierIn);
@@ -385,19 +373,22 @@ public abstract class AuthorityResource<AuthCommon, AuthItemHandler>
             @Context Request request,
             @Context UriInfo ui,
             @PathParam("csid") String csid) {
-        boolean result = false;
+        PoxPayloadOut result = null;
         Specifier specifier;
         
         try {
             ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(ui);
             AuthorityDocumentModelHandler handler = (AuthorityDocumentModelHandler)createDocumentHandler(ctx);
             specifier = getSpecifier(csid, "getAuthority", "GET");
-            result = handler.synchronize(specifier);       
+            
+            getRepositoryClient(ctx).synchronize(ctx, specifier, handler);
+            result = ctx.getOutput();
+
         } catch (Exception e) {
             throw bigReThrow(e, ServiceMessages.SYNC_FAILED, csid);
         }
 
-        if (result == false) {
+        if (result == null) {
             Response response = Response.status(Response.Status.NOT_FOUND).entity(
                     "Get failed, the requested Authority specifier:" + specifier + ": was not found.").type(
                     "text/plain").build();
index fa0a03638567ddd18dc4bd547d2b914b1be6fa5e..6c0ad81c144e21481728d0d6071a3182dc65df0d 100644 (file)
@@ -25,31 +25,38 @@ package org.collectionspace.services.common.vocabulary.nuxeo;
 
 import java.util.Map;
 
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.client.AuthorityClient;
+import org.collectionspace.services.client.PayloadInputPart;
+import org.collectionspace.services.client.VocabularyClient;
 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.RefNameUtils;
+import org.collectionspace.services.common.api.RefNameUtils.AuthorityInfo;
 import org.collectionspace.services.common.api.Tools;
 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.document.DocumentHandler.Action;
 import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
-import org.collectionspace.services.common.vocabulary.AuthorityResource.Specifier;
-import org.collectionspace.services.common.vocabulary.AuthorityResource.SpecifierForm;
-import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.SpecifierForm;
 import org.collectionspace.services.config.service.ObjectPartType;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentFilter;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
 import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
 import org.nuxeo.ecm.core.api.ClientException;
 import org.nuxeo.ecm.core.api.DocumentModel;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.Assert;
 
 /**
  * AuthorityDocumentModelHandler
@@ -69,26 +76,69 @@ public abstract class AuthorityDocumentModelHandler<AuthCommon>
         this.authorityItemCommonSchemaName = authorityItemCommonSchemaName;
     }
     
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<String> getEntityResponseType() {
+       return String.class;
+    }
     
-    public boolean synchronize(Specifier specifier) throws DocumentNotFoundException, DocumentException {
-       boolean result = true;
+    protected PayloadInputPart extractPart(Response res, String partLabel)
+            throws Exception {
+            PoxPayloadIn input = new PoxPayloadIn((String)res.readEntity(getEntityResponseType()));
+            PayloadInputPart payloadInputPart = input.getPart(partLabel);
+            Assert.assertNotNull(payloadInputPart,
+                    "Part " + partLabel + " was unexpectedly null.");
+            return payloadInputPart;
+    }
+    
+    @Override
+    public void handleSync(DocumentWrapper<Specifier> wrapDoc) throws Exception {
        
        ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = this.getServiceContext();
-        if (specifier.form == SpecifierForm.CSID) {
-            if (logger.isDebugEnabled()) {
-                logger.debug("Synchronize Authority with csid=" + specifier.value);
-            }
-            getRepositoryClient(ctx).get(getServiceContext(), specifier.value, this);
-        } else {
-            String whereClause = RefNameServiceUtils.buildWhereForAuthByName(authorityCommonSchemaName, specifier.value);
-            DocumentFilter myFilter = new NuxeoDocumentFilter(whereClause, 0, 1);
-            this.setDocumentFilter(myFilter);
-            getRepositoryClient(ctx).get(ctx, this);
-        }
+        Specifier specifier = wrapDoc.getWrappedObject();
+        //
+        // Get the rev number of the authority so we can compare with rev number of shared authority
+        //
+        DocumentModel docModel = NuxeoUtils.getDocFromSpecifier(ctx, getRepositorySession(), authorityCommonSchemaName, specifier);
+        Long rev = (Long) NuxeoUtils.getProperyValue(docModel, AuthorityItemJAXBSchema.REV);
+        String shortId = (String) NuxeoUtils.getProperyValue(docModel, AuthorityItemJAXBSchema.SHORT_IDENTIFIER);
+        String refName = (String) NuxeoUtils.getProperyValue(docModel, AuthorityItemJAXBSchema.REF_NAME);
+        AuthorityInfo authorityInfo = RefNameUtils.parseAuthorityInfo(refName);
+        //
+        // Using the short ID of the local authority, created a URN specifier to retrieve the SAS authority
+        //
+        Specifier sasSpecifier = new Specifier(SpecifierForm.URN_NAME, RefNameUtils.createShortIdRefName(shortId));
+        Long sasRev = getRevFromSASInstance(sasSpecifier);
         
-        PoxPayloadOut output = ctx.getOutput();
+        AuthorityClient client = ctx.getAuthorityClient();
+        Response res = client.read(sasSpecifier.value);
+        try {
+               int statusCode = res.getStatus();
+       
+               // Check the status code of the response: does it match
+               // the expected response(s)?
+               if (logger.isDebugEnabled()) {
+                   logger.debug(client.getClass().getCanonicalName() + ": status = " + statusCode);
+               }
+               
+                       PayloadInputPart payloadInputPart = extractPart(res, client.getCommonPartName());
+                       if (payloadInputPart != null) {
+                               result = (CPT) payloadInputPart.getBody();
+                       }
+        } finally {
+               res.close();
+        }
         
-        return result;
+    }
+    
+    private Long getRevFromSASInstance(Specifier specifier) {
+       Long result = null;
+       
+       VocabularyClient client = new VocabularyClient();
+       String uri = getUri(specifier);
+       
+       return result;
     }
 
     /*
index ee7e28f20d7e774080708ab9885f75df20e43c93..ddd6ec21e57a40c3fb67dfc5879aa25aa74a0a19 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.batch.BatchCommon;
+
 /**
  * BatchClient.java
  *
@@ -23,7 +25,7 @@ package org.collectionspace.services.client;
  * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
  *
  */
-public class BatchClient extends AbstractCommonListPoxServiceClientImpl<BatchProxy> {
+public class BatchClient extends AbstractCommonListPoxServiceClientImpl<BatchProxy, BatchCommon> {
        public static final String SERVICE_NAME = "batch";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index e62fe58ea9b32f30e898902df2ec6e371673e7f4..30480c35efc760f8067c448ec3b1c9754f732487 100644 (file)
@@ -10,8 +10,8 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
  * 
  * @param <P>
  */
-public abstract class AbstractCommonListPoxServiceClientImpl<P extends CollectionSpaceCommonListPoxProxy>
-       extends AbstractPoxServiceClientImpl<AbstractCommonList, P> {
+public abstract class AbstractCommonListPoxServiceClientImpl<P extends CollectionSpaceCommonListPoxProxy, CPT>
+       extends AbstractPoxServiceClientImpl<AbstractCommonList, P, CPT> {
        //
        // All clients returning AbstractCommonList types should extend this class.
        //
index 42fdf7e1d62be4c696aad0b888b9aa632d23f338..5602c47c2c4afb59014204de54f2bef707b5dd56 100644 (file)
@@ -1,15 +1,16 @@
 package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
-import org.jboss.resteasy.client.ClientResponse;
 
+import org.jboss.resteasy.client.ClientResponse;
+import org.testng.Assert;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 /*
  * CLT = List type
  * P = Proxy type
  */
-public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonList, P extends CollectionSpacePoxProxy<CLT>>
+public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonList, P extends CollectionSpacePoxProxy<CLT>, CPT>
        extends AbstractServiceClientImpl<CLT, PoxPayloadOut, String, P> 
        implements CollectionSpacePoxClient<CLT, P> {
        
@@ -56,5 +57,69 @@ public abstract class AbstractPoxServiceClientImpl<CLT extends AbstractCommonLis
         CollectionSpacePoxProxy<CLT> proxy = getProxy();
         return proxy.advancedSearchIncludeDeleted(whereClause, includeDeleted.toString());
     }
-
+    
+    //
+    // REM - Attemp to move methods from test framework into Java client framework
+    //
+    
+       public CPT extractCommonPartValue(Response res) throws Exception {
+               CPT result = null;
+               
+               PayloadInputPart payloadInputPart = extractPart(res, this.getCommonPartName());
+               if (payloadInputPart != null) {
+                       result = (CPT) payloadInputPart.getBody();
+               }
+               
+               return result;
+       }
+       
+    protected void printList(String testName, CLT list) {
+        if (getLogger().isDebugEnabled()){
+               AbstractCommonListUtils.ListItemsInAbstractCommonList(list, getLogger(), testName);
+        }
+    }
+    
+    protected long getSizeOfList(CLT list) {
+       return list.getTotalItems();            
+    }
+    
+    /**
+     * The entity type expected from the JAX-RS Response object
+     */
+    public Class<String> getEntityResponseType() {
+       return String.class;
+    }
+       
+    public CPT extractCommonPartValue(PoxPayloadOut payloadOut) throws Exception {
+       CPT result = null;
+       
+       PayloadOutputPart payloadOutputPart = payloadOut.getPart(this.getCommonPartName());
+       if (payloadOutputPart != null) {
+               result = (CPT) payloadOutputPart.getBody();
+       }
+        
+       return result;
+    }
+               
+       public PoxPayloadOut createRequestTypeInstance(CPT commonPartTypeInstance) {
+               PoxPayloadOut result = null;
+               
+        PoxPayloadOut payloadOut = new PoxPayloadOut(this.getServicePathComponent());
+        PayloadOutputPart part = payloadOut.addPart(this.getCommonPartName(), commonPartTypeInstance);
+        result = payloadOut;
+               
+               return result;
+       }
+    
+    protected PayloadInputPart extractPart(Response res, String partLabel)
+            throws Exception {
+            if (getLogger().isDebugEnabled()) {
+               getLogger().debug("Reading part " + partLabel + " ...");
+            }
+            PoxPayloadIn input = new PoxPayloadIn((String)res.readEntity(getEntityResponseType()));
+            PayloadInputPart payloadInputPart = input.getPart(partLabel);
+            Assert.assertNotNull(payloadInputPart,
+                    "Part " + partLabel + " was unexpectedly null.");
+            return payloadInputPart;
+    }
 }
index 64d8da7a83a4bbb51b578de8b6027e7a79e9ad6a..64c948d1cd4e0c43777162e17ea51ceea36973fc 100644 (file)
@@ -188,7 +188,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      * Instantiates a new abstract service client impl.
      */
     protected AbstractServiceClientImpl() {
-        readProperties();
+        readClientProperties();
         setupHttpClient();
         setupHttpClient4(); // temp fix for CSPACE-6281
         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
@@ -297,7 +297,7 @@ public abstract class AbstractServiceClientImpl<CLT, REQUEST_PT, RESPONSE_PT, P
      *
      * @exception RuntimeException
      */
-    private void readProperties() {
+    protected void readClientProperties() {
 
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         InputStream is = null;
index 2024c7110b996c9b87e6f641403c0a22b424a30b..b40342e21a1fe8adeca5171753f492a2cd06844a 100644 (file)
@@ -11,10 +11,19 @@ import org.collectionspace.services.jaxb.AbstractCommonList;
  * P - Proxy type
  */
 public abstract class AuthorityClientImpl<AUTHORITY_ITEM_TYPE, P extends AuthorityProxy>
-       extends AbstractPoxServiceClientImpl<AbstractCommonList, P>
+       extends AbstractPoxServiceClientImpl<AbstractCommonList, P, AUTHORITY_ITEM_TYPE>
        implements AuthorityClient<AUTHORITY_ITEM_TYPE, P> {
 
        private static final String INCLUDE_DELETE_TRUE = Boolean.TRUE.toString();
+       
+       @Override
+    protected void readClientProperties() {
+               super.readClientProperties();
+               //
+               // Override with Shared Authority Server properties from tenant bindings
+               //
+    }
+    
        /*
         * Basic CRUD proxied methods
         */
diff --git a/services/client/src/main/java/org/collectionspace/services/client/GenericAuthorityClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/GenericAuthorityClientImpl.java
new file mode 100644 (file)
index 0000000..048b786
--- /dev/null
@@ -0,0 +1,42 @@
+package org.collectionspace.services.client;
+
+public class GenericAuthorityClientImpl extends
+               AuthorityClientImpl<Object, AuthorityProxy> {
+
+       @Override
+       public String getItemCommonPartName() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getInAuthority(Object item) {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public void setInAuthority(Object item, String inAuthorityCsid) {
+               // TODO Auto-generated method stub
+               
+       }
+
+       @Override
+       public Class<AuthorityProxy> getProxyClass() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getServiceName() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+       @Override
+       public String getServicePathComponent() {
+               // TODO Auto-generated method stub
+               return null;
+       }
+
+}
index 68f2570f6b73dab9cb1213317b9f6610852208a0..689618ca580196e221879f501c68066de76ba552 100644 (file)
@@ -19,6 +19,7 @@ package org.collectionspace.services.client.index;
 import javax.ws.rs.core.Response;
 
 import org.collectionspace.services.client.AbstractCommonListPoxServiceClientImpl;
+import org.collectionspace.services.index.IndexesCommon;
 
 /**
  * IndexClient.java
@@ -27,7 +28,7 @@ import org.collectionspace.services.client.AbstractCommonListPoxServiceClientImp
  * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
  *
  */
-public class IndexClient extends AbstractCommonListPoxServiceClientImpl<IndexProxy> {
+public class IndexClient extends AbstractCommonListPoxServiceClientImpl<IndexProxy, IndexesCommon> {
        public static final String SERVICE_NAME = "index";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index c19f9de7e013f9515bd25a1dfe525231d6c087bd..362b31ccc0d1c177534475d581ec18754d41cf77 100644 (file)
@@ -35,7 +35,7 @@ public abstract class AbstractPoxServiceTestImpl<CLT extends AbstractCommonList,
        }
        
     protected void printList(String testName, CLT list) {
-        if (getLogger().isTraceEnabled()){
+        if (getLogger().isDebugEnabled()){
                AbstractCommonListUtils.ListItemsInAbstractCommonList(list, getLogger(), testName);
         }
     }
index cbce4fa9245fabfed5b95114f434ac11a428f352..6026fe55cb2af543c7e4c8bbf93118c5d2882557 100644 (file)
@@ -29,6 +29,7 @@ import java.lang.reflect.TypeVariable;
 
 import org.collectionspace.services.jaxb.AbstractCommonList;
 import org.collectionspace.services.workflow.WorkflowCommon;
+import org.collectionspace.services.client.AbstractCommonListUtils;
 import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.CollectionSpacePoxClient;
@@ -435,6 +436,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
     protected void printList(String testName, CLT list) {
        // By default, do nothing.  Tests can override this method to produce additional
        // output after the "readList" test has run.
+       AbstractCommonListUtils.ListItemsInAbstractCommonList((AbstractCommonList)list, logger, testName);
     }
         
     @Override
@@ -460,7 +462,7 @@ public abstract class AbstractServiceTestImpl<CLT, CPT, REQUEST_TYPE, RESPONSE_T
 
         // Optionally output additional data about list members for debugging.
         boolean iterateThroughList = true;
-        if (iterateThroughList && logger.isDebugEnabled()) {
+        if (iterateThroughList && logger.isTraceEnabled()) {
             printList(testName, list);
         }
     }
index 842e851715c655d7874367cd77359ab0e7ab47f5..fbce0537fb013df653dccecb6b63971ff2d46d7b 100644 (file)
@@ -28,6 +28,8 @@ package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
+
 // FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
 
 /**
@@ -36,7 +38,7 @@ import javax.ws.rs.core.Response;
  * $LastChangedRevision: $
  * $LastChangedDate: $
  */
-public class CollectionObjectClient extends AbstractCommonListPoxServiceClientImpl<CollectionObjectProxy> {
+public class CollectionObjectClient extends AbstractCommonListPoxServiceClientImpl<CollectionObjectProxy, CollectionobjectsCommon> {
 
     public static final String SERVICE_NAME = "collectionobjects";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
index f6b080220f49c21a27bab5b485d13ac7a1c71841..9a18c008a81b7818feb43550a9c2274542025844 100644 (file)
@@ -32,6 +32,7 @@ import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 
 import org.collectionspace.authentication.spi.AuthNContext;
+import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.client.IClientQueryParams;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.workflow.WorkflowClient;
@@ -94,6 +95,8 @@ public abstract class AbstractServiceContextImpl<IT, OT>
     private String overrideDocumentType = null;
     /** The val handlers. */
     private List<ValidatorHandler<IT, OT>> valHandlers = null;
+    /** The authority client -use for shared authority server */
+    private AuthorityClient authorityClient = null;
     /** The doc handler. */
     private DocumentHandler docHandler = null;
     /** security context */
@@ -623,6 +626,32 @@ public abstract class AbstractServiceContextImpl<IT, OT>
         return valHandlers;
     }
     
+    @Override
+    public AuthorityClient getAuthorityClient() throws Exception {
+       AuthorityClient result = authorityClient;
+       
+        if (authorityClient == null) {
+               String authorityClientClazz = getServiceBinding().getClientHandler();
+               ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+               authorityClientClazz = authorityClientClazz.trim();
+               try {
+                   Class<?> c = tccl.loadClass(authorityClientClazz);
+                   if (AuthorityClient.class.isAssignableFrom(c)) {
+                       result = authorityClient = ((AuthorityClient) c.newInstance());
+                   } else {
+                       logger.error(String.format("The service binding clientHandler class '%s' for '%s' service was not of type AuthorityClient.",
+                                       authorityClientClazz, this.getServiceName()));
+                   }
+               } catch (ClassNotFoundException e) {
+                       String msg = String.format("Missing document validation handler: '%s'.", authorityClientClazz);
+                       logger.warn(msg);
+                       logger.trace(msg, e);
+               }
+        }
+        
+        return result;
+    }    
+    
     @Override
     public void addValidatorHandler(ValidatorHandler<IT, OT> validator) throws Exception {
         if (valHandlers == null) {
index 552732f566d803977272bcdd8c407e83e3fd22dc..241206a364b56e7a2c14c614fb591769fb242aca 100644 (file)
@@ -29,6 +29,7 @@ import java.util.Map;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.UriInfo;
 
+import org.collectionspace.services.client.AuthorityClient;
 import org.collectionspace.services.common.ResourceMap;
 import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.ValidatorHandler;
@@ -351,6 +352,8 @@ public interface ServiceContext<IT, OT> {
        public RepositoryDomainType getRepositoryDomain();
 
        public void setRepositoryDomain(RepositoryDomainType repositoryDomain);
+
+       public AuthorityClient getAuthorityClient() throws Exception;
 }
 
 
index 55f2cafb30d8acfc0a12bcf5fa36b04ab21671a2..56368f4f6a9d6c465c5e05f535e71d10c8b70545 100644 (file)
@@ -33,6 +33,8 @@ 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.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -160,6 +162,10 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
             case DELETE:
                 validate(action);
                 prepareDelete();
+                break;
+                
+            case SYNC:
+                prepareSync();
                 break;
                 
                        case WORKFLOW:
@@ -209,6 +215,14 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
     public void prepareDelete() throws Exception {
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.document.DocumentHandler#prepareDelete()
+     */
+    @Override
+    public void prepareSync() throws Exception {
+       // Do nothing. Subclasses can override if they want/need to.
+    }
+
     /* (non-Javadoc)
      * @see org.collectionspace.services.common.document.DocumentHandler#handle(org.collectionspace.services.common.document.DocumentHandler.Action, org.collectionspace.services.common.document.DocumentWrapper)
      */
@@ -235,6 +249,10 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
                 handleDelete((DocumentWrapper<WT>) wrapDoc);
                 break;
                 
+            case SYNC:
+                handleSync((DocumentWrapper<Specifier>) 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();
@@ -276,8 +294,17 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
      */
     @Override
     public void handleDelete(DocumentWrapper<WT> wrapDoc) throws Exception {
-        
+        // Do nothing. Subclasses can override if they want/need to.
     }
+    
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.document.DocumentHandler#handleDelete(org.collectionspace.services.common.document.DocumentWrapper)
+     */
+    @Override
+    public void handleSync(DocumentWrapper<Specifier> wrapDoc) throws Exception {
+       // Do nothing. Subclasses can override if they want/need to.
+    }
+    
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.common.document.DocumentHandler#complete(org.collectionspace.services.common.document.DocumentHandler.Action, org.collectionspace.services.common.document.DocumentWrapper)
@@ -303,6 +330,10 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
 
             case DELETE:
                 completeDelete((DocumentWrapper<WT>) wrapDoc);
+                break;
+                
+            case SYNC:
+                completeSync((DocumentWrapper<Specifier>) wrapDoc);
                 break;
                 
                        case WORKFLOW:
@@ -352,6 +383,13 @@ public abstract class AbstractDocumentHandlerImpl<T, TL, WT, WTL>
     @Override
     public void completeDelete(DocumentWrapper<WT> wrapDoc) throws Exception {
     }
+    
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.document.DocumentHandler#completeDelete(org.collectionspace.services.common.document.DocumentWrapper)
+     */
+    @Override
+    public void completeSync(DocumentWrapper<Specifier> wrapDoc) throws Exception {
+    }    
 
     /* (non-Javadoc)
      * @see org.collectionspace.services.common.document.DocumentHandler#extractCommonPart(org.collectionspace.services.common.document.DocumentWrapper)
index 4297ad2c6223deb8c52a81d3824f29732ced431e..cf09bc1f0c7b84f79cad372bee76c1863da66263 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Map;
 
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.query.QueryContext;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
 import org.collectionspace.services.lifecycle.Lifecycle;
 import org.collectionspace.services.lifecycle.TransitionDef;
 import org.nuxeo.ecm.core.api.DocumentModel;
@@ -46,7 +47,7 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 public interface DocumentHandler<T, TL, WT, WTL> {
 
     public enum Action {
-        CREATE, GET, GET_ALL, UPDATE, DELETE, WORKFLOW
+        CREATE, GET, GET_ALL, UPDATE, DELETE, WORKFLOW, SYNC
     }
     
     public Lifecycle getLifecycle();
@@ -363,4 +364,24 @@ public interface DocumentHandler<T, TL, WT, WTL> {
      */
     public Map<String,String> getJDBCQueryParams();
 
+    /**
+     * 
+     * @throws Exception
+     */
+       void prepareSync() throws Exception;
+
+       /**
+        * 
+        * @param wrapDoc
+        * @throws Exception
+        */
+       void handleSync(DocumentWrapper<Specifier> wrapDoc) throws Exception;
+
+       /**
+        * 
+        * @param wrapDoc
+        * @throws Exception
+        */
+       void completeSync(DocumentWrapper<Specifier> wrapDoc) throws Exception;
+
 }
index 9df4fbffcc19aee30b5c8bc0454dd54e996c7e59..ffb433a75879e692419f7104df03658d8ac25122 100644 (file)
@@ -24,6 +24,8 @@ import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
 import org.collectionspace.services.common.document.DocumentHandler;
 import org.collectionspace.services.common.document.DocumentNotFoundException;
+import org.collectionspace.services.common.document.TransactionException;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
 import org.collectionspace.services.lifecycle.TransitionDef;
 
 /**
@@ -142,4 +144,11 @@ public interface StorageClient {
     void doWorkflowTransition(ServiceContext ctx, String id, DocumentHandler handler, TransitionDef transitionDef) 
                throws BadRequestException, DocumentNotFoundException, DocumentException;
 
+    /*
+     * Ask a resource to synchronize itself with a shared server resource
+     */
+       void synchronize(ServiceContext ctx, Specifier specifier, DocumentHandler handler)
+                       throws DocumentNotFoundException, TransactionException,
+                       DocumentException;
+
 }
index 9e52abd0adf8b92ea1433e687cb7eb7a23a95b22..ba237810e42a595d03179d3811dfbcdfb895f65a 100644 (file)
@@ -37,7 +37,9 @@ 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.JaxbUtils;
+import org.collectionspace.services.common.document.TransactionException;
 import org.collectionspace.services.common.storage.StorageClient;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
 import org.collectionspace.services.common.context.ServiceContextProperties;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.query.QueryContext;
@@ -593,4 +595,12 @@ public class JpaStorageClientImpl implements StorageClient {
                        DocumentException {
         throw new UnsupportedOperationException();
        }
+
+       @Override
+       public void synchronize(ServiceContext ctx, Specifier specifier,
+                       DocumentHandler handler) throws DocumentNotFoundException,
+                       TransactionException, DocumentException {
+               // TODO Auto-generated method stub
+               // Do nothing. Subclasses can override if they want/need to.
+       }
 }
index 1ac6866b9be663fde06048ab197761329ebabb61..a490e7d2766ef39033cc01172daf8be84178a1eb 100644 (file)
@@ -35,9 +35,10 @@ 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.CoreSession;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.IQueryManager;
 import org.collectionspace.services.client.IRelationsManager;
@@ -80,6 +81,20 @@ import org.collectionspace.services.nuxeo.util.NuxeoUtils;
  */
 public class RefNameServiceUtils {
 
+    public static enum SpecifierForm {
+        CSID, URN_NAME
+    };
+
+    public static class Specifier {
+        public SpecifierForm form;
+        public String value;
+
+        public Specifier(SpecifierForm form, String value) {
+            this.form = form;
+            this.value = value;
+        }
+    }
+
     public static class AuthRefConfigInfo {
 
         public String getQualifiedDisplayName() {
index a2cd09005273a7b575e4543900000ca4d857e7b5..a1c33595a63d67759de8f04915a4abe789d16532 100644 (file)
@@ -53,6 +53,7 @@ import org.collectionspace.services.common.query.QueryContext;
 import org.collectionspace.services.common.repository.RepositoryClient;
 import org.collectionspace.services.common.repository.RepositoryClientFactory;
 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthRefConfigInfo;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
 import org.collectionspace.services.lifecycle.Lifecycle;
 import org.collectionspace.services.lifecycle.State;
 import org.collectionspace.services.lifecycle.StateList;
@@ -203,6 +204,11 @@ public abstract class DocumentModelHandler<T, TL>
     public String getUri(DocumentModel docModel) {
         return getServiceContextPath()+getCsid(docModel);
     }
+    
+    public String getUri(Specifier specifier) {
+        return getServiceContextPath() + specifier.value;
+    }
+    
         
     public RepositoryClient<PoxPayloadIn, PoxPayloadOut> getRepositoryClient(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx) {
         RepositoryClient<PoxPayloadIn, PoxPayloadOut> repositoryClient = 
index 6ba21460f4b0ff348c0fdcae6d95e6afb9007075..fd1b384949ebcb99327119b6cadebfac0092a442 100644 (file)
@@ -62,6 +62,7 @@ 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.common.vocabulary.RefNameServiceUtils.Specifier;
 import org.collectionspace.services.config.tenant.TenantBindingType;
 import org.collectionspace.services.config.tenant.RepositoryDomainType;
 
@@ -256,6 +257,39 @@ public class RepositoryClientImpl implements RepositoryClient<PoxPayloadIn, PoxP
        return result;
     }
     
+    @Override
+    public void synchronize(ServiceContext ctx, Specifier specifier, DocumentHandler handler)
+            throws DocumentNotFoundException, TransactionException, DocumentException {
+
+        if (handler == null) {
+            throw new IllegalArgumentException(
+                    "RepositoryJavaClient.get: handler is missing");
+        }
+
+        CoreSessionInterface repoSession = null;
+        try {
+            handler.prepare(Action.SYNC);
+            repoSession = getRepositorySession(ctx);
+            ((DocumentModelHandler) handler).setRepositorySession(repoSession);
+            DocumentWrapper<Specifier> wrapDoc = new DocumentWrapperImpl<Specifier>(specifier);
+            handler.handle(Action.SYNC, wrapDoc);
+            handler.complete(Action.SYNC, wrapDoc);
+        } catch (IllegalArgumentException iae) {
+            throw iae;
+        } catch (DocumentException de) {
+            throw de;
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception ", e);
+            }
+            throw new NuxeoDocumentException(e);
+        } finally {
+            if (repoSession != null) {
+                releaseRepositorySession(ctx, repoSession);
+            }
+        }
+    }
+    
     /**
      * get document from the Nuxeo repository
      *
index f85a33347973ba3fc3c9e3dfee7216b36786acf9..d7eeb0e9870a98a5207ecc6b7f8a31266ba84bb0 100644 (file)
@@ -40,8 +40,12 @@ import org.collectionspace.services.common.document.DocumentException;
 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.common.vocabulary.RefNameServiceUtils;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier;
+import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.SpecifierForm;
 import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentException;
 import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentFilter;
 import org.dom4j.Document;
 import org.dom4j.io.SAXReader;
 import org.mortbay.log.Log;
@@ -640,7 +644,42 @@ public class NuxeoUtils {
         }
 
         return result;
-    }    
+    }
+    
+    static public DocumentModel getDocFromSpecifier(
+               ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
+               CoreSessionInterface repoSession,
+               String schemaName,
+               Specifier specifier) throws Exception {
+           DocumentModel result = null;
+       
+        if (specifier.form == SpecifierForm.CSID) {
+            result = getDocFromCsid(ctx, repoSession, specifier.value);
+        } else {
+            String whereClause = RefNameServiceUtils.buildWhereForAuthByName(schemaName, specifier.value);
+               QueryContext queryContext = new QueryContext(ctx, whereClause);
+               //
+               // Set of query context using the current service context, but change the document type
+               // to be the base Nuxeo document type so we can look for the document across service workspaces
+               //
+               queryContext.setDocType(NuxeoUtils.BASE_DOCUMENT_TYPE);
+           
+                   DocumentModelList docModelList = null;
+               //
+               // Since we're doing a query, we get back a list so we need to make sure there is only
+               // a single result since CSID values are supposed to be unique.
+               String query = buildNXQLQuery(ctx, queryContext);
+               docModelList = repoSession.query(query);
+               long resultSize = docModelList.totalSize();
+               if (resultSize == 1) {
+                       result = docModelList.get(0);
+               } else if (resultSize > 1) {
+                       throw new DocumentException("Found more than 1 document with CSID = " + specifier.value);
+               }
+        }
+
+        return result;
+    }     
 
     /*
     public static void printDocumentModel(DocumentModel docModel) throws Exception {
index 29b7f199f0dca21609b17671802862fad39d65b2..696ccd7706881de2904d968e05a1bb5f6e0ce1bc 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.conditioncheck.ConditionchecksCommon;
+
 /**
  * ConditioncheckClient.java
  */
-public class ConditioncheckClient extends AbstractCommonListPoxServiceClientImpl<ConditioncheckProxy> {
+public class ConditioncheckClient extends AbstractCommonListPoxServiceClientImpl<ConditioncheckProxy, ConditionchecksCommon> {
 
     public static final String SERVICE_NAME = "conditionchecks";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
index 446d12c3441fa9854dfe0ca7174e406a227a751c..79cbb15dc5ef083e6f6f10fb6650a251a1be6959 100644 (file)
@@ -44,6 +44,7 @@
             <!-- validator handler(s) to be used to validate the content (need to be in classpath) -->
             <!-- validator handler is called for create (POST) and update (PUT) requests only -->
             <xs:element name="validatorHandler" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="clientHandler" type="xs:string" minOccurs="0" maxOccurs="1"/>
             <xs:element name="disableAsserts" type="xs:boolean" minOccurs="0" maxOccurs="1"/>
             <!-- initHandler is a post-init task after the Nuxeo repository is available. -->
             <!-- worked: <xs:element name="initHandler" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>-->
index 00b8ad1c2923799baee7ccbe9a9da3608c6ab866..4b4c01e09e830590af0d200c932d8f96494dfb84 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.conservation.ConservationCommon;
+
 /**
  * ConservationClient.java
  *
@@ -23,7 +25,7 @@ package org.collectionspace.services.client;
  * $LastChangedDate$
  *
  */
-public class ConservationClient extends AbstractCommonListPoxServiceClientImpl<ConservationProxy> {
+public class ConservationClient extends AbstractCommonListPoxServiceClientImpl<ConservationProxy, ConservationCommon> {
 
     public static final String SERVICE_NAME = "conservation";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
index 2d25618ec86671328de680ce2d1e212334c4d173..d9e6488d8979101737c0ec9875ceac122a75e142 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.contact.ContactsCommon;
+
 /**
  * ContactClient.java
  *
@@ -23,7 +25,7 @@ package org.collectionspace.services.client;
  * $LastChangedDate: $
  * 
  */
-public class ContactClient extends AbstractCommonListPoxServiceClientImpl<ContactProxy> {
+public class ContactClient extends AbstractCommonListPoxServiceClientImpl<ContactProxy, ContactsCommon> {
 
     public static final String SERVICE_NAME = "contacts";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
index 3fd48d4b9beef37cf32ad0207ff9aa6269ed36b4..394da1b78b960a0b5f06aaf31f9b33910b27d68f 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.dimension.DimensionsCommon;
+
 /**
  * A DimensionClient.
 
  * @version $Revision:$
  */
-public class DimensionClient extends AbstractCommonListPoxServiceClientImpl<DimensionProxy> {
+public class DimensionClient extends AbstractCommonListPoxServiceClientImpl<DimensionProxy, DimensionsCommon> {
        public static final String SERVICE_NAME = "dimensions";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
index dec1bd05ae523719aa914e7d595af3d785e66419..697f5c0f77a4a7f180150b2739e306f7f119a9bf 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.exhibition.ExhibitionsCommon;
+
 /**
  * ExhibitionClient.java
  */
-public class ExhibitionClient extends AbstractCommonListPoxServiceClientImpl<ExhibitionProxy> {
+public class ExhibitionClient extends AbstractCommonListPoxServiceClientImpl<ExhibitionProxy, ExhibitionsCommon> {
 
     public static final String SERVICE_NAME = "exhibitions";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
index 1c820eef30026c1481a4587a6afe72a6a2459a05..df06571f99f9d41c3a6a4a8175b842de64ab73e2 100644 (file)
@@ -16,6 +16,8 @@
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.group.GroupsCommon;
+
 /**
  * GroupClient.java
  *
@@ -23,7 +25,7 @@ package org.collectionspace.services.client;
  * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
  *
  */
-public class GroupClient extends AbstractCommonListPoxServiceClientImpl<GroupProxy> {
+public class GroupClient extends AbstractCommonListPoxServiceClientImpl<GroupProxy, GroupsCommon> {
        
        public static final String SERVICE_NAME = "groups";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
index 6d167c4c81e561c4682f542566c7dd56ba7fc077..c749880690f3bb107d5aafe05094102b16e4df64 100644 (file)
@@ -42,7 +42,7 @@
         </dependency>
         <dependency>
             <groupId>org.collectionspace.services</groupId>
-            <artifactId>org.collectionspace.services.dimension.client</artifactId> <!-- Dimension instances are used as a unit-tests targets -->
+            <artifactId>org.collectionspace.services.index.jaxb</artifactId>
             <version>${project.version}</version>
         </dependency>
 <!-- External dependencies -->        
diff --git a/services/index/jaxb/.gitignore b/services/index/jaxb/.gitignore
new file mode 100644 (file)
index 0000000..b83d222
--- /dev/null
@@ -0,0 +1 @@
+/target/
index c62d3150160bf35d1082e8440ff26c9d66f83532..e2ed0117b388055ba6d0c4edaf43046970f68d11 100644 (file)
@@ -3,13 +3,12 @@
     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>
-        <artifactId>org.collectionspace.services.index</artifactId>
         <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.index</artifactId>
         <version>4.4-SNAPSHOT</version>
     </parent>
     
     <modelVersion>4.0.0</modelVersion>
-    <groupId>org.collectionspace.services</groupId>
     <artifactId>org.collectionspace.services.index.jaxb</artifactId>
     <name>services.index.jaxb</name>
     
diff --git a/services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexJAXBSchema.java b/services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexJAXBSchema.java
new file mode 100644 (file)
index 0000000..aa05c9a
--- /dev/null
@@ -0,0 +1,9 @@
+/**
+ * 
+ */
+package org.collectionspace.services.index;
+
+public interface IndexJAXBSchema {
+}
+
+
diff --git a/services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexListItemJAXBSchema.java b/services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexListItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..7ed65b9
--- /dev/null
@@ -0,0 +1,4 @@
+package org.collectionspace.services.index;
+
+public interface IndexListItemJAXBSchema {
+}
similarity index 60%
rename from services/jaxb/src/main/resources/index_common.xsd
rename to services/index/jaxb/src/main/resources/indexes-common.xsd
index 981ea41bdccbe78a5a6588e19864935df6fc9324..8f8edbb5260a5c51434d17c36d5acf2317845504 100644 (file)
@@ -7,31 +7,32 @@
     Part    : Common
     Used for: JAXB binding between XML and Java objects
 
-    $LastChangedRevision: 2316 $
-    $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $
+    $LastChangedRevision: 860 $
+    $LastChangedDate: 2009-10-14 14:48:05 -0700 (Wed, 14 Oct 2009) $
 -->
 
 <xs:schema 
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
-  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
-  jaxb:version="1.0" elementFormDefault="unqualified"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"
+  elementFormDefault="unqualified"
   xmlns:ns="http://collectionspace.org/services/index"
   xmlns="http://collectionspace.org/services/index"
   targetNamespace="http://collectionspace.org/services/index"
   version="0.1">
+
 <!--
     Avoid XmlRootElement nightmare:
     See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
--->    
-    <!-- index -->
-    <xs:element name="index_common">
+-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Index+Schema -->    
+    
+    <!-- index  -->
+    <xs:element name="indexes_common">
         <xs:complexType>
             <xs:sequence>
-                <!--  Index Information Group -->
-                <xs:element name="indexPolicy" type="xs:string"/>
+                <xs:element name="csid" type="xs:string" />
             </xs:sequence>
         </xs:complexType>
-    </xs:element>
-        
+    </xs:element>    
 </xs:schema>
 
index da22a260a62bc7ce5855c4a6df37e489cc0f4b1e..6c2cee691e9570bfb61d60e6f5efd4bc19120e9e 100644 (file)
@@ -13,6 +13,7 @@
     <packaging>pom</packaging>
 
     <modules>
+        <module>jaxb</module>
         <module>3rdparty</module>
         <module>client</module>
         <module>service</module>
index af3ab35340262bff2647d03011049c4b8940a586..410bfda2f8007a315e57c4e77c73676b3c7ed87a 100644 (file)
  */
 package org.collectionspace.services.client;
 
+import org.collectionspace.services.intake.IntakesCommon;
+
 /**
  * IntakeClient
  * 
  * $LastChangedRevision: $
  * $LastChangedDate: $
  */
-public class IntakeClient extends AbstractCommonListPoxServiceClientImpl<IntakeProxy> {
+public class IntakeClient extends AbstractCommonListPoxServiceClientImpl<IntakeProxy, IntakesCommon> {
 
     public static final String SERVICE_NAME = "intakes";
     public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
index e756df276c774a15ae66887919be5125b954dc11..0a103d938ff8cdb563493bcc626b57c79f2ac13e 100644 (file)
@@ -28,12 +28,13 @@ package org.collectionspace.services.client;
 
 import javax.ws.rs.core.Response;
 
+import org.collectionspace.services.relation.RelationsCommon;
 import org.collectionspace.services.relation.RelationsCommonList;
 
 /**
  * The Class RelationClient.
  */
-public class RelationClient extends AbstractPoxServiceClientImpl<RelationsCommonList, RelationProxy> {
+public class RelationClient extends AbstractPoxServiceClientImpl<RelationsCommonList, RelationProxy, RelationsCommon> {
        public static final String SERVICE_DOC_TYPE = IRelationsManager.DOC_TYPE; // Used for CMIS queries only -should be the same as what's in the tenant bindings
        public static final String SERVICE_NAME = IRelationsManager.SERVICE_NAME;
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
index 7ca5aaea0ef36ac03ae793bccfd85f4b0cb3855d..da70a638c40351ba1f5a67151cfdebc24075e55f 100644 (file)
@@ -3,4 +3,5 @@ package org.collectionspace.services.vocabulary;
 public interface VocabularyItemJAXBSchema {
     final static String DISPLAY_NAME = "displayName";
     final static String TERM_STATUS = "termStatus";
+    final static String REV = "rev";
 }
\ No newline at end of file
diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyJAXBSchema.java
new file mode 100644 (file)
index 0000000..c7d4079
--- /dev/null
@@ -0,0 +1,5 @@
+package org.collectionspace.services.vocabulary;
+
+public class VocabularyJAXBSchema {
+    final static String REV = "rev";
+}