From 02577ffda3a72bec79c31f599dcc6de2c55b0058 Mon Sep 17 00:00:00 2001 From: remillet Date: Sat, 2 Apr 2016 20:18:19 -0700 Subject: [PATCH] CSPACE-6935: Refactor some of the Java client classes to be more useful for call the Shared Authority Server to sync authority data. --- .../services/client/AcquisitionClient.java | 4 +- .../AuthorityItemListItemJAXBSchema.java | 1 + .../vocabulary/AuthorityJAXBSchema.java | 6 +- .../AuthorityListItemJAXBSchema.java | 1 + services/authority/service/pom.xml | 5 ++ .../common/vocabulary/AuthorityResource.java | 29 +++--- .../nuxeo/AuthorityDocumentModelHandler.java | 88 +++++++++++++++---- .../services/client/BatchClient.java | 4 +- ...bstractCommonListPoxServiceClientImpl.java | 4 +- .../client/AbstractPoxServiceClientImpl.java | 71 ++++++++++++++- .../client/AbstractServiceClientImpl.java | 4 +- .../services/client/AuthorityClientImpl.java | 11 ++- .../client/GenericAuthorityClientImpl.java | 42 +++++++++ .../services/client/index/IndexClient.java | 3 +- .../test/AbstractPoxServiceTestImpl.java | 2 +- .../client/test/AbstractServiceTestImpl.java | 4 +- .../client/CollectionObjectClient.java | 4 +- .../context/AbstractServiceContextImpl.java | 29 ++++++ .../common/context/ServiceContext.java | 3 + .../document/AbstractDocumentHandlerImpl.java | 40 ++++++++- .../common/document/DocumentHandler.java | 23 ++++- .../common/storage/StorageClient.java | 9 ++ .../storage/jpa/JpaStorageClientImpl.java | 10 +++ .../vocabulary/RefNameServiceUtils.java | 17 +++- .../client/java/DocumentModelHandler.java | 6 ++ .../client/java/RepositoryClientImpl.java | 34 +++++++ .../services/nuxeo/util/NuxeoUtils.java | 41 ++++++++- .../services/client/ConditioncheckClient.java | 4 +- .../config/src/main/resources/service.xsd | 1 + .../services/client/ConservationClient.java | 4 +- .../services/client/ContactClient.java | 4 +- .../services/client/DimensionClient.java | 4 +- .../services/client/ExhibitionClient.java | 4 +- .../services/client/GroupClient.java | 4 +- services/index/client/pom.xml | 2 +- services/index/jaxb/.gitignore | 1 + services/index/jaxb/pom.xml | 3 +- .../services/index/IndexJAXBSchema.java | 9 ++ .../index/IndexListItemJAXBSchema.java | 4 + .../src/main/resources/indexes-common.xsd} | 23 ++--- services/index/pom.xml | 1 + .../services/client/IntakeClient.java | 4 +- .../services/client/RelationClient.java | 3 +- .../vocabulary/VocabularyItemJAXBSchema.java | 1 + .../vocabulary/VocabularyJAXBSchema.java | 5 ++ 45 files changed, 493 insertions(+), 83 deletions(-) create mode 100644 services/client/src/main/java/org/collectionspace/services/client/GenericAuthorityClientImpl.java create mode 100644 services/index/jaxb/.gitignore create mode 100644 services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexJAXBSchema.java create mode 100644 services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexListItemJAXBSchema.java rename services/{jaxb/src/main/resources/index_common.xsd => index/jaxb/src/main/resources/indexes-common.xsd} (60%) create mode 100644 services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyJAXBSchema.java diff --git a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java index 52814b637..328e349be 100644 --- a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java +++ b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java @@ -1,11 +1,13 @@ package org.collectionspace.services.client; +import org.collectionspace.services.acquisition.AcquisitionsCommon; + /** * An AcquisitionClient. * @version $Revision:$ */ -public class AcquisitionClient extends AbstractCommonListPoxServiceClientImpl { +public class AcquisitionClient extends AbstractCommonListPoxServiceClientImpl { 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; diff --git a/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityItemListItemJAXBSchema.java b/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityItemListItemJAXBSchema.java index 6814288f6..e12f0b651 100644 --- a/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityItemListItemJAXBSchema.java +++ b/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityItemListItemJAXBSchema.java @@ -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"; } diff --git a/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityJAXBSchema.java b/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityJAXBSchema.java index 77bea4636..d3cfd7127 100644 --- a/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityJAXBSchema.java +++ b/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityJAXBSchema.java @@ -23,14 +23,10 @@ */ 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"; diff --git a/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityListItemJAXBSchema.java b/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityListItemJAXBSchema.java index 2cd5ae704..a4d128096 100644 --- a/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityListItemJAXBSchema.java +++ b/services/authority/jaxb/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityListItemJAXBSchema.java @@ -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"; } diff --git a/services/authority/service/pom.xml b/services/authority/service/pom.xml index 60818cd0b..b59d5606e 100644 --- a/services/authority/service/pom.xml +++ b/services/authority/service/pom.xml @@ -34,6 +34,11 @@ org.collectionspace.services.client ${project.version} + + org.collectionspace.services + org.collectionspace.services.vocabulary.client + ${project.version} + org.collectionspace.services org.collectionspace.services.common diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java index cd67fd3aa..96abf6c08 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java @@ -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 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 @Context Request request, @Context UriInfo ui, @PathParam("csid") String csid) { - boolean result = false; + PoxPayloadOut result = null; Specifier specifier; try { ServiceContext 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(); diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java index fa0a03638..6c0ad81c1 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java @@ -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 this.authorityItemCommonSchemaName = authorityItemCommonSchemaName; } + /** + * The entity type expected from the JAX-RS Response object + */ + public Class 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 wrapDoc) throws Exception { ServiceContext 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; } /* diff --git a/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java b/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java index ee7e28f20..ddd6ec21e 100644 --- a/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java +++ b/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java @@ -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 { +public class BatchClient extends AbstractCommonListPoxServiceClientImpl { 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; diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java index e62fe58ea..30480c35e 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractCommonListPoxServiceClientImpl.java @@ -10,8 +10,8 @@ import org.collectionspace.services.jaxb.AbstractCommonList; * * @param

*/ -public abstract class AbstractCommonListPoxServiceClientImpl

- extends AbstractPoxServiceClientImpl { +public abstract class AbstractCommonListPoxServiceClientImpl

+ extends AbstractPoxServiceClientImpl { // // All clients returning AbstractCommonList types should extend this class. // diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java index 42fdf7e1d..5602c47c2 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractPoxServiceClientImpl.java @@ -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> +public abstract class AbstractPoxServiceClientImpl, CPT> extends AbstractServiceClientImpl implements CollectionSpacePoxClient { @@ -56,5 +57,69 @@ public abstract class AbstractPoxServiceClientImpl 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 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; + } } diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java index 64d8da7a8..64c948d1c 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java @@ -188,7 +188,7 @@ public abstract class AbstractServiceClientImpl - extends AbstractPoxServiceClientImpl + extends AbstractPoxServiceClientImpl implements AuthorityClient { 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 index 000000000..048b78607 --- /dev/null +++ b/services/client/src/main/java/org/collectionspace/services/client/GenericAuthorityClientImpl.java @@ -0,0 +1,42 @@ +package org.collectionspace.services.client; + +public class GenericAuthorityClientImpl extends + AuthorityClientImpl { + + @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 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; + } + +} diff --git a/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java b/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java index 68f2570f6..689618ca5 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java @@ -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 { +public class IndexClient extends AbstractCommonListPoxServiceClientImpl { 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; diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java index c19f9de7e..362b31ccc 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/test/AbstractPoxServiceTestImpl.java @@ -35,7 +35,7 @@ public abstract class AbstractPoxServiceTestImpl { +public class CollectionObjectClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "collectionobjects"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java b/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java index f6b080220..9a18c008a 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/AbstractServiceContextImpl.java @@ -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 private String overrideDocumentType = null; /** The val handlers. */ private List> 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 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 validator) throws Exception { if (valHandlers == null) { diff --git a/services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java b/services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java index 552732f56..241206a36 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/ServiceContext.java @@ -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 { public RepositoryDomainType getRepositoryDomain(); public void setRepositoryDomain(RepositoryDomainType repositoryDomain); + + public AuthorityClient getAuthorityClient() throws Exception; } diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java b/services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java index 55f2cafb3..56368f4f6 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/AbstractDocumentHandlerImpl.java @@ -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 case DELETE: validate(action); prepareDelete(); + break; + + case SYNC: + prepareSync(); break; case WORKFLOW: @@ -209,6 +215,14 @@ public abstract class AbstractDocumentHandlerImpl 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 handleDelete((DocumentWrapper) wrapDoc); break; + case SYNC: + handleSync((DocumentWrapper) 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 */ @Override public void handleDelete(DocumentWrapper 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 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 case DELETE: completeDelete((DocumentWrapper) wrapDoc); + break; + + case SYNC: + completeSync((DocumentWrapper) wrapDoc); break; case WORKFLOW: @@ -352,6 +383,13 @@ public abstract class AbstractDocumentHandlerImpl @Override public void completeDelete(DocumentWrapper wrapDoc) throws Exception { } + + /* (non-Javadoc) + * @see org.collectionspace.services.common.document.DocumentHandler#completeDelete(org.collectionspace.services.common.document.DocumentWrapper) + */ + @Override + public void completeSync(DocumentWrapper wrapDoc) throws Exception { + } /* (non-Javadoc) * @see org.collectionspace.services.common.document.DocumentHandler#extractCommonPart(org.collectionspace.services.common.document.DocumentWrapper) diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentHandler.java b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentHandler.java index 4297ad2c6..cf09bc1f0 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentHandler.java @@ -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 { 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 { */ public Map getJDBCQueryParams(); + /** + * + * @throws Exception + */ + void prepareSync() throws Exception; + + /** + * + * @param wrapDoc + * @throws Exception + */ + void handleSync(DocumentWrapper wrapDoc) throws Exception; + + /** + * + * @param wrapDoc + * @throws Exception + */ + void completeSync(DocumentWrapper wrapDoc) throws Exception; + } diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/StorageClient.java b/services/common/src/main/java/org/collectionspace/services/common/storage/StorageClient.java index 9df4fbffc..ffb433a75 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/StorageClient.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/StorageClient.java @@ -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; + } diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java index 9e52abd0a..ba237810e 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java @@ -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. + } } diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java index 1ac6866b9..a490e7d27 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java @@ -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() { diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java index a2cd09005..a1c33595a 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java @@ -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 public String getUri(DocumentModel docModel) { return getServiceContextPath()+getCsid(docModel); } + + public String getUri(Specifier specifier) { + return getServiceContextPath() + specifier.value; + } + public RepositoryClient getRepositoryClient(ServiceContext ctx) { RepositoryClient repositoryClient = diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java index 6ba21460f..fd1b38494 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java @@ -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 wrapDoc = new DocumentWrapperImpl(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 * diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java index f85a33347..d7eeb0e98 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java @@ -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 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 { diff --git a/services/conditioncheck/client/src/main/java/org/collectionspace/services/client/ConditioncheckClient.java b/services/conditioncheck/client/src/main/java/org/collectionspace/services/client/ConditioncheckClient.java index 29b7f199f..696ccd770 100644 --- a/services/conditioncheck/client/src/main/java/org/collectionspace/services/client/ConditioncheckClient.java +++ b/services/conditioncheck/client/src/main/java/org/collectionspace/services/client/ConditioncheckClient.java @@ -16,10 +16,12 @@ */ package org.collectionspace.services.client; +import org.collectionspace.services.conditioncheck.ConditionchecksCommon; + /** * ConditioncheckClient.java */ -public class ConditioncheckClient extends AbstractCommonListPoxServiceClientImpl { +public class ConditioncheckClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "conditionchecks"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/config/src/main/resources/service.xsd b/services/config/src/main/resources/service.xsd index 446d12c34..79cbb15dc 100644 --- a/services/config/src/main/resources/service.xsd +++ b/services/config/src/main/resources/service.xsd @@ -44,6 +44,7 @@ + diff --git a/services/conservation/client/src/main/java/org/collectionspace/services/client/ConservationClient.java b/services/conservation/client/src/main/java/org/collectionspace/services/client/ConservationClient.java index 00b8ad1c2..4b4c01e09 100644 --- a/services/conservation/client/src/main/java/org/collectionspace/services/client/ConservationClient.java +++ b/services/conservation/client/src/main/java/org/collectionspace/services/client/ConservationClient.java @@ -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 { +public class ConservationClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "conservation"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java index 2d25618ec..d9e6488d8 100644 --- a/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java +++ b/services/contact/client/src/main/java/org/collectionspace/services/client/ContactClient.java @@ -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 { +public class ContactClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "contacts"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java index 3fd48d4b9..394da1b78 100644 --- a/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java +++ b/services/dimension/client/src/main/java/org/collectionspace/services/client/DimensionClient.java @@ -26,12 +26,14 @@ */ package org.collectionspace.services.client; +import org.collectionspace.services.dimension.DimensionsCommon; + /** * A DimensionClient. * @version $Revision:$ */ -public class DimensionClient extends AbstractCommonListPoxServiceClientImpl { +public class DimensionClient extends AbstractCommonListPoxServiceClientImpl { 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; diff --git a/services/exhibition/client/src/main/java/org/collectionspace/services/client/ExhibitionClient.java b/services/exhibition/client/src/main/java/org/collectionspace/services/client/ExhibitionClient.java index dec1bd05a..697f5c0f7 100644 --- a/services/exhibition/client/src/main/java/org/collectionspace/services/client/ExhibitionClient.java +++ b/services/exhibition/client/src/main/java/org/collectionspace/services/client/ExhibitionClient.java @@ -16,10 +16,12 @@ */ package org.collectionspace.services.client; +import org.collectionspace.services.exhibition.ExhibitionsCommon; + /** * ExhibitionClient.java */ -public class ExhibitionClient extends AbstractCommonListPoxServiceClientImpl { +public class ExhibitionClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "exhibitions"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/group/client/src/main/java/org/collectionspace/services/client/GroupClient.java b/services/group/client/src/main/java/org/collectionspace/services/client/GroupClient.java index 1c820eef3..df06571f9 100644 --- a/services/group/client/src/main/java/org/collectionspace/services/client/GroupClient.java +++ b/services/group/client/src/main/java/org/collectionspace/services/client/GroupClient.java @@ -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 { +public class GroupClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "groups"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/index/client/pom.xml b/services/index/client/pom.xml index 6d167c4c8..c74988069 100644 --- a/services/index/client/pom.xml +++ b/services/index/client/pom.xml @@ -42,7 +42,7 @@ org.collectionspace.services - org.collectionspace.services.dimension.client + org.collectionspace.services.index.jaxb ${project.version} diff --git a/services/index/jaxb/.gitignore b/services/index/jaxb/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/services/index/jaxb/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/services/index/jaxb/pom.xml b/services/index/jaxb/pom.xml index c62d31501..e2ed0117b 100644 --- a/services/index/jaxb/pom.xml +++ b/services/index/jaxb/pom.xml @@ -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"> - org.collectionspace.services.index org.collectionspace.services + org.collectionspace.services.index 4.4-SNAPSHOT 4.0.0 - org.collectionspace.services org.collectionspace.services.index.jaxb services.index.jaxb 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 index 000000000..aa05c9a5b --- /dev/null +++ b/services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexJAXBSchema.java @@ -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 index 000000000..7ed65b9a5 --- /dev/null +++ b/services/index/jaxb/src/main/java/org/collectionspace/services/index/IndexListItemJAXBSchema.java @@ -0,0 +1,4 @@ +package org.collectionspace.services.index; + +public interface IndexListItemJAXBSchema { +} diff --git a/services/jaxb/src/main/resources/index_common.xsd b/services/index/jaxb/src/main/resources/indexes-common.xsd 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 981ea41bd..8f8edbb52 100644 --- a/services/jaxb/src/main/resources/index_common.xsd +++ b/services/index/jaxb/src/main/resources/indexes-common.xsd @@ -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) $ --> + - - +--> + + + + - - + - - + diff --git a/services/index/pom.xml b/services/index/pom.xml index da22a260a..6c2cee691 100644 --- a/services/index/pom.xml +++ b/services/index/pom.xml @@ -13,6 +13,7 @@ pom + jaxb 3rdparty client service diff --git a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java index af3ab3534..410bfda2f 100644 --- a/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java +++ b/services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java @@ -22,13 +22,15 @@ */ package org.collectionspace.services.client; +import org.collectionspace.services.intake.IntakesCommon; + /** * IntakeClient * * $LastChangedRevision: $ * $LastChangedDate: $ */ -public class IntakeClient extends AbstractCommonListPoxServiceClientImpl { +public class IntakeClient extends AbstractCommonListPoxServiceClientImpl { public static final String SERVICE_NAME = "intakes"; public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; diff --git a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java index e756df276..0a103d938 100644 --- a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java +++ b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java @@ -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 { +public class RelationClient extends AbstractPoxServiceClientImpl { 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; diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyItemJAXBSchema.java index 7ca5aaea0..da70a638c 100644 --- a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyItemJAXBSchema.java +++ b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyItemJAXBSchema.java @@ -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 index 000000000..c7d407938 --- /dev/null +++ b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/vocabulary/VocabularyJAXBSchema.java @@ -0,0 +1,5 @@ +package org.collectionspace.services.vocabulary; + +public class VocabularyJAXBSchema { + final static String REV = "rev"; +} -- 2.47.3