]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-451 Have basics of the Vocabulary service working. Vocabulary Items still...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Wed, 7 Oct 2009 23:07:59 +0000 (23:07 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Wed, 7 Oct 2009 23:07:59 +0000 (23:07 +0000)
34 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/build.xml
services/common/.classpath
services/common/src/main/config/tenant-bindings.xml
services/vocabulary/3rdparty/.classpath [new file with mode: 0644]
services/vocabulary/3rdparty/.project [new file with mode: 0644]
services/vocabulary/3rdparty/.settings/org.maven.ide.eclipse.prefs [new file with mode: 0644]
services/vocabulary/3rdparty/build.xml [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/META-INF/MANIFEST.MF [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/core-types-contrib.xml [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/deployment-fragment.xml [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/ecm-types-contrib.xml [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/layouts-contrib.xml [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/README.txt [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/vocabularies-common.xsd [new file with mode: 0644]
services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/vocabularyitems-common.xsd [new file with mode: 0644]
services/vocabulary/3rdparty/pom.xml [new file with mode: 0644]
services/vocabulary/client/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
services/vocabulary/client/.settings/org.maven.ide.eclipse.prefs [new file with mode: 0644]
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java [new file with mode: 0644]
services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java [new file with mode: 0644]
services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java [new file with mode: 0644]
services/vocabulary/client/src/test/resources/log4j.properties [new file with mode: 0644]
services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java [new file with mode: 0644]
services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java [new file with mode: 0644]
services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java [new file with mode: 0644]
services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java [new file with mode: 0644]
services/vocabulary/jaxb/src/main/resources/vocabulary-common.xsd [new file with mode: 0644]
services/vocabulary/pom.xml
services/vocabulary/service/.classpath
services/vocabulary/service/pom.xml
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabResource.java [deleted file]
services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java [new file with mode: 0644]

index 66e6c6ffff3ff064385fab65cbd82e626b09757c..5fdb4a38892beb0c0878ddda9bfa869779c8fc7c 100644 (file)
             <artifactId>org.collectionspace.services.acquisition.service</artifactId>\r
             <version>1.0</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.vocabulary.service</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.relation.service</artifactId>\r
index 1651aef3240241c6ae73ae1cdfeddaa5bfbaa6a1..199cc8061122111863ecd04d2cd0b226d3e548aa 100644 (file)
@@ -6,6 +6,7 @@ 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.vocabulary.VocabularyResource;
 //import org.collectionspace.services.query.QueryResource;
 
 import javax.ws.rs.core.Application;
@@ -25,6 +26,7 @@ public class CollectionSpaceJaxRsApplication extends Application {
         singletons.add(new AcquisitionResource());
 //        singletons.add(new RelationResource());
         singletons.add(new NewRelationResource());
+        singletons.add(new VocabularyResource());
 //        singletons.add(new QueryResource());
 //        singletons.add(new DomainIdentifierResource());
 //        singletons.add(new PingResource());
index 074c796e004bf3b1fd00049ac5a81c307b57b6d4..fe66659d06847e142864628e97a52c45760d69fe 100644 (file)
         <ant antfile="id/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="collectionobject/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="deploy" inheritAll="false"/>\r
+        <ant antfile="vocabulary/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="acquisition/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="JaxRsServiceProvider/build.xml" target="deploy" inheritAll="false"/>\r
     </target>\r
     <target name="undeploy"\r
     description="undeploy services from ${jboss.server.cspace}">\r
         <ant antfile="JaxRsServiceProvider/build.xml" target="undeploy" inheritAll="false"/>\r
+        <ant antfile="vocabulary/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="acquisition/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="collectionobject/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="id/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="collectionobject/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="intake/build.xml" target="dist" inheritAll="false"/>\r
+        <ant antfile="vocabulary/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="acquisition/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="JaxRsServiceProvider/build.xml" target="dist" inheritAll="false"/>\r
     </target>\r
index d6a97196684328aaeed1607a3324aef9ae1245dd..4c2d7084d0ca0da2cb75936a6e83db01c16b713f 100644 (file)
@@ -4,7 +4,7 @@
        <classpathentry kind="src" path="target/generated-sources/xjc"/>\r
        <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
        <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
-       <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
+       <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
        <classpathentry kind="output" path="target/classes"/>\r
 </classpath>\r
index 2e3d3e86150c0e7c4da1e4a07bb011a03154ce8f..9355c744aad267b078c7e0eaba973d9350ca2e93 100644 (file)
             </service:object>
         </tenant:serviceBindings>
         <!-- end intake service meta-data -->
+        <!-- begin vocabulary service meta-data -->
+        <tenant:serviceBindings name="Vocabularies" version="0.1">
+            <service:repositoryClient xmlns:service='http://collectionspace.org/services/common/service'>nuxeo-java</service:repositoryClient>
+            <service:object id="1" name="Vocabulary" version="0.1"
+            xmlns:service='http://collectionspace.org/services/common/service'>
+                <service:part id="0" control_group="Managed"
+                            versionable="true" auditable="false"
+                            label="vocabularies-system" updated="" order="0">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent
+                        namespaceURI="http://collectionspace.org/services/common/system"
+                        schemaLocation="http://collectionspace.org/services/common/system http://collectionspace.org/services/common/system/system-response.xsd">
+                        </service:xmlContent>
+                    </service:content>
+                </service:part>
+                <service:part id="1" control_group="Managed"
+                            versionable="true" auditable="false"
+                            label="vocabularies-common" updated="" order="1">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent
+                        namespaceURI="http://collectionspace.org/services/vocabulary"
+                        schemaLocation="http://collectionspace.org/services/vocabulary http://services.collectionspace.org/vocabulary/vocabularies-common.xsd">
+                        </service:xmlContent>
+                    </service:content>
+                </service:part>
+            </service:object>
+        </tenant:serviceBindings>
+        <!-- end vocabulary service meta-data -->
                 <!-- begin acquisition service meta-data -->
         <tenant:serviceBindings name="Acquisitions" version="0.1">
             <service:repositoryClient xmlns:service='http://collectionspace.org/services/common/service'>nuxeo-java</service:repositoryClient>
diff --git a/services/vocabulary/3rdparty/.classpath b/services/vocabulary/3rdparty/.classpath
new file mode 100644 (file)
index 0000000..0469885
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+       <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+       <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
diff --git a/services/vocabulary/3rdparty/.project b/services/vocabulary/3rdparty/.project
new file mode 100644 (file)
index 0000000..b3274cf
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.collectionspace.services.project.3rdparty</name>\r
+       <comment></comment>\r
+       <projects>\r
+       </projects>\r
+       <buildSpec>\r
+               <buildCommand>\r
+                       <name>org.eclipse.jdt.core.javabuilder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+               <buildCommand>\r
+                       <name>org.maven.ide.eclipse.maven2Builder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+               <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/services/vocabulary/3rdparty/.settings/org.maven.ide.eclipse.prefs b/services/vocabulary/3rdparty/.settings/org.maven.ide.eclipse.prefs
new file mode 100644 (file)
index 0000000..93b6f8a
--- /dev/null
@@ -0,0 +1,9 @@
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
diff --git a/services/vocabulary/3rdparty/build.xml b/services/vocabulary/3rdparty/build.xml
new file mode 100644 (file)
index 0000000..4222b92
--- /dev/null
@@ -0,0 +1,125 @@
+\r
+<project name="vocabulary.3rdparty" default="package" basedir=".">\r
+    <description>\r
+        vocabulary service 3rdparty\r
+    </description>\r
+  <!-- set global properties for this build -->\r
+    <property name="services.trunk" value="../../.."/>\r
+    <property file="${services.trunk}/build.properties" />\r
+    <property name="mvn.opts" value="" />\r
+    <property name="src" location="src"/>\r
+\r
+    <condition property="osfamily-unix">\r
+        <os family="unix" />\r
+    </condition>\r
+    <condition property="osfamily-windows">\r
+        <os family="windows" />\r
+    </condition>\r
+\r
+    <target name="init" >\r
+    <!-- Create the time stamp -->\r
+        <tstamp/>\r
+    </target>\r
+\r
+    <target name="package" depends="package-unix,package-windows"\r
+  description="Package CollectionSpace Services" />\r
+    <target name="package-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="package" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="package-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="package" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="install" depends="package,install-unix,install-windows"\r
+  description="Install" />\r
+    <target name="install-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="install" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="install-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="install" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    \r
+    <target name="clean" depends="clean-unix,clean-windows"\r
+  description="Delete target directories" >\r
+        <delete dir="${build}"/>\r
+    </target>\r
+    <target name="clean-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="clean" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="clean-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="clean" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+    <target name="test-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="test" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="test-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="test" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="deploy" depends="package"\r
+    description="deploy vocabulary in ${jboss.server.nuxeo}">\r
+        <ant antfile="nuxeo-platform-cs-vocabulary/build.xml" target="deploy" inheritall="false"/>\r
+    </target>\r
+\r
+    <target name="undeploy"\r
+    description="undeploy vocabulary from ${jboss.server.nuxeo}">\r
+        <ant antfile="nuxeo-platform-cs-vocabulary/build.xml" target="undeploy" inheritall="false"/>\r
+    </target>\r
+\r
+    <target name="dist"\r
+    description="generate distribution for vocabulary" depends="package">\r
+        <ant antfile="nuxeo-platform-cs-vocabulary/build.xml" target="dist" inheritall="false"/>\r
+    </target>\r
+\r
+\r
+</project>\r
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/META-INF/MANIFEST.MF b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..dc2b0b1
--- /dev/null
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.vocabulary;singleton:=true \r
+Bundle-Version: 1.0.0\r
+Bundle-Localization: plugin\r
+Bundle-Vendor: Nuxeo \r
+Require-Bundle: org.nuxeo.runtime, \r
+ org.nuxeo.ecm.core.api, \r
+ org.nuxeo.ecm.core,\r
+ org.nuxeo.ecm.core.api,\r
+ org.nuxeo.ecm.platform.types.api,\r
+ org.nuxeo.ecm.platform.versioning.api,\r
+ org.nuxeo.ecm.platform.ui,\r
+ org.nuxeo.ecm.platform.forms.layout.client,\r
+ org.nuxeo.ecm.platform.publishing.api,\r
+ org.nuxeo.ecm.platform.ws \r
+Provide-Package: org.collectionspace.vocabulary\r
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/ecm-types-contrib.xml,\r
+ OSGI-INF/layouts-contrib.xml\r
+\r
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/core-types-contrib.xml
new file mode 100644 (file)
index 0000000..7521aa8
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.vocabulary.coreTypes">
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+    <schema name="vocabularies-common" prefix="vocabularies-common" src="schemas/vocabularies-common.xsd"/>
+  </extension>
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+    <schema name="vocabularyitems-common" prefix="vocabularyitems-common" src="schemas/vocabularyitems-common.xsd"/>
+  </extension>
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+    <doctype name="Vocabulary" extends="Document">
+      <schema name="common"/>
+      <schema name="dublincore"/>
+      <schema name="vocabularies-common"/>
+    </doctype>
+  </extension>
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+    <doctype name="VocabularyItem" extends="Document">
+      <schema name="common"/>
+      <schema name="dublincore"/>
+      <schema name="vocabularyitems-common"/>
+    </doctype>
+  </extension>
+</component>
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/deployment-fragment.xml
new file mode 100644 (file)
index 0000000..88b94ff
--- /dev/null
@@ -0,0 +1,408 @@
+<?xml version="1.0"?>
+<fragment>
+
+  <extension target="application#MODULE">
+    <module>
+      <ejb>${bundle.fileName}</ejb>
+    </module>
+
+    <module>
+      <web>
+        <web-uri>nuxeo.war</web-uri>
+        <context-root>/nuxeo</context-root>
+      </web>
+    </module>
+  </extension>
+
+  <!-- uncomment that to enable tomcat based auth
+    <extension target="web#LOGIN-CONFIG">
+    <login-config>
+    <auth-method>FORM</auth-method>
+    <realm-name>nuxeo.ecm</realm-name>
+    <form-login-config>
+    <form-login-page>/login.jsp</form-login-page>
+    <form-error-page>/login.jsp?loginFailed=true</form-error-page>
+    </form-login-config>
+    </login-config>
+    </extension>
+  -->
+
+  <extension target="web#FILTER-MAPPING">
+
+    <!-- Seam Context Filter is declared in org.nuxeo.ecm.platform.ui.web
+      deployment fragment -->
+
+    <filter-mapping>
+      <filter-name>Seam Context Filter</filter-name>
+      <url-pattern>/ws/FileManageWS</url-pattern>
+    </filter-mapping>
+
+    <filter-mapping>
+      <filter-name>Seam Context Filter</filter-name>
+      <url-pattern>/DocumentManagerWS</url-pattern>
+    </filter-mapping>
+  </extension>
+
+  <extension target="web#SERVLET">
+  </extension>
+
+  <extension target="web#SERVLET-MAPPING">
+  </extension>
+
+  <extension target="pages#PAGES">
+    <!-- This calls a method which load the Workspace logo -->
+    <page view-id="/showLogo.xhtml" action="#{logoHelper.getLogo}"/>
+
+    <!-- Bind URL to the Document URL resolver-->
+    <page view-id="/getDocument.xhtml"
+        action="#{navigationContext.navigateToURL}">
+    </page>
+
+    <page view-id="/nxliveedit.xhtml" action="#{liveEditHelper.getBootstrap()}"/>
+
+    <!-- Bind URL to the Parallele conversation Document URL resolver-->
+    <page view-id="/parallele.xhtml"
+        action="#{paralleleNavigationHelper.navigateToURL}">
+    </page>
+
+    <!-- Post login and 'home' view handler -->
+    <page view-id="/nxstartup.xhtml"
+        action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'view')}"/>
+
+    <!-- To redirect to the user dashboard instead, use instead:
+
+      <page view-id="/nxstartup.xhtml"
+      action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'user_dashboard')}" />
+    -->
+
+    <!--  config for workspace management
+      = give a description for each viewId
+    -->
+
+    <page view-id="/view_domains.xhtml">
+      #{currentServerLocation.name}/#{currentTabAction.label}
+    </page>
+
+    <page view-id="/select_document_type.faces.xhtml">
+      Create new document in #{currentDocument.name}
+    </page>
+
+    <page view-id="/create_document.faces.xhtml">
+      Create new document in #{currentDocument.name}
+    </page>
+
+    <page view-id="/user_dashboard.xhtml">
+      breadcrumb=command.user_dashboard
+    </page>
+
+    <page view-id="/view_users.xhtml">
+      breadcrumb=command.manageMembers
+    </page>
+
+    <page view-id="/view_many_users.xhtml">
+      breadcrumb=command.manageMembers
+    </page>
+
+    <page view-id="/view_vocabularies.xhtml">
+      breadcrumb=title.vocabularies
+    </page>
+
+    <page view-id="/search/search_form.xhtml">
+      breadcrumb=command.advancedSearch
+    </page>
+  </extension>
+
+  <extension target="faces-config#APPLICATION">
+    <locale-config>
+      <default-locale>en</default-locale>
+      <supported-locale>en_GB</supported-locale>
+      <supported-locale>en_US</supported-locale>
+      <supported-locale>fr</supported-locale>
+      <supported-locale>de</supported-locale>
+      <supported-locale>es</supported-locale>
+      <supported-locale>it</supported-locale>
+      <supported-locale>ar</supported-locale>
+      <supported-locale>ru</supported-locale>
+      <supported-locale>ja</supported-locale>
+      <supported-locale>vn</supported-locale>
+    </locale-config>
+
+    <message-bundle>messages</message-bundle>
+  </extension>
+
+  <extension target="components#PAGEFLOW">
+    <value>config/addWorkspace.jpdl.xml</value>
+  </extension>
+
+  <extension target="faces-config#NAVIGATION">
+    <!-- generic pages -->
+    <navigation-case>
+      <from-outcome>generic_error_page</from-outcome>
+      <to-view-id>/generic_error_page.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>generic_message_page</from-outcome>
+      <to-view-id>/generic_message_page.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>home</from-outcome>
+      <to-view-id>/nxstartup.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>user_login</from-outcome>
+      <to-view-id>/login.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>user_logout</from-outcome>
+      <to-view-id>/logout.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_servers</from-outcome>
+      <to-view-id>/view_servers.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- pages for document actions -->
+
+    <navigation-case>
+      <from-outcome>view_domains</from-outcome>
+      <to-view-id>/view_domains.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>select_document_type</from-outcome>
+      <to-view-id>/select_document_type.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>create_document</from-outcome>
+      <to-view-id>/create_document.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>edit_document</from-outcome>
+      <to-view-id>/edit_document.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_documents</from-outcome>
+      <to-view-id>/view_documents.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>create_file</from-outcome>
+      <to-view-id>/create_file.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>create_workspace_wizard</from-outcome>
+      <to-view-id>/createWorkspaceWizard.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>send_email</from-outcome>
+      <to-view-id>/document_email.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- AT: BBB, use view_documents instead -->
+    <navigation-case>
+      <from-outcome>view_workspaces</from-outcome>
+      <to-view-id>/view_workspaces.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- AT: BBB, use create_document instead -->
+    <navigation-case>
+      <from-outcome>create_domain</from-outcome>
+      <to-view-id>/create_domain.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- AT: BBB, use edit_document instead -->
+    <navigation-case>
+      <from-outcome>edit_domain</from-outcome>
+      <to-view-id>/edit_domain.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- AT: BBB, use create_document instead -->
+    <navigation-case>
+      <from-outcome>create_workspace</from-outcome>
+      <to-view-id>/create_workspace.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- AT: BBB, use edit_document instead -->
+    <navigation-case>
+      <from-outcome>edit_workspace</from-outcome>
+      <to-view-id>/edit_workspace.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- users ang groups -->
+
+    <navigation-case>
+      <from-outcome>members_management</from-outcome>
+      <to-view-id>/members_management.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_users</from-outcome>
+      <to-view-id>/view_users.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_many_users</from-outcome>
+      <to-view-id>/view_many_users.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>edit_user</from-outcome>
+      <to-view-id>/edit_user.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>edit_user_password</from-outcome>
+      <to-view-id>/edit_user_password.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_user</from-outcome>
+      <to-view-id>/view_user.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>create_user</from-outcome>
+      <to-view-id>/create_user.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_groups</from-outcome>
+      <to-view-id>/view_groups.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_group</from-outcome>
+      <to-view-id>/view_group.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>edit_group</from-outcome>
+      <to-view-id>/edit_group.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>create_group</from-outcome>
+      <to-view-id>/create_group.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_vocabularies</from-outcome>
+      <to-view-id>/view_vocabularies.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>view_vocabulary</from-outcome>
+      <to-view-id>/view_vocabulary.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- search -->
+
+    <navigation-case>
+      <from-outcome>search_form</from-outcome>
+      <to-view-id>/search/search_form.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>search_results_nxql</from-outcome>
+      <to-view-id>/search/search_results_nxql.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>search_results_advanced</from-outcome>
+      <to-view-id>
+        /search/search_results_advanced.xhtml
+      </to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>search_results_simple</from-outcome>
+      <to-view-id>/search/search_results_simple.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <!-- miscellaneaous -->
+
+    <navigation-case>
+      <from-outcome>clipboard</from-outcome>
+      <to-view-id>/incl/clipboard.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>user_dashboard</from-outcome>
+      <to-view-id>/user_dashboard.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>select_workspace_template</from-outcome>
+      <to-view-id>/select_workspace_template.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>pdf_generation_error</from-outcome>
+      <to-view-id>/pdf_generation_error.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>mass_edit</from-outcome>
+      <to-view-id>/massedit_documents.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+
+    <navigation-case>
+      <from-outcome>mass_edit_confirm</from-outcome>
+      <to-view-id>/massedit_documents_preview.xhtml</to-view-id>
+      <redirect/>
+    </navigation-case>
+  </extension>
+
+</fragment>
+
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/ecm-types-contrib.xml
new file mode 100644 (file)
index 0000000..2d36a8f
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.vocabulary.ecm.types">
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="Vocabulary" coretype="Vocabulary">
+      <label>org.collectionspace.vocabulary</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>csvocabulary</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>Vocabulary</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>Vocabulary</type>
+      </subtypes>
+    </type>
+
+  </extension>
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="VocabularyItem" coretype="VocabularyItem">
+      <label>org.collectionspace.vocabularyitem</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>vocabularyitem</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>VocabularyItem</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>VocabularyItem</type>
+      </subtypes>
+    </type>
+
+  </extension>
+</component>
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/OSGI-INF/layouts-contrib.xml
new file mode 100644 (file)
index 0000000..166b39d
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+
+<component name="org.collectionspace.vocabulary.layouts.webapp">
+
+       <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+    point="layouts">
+
+    <layout name="csvocabulary">
+      <templates>
+        <template mode="any">/layouts/layout_default_template.xhtml</template>
+      </templates>
+      <rows>
+        <row><widget>displayName</widget></row>
+        <row><widget>vocabType</widget></row>
+      </rows>
+
+      <widget name="displayName" type="text">
+        <labels>
+          <label mode="any">Name</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="vocabulary">displayName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="vocabType" type="text">
+        <labels>
+          <label mode="any">Type</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="vocabulary">vocabType</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+    </layout>
+  </extension>
+
+  <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+    point="layouts">
+
+               <layout name="vocabularyitem">
+      <templates>
+        <template mode="any">/layouts/layout_default_template.xhtml</template>
+      </templates>
+      <rows>
+        <row><widget>displayName</widget></row>
+        <row><widget>inVocabulary</widget></row>
+      </rows>
+
+      <widget name="displayName" type="text">
+        <labels>
+          <label mode="any">Name</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="vocabularyitem">displayName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="inVocabulary" type="text">
+        <labels>
+          <label mode="any">Vocab</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="vocabularyitem">inVocabulary</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+    </layout>
+  </extension>
+</component>
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/README.txt b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/README.txt
new file mode 100644 (file)
index 0000000..63bcc64
--- /dev/null
@@ -0,0 +1,4 @@
+The schema file here should be generated from the one defined for JAXB in:\r
+{root, e.g., trunk}\services\vocabulary\jaxb\src\main\resources\vocabulary-common.xsd\r
+\r
+Soon, we should do this with a tool (XSLT).
\ No newline at end of file
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/vocabularies-common.xsd b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/vocabularies-common.xsd
new file mode 100644 (file)
index 0000000..7e642fe
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/vocabulary"
+  xmlns="http://collectionspace.org/services/vocabulary"
+  targetNamespace="http://collectionspace.org/services/vocabulary"
+  version="0.1"
+>
+
+<!-- Flattened version of jaxb schema for nuxeo -->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Vocabulary+Schema -->    
+
+               <!--  Vocabulary Information Group -->
+               <xs:element name="displayName" type="xs:string"/>
+               <xs:element name="vocabType" type="xs:string"/>
+
+</xs:schema>
+
diff --git a/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/vocabularyitems-common.xsd b/services/vocabulary/3rdparty/nuxeo-platform-cs-vocabulary/src/main/resources/schemas/vocabularyitems-common.xsd
new file mode 100644 (file)
index 0000000..8b0d443
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/vocabulary"
+  xmlns="http://collectionspace.org/services/vocabulary"
+  targetNamespace="http://collectionspace.org/services/vocabulary"
+  version="0.1"
+>
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Vocabulary+Schema -->    
+
+               <!--  VocabularyItem Information Group -->
+               <!--  inVocabulary is the csid of the owning Vocabulary -->
+               <xs:element name="inVocabulary" type="xs:string" />
+               <xs:element name="displayName" type="xs:string"/>
+
+</xs:schema>
+
diff --git a/services/vocabulary/3rdparty/pom.xml b/services/vocabulary/3rdparty/pom.xml
new file mode 100644 (file)
index 0000000..dd59afb
--- /dev/null
@@ -0,0 +1,23 @@
+\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+    <parent>\r
+        <artifactId>org.collectionspace.services.vocabulary</artifactId>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <version>1.0</version>\r
+    </parent>\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <version>1.0</version>\r
+    <artifactId>org.collectionspace.services.vocabulary.3rdparty</artifactId>\r
+    <packaging>pom</packaging>\r
+    <name>services.vocabulary.3rdparty</name>\r
+    <description>\r
+    3rd party build for vocabulary service\r
+    </description>\r
+\r
+    <modules>\r
+        <module>nuxeo-platform-cs-vocabulary</module>\r
+    </modules>\r
+</project>\r
diff --git a/services/vocabulary/client/.settings/org.eclipse.jdt.core.prefs b/services/vocabulary/client/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..0b4dbbe
--- /dev/null
@@ -0,0 +1,5 @@
+#Mon Oct 05 17:07:09 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
diff --git a/services/vocabulary/client/.settings/org.maven.ide.eclipse.prefs b/services/vocabulary/client/.settings/org.maven.ide.eclipse.prefs
new file mode 100644 (file)
index 0000000..93b6f8a
--- /dev/null
@@ -0,0 +1,9 @@
+#Fri Sep 11 17:00:30 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+skipCompilerPlugin=true\r
+version=1\r
diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyClient.java
new file mode 100644 (file)
index 0000000..50cd352
--- /dev/null
@@ -0,0 +1,97 @@
+package org.collectionspace.services.client;
+
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.vocabulary.VocabulariesCommonList;
+
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * A VocabularyClient.
+
+ * @version $Revision:$
+ */
+public class VocabularyClient extends BaseServiceClient {
+
+
+    /**
+     *
+     */
+    private static final VocabularyClient instance = new VocabularyClient();
+    /**
+     *
+     */
+    private VocabularyProxy vocabularyProxy;
+
+    /**
+     *
+     * Default constructor for VocabularyClient class.
+     *
+     */
+    public VocabularyClient() {
+        ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+        RegisterBuiltin.register(factory);
+        vocabularyProxy = ProxyFactory.create(VocabularyProxy.class, getBaseURL());
+    }
+
+    /**
+     * FIXME Comment this
+     *
+     * @return
+     */
+    public static VocabularyClient getInstance() {
+        return instance;
+    }
+
+    /**
+     * @return
+     * @see org.collectionspace.hello.client.VocabularyProxy#getVocabulary()
+     */
+    public ClientResponse<VocabulariesCommonList> readList() {
+        return vocabularyProxy.readList();
+    }
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.hello.client.VocabularyProxy#getVocabulary(java.lang.String)
+     */
+
+    public ClientResponse<MultipartInput> read(String csid) {
+        return vocabularyProxy.read(csid);
+    }
+
+    /**
+     * @param vocabulary
+     * @return
+     * @see org.collectionspace.hello.client.VocabularyProxy#createVocabulary(org.collectionspace.hello.Vocabulary)
+     */
+    public ClientResponse<Response> create(MultipartOutput multipart) {
+        return vocabularyProxy.create(multipart);
+    }
+
+    /**
+     * @param csid
+     * @param vocabulary
+     * @return
+     * @see org.collectionspace.hello.client.VocabularyProxy#updateVocabulary(java.lang.Long, org.collectionspace.hello.Vocabulary)
+     */
+    public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
+        return vocabularyProxy.update(csid, multipart);
+
+    }
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.hello.client.VocabularyProxy#deleteVocabulary(java.lang.Long)
+     */
+    public ClientResponse<Response> delete(String csid) {
+        return vocabularyProxy.delete(csid);
+    }
+}
diff --git a/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java b/services/vocabulary/client/src/main/java/org/collectionspace/services/client/VocabularyProxy.java
new file mode 100644 (file)
index 0000000..4b29336
--- /dev/null
@@ -0,0 +1,48 @@
+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.vocabulary.VocabulariesCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+
+/**
+ * @version $Revision:$
+ */
+@Path("/vocabularies/")
+@Produces({"multipart/mixed"})
+@Consumes({"multipart/mixed"})
+public interface VocabularyProxy {
+
+    @GET
+    @Produces({"application/xml"})
+    ClientResponse<VocabulariesCommonList> readList();
+
+    //(C)reate
+    @POST
+    ClientResponse<Response> create(MultipartOutput multipart);
+
+    //(R)ead
+    @GET
+    @Path("/{csid}")
+    ClientResponse<MultipartInput> read(@PathParam("csid") String csid);
+
+    //(U)pdate
+    @PUT
+    @Path("/{csid}")
+    ClientResponse<MultipartInput> update(@PathParam("csid") String csid, MultipartOutput multipart);
+
+    //(D)elete
+    @DELETE
+    @Path("/{csid}")
+    ClientResponse<Response> delete(@PathParam("csid") String csid);
+}
diff --git a/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java b/services/vocabulary/client/src/test/java/org/collectionspace/services/client/test/VocabularyServiceTest.java
new file mode 100644 (file)
index 0000000..5a07965
--- /dev/null
@@ -0,0 +1,530 @@
+/**
+ * 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.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.client.VocabularyClient;
+import org.collectionspace.services.vocabulary.VocabulariesCommon;
+import org.collectionspace.services.vocabulary.VocabulariesCommonList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * VocabularyServiceTest, carries out tests against a
+ * deployed and running Vocabulary Service.
+ *
+ * $LastChangedRevision: 753 $
+ * $LastChangedDate: 2009-09-23 11:03:36 -0700 (Wed, 23 Sep 2009) $
+ */
+public class VocabularyServiceTest extends AbstractServiceTest {
+
+    // Instance variables specific to this test.
+    private VocabularyClient client = new VocabularyClient();
+    final String SERVICE_PATH_COMPONENT = "vocabularies";
+    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();
+
+        MultipartOutput multipart = createVocabularyInstance(identifier);
+        ClientResponse<Response> res = client.create(multipart);
+
+        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);
+        verbose("create: knownResourceId=" + knownResourceId);
+    }
+
+    @Override
+    @Test(dependsOnMethods = {"create"})
+    public void createList() {
+        for(int i = 0; i < 3; i++){
+            create();
+        }
+    }
+
+    // Failure outcomes
+    // Placeholders until the three tests below can be uncommented.
+    // See Issue CSPACE-401.
+    public void createWithEmptyEntityBody() {
+    }
+
+    public void createWithMalformedXml() {
+    }
+
+    public void createWithWrongXmlSchema() {
+    }
+
+    /*
+    @Override
+    @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+    public void createWithEmptyEntityBody() {
+
+    // Perform setup.
+    setupCreateWithEmptyEntityBody();
+
+    // Submit the request to the service and store the response.
+    String method = REQUEST_TYPE.httpMethodName();
+    String url = getServiceRootURL();
+    String mediaType = MediaType.APPLICATION_XML;
+    final String entity = "";
+    int statusCode = submitRequest(method, url, mediaType, entity);
+
+    // Check the status code of the response: does it match
+    // the expected response(s)?
+    verbose("createWithEmptyEntityBody 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 createWithMalformedXml() {
+
+    // Perform setup.
+    setupCreateWithMalformedXml();
+
+    // Submit the request to the service and store the response.
+    String method = REQUEST_TYPE.httpMethodName();
+    String url = getServiceRootURL();
+    String mediaType = MediaType.APPLICATION_XML;
+    final String entity = MALFORMED_XML_DATA; // Constant from base class.
+    int statusCode = submitRequest(method, url, mediaType, 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();
+    String mediaType = MediaType.APPLICATION_XML;
+    final String entity = WRONG_XML_SCHEMA_DATA;
+    int statusCode = submitRequest(method, url, mediaType, 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<MultipartInput> 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);
+        //FIXME: remove the following try catch once Aron fixes signatures
+        try{
+            MultipartInput input = (MultipartInput) res.getEntity();
+            VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
+                    getCommonPartName(), VocabulariesCommon.class);
+            Assert.assertNotNull(vocabulary);
+        }catch(Exception e){
+            throw new RuntimeException(e);
+        }
+    }
+
+    // Failure outcomes
+    @Override
+    @Test(dependsOnMethods = {"read"})
+    public void readNonExistent() {
+
+        // Perform setup.
+        setupReadNonExistent();
+
+        // Submit the request to the service and store the response.
+        ClientResponse<MultipartInput> 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 = {"read"})
+    public void readList() {
+
+        // Perform setup.
+        setupReadList();
+
+        // Submit the request to the service and store the response.
+        ClientResponse<VocabulariesCommonList> res = client.readList();
+        VocabulariesCommonList 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<VocabulariesCommonList.VocabularyListItem> items =
+                    list.getVocabularyListItem();
+            int i = 0;
+            for(VocabulariesCommonList.VocabularyListItem item : items){
+                verbose("readList: list-item[" + i + "] csid=" +
+                        item.getCsid());
+                verbose("readList: list-item[" + i + "] displayName=" +
+                        item.getDisplayName());
+                verbose("readList: list-item[" + i + "] URI=" +
+                        item.getUri());
+                i++;
+            }
+        }
+
+    }
+
+    // Failure outcomes
+    // None at present.
+    // ---------------------------------------------------------------
+    // CRUD tests : UPDATE tests
+    // ---------------------------------------------------------------
+    // Success outcomes
+    @Override
+    @Test(dependsOnMethods = {"read"})
+    public void update() {
+
+        // Perform setup.
+        setupUpdate();
+
+        try{ //ideally, just remove try-catch and let the exception bubble up
+            // Retrieve an existing resource that we can update.
+            ClientResponse<MultipartInput> res =
+                    client.read(knownResourceId);
+            verbose("update: read status = " + res.getStatus());
+            Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+
+            verbose("got object to update with ID: " + knownResourceId);
+            MultipartInput input = (MultipartInput) res.getEntity();
+            VocabulariesCommon vocabulary = (VocabulariesCommon) extractPart(input,
+                    getCommonPartName(), VocabulariesCommon.class);
+            Assert.assertNotNull(vocabulary);
+
+            // Update the content of this resource.
+            vocabulary.setDisplayName("updated-" + vocabulary.getDisplayName());
+             vocabulary.setVocabType("updated-" + vocabulary.getVocabType());
+           verbose("to be updated object", vocabulary, VocabulariesCommon.class);
+            // Submit the request to the service and store the response.
+            MultipartOutput output = new MultipartOutput();
+            OutputPart commonPart = output.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE);
+            commonPart.getHeaders().add("label", getCommonPartName());
+
+            res = client.update(knownResourceId, output);
+            int statusCode = res.getStatus();
+            // 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);
+
+
+            input = (MultipartInput) res.getEntity();
+            VocabulariesCommon updatedVocabulary =
+                    (VocabulariesCommon) extractPart(input,
+                    getCommonPartName(), VocabulariesCommon.class);
+            Assert.assertNotNull(updatedVocabulary);
+
+            Assert.assertEquals(updatedVocabulary.getDisplayName(),
+                    vocabulary.getDisplayName(),
+                    "Data in updated object did not match submitted data.");
+        }catch(Exception e){
+            e.printStackTrace();
+        }
+    }
+
+    // Failure outcomes
+    // Placeholders until the three tests below can be uncommented.
+    // See Issue CSPACE-401.
+    public void updateWithEmptyEntityBody() {
+    }
+
+    public void updateWithMalformedXml() {
+    }
+
+    public void updateWithWrongXmlSchema() {
+    }
+
+    /*
+    @Override
+    @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+    public void updateWithEmptyEntityBody() {
+
+    // Perform setup.
+    setupUpdateWithEmptyEntityBody();
+
+    // Submit the request to the service and store the response.
+    String method = REQUEST_TYPE.httpMethodName();
+    String url = getResourceURL(knownResourceId);
+    String mediaType = MediaType.APPLICATION_XML;
+    final String entity = "";
+    int statusCode = submitRequest(method, url, mediaType, entity);
+
+    // Check the status code of the response: does it match
+    // the expected response(s)?
+    verbose("updateWithEmptyEntityBody 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 updateWithMalformedXml() {
+
+    // Perform setup.
+    setupUpdateWithMalformedXml();
+
+    // Submit the request to the service and store the response.
+    String method = REQUEST_TYPE.httpMethodName();
+    String url = getResourceURL(knownResourceId);
+    String mediaType = MediaType.APPLICATION_XML;
+    final String entity = MALFORMED_XML_DATA;
+    int statusCode = submitRequest(method, url, mediaType, 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);
+    String mediaType = MediaType.APPLICATION_XML;
+    final String entity = WRONG_XML_SCHEMA_DATA;
+    int statusCode = submitRequest(method, url, mediaType, 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.
+
+        // The only relevant ID may be the one used in update(), below.
+        MultipartOutput multipart = createVocabularyInstance(NON_EXISTENT_ID);
+        ClientResponse<MultipartInput> res =
+                client.update(NON_EXISTENT_ID, multipart);
+        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", "readList", "testSubmitRequest", "update"})
+    public void delete() {
+
+        // Perform setup.
+        setupDelete();
+
+        // Submit the request to the service and store the response.
+        ClientResponse<Response> 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<Response> 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 MultipartOutput createVocabularyInstance(String identifier) {
+        return createVocabularyInstance(
+                "displayName-" + identifier,
+                "vocabType-" + identifier);
+    }
+
+    private MultipartOutput createVocabularyInstance(String displayName, String vocabType) {
+        VocabulariesCommon vocabulary = new VocabulariesCommon();
+        vocabulary.setDisplayName(displayName);
+        vocabulary.setVocabType(vocabType);
+        MultipartOutput multipart = new MultipartOutput();
+        OutputPart commonPart = multipart.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", getCommonPartName());
+
+        verbose("to be created, vocabulary common ", vocabulary, VocabulariesCommon.class);
+
+        return multipart;
+    }
+}
diff --git a/services/vocabulary/client/src/test/resources/log4j.properties b/services/vocabulary/client/src/test/resources/log4j.properties
new file mode 100644 (file)
index 0000000..18c5103
--- /dev/null
@@ -0,0 +1,23 @@
+log4j.rootLogger=debug, stdout, R\r
+\r
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
+\r
+# Pattern to output the caller's file name and line number.\r
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+log4j.appender.R=org.apache.log4j.RollingFileAppender\r
+log4j.appender.R.File=target/test-client.log\r
+\r
+log4j.appender.R.MaxFileSize=100KB\r
+# Keep one backup file\r
+log4j.appender.R.MaxBackupIndex=1\r
+\r
+log4j.appender.R.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+#packages\r
+log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.org.apache=INFO\r
+log4j.logger.httpclient=INFO\r
+log4j.logger.org.jboss.resteasy=INFO\r
diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..c0c3038
--- /dev/null
@@ -0,0 +1,15 @@
+/**\r
+ * \r
+ */\r
+package org.collectionspace.services;\r
+\r
+/**\r
+ * @author pschmitz\r
+ *\r
+ */\r
+public interface VocabularyItemJAXBSchema {\r
+       final static String DISPLAY_NAME = "displayName";\r
+       final static String IN_VOCABULARY = "inVocabulary";\r
+}\r
+\r
+\r
diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyItemListItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..f5f947b
--- /dev/null
@@ -0,0 +1,7 @@
+package org.collectionspace.services;\r
+\r
+public interface VocabularyItemListItemJAXBSchema {\r
+       final static String DISPLAY_NAME = "displayName";\r
+       final static String CSID = "csid";\r
+       final static String URI = "url";\r
+}\r
diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyJAXBSchema.java
new file mode 100644 (file)
index 0000000..fa90ed4
--- /dev/null
@@ -0,0 +1,15 @@
+/**\r
+ * \r
+ */\r
+package org.collectionspace.services;\r
+\r
+/**\r
+ * @author pschmitz\r
+ *\r
+ */\r
+public interface VocabularyJAXBSchema {\r
+       final static String DISPLAY_NAME = "displayName";\r
+       final static String VOCAB_TYPE = "vocabType";\r
+}\r
+\r
+\r
diff --git a/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java b/services/vocabulary/jaxb/src/main/java/org/collectionspace/services/VocabularyListItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..eae5441
--- /dev/null
@@ -0,0 +1,8 @@
+package org.collectionspace.services;\r
+\r
+public interface VocabularyListItemJAXBSchema {\r
+       final static String DISPLAY_NAME = "displayName";\r
+       final static String VOCAB_TYPE = "vocabType";\r
+       final static String CSID = "csid";\r
+       final static String URI = "url";\r
+}\r
diff --git a/services/vocabulary/jaxb/src/main/resources/vocabulary-common.xsd b/services/vocabulary/jaxb/src/main/resources/vocabulary-common.xsd
new file mode 100644 (file)
index 0000000..0af81ee
--- /dev/null
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/vocabulary"
+  xmlns="http://collectionspace.org/services/vocabulary"
+  targetNamespace="http://collectionspace.org/services/vocabulary"
+  version="0.1"
+>
+
+
+<!-- avoid XmlRootElement nightnmare, see http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Vocabulary+Schema -->    
+    
+    <!-- Vocabulary  -->
+    <xs:element name="vocabularies-common">
+        <xs:complexType>
+            <xs:sequence>
+                <!--  Common identifier -->
+                <xs:element name="csid" type="xs:string" />
+                
+                <!--  Vocabulary Information Group -->
+                <xs:element name="displayName" type="xs:string"/>
+                <xs:element name="vocabType" type="xs:string"/>
+
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+    <!-- Vocabulary instances, as in nuxeo repository -->
+    <xs:element name="vocabularies-common-list">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="vocabulary-list-item" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="displayName" type="xs:string"
+                                minOccurs="1" />
+                            <xs:element name="vocabType" type="xs:string"
+                                minOccurs="1" />
+                            <!-- uri to retrieve vocabulary details -->
+                            <xs:element name="uri" type="xs:anyURI"
+                                minOccurs="1" />
+                            <xs:element name="csid" type="xs:string"
+                                minOccurs="1" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+</xs:schema>
+
index 316d79b5e3af8273297b17f6bc86bf08897f27d8..7486fc97bf3b957b2beff2b356f525ccfe33fe45 100644 (file)
     <name>services.vocabulary</name>\r
 \r
     <modules>\r
+        <module>jaxb</module>\r
         <module>service</module>\r
+        <module>3rdparty</module>\r
+        <module>client</module>\r
     </modules>\r
 \r
     <build>\r
index a374a40f834d542145b1b2f8f0dd8215963e1599..c641afdb99c45b4211ac1ebdf9a7d58dc4ff480c 100644 (file)
@@ -2,6 +2,8 @@
 <classpath>\r
        <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
        <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+       <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+       <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
        <classpathentry kind="output" path="target/classes"/>\r
index de80035b1f57dfb3c73518762e18f97d13127c5b..0323438f3a35b04649c592630a71528f0dda9f28 100644 (file)
             <artifactId>org.collectionspace.services.common</artifactId>\r
             <version>1.0</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>                          \r
         <dependency>\r
             <groupId>org.slf4j</groupId>\r
             <artifactId>slf4j-api</artifactId>\r
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
deleted file mode 100644 (file)
index f8c8a02..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/**\r
- *  This document is a part of the source code and related artifacts\r
- *  for CollectionSpace, an open source collections management system\r
- *  for museums and related institutions:\r
-\r
- *  http://www.collectionspace.org\r
- *  http://wiki.collectionspace.org\r
-\r
- *  Copyright 2009 University of California at Berkeley\r
-\r
- *  Licensed under the Educational Community License (ECL), Version 2.0.\r
- *  You may not use this file except in compliance with this License.\r
-\r
- *  You may obtain a copy of the ECL 2.0 License at\r
-\r
- *  https://source.collectionspace.org/collection-space/LICENSE.txt\r
-\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-package org.collectionspace.services.vocabulary;\r
-\r
-import javax.ws.rs.Consumes;\r
-import javax.ws.rs.GET;\r
-import javax.ws.rs.Path;\r
-import javax.ws.rs.Produces;\r
-import javax.ws.rs.DELETE;\r
-import javax.ws.rs.POST;\r
-import javax.ws.rs.PUT;\r
-import javax.ws.rs.PathParam;\r
-import javax.ws.rs.WebApplicationException;\r
-import javax.ws.rs.core.Context;\r
-import javax.ws.rs.core.Response;\r
-import javax.ws.rs.core.UriBuilder;\r
-import javax.ws.rs.core.UriInfo;\r
-import javax.xml.bind.JAXBContext;\r
-import javax.xml.bind.Marshaller;\r
-\r
-import org.collectionspace.services.common.vocabulary.VocabManager;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-@Path("/vocab")\r
-@Consumes("application/xml")\r
-@Produces("application/xml")\r
-public class VocabResource {\r
-\r
-    public final static String SERVICE_NAME = "vocab";\r
-    final Logger logger = LoggerFactory.getLogger(VocabResource.class);\r
-\r
-    public VocabResource() {\r
-        // do nothing\r
-    }\r
-\r
-    @GET\r
-    @Path("{csid}")\r
-    public void getVocab(\r
-            @PathParam("csid") String csid) {\r
-        if(logger.isDebugEnabled()){\r
-            verbose("getVocab with csid=" + csid);\r
-        }\r
-        if(csid == null || "".equals(csid)){\r
-            logger.error("getVocab: missing csid!");\r
-            Response response = Response.status(Response.Status.BAD_REQUEST).entity(\r
-                    "get failed on getVocab csid=" + csid).type(\r
-                    "text/plain").build();\r
-            throw new WebApplicationException(response);\r
-        }\r
-\r
-        try {\r
-               //\r
-               // An example call to the Vocabulary manager\r
-               //\r
-               VocabManager.exampleMethod("someParam");\r
-        } catch(Exception e){\r
-            if(logger.isDebugEnabled()){\r
-                logger.debug("getVocab", e);\r
-            }\r
-            Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
-                    "Get failed on vocab csid=" + csid).type(\r
-                    "text/plain").build();\r
-            throw new WebApplicationException(response);\r
-        }\r
-\r
-        // an example of how to send a failed message\r
-        if(false){\r
-            Response response = Response.status(Response.Status.NOT_FOUND).entity(\r
-                    "Get failed, the requested CSID:" + csid + ": was not found.").type(\r
-                    "text/plain").build();\r
-            throw new WebApplicationException(response);\r
-        }\r
-    }\r
-\r
-    private void verbose(String msg) {\r
-        System.out.println("VocabResource. " + msg);\r
-    }\r
-}\r
diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java
new file mode 100644 (file)
index 0000000..cf7b7e2
--- /dev/null
@@ -0,0 +1,243 @@
+/**
+ *  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 org.collectionspace.services.common.AbstractCollectionSpaceResource;
+import org.collectionspace.services.vocabulary.nuxeo.VocabularyHandlerFactory;
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.context.RemoteServiceContext;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.repository.DocumentNotFoundException;
+import org.collectionspace.services.common.repository.DocumentHandler;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Path("/vocabularies")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class VocabularyResource extends AbstractCollectionSpaceResource {
+
+    private final static String serviceName = "vocabularies";
+    final Logger logger = LoggerFactory.getLogger(VocabularyResource.class);
+    //FIXME retrieve client type from configuration
+    final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+
+    public VocabularyResource() {
+        // do nothing
+    }
+
+    @Override
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    @Override
+    public DocumentHandler createDocumentHandler(RemoteServiceContext ctx) throws Exception {
+        DocumentHandler docHandler = VocabularyHandlerFactory.getInstance().getHandler(
+                ctx.getRepositoryClientType().toString());
+        docHandler.setServiceContext(ctx);
+        if(ctx.getInput() != null){
+            Object obj = ctx.getInputPart(ctx.getCommonPartLabel(), VocabulariesCommon.class);
+            if(obj != null){
+                docHandler.setCommonPart((VocabulariesCommon) obj);
+            }
+        }
+        return docHandler;
+    }
+
+    @POST
+    public Response createVocabulary(MultipartInput input) {
+        try{
+            RemoteServiceContext ctx = createServiceContext(input);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            String csid = getRepositoryClient(ctx).create(ctx, handler);
+            //vocabularyObject.setCsid(csid);
+            UriBuilder path = UriBuilder.fromResource(VocabularyResource.class);
+            path.path("" + csid);
+            Response response = Response.created(path.build()).build();
+            return response;
+        }catch(Exception e){
+            if(logger.isDebugEnabled()){
+                logger.debug("Caught exception in createVocabulary", 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 MultipartOutput getVocabulary(
+            @PathParam("csid") String csid) {
+        if(logger.isDebugEnabled()){
+            logger.debug("getVocabulary with csid=" + csid);
+        }
+        if(csid == null || "".equals(csid)){
+            logger.error("getVocabulary: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "get failed on Vocabulary csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        MultipartOutput result = null;
+        try{
+            RemoteServiceContext ctx = createServiceContext(null);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).get(ctx, csid, handler);
+            result = ctx.getOutput();
+        }catch(DocumentNotFoundException dnfe){
+            if(logger.isDebugEnabled()){
+                logger.debug("getVocabulary", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Get failed on Vocabulary csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }catch(Exception e){
+            if(logger.isDebugEnabled()){
+                logger.debug("getVocabulary", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Get failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        if(result == null){
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Get failed, the requested Vocabulary CSID:" + csid + ": was not found.").type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return result;
+    }
+
+    @GET
+    @Produces("application/xml")
+    public VocabulariesCommonList getVocabularyList(@Context UriInfo ui) {
+        VocabulariesCommonList vocabularyObjectList = new VocabulariesCommonList();
+        try{
+            RemoteServiceContext ctx = createServiceContext(null);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).getAll(ctx, handler);
+            vocabularyObjectList = (VocabulariesCommonList) handler.getCommonPartList();
+        }catch(Exception e){
+            if(logger.isDebugEnabled()){
+                logger.debug("Caught exception in getVocabularyList", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return vocabularyObjectList;
+    }
+
+    @PUT
+    @Path("{csid}")
+    public MultipartOutput updateVocabulary(
+            @PathParam("csid") String csid,
+            MultipartInput theUpdate) {
+        if(logger.isDebugEnabled()){
+            logger.debug("updateVocabulary with csid=" + csid);
+        }
+        if(csid == null || "".equals(csid)){
+            logger.error("updateVocabulary: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "update failed on Vocabulary csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        MultipartOutput result = null;
+        try{
+            RemoteServiceContext ctx = createServiceContext(theUpdate);
+            DocumentHandler handler = createDocumentHandler(ctx);
+            getRepositoryClient(ctx).update(ctx, csid, handler);
+            result = ctx.getOutput();
+        }catch(DocumentNotFoundException dnfe){
+            if(logger.isDebugEnabled()){
+                logger.debug("caugth exception in updateVocabulary", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Update failed on Vocabulary 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 result;
+    }
+
+    @DELETE
+    @Path("{csid}")
+    public Response deleteVocabulary(@PathParam("csid") String csid) {
+
+        if(logger.isDebugEnabled()){
+            logger.debug("deleteVocabulary with csid=" + csid);
+        }
+        if(csid == null || "".equals(csid)){
+            logger.error("deleteVocabulary: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "delete failed on Vocabulary csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        try{
+            ServiceContext ctx = createServiceContext(null);
+            getRepositoryClient(ctx).delete(ctx, csid);
+            return Response.status(HttpResponseCodes.SC_OK).build();
+        }catch(DocumentNotFoundException dnfe){
+            if(logger.isDebugEnabled()){
+                logger.debug("caught exception in deleteVocabulary", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Delete failed on Vocabulary 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);
+        }
+
+    }
+}