From: Richard Millet Date: Thu, 10 Sep 2009 21:37:07 +0000 (+0000) Subject: CSPACE-432: Create stubbed Acquisition service modules and build files. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=7c4e36212e23b801ee949371bd966a69fa55bd2e;p=tmp%2Fjakarta-migration.git CSPACE-432: Create stubbed Acquisition service modules and build files. --- diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 422db5f4d..c86a2584d 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -37,6 +37,11 @@ org.collectionspace.services.intake.service 1.0 + + org.collectionspace.services + org.collectionspace.services.acquisition.service + 1.0 + org.collectionspace.services org.collectionspace.services.relation.service diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index 65c4b42b6..7f77d8e3f 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -5,6 +5,7 @@ import org.collectionspace.services.id.IDResource; import org.collectionspace.services.intake.IntakeResource; //import org.collectionspace.services.relation.RelationResource; import org.collectionspace.services.relation.NewRelationResource; +import org.collectionspace.services.acquisition.AcquisitionResource; import org.collectionspace.services.query.QueryResource; import javax.ws.rs.core.Application; @@ -21,6 +22,7 @@ public class CollectionSpaceJaxRsApplication extends Application { singletons.add(new CollectionObjectResource()); singletons.add(new IDResource()); singletons.add(new IntakeResource()); + singletons.add(new AcquisitionResource()); // singletons.add(new RelationResource()); singletons.add(new NewRelationResource()); singletons.add(new QueryResource()); diff --git a/services/acquisition/.classpath b/services/acquisition/.classpath new file mode 100644 index 000000000..046988541 --- /dev/null +++ b/services/acquisition/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/services/acquisition/.project b/services/acquisition/.project new file mode 100644 index 000000000..e347cf54a --- /dev/null +++ b/services/acquisition/.project @@ -0,0 +1,23 @@ + + + acquisition-service + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/acquisition/.settings/org.eclipse.jdt.core.prefs b/services/acquisition/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..b634d9cad --- /dev/null +++ b/services/acquisition/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +#Thu Apr 30 16:21:29 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/services/acquisition/.settings/org.maven.ide.eclipse.prefs b/services/acquisition/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..aa95f8a57 --- /dev/null +++ b/services/acquisition/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Thu Apr 30 16:20:57 PDT 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/services/acquisition/3rdparty/.classpath b/services/acquisition/3rdparty/.classpath new file mode 100644 index 000000000..046988541 --- /dev/null +++ b/services/acquisition/3rdparty/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/services/acquisition/3rdparty/.project b/services/acquisition/3rdparty/.project new file mode 100644 index 000000000..f2b6bc160 --- /dev/null +++ b/services/acquisition/3rdparty/.project @@ -0,0 +1,23 @@ + + + org.collectionspace.services.acquisition.3rdparty + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/acquisition/3rdparty/.settings/org.eclipse.jdt.core.prefs b/services/acquisition/3rdparty/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..38fc7a0e5 --- /dev/null +++ b/services/acquisition/3rdparty/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +#Mon Jun 29 14:28:26 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/services/acquisition/3rdparty/.settings/org.maven.ide.eclipse.prefs b/services/acquisition/3rdparty/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..0f12a7ea5 --- /dev/null +++ b/services/acquisition/3rdparty/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Mon Jun 29 14:27:15 PDT 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/services/acquisition/3rdparty/build.xml b/services/acquisition/3rdparty/build.xml new file mode 100644 index 000000000..31c5b8b6c --- /dev/null +++ b/services/acquisition/3rdparty/build.xml @@ -0,0 +1,125 @@ + + + + acquisition service 3rdparty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.classpath b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.classpath new file mode 100644 index 000000000..68e178d98 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.project b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.project new file mode 100644 index 000000000..8388db443 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.project @@ -0,0 +1,23 @@ + + + nuxeo-platform-collectionspace + Nuxeo Enterprise Platform: CS extensions + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.maven.ide.eclipse.maven2Nature + org.eclipse.jdt.core.javanature + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.settings/org.eclipse.jdt.core.prefs b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..9f55372ab --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +#Wed Aug 26 09:55:09 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.settings/org.maven.ide.eclipse.prefs b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..f18b0e3ae --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Wed Apr 08 13:24:46 PDT 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/build.xml b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/build.xml new file mode 100644 index 000000000..07ad941c0 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/build.xml @@ -0,0 +1,130 @@ + + + + acquisition nuxeo document type + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/pom.xml b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/pom.xml new file mode 100644 index 000000000..260d49250 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/pom.xml @@ -0,0 +1,19 @@ + + + org.collectionspace.services + nuxeo-platform-collectionspace + 1.0 + + + 4.0.0 + org.collectionspace.services + 1.0 + org.collectionspace.services.acquisition.3rdparty.nuxeo + jar + services.acquisition.3rdparty.nuxeo + + Acquisition Nuxeo Document Type + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/META-INF/MANIFEST.MF b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..15b4aa983 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 1 +Bundle-Name: NuxeoCS +Bundle-SymbolicName: org.collectionspace.acquisition;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Bundle-Vendor: Nuxeo +Require-Bundle: org.nuxeo.runtime, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.core, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.platform.types.api, + org.nuxeo.ecm.platform.versioning.api, + org.nuxeo.ecm.platform.ui, + org.nuxeo.ecm.platform.forms.layout.client, + org.nuxeo.ecm.platform.publishing.api, + org.nuxeo.ecm.platform.ws +Provide-Package: org.collectionspace.acquisition +Nuxeo-Component: OSGI-INF/core-types-contrib.xml, + OSGI-INF/ecm-types-contrib.xml, + OSGI-INF/layouts-contrib.xml + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/core-types-contrib.xml new file mode 100644 index 000000000..3554f7d58 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/core-types-contrib.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/deployment-fragment.xml new file mode 100644 index 000000000..88b94ffd1 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/deployment-fragment.xml @@ -0,0 +1,408 @@ + + + + + + ${bundle.fileName} + + + + + nuxeo.war + /nuxeo + + + + + + + + + + + + Seam Context Filter + /ws/FileManageWS + + + + Seam Context Filter + /DocumentManagerWS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #{currentServerLocation.name}/#{currentTabAction.label} + + + + Create new document in #{currentDocument.name} + + + + Create new document in #{currentDocument.name} + + + + breadcrumb=command.user_dashboard + + + + breadcrumb=command.manageMembers + + + + breadcrumb=command.manageMembers + + + + breadcrumb=title.vocabularies + + + + breadcrumb=command.advancedSearch + + + + + + en + en_GB + en_US + fr + de + es + it + ar + ru + ja + vn + + + messages + + + + config/addWorkspace.jpdl.xml + + + + + + generic_error_page + /generic_error_page.xhtml + + + + + generic_message_page + /generic_message_page.xhtml + + + + + home + /nxstartup.xhtml + + + + + user_login + /login.xhtml + + + + + user_logout + /logout.xhtml + + + + + view_servers + /view_servers.xhtml + + + + + + + view_domains + /view_domains.xhtml + + + + + select_document_type + /select_document_type.xhtml + + + + + create_document + /create_document.xhtml + + + + + edit_document + /edit_document.xhtml + + + + + view_documents + /view_documents.xhtml + + + + + create_file + /create_file.xhtml + + + + + create_workspace_wizard + /createWorkspaceWizard.xhtml + + + + + send_email + /document_email.xhtml + + + + + + view_workspaces + /view_workspaces.xhtml + + + + + + create_domain + /create_domain.xhtml + + + + + + edit_domain + /edit_domain.xhtml + + + + + + create_workspace + /create_workspace.xhtml + + + + + + edit_workspace + /edit_workspace.xhtml + + + + + + + members_management + /members_management.xhtml + + + + + view_users + /view_users.xhtml + + + + + view_many_users + /view_many_users.xhtml + + + + + edit_user + /edit_user.xhtml + + + + + edit_user_password + /edit_user_password.xhtml + + + + + view_user + /view_user.xhtml + + + + + create_user + /create_user.xhtml + + + + + view_groups + /view_groups.xhtml + + + + + view_group + /view_group.xhtml + + + + + edit_group + /edit_group.xhtml + + + + + create_group + /create_group.xhtml + + + + + view_vocabularies + /view_vocabularies.xhtml + + + + + view_vocabulary + /view_vocabulary.xhtml + + + + + + + search_form + /search/search_form.xhtml + + + + + search_results_nxql + /search/search_results_nxql.xhtml + + + + + search_results_advanced + + /search/search_results_advanced.xhtml + + + + + + search_results_simple + /search/search_results_simple.xhtml + + + + + + + clipboard + /incl/clipboard.xhtml + + + + + user_dashboard + /user_dashboard.xhtml + + + + + select_workspace_template + /select_workspace_template.xhtml + + + + + pdf_generation_error + /pdf_generation_error.xhtml + + + + + mass_edit + /massedit_documents.xhtml + + + + + mass_edit_confirm + /massedit_documents_preview.xhtml + + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/ecm-types-contrib.xml new file mode 100644 index 000000000..77fb0fa70 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/ecm-types-contrib.xml @@ -0,0 +1,28 @@ + + + + + + + view_documents + + + heading + acquisition + + + + + + Acquisition + + + + + + Acquisition + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/layouts-contrib.xml new file mode 100644 index 000000000..82738e962 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/OSGI-INF/layouts-contrib.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + accessiondate + + + + + + + true + + accessiondate + + + dataInputText + + + + + + diff --git a/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/schemas/acquisition.xsd b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/schemas/acquisition.xsd new file mode 100644 index 000000000..c8442d1a2 --- /dev/null +++ b/services/acquisition/3rdparty/nuxeo-platform-cs-acquisition/src/main/resources/schemas/acquisition.xsd @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/services/acquisition/3rdparty/pom.xml b/services/acquisition/3rdparty/pom.xml new file mode 100644 index 000000000..77e456623 --- /dev/null +++ b/services/acquisition/3rdparty/pom.xml @@ -0,0 +1,23 @@ + + + + org.collectionspace.services.acquisition + org.collectionspace.services + 1.0 + + 4.0.0 + org.collectionspace.services + 1.0 + org.collectionspace.services.acquisition.3rdparty + pom + services.acquisition.3rdparty + + 3rd party build for acquisition service + + + + nuxeo-platform-cs-acquisition + + diff --git a/services/acquisition/build.xml b/services/acquisition/build.xml new file mode 100644 index 000000000..319f7961d --- /dev/null +++ b/services/acquisition/build.xml @@ -0,0 +1,122 @@ + + + + acquisition service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/acquisition/client/.classpath b/services/acquisition/client/.classpath new file mode 100644 index 000000000..425cd1620 --- /dev/null +++ b/services/acquisition/client/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/services/acquisition/client/.project b/services/acquisition/client/.project new file mode 100644 index 000000000..1f677d8f3 --- /dev/null +++ b/services/acquisition/client/.project @@ -0,0 +1,23 @@ + + + javaee-acquisition-client + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/acquisition/client/.settings/org.eclipse.jdt.core.prefs b/services/acquisition/client/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..0899025a2 --- /dev/null +++ b/services/acquisition/client/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Mar 26 13:03:04 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/services/acquisition/client/.settings/org.maven.ide.eclipse.prefs b/services/acquisition/client/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..c6e4123cd --- /dev/null +++ b/services/acquisition/client/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Thu Feb 26 16:30:28 PST 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/services/acquisition/client/pom.xml b/services/acquisition/client/pom.xml new file mode 100644 index 000000000..03838a914 --- /dev/null +++ b/services/acquisition/client/pom.xml @@ -0,0 +1,111 @@ + + + + + org.collectionspace.services.acquisition + org.collectionspace.services + 1.0 + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.acquisition.client + 1.0 + services.acquisition.client + + + + + org.slf4j + slf4j-api + test + + + org.slf4j + slf4j-log4j12 + test + + + org.collectionspace.services + org.collectionspace.services.acquisition.jaxb + 1.0 + + + org.collectionspace.services + org.collectionspace.services.client + 1.0 + + + + org.testng + testng + 5.6 + + + org.slf4j + slf4j-api + 1.5.2 + + + org.slf4j + slf4j-log4j12 + 1.5.2 + + + org.jboss.resteasy + resteasy-jaxrs + 1.0.2.GA + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + 1.0.2.GA + + + org.jboss.resteasy + resteasy-multipart-provider + 1.0.2.GA + + + commons-httpclient + commons-httpclient + 3.1 + + + + + collectionspace-services-acquisition-client + + + org.apache.maven.plugins + maven-surefire-plugin + + + + log4j.configuration + file:target/test-classes/log4j.properties + + + + + + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + + + + + + 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 new file mode 100644 index 000000000..e4092c686 --- /dev/null +++ b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionClient.java @@ -0,0 +1,94 @@ +package org.collectionspace.services.client; + +import javax.ws.rs.core.Response; + +import org.collectionspace.services.acquisition.Acquisition; +import org.collectionspace.services.acquisition.AcquisitionList; + +import org.jboss.resteasy.client.ProxyFactory; +import org.jboss.resteasy.plugins.providers.RegisterBuiltin; +import org.jboss.resteasy.client.ClientResponse; +import org.jboss.resteasy.spi.ResteasyProviderFactory; + +/** + * An AcquisitionClient. + + * @version $Revision:$ + */ +public class AcquisitionClient extends BaseServiceClient { + + + /** + * + */ + private static final AcquisitionClient instance = new AcquisitionClient(); + /** + * + */ + private AcquisitionProxy acquisitionProxy; + + /** + * + * Default constructor for IntakeClient class. + * + */ + public AcquisitionClient() { + ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); + RegisterBuiltin.register(factory); + acquisitionProxy = ProxyFactory.create(AcquisitionProxy.class, getBaseURL()); + } + + /** + * FIXME Comment this + * + * @return + */ + public static AcquisitionClient getInstance() { + return instance; + } + + /** + * @return + * @see org.collectionspace.hello.client.IntakeProxy#getIntake() + */ + public ClientResponse readList() { + return acquisitionProxy.readList(); + } + + /** + * @param csid + * @return + * @see org.collectionspace.hello.client.IntakeProxy#getIntake(java.lang.String) + */ + public ClientResponse read(String csid) { + return acquisitionProxy.read(csid); + } + + /** + * @param intake + * @return + * @see org.collectionspace.hello.client.IntakeProxy#createIntake(org.collectionspace.hello.Intake) + */ + public ClientResponse create(Acquisition intake) { + return acquisitionProxy.create(intake); + } + + /** + * @param csid + * @param intake + * @return + * @see org.collectionspace.hello.client.IntakeProxy#updateIntake(java.lang.Long, org.collectionspace.hello.Intake) + */ + public ClientResponse update(String csid, Acquisition intake) { + return acquisitionProxy.update(csid, intake); + } + + /** + * @param csid + * @return + * @see org.collectionspace.hello.client.IntakeProxy#deleteIntake(java.lang.Long) + */ + public ClientResponse delete(String csid) { + return acquisitionProxy.delete(csid); + } +} diff --git a/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java new file mode 100644 index 000000000..b74f11241 --- /dev/null +++ b/services/acquisition/client/src/main/java/org/collectionspace/services/client/AcquisitionProxy.java @@ -0,0 +1,46 @@ +package org.collectionspace.services.client; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; + +import org.collectionspace.services.acquisition.Acquisition; +import org.collectionspace.services.acquisition.AcquisitionList; +import org.jboss.resteasy.client.ClientResponse; + +/** + * @version $Revision:$ + */ +@Path("/acquisitions/") +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public interface AcquisitionProxy { + + @GET + ClientResponse readList(); + + //(C)reate + @POST + ClientResponse create(Acquisition co); + + //(R)ead + @GET + @Path("/{csid}") + ClientResponse read(@PathParam("csid") String csid); + + //(U)pdate + @PUT + @Path("/{csid}") + ClientResponse update(@PathParam("csid") String csid, Acquisition co); + + //(D)elete + @DELETE + @Path("/{csid}") + ClientResponse delete(@PathParam("csid") String csid); +} \ No newline at end of file diff --git a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java new file mode 100644 index 000000000..fd750835c --- /dev/null +++ b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionServiceTest.java @@ -0,0 +1,471 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + package org.collectionspace.services.client.test; + +import java.util.List; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.collectionspace.services.client.AcquisitionClient; +import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.acquisition.Acquisition; +import org.collectionspace.services.acquisition.AcquisitionList; + +import org.jboss.resteasy.client.ClientResponse; + +import org.testng.Assert; +import org.testng.annotations.Test; + +/** + * AcquisitionServiceTest, carries out tests against a + * deployed and running Acquisition Service. + * + * $LastChangedRevision: 621 $ + * $LastChangedDate: 2009-09-02 16:49:01 -0700 (Wed, 02 Sep 2009) $ + */ +public class AcquisitionServiceTest extends AbstractServiceTest { + + // Instance variables specific to this test. + private AcquisitionClient client = new AcquisitionClient(); + final String SERVICE_PATH_COMPONENT = "acquisitions"; + private String knownResourceId = null; + + + // --------------------------------------------------------------- + // CRUD tests : CREATE tests + // --------------------------------------------------------------- + + // Success outcomes + + @Override + @Test + public void create() { + + // Perform setup, such as initializing the type of service request + // (e.g. CREATE, DELETE), its valid and expected status codes, and + // its associated HTTP method name (e.g. POST, DELETE). + setupCreate(); + + // Submit the request to the service and store the response. + String identifier = createIdentifier(); + Acquisition acquisition = createAcquisitionInstance(identifier); + ClientResponse res = client.create(acquisition); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + // + // Specifically: + // Does it fall within the set of valid status codes? + // Does it exactly match the expected status code? + verbose("create: status = " + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + + // Store the ID returned from this create operation for + // additional tests below. + knownResourceId = extractId(res); + } + + @Override + @Test(dependsOnMethods = {"create"}) + public void createList() { + for(int i = 0; i < 3; i++){ + create(); + } + } + + // Failure outcomes + + @Override + @Test(dependsOnMethods = {"create"}, + expectedExceptions = IllegalArgumentException.class) + public void createNull() { + ClientResponse res = client.create(null); + } + + // Placeholders until the two tests below can be uncommented. + // See Issue CSPACE-401. + public void createWithMalformedXml() {} + public void createWithWrongXmlSchema() {} + +/* + @Override + @Test(dependsOnMethods = {"create", "testSubmitRequest"}) + public void createWithMalformedXml() { + + // Perform setup. + setupCreateWithMalformedXml(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getServiceRootURL(); + final String entity = MALFORMED_XML_DATA; // Constant from base class. + int statusCode = submitRequest(method, url, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("createWithMalformedXml url=" + url + " status=" + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + @Override + @Test(dependsOnMethods = {"create", "testSubmitRequest"}) + public void createWithWrongXmlSchema() { + + // Perform setup. + setupCreateWithWrongXmlSchema(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getServiceRootURL(); + final String entity = WRONG_XML_SCHEMA_DATA; + int statusCode = submitRequest(method, url, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("createWithWrongSchema url=" + url + " status=" + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } +*/ + + // --------------------------------------------------------------- + // CRUD tests : READ tests + // --------------------------------------------------------------- + + // Success outcomes + + @Override + @Test(dependsOnMethods = {"create"}) + public void read() { + + // Perform setup. + setupRead(); + + // Submit the request to the service and store the response. + ClientResponse res = client.read(knownResourceId); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("read: status = " + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + // Failure outcomes + + @Override + @Test(dependsOnMethods = {"read"}) + public void readNonExistent() { + + // Perform setup. + setupReadNonExistent(); + + // Submit the request to the service and store the response. + ClientResponse res = client.read(NON_EXISTENT_ID); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("readNonExistent: status = " + res.getStatus()); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + + // --------------------------------------------------------------- + // CRUD tests : READ_LIST tests + // --------------------------------------------------------------- + + // Success outcomes + + @Override + @Test(dependsOnMethods = {"createList"}) + public void readList() { + + // Perform setup. + setupReadList(); + + // Submit the request to the service and store the response. + ClientResponse res = client.readList(); + AcquisitionList list = res.getEntity(); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("readList: status = " + res.getStatus()); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + + // Optionally output additional data about list members for debugging. + boolean iterateThroughList = false; + if (iterateThroughList && logger.isDebugEnabled()) { + List items = + list.getAcquisitionListItem(); + int i = 0; + for(AcquisitionList.AcquisitionListItem item : items){ + verbose("readList: list-item[" + i + "] csid=" + + item.getCsid()); + verbose("readList: list-item[" + i + "] objectNumber=" + + item.getAccessiondate()); + verbose("readList: list-item[" + i + "] URI=" + + item.getUri()); + i++; + } + } + + } + + // Failure outcomes + + // None at present. + + + // --------------------------------------------------------------- + // CRUD tests : UPDATE tests + // --------------------------------------------------------------- + + // Success outcomes + + @Override + @Test(dependsOnMethods = {"create"}) + public void update() { + + // Perform setup. + setupUpdate(); + + // Retrieve an existing resource that we can update. + ClientResponse res = client.read(knownResourceId); + verbose("read: status = " + res.getStatus()); + Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE); + Acquisition acquisition = res.getEntity(); + verbose("Got object to update with ID: " + knownResourceId, + acquisition, Acquisition.class); + + // Update the content of this resource. + acquisition.setAccessiondate("updated-" + acquisition.getAccessiondate()); +// acquisition.setEntryDate("updated-" + acquisition.getEntryDate()); + + // Submit the request to the service and store the response. + res = client.update(knownResourceId, acquisition); + int statusCode = res.getStatus(); + Acquisition updatedObject = res.getEntity(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("update: status = " + res.getStatus()); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + + // Check the contents of the response: does it match + // what was submitted? + verbose("update: ", updatedObject, Acquisition.class); + Assert.assertEquals(updatedObject.getAccessiondate(), + acquisition.getAccessiondate(), + "Data in updated object did not match submitted data."); + } + + // Failure outcomes + + // Placeholders until the two tests below can be uncommented. + // See Issue CSPACE-401. + public void updateWithMalformedXml() {} + public void updateWithWrongXmlSchema() {} + +/* + @Override + @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"}) + public void updateWithMalformedXml() { + + // Perform setup. + setupUpdateWithMalformedXml(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getResourceURL(knownResourceId); + final String entity = MALFORMED_XML_DATA; + int statusCode = submitRequest(method, url, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("updateWithMalformedXml: url=" + url + " status=" + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + @Override + @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"}) + public void updateWithWrongXmlSchema() { + + // Perform setup. + setupUpdateWithWrongXmlSchema(); + + // Submit the request to the service and store the response. + String method = REQUEST_TYPE.httpMethodName(); + String url = getResourceURL(knownResourceId); + final String entity = WRONG_XML_SCHEMA_DATA; + int statusCode = submitRequest(method, url, entity); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("updateWithWrongSchema: url=" + url + " status=" + statusCode); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } +*/ + + @Override + @Test(dependsOnMethods = {"update", "testSubmitRequest"}) + public void updateNonExistent() { + + // Perform setup. + setupUpdateNonExistent(); + + // Submit the request to the service and store the response. + // Note: The ID used in this 'create' call may be arbitrary. + // The only relevant ID may be the one used in update(), below. + Acquisition acquisition = createAcquisitionInstance(NON_EXISTENT_ID); + ClientResponse res = + client.update(NON_EXISTENT_ID, acquisition); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("updateNonExistent: status = " + res.getStatus()); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + // --------------------------------------------------------------- + // CRUD tests : DELETE tests + // --------------------------------------------------------------- + + // Success outcomes + + @Override + @Test(dependsOnMethods = + {"create", "read", "update"}) + public void delete() { + + // Perform setup. + setupDelete(); + + // Submit the request to the service and store the response. + ClientResponse res = client.delete(knownResourceId); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("delete: status = " + res.getStatus()); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + // Failure outcomes + + @Override + @Test(dependsOnMethods = {"delete"}) + public void deleteNonExistent() { + + // Perform setup. + setupDeleteNonExistent(); + + // Submit the request to the service and store the response. + ClientResponse res = client.delete(NON_EXISTENT_ID); + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("deleteNonExistent: status = " + res.getStatus()); + Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode), + invalidStatusCodeMessage(REQUEST_TYPE, statusCode)); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + } + + + // --------------------------------------------------------------- + // Utility tests : tests of code used in tests above + // --------------------------------------------------------------- + + /** + * Tests the code for manually submitting data that is used by several + * of the methods above. + */ + @Test(dependsOnMethods = {"create", "read"}) + public void testSubmitRequest() { + + // Expected status code: 200 OK + final int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode(); + + // Submit the request to the service and store the response. + String method = ServiceRequestType.READ.httpMethodName(); + String url = getResourceURL(knownResourceId); + int statusCode = submitRequest(method, url); + + // Check the status code of the response: does it match + // the expected response(s)? + verbose("testSubmitRequest: url=" + url + " status=" + statusCode); + Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE); + + } + + // --------------------------------------------------------------- + // Utility methods used by tests above + // --------------------------------------------------------------- + + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + private Acquisition createAcquisitionInstance(String identifier) { + Acquisition acquisition = + createAcquisitionInstance( + "entryNumber-" + identifier, + "entryDate-" + identifier); + return acquisition; + } + + private Acquisition createAcquisitionInstance(String entryNumber, String entryDate) { + Acquisition acquisition = new Acquisition(); +// acquisition.setEntryNumber(entryNumber); + acquisition.setAccessiondate(entryDate); + return acquisition; + } + +} diff --git a/services/acquisition/client/src/test/resources/log4j.properties b/services/acquisition/client/src/test/resources/log4j.properties new file mode 100644 index 000000000..18c510350 --- /dev/null +++ b/services/acquisition/client/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +log4j.rootLogger=debug, stdout, R + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=target/test-client.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +#packages +log4j.logger.org.collectionspace=DEBUG +log4j.logger.org.apache=INFO +log4j.logger.httpclient=INFO +log4j.logger.org.jboss.resteasy=INFO diff --git a/services/acquisition/jaxb/.classpath b/services/acquisition/jaxb/.classpath new file mode 100644 index 000000000..65161d26b --- /dev/null +++ b/services/acquisition/jaxb/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/services/acquisition/jaxb/.project b/services/acquisition/jaxb/.project new file mode 100644 index 000000000..d720ed740 --- /dev/null +++ b/services/acquisition/jaxb/.project @@ -0,0 +1,23 @@ + + + javaee-acquisition-jaxb + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/acquisition/jaxb/.settings/org.eclipse.jdt.core.prefs b/services/acquisition/jaxb/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..5bc41d55d --- /dev/null +++ b/services/acquisition/jaxb/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Jul 30 17:14:47 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/services/acquisition/jaxb/.settings/org.maven.ide.eclipse.prefs b/services/acquisition/jaxb/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..c6e4123cd --- /dev/null +++ b/services/acquisition/jaxb/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Thu Feb 26 16:30:28 PST 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/services/acquisition/jaxb/pom.xml b/services/acquisition/jaxb/pom.xml new file mode 100644 index 000000000..a89dcfdce --- /dev/null +++ b/services/acquisition/jaxb/pom.xml @@ -0,0 +1,105 @@ + + + + + org.collectionspace.services.acquisition + org.collectionspace.services + 1.0 + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.acquisition.jaxb + 1.0 + services.acquisition.jaxb + + + + com.sun.xml.bind + jaxb-impl + 2.0.2 + + + org.jvnet.jaxb2-commons + property-listener-injector + 1.0 + + + org.jvnet.jaxb2_commons + runtime + 0.4.1.4 + + + + collectionspace-services-acquisition-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + generate + + + + + + + javax.activation + activation + 1.1 + + + com.sun.xml.bind + jaxb-impl + 2.1.2 + + + + + -XtoString + -Xinject-listener-code + + + + + + + org.jvnet.jaxb2_commons + + basic + 0.4.1 + + + + org.jvnet.jaxb2-commons + + + property-listener-injector + + 1.0 + + + + + + + + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + + + + + + diff --git a/services/acquisition/jaxb/src/main/java/org/collectionspace/services/AcquisitionJAXBSchema.java b/services/acquisition/jaxb/src/main/java/org/collectionspace/services/AcquisitionJAXBSchema.java new file mode 100644 index 000000000..6b36e4853 --- /dev/null +++ b/services/acquisition/jaxb/src/main/java/org/collectionspace/services/AcquisitionJAXBSchema.java @@ -0,0 +1,14 @@ +/** + * + */ +package org.collectionspace.services; + +/** + * @author remillet + * + */ +public interface AcquisitionJAXBSchema { + final static String ACCESSIONDATE = "accessiondate"; +} + + diff --git a/services/acquisition/jaxb/src/main/java/org/collectionspace/services/AcquisitionListItemJAXBSchema.java b/services/acquisition/jaxb/src/main/java/org/collectionspace/services/AcquisitionListItemJAXBSchema.java new file mode 100644 index 000000000..696fa2514 --- /dev/null +++ b/services/acquisition/jaxb/src/main/java/org/collectionspace/services/AcquisitionListItemJAXBSchema.java @@ -0,0 +1,7 @@ +package org.collectionspace.services; + +public interface AcquisitionListItemJAXBSchema { + final static String ENTRY_NUMBER = "xyz"; + final static String CSID = "csid"; + final static String URI = "url"; +} diff --git a/services/acquisition/jaxb/src/main/resources/acquisition.xsd b/services/acquisition/jaxb/src/main/resources/acquisition.xsd new file mode 100644 index 000000000..59466e746 --- /dev/null +++ b/services/acquisition/jaxb/src/main/resources/acquisition.xsd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/acquisition/pom.xml b/services/acquisition/pom.xml new file mode 100644 index 000000000..2d431e5c4 --- /dev/null +++ b/services/acquisition/pom.xml @@ -0,0 +1,71 @@ + + + + + org.collectionspace.services.main + org.collectionspace.services + 1.0 + + 4.0.0 + org.collectionspace.services + 1.0 + org.collectionspace.services.acquisition + pom + services.acquisition + + + + jaxb + service + 3rdparty + client + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-site-plugin + + /usr/bin/unzip -o > err.txt + + + + org.apache.maven.plugins + maven-war-plugin + 2.0.1 + + WEB-INF/lib/*.jar + + + true + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.6 + 1.6 + + + + + + diff --git a/services/acquisition/service/.classpath b/services/acquisition/service/.classpath new file mode 100644 index 000000000..425cd1620 --- /dev/null +++ b/services/acquisition/service/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/services/acquisition/service/.project b/services/acquisition/service/.project new file mode 100644 index 000000000..4ad04aa60 --- /dev/null +++ b/services/acquisition/service/.project @@ -0,0 +1,23 @@ + + + org.collectionspace.services.acquisition.service + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/acquisition/service/.settings/org.eclipse.jdt.core.prefs b/services/acquisition/service/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..02987e798 --- /dev/null +++ b/services/acquisition/service/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Jul 30 17:13:26 PDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/services/acquisition/service/.settings/org.maven.ide.eclipse.prefs b/services/acquisition/service/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..0f12a7ea5 --- /dev/null +++ b/services/acquisition/service/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Mon Jun 29 14:27:15 PDT 2009 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +version=1 diff --git a/services/acquisition/service/pom.xml b/services/acquisition/service/pom.xml new file mode 100644 index 000000000..e3a9d80aa --- /dev/null +++ b/services/acquisition/service/pom.xml @@ -0,0 +1,137 @@ + + + + + org.collectionspace.services.acquisition + org.collectionspace.services + 1.0 + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.acquisition.service + jar + 1.0 + services.acquisition.service + + + + org.collectionspace.services + org.collectionspace.services.common + 1.0 + + + org.collectionspace.services + org.collectionspace.services.acquisition.jaxb + 1.0 + + + + junit + junit + 4.1 + test + + + org.testng + testng + 5.6 + + + + + + + + javax.security + jaas + 1.0.01 + provided + + + + dom4j + dom4j + 1.6.1 + provided + + + + + + org.jboss.resteasy + resteasy-jaxrs + 1.0.2.GA + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + 1.0.2.GA + + + org.jboss.resteasy + resteasy-multipart-provider + 1.0.2.GA + + + + + + org.nuxeo.ecm.core + nuxeo-core-api + ${nuxeo.version.1.5} + + + jboss-remoting + jboss + + + + + + org.restlet + org.restlet + 1.0.7 + + + com.noelios.restlet + com.noelios.restlet.ext.httpclient + 1.0.7 + + + com.noelios.restlet + com.noelios.restlet + 1.0.7 + + + + + + collectionspace-services-acquisition + + + org.codehaus.mojo + jboss-maven-plugin + + ${jboss.dir} + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.6 + 1.6 + true + + + + + + diff --git a/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionResource.java b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionResource.java new file mode 100644 index 000000000..ff4a5c44d --- /dev/null +++ b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionResource.java @@ -0,0 +1,266 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + + * http://www.collectionspace.org + * http://wiki.collectionspace.org + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.acquisition; + +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.DELETE; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.PathParam; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriInfo; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.collectionspace.services.acquisition.AcquisitionList.*; + +import org.collectionspace.services.acquisition.nuxeo.AcquisitionConstants; +import org.collectionspace.services.acquisition.nuxeo.AcquisitionHandlerFactory; +import org.collectionspace.services.common.NuxeoClientType; +import org.collectionspace.services.common.ServiceMain; +import org.collectionspace.services.common.repository.DocumentNotFoundException; +import org.collectionspace.services.common.repository.DocumentHandler; +import org.collectionspace.services.common.repository.RepositoryClient; +import org.collectionspace.services.common.repository.RepositoryClientFactory; +import org.jboss.resteasy.util.HttpResponseCodes; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Path("/acquisitions") +@Consumes("application/xml") +@Produces("application/xml") +public class AcquisitionResource { + + public final static String ACQUISITION_SERVICE_NAME = "acquisitions"; + final Logger logger = LoggerFactory.getLogger(AcquisitionResource.class); + //FIXME retrieve client type from configuration + final static NuxeoClientType CLIENT_TYPE = ServiceMain.getInstance().getNuxeoClientType(); + + public AcquisitionResource() { + // do nothing + } + + @POST + public Response createAcquisition( + Acquisition acquisitionObject) { + + String csid = null; + try{ + RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance(); + RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString()); + AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance(); + DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString()); + handler.setCommonObject(acquisitionObject); + csid = client.create(ACQUISITION_SERVICE_NAME, handler); + acquisitionObject.setCsid(csid); + if(logger.isDebugEnabled()){ + verbose("createAcquisition: ", acquisitionObject); + } + UriBuilder path = UriBuilder.fromResource(AcquisitionResource.class); + path.path("" + csid); + Response response = Response.created(path.build()).build(); + return response; + }catch(Exception e){ + if(logger.isDebugEnabled()){ + logger.debug("Caught exception in createAcquisition", e); + } + Response response = Response.status( + Response.Status.INTERNAL_SERVER_ERROR).entity("Create failed").type("text/plain").build(); + throw new WebApplicationException(response); + } + } + + @GET + @Path("{csid}") + public Acquisition getAcquisition( + @PathParam("csid") String csid) { + if(logger.isDebugEnabled()){ + verbose("getAcquisition with csid=" + csid); + } + if(csid == null || "".equals(csid)){ + logger.error("getAcquisition: missing csid!"); + Response response = Response.status(Response.Status.BAD_REQUEST).entity( + "get failed on Acquisition csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + } + Acquisition acquisitionObject = null; + try{ + RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance(); + RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString()); + AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance(); + DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString()); + client.get(csid, handler); + acquisitionObject = (Acquisition) handler.getCommonObject(); + }catch(DocumentNotFoundException dnfe){ + if(logger.isDebugEnabled()){ + logger.debug("getAcquisition", dnfe); + } + Response response = Response.status(Response.Status.NOT_FOUND).entity( + "Get failed on Acquisition csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + }catch(Exception e){ + if(logger.isDebugEnabled()){ + logger.debug("getAcquisition", e); + } + Response response = Response.status( + Response.Status.INTERNAL_SERVER_ERROR).entity("Get failed").type("text/plain").build(); + throw new WebApplicationException(response); + } + + if(acquisitionObject == null){ + Response response = Response.status(Response.Status.NOT_FOUND).entity( + "Get failed, the requested Acquisition CSID:" + csid + ": was not found.").type( + "text/plain").build(); + throw new WebApplicationException(response); + } + if(logger.isDebugEnabled()){ + verbose("getAcquisition: ", acquisitionObject); + } + return acquisitionObject; + } + + @GET + public AcquisitionList getAcquisitionList(@Context UriInfo ui) { + AcquisitionList acquisitionObjectList = new AcquisitionList(); + try{ + RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance(); + RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString()); + AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance(); + DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString()); + client.getAll(ACQUISITION_SERVICE_NAME, handler); + acquisitionObjectList = (AcquisitionList) handler.getCommonObjectList(); + }catch(Exception e){ + if(logger.isDebugEnabled()){ + logger.debug("Caught exception in getAcquisitionList", e); + } + Response response = Response.status( + Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build(); + throw new WebApplicationException(response); + } + return acquisitionObjectList; + } + + @PUT + @Path("{csid}") + public Acquisition updateAcquisition( + @PathParam("csid") String csid, + Acquisition theUpdate) { + if(logger.isDebugEnabled()){ + verbose("updateAcquisition with csid=" + csid); + } + if(csid == null || "".equals(csid)){ + logger.error("updateAcquisition: missing csid!"); + Response response = Response.status(Response.Status.BAD_REQUEST).entity( + "update failed on Acquisition csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + } + if(logger.isDebugEnabled()){ + verbose("updateAcquisition with input: ", theUpdate); + } + try{ + RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance(); + RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString()); + AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance(); + DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString()); + handler.setCommonObject(theUpdate); + client.update(csid, handler); + }catch(DocumentNotFoundException dnfe){ + if(logger.isDebugEnabled()){ + logger.debug("caugth exception in updateAcquisition", dnfe); + } + Response response = Response.status(Response.Status.NOT_FOUND).entity( + "Update failed on Acquisition csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + }catch(Exception e){ + Response response = Response.status( + Response.Status.INTERNAL_SERVER_ERROR).entity("Update failed").type("text/plain").build(); + throw new WebApplicationException(response); + } + return theUpdate; + } + + @DELETE + @Path("{csid}") + public Response deleteAcquisition(@PathParam("csid") String csid) { + + if(logger.isDebugEnabled()){ + verbose("deleteAcquisition with csid=" + csid); + } + if(csid == null || "".equals(csid)){ + logger.error("deleteAcquisition: missing csid!"); + Response response = Response.status(Response.Status.BAD_REQUEST).entity( + "delete failed on Acquisition csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + } + try{ + RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance(); + RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString()); + client.delete(csid); + return Response.status(HttpResponseCodes.SC_OK).build(); + }catch(DocumentNotFoundException dnfe){ + if(logger.isDebugEnabled()){ + logger.debug("caught exception in deleteAcquisition", dnfe); + } + Response response = Response.status(Response.Status.NOT_FOUND).entity( + "Delete failed on Acquisition csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + }catch(Exception e){ + Response response = Response.status( + Response.Status.INTERNAL_SERVER_ERROR).entity("Delete failed").type("text/plain").build(); + throw new WebApplicationException(response); + } + + } + + private void verbose(String msg, Acquisition acquisitionObject) { + try{ + verbose(msg); + JAXBContext jc = JAXBContext.newInstance( + Acquisition.class); + + Marshaller m = jc.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + m.marshal(acquisitionObject, System.out); + }catch(Exception e){ + e.printStackTrace(); + } + + } + + private void verbose(String msg) { + System.out.println("AcquisitionResource. " + msg); + } +} diff --git a/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionService.java b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionService.java new file mode 100644 index 000000000..68009d3fc --- /dev/null +++ b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/AcquisitionService.java @@ -0,0 +1,38 @@ +/** + * + */ +package org.collectionspace.services.acquisition; + +import java.io.IOException; +import org.dom4j.Document; +import org.dom4j.DocumentException; + +import org.collectionspace.services.acquisition.Acquisition; + +/** + * @author remillet + * + */ +public interface AcquisitionService { + + public final static String ACQUISITION_SCHEMA_NAME = "acquisition"; + + // Create + Document postAcquisition(Acquisition co) + throws DocumentException, IOException; + + // Read single object + Document getAcquisition(String csid) throws DocumentException, + IOException; + + // Read a list of objects + Document getAcquisitionList() throws DocumentException, IOException; + + // Update + Document putAcquisition(String csid, Acquisition theUpdate) + throws DocumentException, IOException; + + // Delete + Document deleteAcquisition(String csid) throws DocumentException, + IOException; +} diff --git a/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionConstants.java b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionConstants.java new file mode 100644 index 000000000..df0b9c55d --- /dev/null +++ b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionConstants.java @@ -0,0 +1,35 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + + * http://www.collectionspace.org + * http://wiki.collectionspace.org + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.acquisition.nuxeo; + +/** + * IntakeConstants processes CollectionObject document + * + */ +public class AcquisitionConstants { + + public final static String NUXEO_DOCTYPE = "Acquisition"; + public final static String NUXEO_SCHEMA_NAME = "acquisition"; + public final static String NUXEO_DC_TITLE = "CollectionSpace-Acquisition"; +} diff --git a/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionDocumentModelHandler.java b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionDocumentModelHandler.java new file mode 100644 index 000000000..1570184da --- /dev/null +++ b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionDocumentModelHandler.java @@ -0,0 +1,178 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + + * http://www.collectionspace.org + * http://wiki.collectionspace.org + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.acquisition.nuxeo; + +import java.util.Iterator; +import java.util.List; + +import org.collectionspace.services.AcquisitionJAXBSchema; +import org.collectionspace.services.common.repository.DocumentWrapper; +import org.collectionspace.services.acquisition.Acquisition; +import org.collectionspace.services.acquisition.AcquisitionList; +import org.collectionspace.services.acquisition.AcquisitionList.AcquisitionListItem; +import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler; +import org.collectionspace.services.acquisition.nuxeo.AcquisitionConstants; + +import org.nuxeo.ecm.core.api.DocumentModel; +import org.nuxeo.ecm.core.api.DocumentModelList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * AcquisitionDocumentModelHandler + * + * $LastChangedRevision: $ + * $LastChangedDate: $ + */ +public class AcquisitionDocumentModelHandler + extends DocumentModelHandler { + + private final Logger logger = LoggerFactory.getLogger(AcquisitionDocumentModelHandler.class); + /** + * acquisition is used to stash JAXB object to use when handle is called + * for Action.CREATE, Action.UPDATE or Action.GET + */ + private Acquisition acquisition; + /** + * acquisitionList is stashed when handle is called + * for ACTION.GET_ALL + */ + private AcquisitionList acquisitionList; + + @Override + public void prepare(Action action) throws Exception { + //no specific action needed + } + + /** + * getCommonObject get associated acquisition + * @return + */ + @Override + public Acquisition getCommonObject() { + return acquisition; + } + + /** + * setCommonObject set associated acquisition + * @param acquisition + */ + @Override + public void setCommonObject(Acquisition acquisition) { + this.acquisition = acquisition; + } + + /** + * getAcquisitionList get associated acquisition (for index/GET_ALL) + * @return + */ + @Override + public AcquisitionList getCommonObjectList() { + return acquisitionList; + } + + @Override + public void setCommonObjectList(AcquisitionList acquisitionList) { + this.acquisitionList = acquisitionList; + } + + @Override + public Acquisition extractCommonObject(DocumentWrapper wrapDoc) + throws Exception { + DocumentModel docModel = (DocumentModel) wrapDoc.getWrappedObject(); + Acquisition acquisitionObject = new Acquisition(); + + //FIXME property get should be dynamically set using schema inspection + //so it does not require hard coding + + // acquisition core values + acquisitionObject.setAccessiondate((String)docModel.getPropertyValue( + getQProperty(AcquisitionJAXBSchema.ACCESSIONDATE))); + + return acquisitionObject; + } + + @Override + public void fillCommonObject(Acquisition acquisitionObject, DocumentWrapper wrapDoc) throws Exception { + DocumentModel docModel = (DocumentModel) wrapDoc.getWrappedObject(); + //FIXME property setter should be dynamically set using schema inspection + //so it does not require hard coding + + // a default title for the Dublin Core schema + docModel.setPropertyValue("dublincore:title", AcquisitionConstants.NUXEO_DC_TITLE); + + // acquisition core values + if(acquisitionObject.getAccessiondate() != null){ + docModel.setPropertyValue(getQProperty( + AcquisitionJAXBSchema.ACCESSIONDATE), acquisitionObject.getAccessiondate()); + } + } + + @Override + public AcquisitionList extractCommonObjectList(DocumentWrapper wrapDoc) throws Exception { + DocumentModelList docList = (DocumentModelList) wrapDoc.getWrappedObject(); + + AcquisitionList coList = new AcquisitionList(); + List list = coList.getAcquisitionListItem(); + + //FIXME: iterating over a long list of documents is not a long term + //strategy...need to change to more efficient iterating in future + Iterator iter = docList.iterator(); + while(iter.hasNext()){ + DocumentModel docModel = iter.next(); + AcquisitionListItem listItem = new AcquisitionListItem(); + listItem.setAccessiondate((String)docModel.getPropertyValue( + getQProperty(AcquisitionJAXBSchema.ACCESSIONDATE))); + //need fully qualified context for URI + String id = docModel.getId(); + listItem.setUri("/acquisitions/" + id); + listItem.setCsid(id); + list.add(listItem); + } + + return coList; + } + + @Override + public void fillCommonObjectList(AcquisitionList obj, DocumentWrapper wrapDoc) throws Exception { + throw new UnsupportedOperationException(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#getDocumentType() + */ + public String getDocumentType() { + return AcquisitionConstants.NUXEO_DOCTYPE; + } + + /** + * getQProperty converts the given property to qualified schema property + * @param prop + * @return + */ + private String getQProperty(String prop) { + return AcquisitionConstants.NUXEO_SCHEMA_NAME + ":" + prop; + } +} + diff --git a/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionHandlerFactory.java b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionHandlerFactory.java new file mode 100644 index 000000000..ecb198567 --- /dev/null +++ b/services/acquisition/service/src/main/java/org/collectionspace/services/acquisition/nuxeo/AcquisitionHandlerFactory.java @@ -0,0 +1,54 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + + * http://www.collectionspace.org + * http://wiki.collectionspace.org + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.acquisition.nuxeo; + +import org.collectionspace.services.common.NuxeoClientType; +import org.collectionspace.services.common.repository.DocumentHandler; + +/** + * AcquisitionHandlerFactory creates handlers for acquisition based + * on type of Nuxeo client used + * + * $LastChangedRevision: $ + * $LastChangedDate: $ + */ +public class AcquisitionHandlerFactory { + + private static final AcquisitionHandlerFactory self = new AcquisitionHandlerFactory(); + + private AcquisitionHandlerFactory() { + } + + public static AcquisitionHandlerFactory getInstance() { + return self; + } + + public DocumentHandler getHandler(String clientType) { + if(NuxeoClientType.JAVA.toString().equals(clientType)){ + return new AcquisitionDocumentModelHandler(); + } + + throw new IllegalArgumentException("Not supported client=" + clientType); + } +} diff --git a/services/acquisition/service/src/test/java/org/collectionspace/services/test/AcquisitionServiceTest.java b/services/acquisition/service/src/test/java/org/collectionspace/services/test/AcquisitionServiceTest.java new file mode 100644 index 000000000..ddf3e3d6f --- /dev/null +++ b/services/acquisition/service/src/test/java/org/collectionspace/services/test/AcquisitionServiceTest.java @@ -0,0 +1,13 @@ +package org.collectionspace.services.test; + +//import org.collectionspace.services.acquisition.Acquisition; +//import org.collectionspace.services.acquisition.AcquisitionList; + +/** + * A AcquisitionServiceTest. + * + * @version $Revision:$ + */ +public class AcquisitionServiceTest { + //empty +} diff --git a/services/acquisition/service/src/test/resources/log4j.xml b/services/acquisition/service/src/test/resources/log4j.xml new file mode 100644 index 000000000..52121cb83 --- /dev/null +++ b/services/acquisition/service/src/test/resources/log4j.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/common/src/main/config/service-config.xml b/services/common/src/main/config/service-config.xml index fd1e3fe85..01bc94a1f 100644 --- a/services/common/src/main/config/service-config.xml +++ b/services/common/src/main/config/service-config.xml @@ -44,6 +44,10 @@ relations Relations + + acquisitions + Acquisitions + diff --git a/services/pom.xml b/services/pom.xml index a8de573f6..2969eeed3 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -20,6 +20,7 @@ authentication relation query + acquisition vocabulary id collectionobject