From eb5d1e4386a3583b16517e160b34cfbe6695383d Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Tue, 8 Sep 2009 21:53:36 +0000 Subject: [PATCH] CSPACE-411: Created stubbed Vocabulary service module and corresponding build pom files. --- .../common/vocabulary/IVocabManager.java | 7 + .../common/vocabulary/VocabManager.java | 9 ++ .../common/vocabulary/VocabManagerImpl.java | 22 +++ services/pom.xml | 1 + services/query/.project | 2 +- services/vocabulary/.classpath | 6 + services/vocabulary/.project | 23 +++ .../.settings/org.eclipse.jdt.core.prefs | 5 + .../.settings/org.maven.ide.eclipse.prefs | 8 + services/vocabulary/pom.xml | 65 ++++++++ services/vocabulary/service/.classpath | 8 + services/vocabulary/service/.project | 23 +++ .../.settings/org.eclipse.jdt.core.prefs | 12 ++ .../.settings/org.maven.ide.eclipse.prefs | 8 + services/vocabulary/service/pom.xml | 149 ++++++++++++++++++ .../services/vocabulary/VocabResource.java | 100 ++++++++++++ 16 files changed, 447 insertions(+), 1 deletion(-) create mode 100644 services/common/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java create mode 100644 services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java create mode 100644 services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java create mode 100644 services/vocabulary/.classpath create mode 100644 services/vocabulary/.project create mode 100644 services/vocabulary/.settings/org.eclipse.jdt.core.prefs create mode 100644 services/vocabulary/.settings/org.maven.ide.eclipse.prefs create mode 100644 services/vocabulary/pom.xml create mode 100644 services/vocabulary/service/.classpath create mode 100644 services/vocabulary/service/.project create mode 100644 services/vocabulary/service/.settings/org.eclipse.jdt.core.prefs create mode 100644 services/vocabulary/service/.settings/org.maven.ide.eclipse.prefs create mode 100644 services/vocabulary/service/pom.xml create mode 100644 services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabResource.java diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java new file mode 100644 index 000000000..c39206bba --- /dev/null +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/IVocabManager.java @@ -0,0 +1,7 @@ +package org.collectionspace.services.common.vocabulary; + +public interface IVocabManager { + + public void exampleMethod(String someParam); + +} diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java new file mode 100644 index 000000000..849599071 --- /dev/null +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManager.java @@ -0,0 +1,9 @@ +package org.collectionspace.services.common.vocabulary; + +public class VocabManager { + static private final IVocabManager vocabManager = new VocabManagerImpl(); + + static public void exampleMethod(String someParam) { + vocabManager.exampleMethod(someParam); + } +} diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java new file mode 100644 index 000000000..3323f07df --- /dev/null +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/VocabManagerImpl.java @@ -0,0 +1,22 @@ +package org.collectionspace.services.common.vocabulary; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.nuxeo.ecm.core.api.DocumentModel; +import org.nuxeo.ecm.core.api.DocumentModelList; +import org.nuxeo.ecm.core.api.repository.RepositoryInstance; +import org.nuxeo.ecm.core.client.NuxeoClient; + +import org.collectionspace.services.nuxeo.client.java.NuxeoConnector; +import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClient; +import org.collectionspace.services.common.query.IQueryManager; + +public class VocabManagerImpl implements IVocabManager { + + private final Logger logger = LoggerFactory + .getLogger(RepositoryJavaClient.class); + + public void exampleMethod(String someParam) { + } +} diff --git a/services/pom.xml b/services/pom.xml index 1286b5fae..a8de573f6 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -20,6 +20,7 @@ authentication relation query + vocabulary id collectionobject intake diff --git a/services/query/.project b/services/query/.project index 0d231bad3..a39a88e4f 100644 --- a/services/query/.project +++ b/services/query/.project @@ -1,6 +1,6 @@ - org.collectionspace.services.collectionobject + org.collectionspace.services.query diff --git a/services/vocabulary/.classpath b/services/vocabulary/.classpath new file mode 100644 index 000000000..046988541 --- /dev/null +++ b/services/vocabulary/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/services/vocabulary/.project b/services/vocabulary/.project new file mode 100644 index 000000000..3832c86ce --- /dev/null +++ b/services/vocabulary/.project @@ -0,0 +1,23 @@ + + + org.collectionspace.services.vocabulary + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/vocabulary/.settings/org.eclipse.jdt.core.prefs b/services/vocabulary/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..b634d9cad --- /dev/null +++ b/services/vocabulary/.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/vocabulary/.settings/org.maven.ide.eclipse.prefs b/services/vocabulary/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..86c513b9c --- /dev/null +++ b/services/vocabulary/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,8 @@ +#Thu Jul 16 13:50:16 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/vocabulary/pom.xml b/services/vocabulary/pom.xml new file mode 100644 index 000000000..316d79b5e --- /dev/null +++ b/services/vocabulary/pom.xml @@ -0,0 +1,65 @@ + + + + org.collectionspace.services.main + org.collectionspace.services + 1.0 + + 4.0.0 + org.collectionspace.services + 1.0 + org.collectionspace.services.vocabulary + pom + services.vocabulary + + + service + + + + + + + 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/vocabulary/service/.classpath b/services/vocabulary/service/.classpath new file mode 100644 index 000000000..199bbbbdb --- /dev/null +++ b/services/vocabulary/service/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/services/vocabulary/service/.project b/services/vocabulary/service/.project new file mode 100644 index 000000000..11fb6e89d --- /dev/null +++ b/services/vocabulary/service/.project @@ -0,0 +1,23 @@ + + + org.collectionspace.services.query.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/vocabulary/service/.settings/org.eclipse.jdt.core.prefs b/services/vocabulary/service/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..02987e798 --- /dev/null +++ b/services/vocabulary/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/vocabulary/service/.settings/org.maven.ide.eclipse.prefs b/services/vocabulary/service/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..0f12a7ea5 --- /dev/null +++ b/services/vocabulary/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/vocabulary/service/pom.xml b/services/vocabulary/service/pom.xml new file mode 100644 index 000000000..de80035b1 --- /dev/null +++ b/services/vocabulary/service/pom.xml @@ -0,0 +1,149 @@ + + + + + org.collectionspace.services.vocabulary + org.collectionspace.services + 1.0 + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.vocabulary.service + jar + 1.0 + services.vocabulary.service + + + + org.collectionspace.services + org.collectionspace.services.common + 1.0 + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-log4j12 + + + junit + junit + 4.1 + test + + + org.testng + testng + 5.6 + + + + + commons-beanutils + commons-beanutils + 1.6.1 + + + + commons-logging + commons-logging + 1.1 + + + + + + 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-vocabulary + + + org.codehaus.mojo + jboss-maven-plugin + + ${jboss.dir} + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.6 + 1.6 + + + + + + diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabResource.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabResource.java new file mode 100644 index 000000000..f8c8a02ef --- /dev/null +++ b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabResource.java @@ -0,0 +1,100 @@ +/** + * 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.vocabulary; + +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.common.vocabulary.VocabManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Path("/vocab") +@Consumes("application/xml") +@Produces("application/xml") +public class VocabResource { + + public final static String SERVICE_NAME = "vocab"; + final Logger logger = LoggerFactory.getLogger(VocabResource.class); + + public VocabResource() { + // do nothing + } + + @GET + @Path("{csid}") + public void getVocab( + @PathParam("csid") String csid) { + if(logger.isDebugEnabled()){ + verbose("getVocab with csid=" + csid); + } + if(csid == null || "".equals(csid)){ + logger.error("getVocab: missing csid!"); + Response response = Response.status(Response.Status.BAD_REQUEST).entity( + "get failed on getVocab csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + } + + try { + // + // An example call to the Vocabulary manager + // + VocabManager.exampleMethod("someParam"); + } catch(Exception e){ + if(logger.isDebugEnabled()){ + logger.debug("getVocab", e); + } + Response response = Response.status(Response.Status.NOT_FOUND).entity( + "Get failed on vocab csid=" + csid).type( + "text/plain").build(); + throw new WebApplicationException(response); + } + + // an example of how to send a failed message + if(false){ + Response response = Response.status(Response.Status.NOT_FOUND).entity( + "Get failed, the requested CSID:" + csid + ": was not found.").type( + "text/plain").build(); + throw new WebApplicationException(response); + } + } + + private void verbose(String msg) { + System.out.println("VocabResource. " + msg); + } +} -- 2.47.3