]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-139 added files from branch sprint at 3557 for blob and media handling
authorLaramie Crocker <laramie@berkeley.edu>
Wed, 1 Dec 2010 23:51:45 +0000 (23:51 +0000)
committerLaramie Crocker <laramie@berkeley.edu>
Wed, 1 Dec 2010 23:51:45 +0000 (23:51 +0000)
64 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/blob/3rdparty/build.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/build.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/pom.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/META-INF/MANIFEST.MF [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/core-types-contrib.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/deployment-fragment.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/ecm-types-contrib.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/layouts-contrib.xml [new file with mode: 0644]
services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/schemas/blob_common.xsd [new file with mode: 0644]
services/blob/3rdparty/pom.xml [new file with mode: 0644]
services/blob/build.xml [new file with mode: 0644]
services/blob/client/pom.xml [new file with mode: 0644]
services/blob/client/src/main/java/org/collectionspace/services/client/BlobClient.java [new file with mode: 0644]
services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java [new file with mode: 0644]
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java [new file with mode: 0644]
services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java [new file with mode: 0644]
services/blob/client/src/test/resources/log4j.properties [new file with mode: 0644]
services/blob/jaxb/pom.xml [new file with mode: 0644]
services/blob/jaxb/src/main/java/org/collectionspace/services/BlobJAXBSchema.java [new file with mode: 0644]
services/blob/jaxb/src/main/java/org/collectionspace/services/BlobListItemJAXBSchema.java [new file with mode: 0644]
services/blob/jaxb/src/main/resources/blob_common.xsd [new file with mode: 0644]
services/blob/pom.xml [new file with mode: 0644]
services/blob/service/pom.xml [new file with mode: 0644]
services/blob/service/profiles.xml [new file with mode: 0644]
services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java [new file with mode: 0644]
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobConstants.java [new file with mode: 0644]
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java [new file with mode: 0644]
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobValidatorHandler.java [new file with mode: 0644]
services/blob/service/src/test/java/org/collectionspace/services/test/BlobServiceTest.java [new file with mode: 0644]
services/blob/service/src/test/resources/log4j.xml [new file with mode: 0644]
services/build.xml
services/media/3rdparty/build.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/build.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/pom.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/META-INF/MANIFEST.MF [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/core-types-contrib.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/deployment-fragment.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/ecm-types-contrib.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/layouts-contrib.xml [new file with mode: 0644]
services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/schemas/media_common.xsd [new file with mode: 0644]
services/media/3rdparty/pom.xml [new file with mode: 0644]
services/media/build.xml [new file with mode: 0644]
services/media/client/pom.xml [new file with mode: 0644]
services/media/client/src/main/java/org/collectionspace/services/client/MediaClient.java [new file with mode: 0644]
services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java [new file with mode: 0644]
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java [new file with mode: 0644]
services/media/client/src/test/java/org/collectionspace/services/client/test/MediaServiceTest.java [new file with mode: 0644]
services/media/client/src/test/resources/log4j.properties [new file with mode: 0644]
services/media/jaxb/pom.xml [new file with mode: 0644]
services/media/jaxb/src/main/java/org/collectionspace/services/MediaJAXBSchema.java [new file with mode: 0644]
services/media/jaxb/src/main/java/org/collectionspace/services/MediaListItemJAXBSchema.java [new file with mode: 0644]
services/media/jaxb/src/main/resources/media_common.xsd [new file with mode: 0644]
services/media/pom.xml [new file with mode: 0644]
services/media/service/pom.xml [new file with mode: 0644]
services/media/service/profiles.xml [new file with mode: 0644]
services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java [new file with mode: 0644]
services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaConstants.java [new file with mode: 0644]
services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaDocumentModelHandler.java [new file with mode: 0644]
services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaValidatorHandler.java [new file with mode: 0644]
services/media/service/src/test/java/org/collectionspace/services/test/MediaServiceTest.java [new file with mode: 0644]
services/media/service/src/test/resources/log4j.xml [new file with mode: 0644]
services/pom.xml

index 4fe4f80f84fd11171375d2df50591cb794057a0f..98b3d1eb5529d760c40743545779449fa3e13389 100644 (file)
             <artifactId>org.collectionspace.services.authorization-mgt.service</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.blob.service</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.collectionobject.service</artifactId>\r
             <artifactId>org.collectionspace.services.objectexit.service</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.media.service</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>\r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.location.service</artifactId>\r
index 6be3537f2e9ea9556607426b3a0c7b365e42ce7e..739cc030f6c98f2194da7d380cd986814fc34d22 100644 (file)
 package org.collectionspace.services.jaxrs;
 
 import org.collectionspace.services.account.AccountResource;
+import org.collectionspace.services.blob.BlobResource;
 import org.collectionspace.services.collectionobject.CollectionObjectResource;
 import org.collectionspace.services.id.IDResource;
+import org.collectionspace.services.media.MediaResource;
 import org.collectionspace.services.note.NoteResource;
 import org.collectionspace.services.intake.IntakeResource;
 import org.collectionspace.services.loanin.LoaninResource;
@@ -87,6 +89,8 @@ public class CollectionSpaceJaxRsApplication extends Application {
         singletons.add(new LoanoutResource());
         singletons.add(new ObjectExitResource());
         singletons.add(new LocationAuthorityResource());
+        singletons.add(new MediaResource());
+        singletons.add(new BlobResource());
         singletons.add(new MovementResource());
         singletons.add(new ReportResource());
         singletons.add(new AcquisitionResource());
diff --git a/services/blob/3rdparty/build.xml b/services/blob/3rdparty/build.xml
new file mode 100644 (file)
index 0000000..b1aca6b
--- /dev/null
@@ -0,0 +1,127 @@
+
+<project name="blob.3rdparty" default="package" basedir=".">
+    <description>
+        blob service 3rdparty
+    </description>
+  <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="init" >
+    <!-- Create the time stamp -->
+        <tstamp/>
+    </target>
+
+    <target name="package" depends="package-unix,package-windows"
+  description="Package CollectionSpace Services" />
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="install" depends="install-unix,install-windows"
+  description="Install" />
+    <target name="install-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="install-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    
+    <target name="clean" depends="clean-unix,clean-windows"
+  description="Delete target directories" >
+        <delete dir="${build}"/>
+    </target>
+    <target name="clean-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="clean-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />
+    <target name="test-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="test-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="deploy" depends="install"
+    description="deploy blob in ${jboss.server.nuxeo}">
+        <ant antfile="nuxeo-platform-cs-blob/build.xml" target="deploy" inheritall="false"/>
+    </target>
+
+    <target name="undeploy"
+    description="undeploy blob from ${jboss.server.nuxeo}">
+        <ant antfile="nuxeo-platform-cs-blob/build.xml" target="undeploy" inheritall="false"/>
+    </target>
+
+    <target name="dist"
+    description="generate distribution for blob" depends="package">
+        <ant antfile="nuxeo-platform-cs-blob/build.xml" target="dist" inheritall="false"/>
+    </target>
+
+
+</project>
diff --git a/services/blob/3rdparty/nuxeo-platform-cs-blob/build.xml b/services/blob/3rdparty/nuxeo-platform-cs-blob/build.xml
new file mode 100644 (file)
index 0000000..c17cc92
--- /dev/null
@@ -0,0 +1,143 @@
+
+<project name="nuxeo-platform-cs-blob" default="package" basedir=".">
+    <description>
+        blob nuxeo document type
+    </description>
+    <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+    <property name="nuxeo.blob.jar"
+        value="org.collectionspace.services.blob.3rdparty.nuxeo-${cspace.release}.jar"/>
+    <property name="nuxeo.blob.jars.all"
+        value="org.collectionspace.services.blob.3rdparty.nuxeo-*.jar"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="init" >
+        <!-- Create the time stamp -->
+        <tstamp/>
+    </target>
+
+    <target name="package" depends="package-unix,package-windows"
+        description="Package CollectionSpace Services" />
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="install" depends="install-unix,install-windows"
+        description="Install" />
+    <target name="install-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="install-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="clean" depends="clean-unix,clean-windows"
+        description="Delete target directories" >
+        <delete dir="${build}"/>
+    </target>
+    <target name="clean-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="clean-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />
+    <target name="test-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="test-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="deploy" depends="install"
+        description="deploy blob doctype in ${jboss.server.nuxeo}">
+        <copy file="${basedir}/target/${nuxeo.blob.jar}"
+        todir="${jboss.deploy.nuxeo.plugins}"/>
+    </target>
+
+    <target name="undeploy"
+        description="undeploy blob doctype from ${jboss.server.nuxeo}">
+        <delete>
+            <fileset dir="${jboss.deploy.nuxeo.plugins}">
+                <include name="${nuxeo.blob.jars.all}"/>
+            </fileset>
+            <!-- Legacy deployment location through release 0.6 -->
+            <fileset dir="${jboss.deploy.nuxeo.system}">
+                <include name="${nuxeo.blob.jars.all}"/>
+            </fileset>
+        </delete>
+    </target>
+
+
+    <target name="dist"
+        description="generate distribution for blob doctype" depends="package">
+        <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+            <fileset file="${basedir}/target/${nuxeo.blob.jar}"/>
+        </copy>
+    </target>
+
+</project>
+
diff --git a/services/blob/3rdparty/nuxeo-platform-cs-blob/pom.xml b/services/blob/3rdparty/nuxeo-platform-cs-blob/pom.xml
new file mode 100644 (file)
index 0000000..2c033e3
--- /dev/null
@@ -0,0 +1,38 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.blob.3rdparty</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.blob.3rdparty.nuxeo</artifactId>
+    <name>services.blob.3rdparty.nuxeo</name>
+    <packaging>jar</packaging>
+    <description>
+        Blob Nuxeo Document Type
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile> src/main/resources/META-INF/MANIFEST.MF </manifestFile>
+                        <manifestEntries>
+                            <Bundle-Version>${eclipseVersion}</Bundle-Version>
+                            <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/META-INF/MANIFEST.MF b/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..d250273
--- /dev/null
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.blob;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.ws,\r
+ org.collectionspace.collectionspace_core\r
+Provide-Package: org.collectionspace.blob\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/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/core-types-contrib.xml
new file mode 100644 (file)
index 0000000..8c9cfe3
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.blob.coreTypes">
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+    <schema name="blob_common" prefix="blob_common" src="schemas/blob_common.xsd"/>
+  </extension>
+  
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+    <doctype name="Blob" extends="Document">
+      <schema name="common"/>
+      <schema name="dublincore"/>
+      <schema name="collectionspace_core"/>
+      <schema name="blob_common"/>
+    </doctype>
+  </extension>
+</component>
diff --git a/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/blob/3rdparty/nuxeo-platform-cs-blob/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/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/ecm-types-contrib.xml
new file mode 100644 (file)
index 0000000..b6d129f
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.blob.ecm.types">
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="Blob" coretype="Blob">
+      <label>org.collectionspace.blob</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>collectionspace_core</layout>
+        <layout>blob</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>Blob</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>Blob</type>
+      </subtypes>
+    </type>
+
+  </extension>
+</component>
diff --git a/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/OSGI-INF/layouts-contrib.xml
new file mode 100644 (file)
index 0000000..e72031e
--- /dev/null
@@ -0,0 +1,212 @@
+<?xml version="1.0"?>
+
+<!--
+layouts-contrib.xml
+
+Layout file for configuring screen layouts in the
+user interface of Nuxeo EP's web application, for
+viewing or editing CollectionSpace records stored
+in the Nuxeo repository,
+
+See the "Nuxeo Book" for an introductory description
+of how to edit this file.  For instance, for Nuxeo EP 5.3:
+http://doc.nuxeo.org/5.3/books/nuxeo-book/html/
+
+$LastChangedRevision: $
+$LastChangedDate: $
+-->
+
+<component name="org.collectionspace.blob.layouts.webapp">
+
+    <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+               point="layouts">
+
+        <layout name="blob">
+            <templates>
+                <template mode="any">/layouts/layout_default_template.xhtml</template>
+            </templates>       
+            
+            <rows>
+                <row><widget>blobNumber</widget></row>
+                <row><widget>borrower</widget></row>
+                <row><widget>borrowersContact</widget></row>
+                <row><widget>lendersAuthorizer</widget></row>
+                <row><widget>lendersAuthorizationDate</widget></row>
+                <row><widget>lendersContact</widget></row>
+                
+                <!--
+                     Omitting loaned object status fields in release 0.5.2,
+                     as these are likely to be repeatable or else handled
+                     in some alternate way in release 0.7.
+                -->
+                <!-- <row><widget>loanedObjectStatus</widget></row> -->
+                <!-- <row><widget>loanedObjectStatusDate</widget></row> -->
+                <!-- <row><widget>loanedObjectStatusNote</widget></row> -->
+                
+                <row><widget>blobDate</widget></row>
+                <row><widget>loanReturnDate</widget></row>
+                <row><widget>loanRenewalApplicationDate</widget></row>
+                <row><widget>specialConditionsOfLoan</widget></row>
+                <row><widget>blobNote</widget></row>
+                <row><widget>loanPurpose</widget></row>
+            </rows>
+
+            <widget name="blobNumber" type="text">
+                <labels>
+                    <label mode="any">blobNumber</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">blobNumber</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="borrower" type="text">
+                <labels>
+                    <label mode="any">borrower</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">borrower</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+            
+            <widget name="borrowersContact" type="text">
+                <labels>
+                    <label mode="any">borrowersContact</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">borrowersContact</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="lendersAuthorizer" type="text">
+                <labels>
+                    <label mode="any">lendersAuthorizer</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">lendersAuthorizer</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="lendersAuthorizationDate" type="text">
+                <labels>
+                    <label mode="any">lendersAuthorizationDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">lendersAuthorizationDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="lendersContact" type="text">
+                <labels>
+                    <label mode="any">lendersContact</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">lendersContact</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="blobDate" type="text">
+                <labels>
+                    <label mode="any">blobDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">blobDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="loanReturnDate" type="text">
+                <labels>
+                    <label mode="any">loanReturnDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">loanReturnDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="loanRenewalApplicationDate" type="text">
+                <labels>
+                    <label mode="any">loanRenewalApplicationDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">loanRenewalApplicationDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="specialConditionsOfLoan" type="text">
+                <labels>
+                    <label mode="any">specialConditionsOfLoan</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">specialConditionsOfLoan</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+          </widget>
+
+          <widget name="blobNote" type="text">
+                <labels>
+                    <label mode="any">blobNote</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">blobNote</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="loanPurpose" type="text">
+                <labels>
+                    <label mode="any">loanPurpose</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="blob_common">loanPurpose</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+        </layout>
+    </extension>
+</component>
diff --git a/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/schemas/blob_common.xsd b/services/blob/3rdparty/nuxeo-platform-cs-blob/src/main/resources/schemas/blob_common.xsd
new file mode 100644 (file)
index 0000000..18c953c
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+\r
+<!--\r
+    Loan Out schema (XSD)\r
+    \r
+    Entity  : Blob\r
+    Part    : Common\r
+    Used for: Nuxeo EP core document type\r
+\r
+    $LastChangedRevision: 2316 $\r
+    $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $\r
+-->\r
+\r
+<xs:schema \r
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+    xmlns:ns="http://collectionspace.org/blob/"\r
+    xmlns="http://collectionspace.org/blob/"\r
+    targetNamespace="http://collectionspace.org/blob/"\r
+    version="0.1">\r
+    \r
+    <!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->\r
+\r
+    <!--  Blob Information Group -->\r
+    <xs:element name="currentOwner" type="xs:string"/>\r
+    <xs:element name="depositor" type="xs:string"/>\r
+    <xs:element name="exitDate" type="xs:string"/>\r
+    <xs:element name="exitMethods">\r
+        <xs:complexType>\r
+            <xs:sequence>\r
+                <xs:element name="exitMethod" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>\r
+            </xs:sequence>\r
+        </xs:complexType>\r
+   </xs:element>\r
+    <xs:element name="exitNote" type="xs:string"/>\r
+    <xs:element name="exitNumber" type="xs:string"/>\r
+    <xs:element name="exitReason" type="xs:string"/>\r
+    <xs:element name="packingNote" type="xs:string"/>    \r
+</xs:schema>\r
diff --git a/services/blob/3rdparty/pom.xml b/services/blob/3rdparty/pom.xml
new file mode 100644 (file)
index 0000000..e4af411
--- /dev/null
@@ -0,0 +1,24 @@
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>org.collectionspace.services.blob</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.blob.3rdparty</artifactId>
+    <name>services.blob.3rdparty</name>
+    <packaging>pom</packaging>
+    
+    <description>
+        3rd party build for blob service
+    </description>
+
+    <modules>
+        <module>nuxeo-platform-cs-blob</module>
+    </modules>
+</project>
diff --git a/services/blob/build.xml b/services/blob/build.xml
new file mode 100644 (file)
index 0000000..cf3ae58
--- /dev/null
@@ -0,0 +1,124 @@
+
+<project name="blob" default="package" basedir=".">
+    <description>
+        blob service
+    </description>
+  <!-- set global properties for this build -->
+    <property name="services.trunk" value="../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="package" depends="package-unix,package-windows"
+  description="Package CollectionSpace Services" />
+  
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+
+    <target name="install" depends="install-unix,install-windows"
+  description="Install" />
+    <target name="install-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="install-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="clean" depends="clean-unix,clean-windows"
+  description="Delete target directories" >
+        <delete dir="${build}"/>
+    </target>
+    <target name="clean-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="clean-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />
+    <target name="test-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="test-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="deploy" depends="install"
+    description="deploy blob service">
+        <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+    </target>
+
+    <target name="undeploy"
+    description="undeploy blob service">
+        <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+    </target>
+
+    <target name="dist" depends="package"
+    description="distribute blob service">
+        <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>
+    </target>
+
+</project>
diff --git a/services/blob/client/pom.xml b/services/blob/client/pom.xml
new file mode 100644 (file)
index 0000000..620fff1
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.blob</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.blob.client</artifactId>
+    <name>services.blob.client</name>
+    
+    <dependencies>
+        <!-- keep slf4j dependencies on the top -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+<!-- CollectionSpace dependencies -->
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <optional>true</optional>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+         <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.blob.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.person.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+<!-- External dependencies -->        
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <!-- filter out unwanted jars -->
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-blob-client</finalName>
+    </build>
+</project>
diff --git a/services/blob/client/src/main/java/org/collectionspace/services/client/BlobClient.java b/services/blob/client/src/main/java/org/collectionspace/services/client/BlobClient.java
new file mode 100644 (file)
index 0000000..1823a6d
--- /dev/null
@@ -0,0 +1,150 @@
+/**    
+ * 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 (c) 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
+ */
+package org.collectionspace.services.client;
+
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+//import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.blob.BlobCommonList;
+
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * BlobClient.java
+ *
+ * $LastChangedRevision: 2108 $
+ * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
+ *
+ */
+public class BlobClient extends AbstractServiceClientImpl {
+
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
+     */
+    public String getServicePathComponent() {
+        return "blob"; //Laramie20100824 was blobs, but label was a mismatch.
+    }
+    /**
+     *
+     */
+//    private static final BlobClient instance = new BlobClient();
+    /**
+     *
+     */
+    private BlobProxy blobProxy;
+
+    /**
+     *
+     * Default constructor for BlobClient class.
+     *
+     */
+    public BlobClient() {
+        ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+        RegisterBuiltin.register(factory);
+        setProxy();
+    }
+
+    @Override
+    public CollectionSpaceProxy getProxy() {
+       return this.blobProxy;
+    }    
+
+    /**
+     * allow to reset proxy as per security needs
+     */
+    public void setProxy() {
+        if (useAuth()) {
+            blobProxy = ProxyFactory.create(BlobProxy.class,
+                    getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
+        } else {
+            blobProxy = ProxyFactory.create(BlobProxy.class,
+                    getBaseURL());
+        }
+    }
+
+    /**
+     * FIXME Comment this
+     *
+     * @return
+     */
+//    public static BlobClient getInstance() {
+//        return instance;
+//    }
+
+    /**
+     * @return
+     * @see org.collectionspace.services.client.BlobProxy#getBlob()
+     */
+    public ClientResponse<BlobCommonList> readList() {
+        return blobProxy.readList();
+    }
+    
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.services.client.BlobProxy#getAuthorityRefs(java.lang.String)
+     */
+    public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+        return blobProxy.getAuthorityRefs(csid);
+    }
+
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.services.client.BlobProxy#getBlob(java.lang.String)
+     */
+    public ClientResponse<MultipartInput> read(String csid) {
+        return blobProxy.read(csid);
+    }
+
+    /**
+     * @param blob
+     * @return
+     *
+     */
+    public ClientResponse<Response> create(MultipartOutput multipart) {
+        return blobProxy.create(multipart);
+    }
+
+    /**
+     * @param csid
+     * @param blob
+     * @return
+     */
+    public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
+        return blobProxy.update(csid, multipart);
+
+    }
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.services.client.BlobProxy#deleteBlob(java.lang.Long)
+     */
+    public ClientResponse<Response> delete(String csid) {
+        return blobProxy.delete(csid);
+    }
+}
diff --git a/services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java b/services/blob/client/src/main/java/org/collectionspace/services/client/BlobProxy.java
new file mode 100644 (file)
index 0000000..31bc0d5
--- /dev/null
@@ -0,0 +1,57 @@
+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.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.blob.BlobCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+
+/**
+ * @version $Revision: 2108 $
+ */
+@Path("/blob/")
+@Produces({"multipart/mixed"})
+@Consumes({"multipart/mixed"})
+public interface BlobProxy extends CollectionSpaceProxy {
+
+    //(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);
+    
+    // List
+    @GET
+    @Produces({"application/xml"})
+    ClientResponse<BlobCommonList> readList();
+
+    // List Authority References
+    @GET
+    @Produces({"application/xml"})
+    @Path("/{csid}/authorityrefs/")
+    ClientResponse<AuthorityRefList> getAuthorityRefs(@PathParam("csid") String csid);
+    
+}
diff --git a/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java b/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java
new file mode 100644 (file)
index 0000000..fc10b00
--- /dev/null
@@ -0,0 +1,227 @@
+/**
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.BlobClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.blob.BlobCommon;
+
+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.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * BlobAuthRefsTest, carries out Authority References tests against a deployed and running Blob (aka Loans Out) Service.
+ * $LastChangedRevision:  $
+ * $LastChangedDate:  $
+ */
+public class BlobAuthRefsTest extends BaseServiceTest {
+
+    private final String CLASS_NAME = BlobAuthRefsTest.class.getName();
+    private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+    final String SERVICE_PATH_COMPONENT = "blob";
+    final String PERSON_AUTHORITY_NAME = "BlobPersonAuth";
+    private String knownResourceId = null;
+    private List<String> blobIdsCreated = new ArrayList<String>();
+    private List<String> personIdsCreated = new ArrayList<String>();
+    private String personAuthCSID = null;
+    private String depositorRefName = null;
+    private String exitDate = null;
+    private String exitNumber = null;
+
+    @Override
+    protected CollectionSpaceClient getClientInstance() {
+        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+    }
+
+    @Override
+    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+    }
+
+    @Override
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
+    }
+
+    private MultipartOutput createBlobInstance(String depositorRefName, String exitNumber, String exitDate) {
+        this.exitDate = exitDate;
+        this.exitNumber = exitNumber;
+        this.depositorRefName = depositorRefName;
+        BlobCommon blob = new BlobCommon();
+        blob.setDepositor(depositorRefName);
+        blob.setExitNumber(exitNumber);
+        blob.setExitDate(exitDate);
+
+        MultipartOutput multipart = new MultipartOutput();
+        OutputPart commonPart = multipart.addPart(blob, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", new BlobClient().getCommonPartName());
+        logger.debug("to be created, blob common: " + objectAsXmlString(blob, BlobCommon.class));
+        return multipart;
+    }
+
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    public void createWithAuthRefs(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+        String identifier = createIdentifier(); // Submit the request to the service and store the response.
+        createPersonRefs();// Create all the person refs and entities
+        // Create a new Loans In resource. One or more fields in this resource will be PersonAuthority
+        //    references, and will refer to Person resources by their refNames.
+        BlobClient blobClient = new BlobClient();
+        MultipartOutput multipart = createBlobInstance(depositorRefName, "exitNumber-" + identifier, "exitDate-" + identifier);
+        ClientResponse<Response> res = blobClient.create(multipart);
+        assertStatusCode(res, testName);
+        if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
+            knownResourceId = extractId(res);
+        }
+        blobIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
+    }
+
+    protected void createPersonRefs() {
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
+        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+        ClientResponse<Response> res = personAuthClient.create(multipart);
+        assertStatusCode(res, "createPersonRefs (not a surefire test)");
+        personAuthCSID = extractId(res);
+        String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+        // Create temporary Person resources, and their corresponding refNames by which they can be identified.
+        String csid = "";
+
+        csid = createPerson("Owen the Cur", "Owner", "owenCurOwner", authRefName);
+        personIdsCreated.add(csid);
+        depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+        csid = createPerson("Davenport", "Depositor", "davenportDepositor", authRefName);
+        personIdsCreated.add(csid);
+        depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+    }
+
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        Map<String, String> personInfo = new HashMap<String, String>();
+        personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+        personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+        personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
+        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName());
+        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+        assertStatusCode(res, "createPerson (not a surefire test)");
+        return extractId(res);
+    }
+
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"})
+    public void readAndCheckAuthRefs(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        testSetup(STATUS_OK, ServiceRequestType.READ);
+        BlobClient blobClient = new BlobClient();
+        ClientResponse<MultipartInput> res = blobClient.read(knownResourceId);
+        assertStatusCode(res, testName);
+        MultipartInput input = (MultipartInput) res.getEntity();
+        BlobCommon blob = (BlobCommon) extractPart(input, blobClient.getCommonPartName(), BlobCommon.class);
+        Assert.assertNotNull(blob);
+        logger.debug(objectAsXmlString(blob, BlobCommon.class));
+
+        // Check a couple of fields
+        Assert.assertEquals(blob.getDepositor(), depositorRefName);
+        Assert.assertEquals(blob.getExitDate(), exitDate);
+        Assert.assertEquals(blob.getExitNumber(), exitNumber);
+
+        // Get the auth refs and check them
+        ClientResponse<AuthorityRefList> res2 = blobClient.getAuthorityRefs(knownResourceId);
+        assertStatusCode(res2, testName);
+        AuthorityRefList list = res2.getEntity();
+        List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
+        int numAuthRefsFound = items.size();
+        logger.debug("Authority references, found " + numAuthRefsFound);
+        //Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
+        //                    "Did not find all expected authority references! " +
+        //                    "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
+        if (logger.isDebugEnabled()) {
+            int i = 0;
+            for (AuthorityRefList.AuthorityRefItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] Field:" + item.getSourceField() + "= " + item.getAuthDisplayName() + item.getItemDisplayName());
+                logger.debug(testName + ": list-item[" + i + "] refName=" + item.getRefName());
+                logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+                i++;
+            }
+        }
+    }
+
+    /**
+     * Deletes all resources created by tests, after all tests have been run.
+     * <p/>
+     * This cleanup method will always be run, even if one or more tests fail.
+     * For this reason, it attempts to remove all resources created
+     * at any point during testing, even if some of those resources
+     * may be expected to be deleted by certain tests.
+     */
+    @AfterClass(alwaysRun = true)
+    public void cleanUp() {
+        String noTest = System.getProperty("noTestCleanup");
+        if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+            logger.debug("Skipping Cleanup phase ...");
+            return;
+        }
+        logger.debug("Cleaning up temporary resources created for testing ...");
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        // Delete Person resource(s) (before PersonAuthority resources).
+        for (String resourceId : personIdsCreated) {
+            // Note: Any non-success responses are ignored and not reported.
+            personAuthClient.deleteItem(personAuthCSID, resourceId);
+        }
+        // Delete PersonAuthority resource(s).
+        // Note: Any non-success response is ignored and not reported.
+        if (personAuthCSID != null) {
+            personAuthClient.delete(personAuthCSID);
+            // Delete Loans In resource(s).
+            BlobClient blobClient = new BlobClient();
+            for (String resourceId : blobIdsCreated) {
+                // Note: Any non-success responses are ignored and not reported.
+                blobClient.delete(resourceId);
+            }
+        }
+    }
+
+}
diff --git a/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java b/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobServiceTest.java
new file mode 100644 (file)
index 0000000..e1071bd
--- /dev/null
@@ -0,0 +1,268 @@
+/**
+ * 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.CollectionSpaceClient;
+import org.collectionspace.services.client.BlobClient;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.blob.BlobCommon;
+import org.collectionspace.services.blob.BlobCommonList;
+
+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;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * BlobServiceTest, carries out tests against a deployed and running Blob Service. <p/>
+ * $LastChangedRevision:  $
+ * $LastChangedDate:  $
+ */
+public class BlobServiceTest extends AbstractServiceTestImpl {
+
+    private final String CLASS_NAME = BlobServiceTest.class.getName();
+    private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+    final String SERVICE_PATH_COMPONENT = "blob";
+    private String knownResourceId = null;
+
+    @Override
+    protected CollectionSpaceClient getClientInstance() {
+        return new BlobClient();
+    }
+
+    @Override
+    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+        return response.getEntity(BlobCommonList.class);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    public void create(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupCreate();
+        BlobClient client = new BlobClient();
+        MultipartOutput multipart = createBlobInstance(createIdentifier());
+        ClientResponse<Response> res = client.create(multipart);
+        assertStatusCode(res, testName);
+        if (knownResourceId == null) {
+            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
+            logger.debug(testName + ": knownResourceId=" + knownResourceId);
+        }
+        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    public void createList(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        for (int i = 0; i < 3; i++) {
+            create(testName);
+        }
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    public void read(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupRead();
+        BlobClient client = new BlobClient();
+        ClientResponse<MultipartInput> res = client.read(knownResourceId);
+        assertStatusCode(res, testName);
+        MultipartInput input = (MultipartInput) res.getEntity();
+        BlobCommon blob = (BlobCommon) extractPart(input, client.getCommonPartName(), BlobCommon.class);
+        Assert.assertNotNull(blob);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
+    public void readList(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupReadList();
+        BlobClient client = new BlobClient();
+        ClientResponse<BlobCommonList> res = client.readList();
+        BlobCommonList list = res.getEntity();
+        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            List<BlobCommonList.BlobListItem> items = list.getBlobListItem();
+            int i = 0;
+            for (BlobCommonList.BlobListItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] csid=" + item.getCsid());
+                logger.debug(testName + ": list-item[" + i + "] blobNumber=" + item.getExitNumber());
+                logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+                i++;
+            }
+        }
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
+    public void update(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupUpdate();
+        BlobClient client = new BlobClient();
+        ClientResponse<MultipartInput> res = client.read(knownResourceId);
+        assertStatusCode(res, testName);
+        logger.debug("got object to update with ID: " + knownResourceId);
+        MultipartInput input = (MultipartInput) res.getEntity();
+        BlobCommon blob = (BlobCommon) extractPart(input, client.getCommonPartName(), BlobCommon.class);
+        Assert.assertNotNull(blob);
+
+        blob.setExitNumber("updated-" + blob.getExitNumber());
+        logger.debug("Object to be updated:"+objectAsXmlString(blob, BlobCommon.class));
+        MultipartOutput output = new MultipartOutput();
+        OutputPart commonPart = output.addPart(blob, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", client.getCommonPartName());
+        res = client.update(knownResourceId, output);
+        assertStatusCode(res, testName);
+        input = (MultipartInput) res.getEntity();
+        BlobCommon updatedBlob = (BlobCommon) extractPart(input, client.getCommonPartName(), BlobCommon.class);
+        Assert.assertNotNull(updatedBlob);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
+    public void updateNonExistent(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        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.
+        BlobClient client = new BlobClient();
+        MultipartOutput multipart = createBlobInstance(NON_EXISTENT_ID);
+        ClientResponse<MultipartInput> res = client.update(NON_EXISTENT_ID, multipart);
+        assertStatusCode(res, testName);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+    public void delete(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupDelete();
+        BlobClient client = new BlobClient();
+        ClientResponse<Response> res = client.delete(knownResourceId);
+        assertStatusCode(res, testName);
+    }
+
+    // ---------------------------------------------------------------
+    // Failure outcome tests : means we expect response to fail, but test to succeed
+    // ---------------------------------------------------------------
+
+    // Failure outcome
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
+    public void readNonExistent(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupReadNonExistent();
+        BlobClient client = new BlobClient();
+        ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
+        assertStatusCode(res, testName);
+    }
+
+    // Failure outcome
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
+    public void deleteNonExistent(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupDeleteNonExistent();
+        BlobClient client = new BlobClient();
+        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        assertStatusCode(res, testName);
+    }
+
+    // Failure outcomes
+    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
+
+    @Override
+    public void createWithEmptyEntityBody(String testName) throws Exception {
+    }
+
+    @Override
+    public void createWithMalformedXml(String testName) throws Exception {
+    }
+
+    @Override
+    public void createWithWrongXmlSchema(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithEmptyEntityBody(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithMalformedXml(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithWrongXmlSchema(String testName) throws Exception {
+    }
+
+    // ---------------------------------------------------------------
+    // Utility tests : tests of code used in tests above
+    // ---------------------------------------------------------------
+
+    @Test(dependsOnMethods = {"create", "read"})
+    public void testSubmitRequest() {
+        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
+        String method = ServiceRequestType.READ.httpMethodName();
+        String url = getResourceURL(knownResourceId);
+        int statusCode = submitRequest(method, url);
+        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
+        Assert.assertEquals(statusCode, EXPECTED_STATUS);
+    }
+
+    // ---------------------------------------------------------------
+    // Utility methods used by tests above
+    // ---------------------------------------------------------------
+
+    @Override
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
+    }
+
+    private MultipartOutput createBlobInstance(String exitNumber) {
+        String identifier = "blobNumber-" + exitNumber;
+        BlobCommon blob = new BlobCommon();
+        blob.setExitNumber(identifier);
+        blob.setDepositor("urn:cspace:org.collectionspace.demo:orgauthority:name(TestOrgAuth):organization:name(Northern Climes Museum)'Northern Climes Museum'");
+        MultipartOutput multipart = new MultipartOutput();
+        OutputPart commonPart = multipart.addPart(blob, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", new BlobClient().getCommonPartName());
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("to be created, blob common");
+            logger.debug(objectAsXmlString(blob, BlobCommon.class));
+        }
+
+        return multipart;
+    }
+}
diff --git a/services/blob/client/src/test/resources/log4j.properties b/services/blob/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/blob/jaxb/pom.xml b/services/blob/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..2a86ff1
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>org.collectionspace.services.blob</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.blob.jaxb</artifactId>
+    <name>services.blob.jaxb</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2-commons</groupId>
+            <artifactId>property-listener-injector</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2_commons</groupId>
+            <artifactId>runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-blob-jaxb</finalName>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <groupId>org.jvnet.jaxb2.maven2</groupId>
+                <artifactId>maven-jaxb2-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/blob/jaxb/src/main/java/org/collectionspace/services/BlobJAXBSchema.java b/services/blob/jaxb/src/main/java/org/collectionspace/services/BlobJAXBSchema.java
new file mode 100644 (file)
index 0000000..5f45f65
--- /dev/null
@@ -0,0 +1,16 @@
+/**
+ * 
+ */
+package org.collectionspace.services;
+
+public interface BlobJAXBSchema {
+    final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner";
+    final static String OBJECT_EXIT_DEPOSITOR = "depositor";
+    final static String OBJECT_EXIT_DATE = "exitDate";
+    final static String OBJECT_EXIT_METHODS = "exitMethods";
+    final static String OBJECT_EXIT_METHOD = "exitMethod";
+    final static String OBJECT_EXIT_NOTE = "exitNote";
+    final static String OBJECT_EXIT_NUMBER = "exitNumber";
+    final static String OBJECT_EXIT_REASON = "exitReason";
+    final static String OBJECT_EXIT_PACKING_NOTE = "packingNote";
+}
diff --git a/services/blob/jaxb/src/main/java/org/collectionspace/services/BlobListItemJAXBSchema.java b/services/blob/jaxb/src/main/java/org/collectionspace/services/BlobListItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..44f8abd
--- /dev/null
@@ -0,0 +1,9 @@
+package org.collectionspace.services;
+
+public interface BlobListItemJAXBSchema {
+    final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner";
+    final static String OBJECT_EXIT_NUMBER = "exitNumber";
+    
+       final static String CSID = "csid";
+       final static String URI = "url";
+}
diff --git a/services/blob/jaxb/src/main/resources/blob_common.xsd b/services/blob/jaxb/src/main/resources/blob_common.xsd
new file mode 100644 (file)
index 0000000..45b8efb
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Loan Out schema (XSD)
+    
+    Entity  : Blob
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+
+    $LastChangedRevision: 2316 $
+    $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  jaxb:version="1.0" elementFormDefault="unqualified"
+  xmlns:ns="http://collectionspace.org/services/blob"
+  xmlns="http://collectionspace.org/services/blob"
+  targetNamespace="http://collectionspace.org/services/blob"
+  version="0.1"
+>
+
+<!--
+    Avoid XmlRootElement nightmare:
+    See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->    
+    
+    <!-- blob -->
+    <xs:element name="blob_common">
+        <xs:complexType>
+            <xs:sequence>
+                <!--  Blob Information Group -->
+                <xs:element name="currentOwner" type="xs:string"/>
+                <xs:element name="depositor" type="xs:string"/>
+                <xs:element name="exitDate" type="xs:string"/>
+                <xs:element name="exitMethods" type="exitMethods"/>
+                <xs:element name="exitNote" type="xs:string"/>
+                <xs:element name="exitNumber" type="xs:string"/>
+                <xs:element name="exitReason" type="xs:string"/>
+                <xs:element name="packingNote" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+    <xs:complexType name="exitMethods">
+        <xs:sequence>
+            <xs:element name="exitMethod" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <!-- This is the base class for paginated lists -->
+    <xs:complexType name="abstractCommonList">
+        <xs:annotation>
+            <xs:appinfo>
+                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
+            </xs:appinfo>
+        </xs:annotation>
+    </xs:complexType>
+    
+    <!-- blob records, as in nuxeo repository -->
+    <xs:element name="blob_common_list">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="abstractCommonList">                    
+                    <xs:sequence>
+                        <xs:element name="blob_list_item" maxOccurs="unbounded">
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element name="exitNumber" type="xs:string"   minOccurs="1" />
+                                    <xs:element name="currentOwner" type="xs:string" minOccurs="1" />
+                                    <xs:element name="uri" type="xs:anyURI"          minOccurs="1" />
+                                    <xs:element name="csid" type="xs:string"         minOccurs="1" />
+                                    <!--
+                                    <xs:element name="depositor" type="xs:string"    minOccurs="1" />
+                                    <xs:element name="exitDate" type="xs:string"     minOccurs="1" />
+                                    <xs:element name="exitMethod" type="xs:string"   minOccurs="1" />
+                                    <xs:element name="exitNote" type="xs:string"     minOccurs="1" />
+                                    <xs:element name="exitReason" type="xs:string"   minOccurs="1" />
+                                    <xs:element name="packingNote" type="xs:string"  minOccurs="1" />
+                                    -->
+                                </xs:sequence>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>                    
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/services/blob/pom.xml b/services/blob/pom.xml
new file mode 100644 (file)
index 0000000..029eb00
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- A comment. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.main</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.blob</artifactId>
+    <name>services.blob</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>jaxb</module>
+        <module>service</module>
+        <module>3rdparty</module>
+        <module>client</module>
+    </modules>
+
+</project>
+
diff --git a/services/blob/service/pom.xml b/services/blob/service/pom.xml
new file mode 100644 (file)
index 0000000..5b229ad
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.blob</artifactId>        
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.blob.service</artifactId>
+    <name>services.blob.service</name>
+    <packaging>jar</packaging>       
+
+    <dependencies>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.blob.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.collectionobject.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- External dependencies -->        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        
+      <!-- javax -->
+
+        <dependency>
+            <groupId>javax.security</groupId>
+            <artifactId>jaas</artifactId>
+            <version>1.0.01</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <!-- jboss -->
+
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+        </dependency>
+        
+        <!-- nuxeo -->
+
+        <dependency>
+            <groupId>org.nuxeo.ecm.core</groupId>
+            <artifactId>nuxeo-core-api</artifactId>
+            <version>${nuxeo.core.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jboss-remoting</artifactId>
+                    <groupId>jboss</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.restlet</groupId>
+            <artifactId>org.restlet</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.noelios.restlet</groupId>
+            <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.noelios.restlet</groupId>
+            <artifactId>com.noelios.restlet</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-blob</finalName>
+    </build>
+</project>
+
diff --git a/services/blob/service/profiles.xml b/services/blob/service/profiles.xml
new file mode 100644 (file)
index 0000000..347b9df
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profilesXml xmlns="http://maven.apache.org/PROFILES/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
+</profilesXml>
\ No newline at end of file
diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java
new file mode 100644 (file)
index 0000000..4b56c15
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ *  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.blob;
+
+import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ServiceMain;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MultivaluedMap;
+import java.util.List;
+
+@Path("/blob")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class BlobResource extends ResourceBase {
+
+    @Override
+    public String getServiceName(){
+        return "blob";
+    };
+
+    //FIXME retrieve client type from configuration
+    final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+
+    @Override
+    protected String getVersionString() {
+       final String lastChangeRevision = "$LastChangedRevision: 2108 $";
+       return lastChangeRevision;
+    }
+
+    @Override
+    public Class<BlobCommon> getCommonPartClass() {
+       return BlobCommon.class;
+    }
+
+    public Class getResourceClass() {
+        return this.getClass();
+    }
+
+    public BlobCommonList getBlobList(MultivaluedMap<String, String> queryParams) {
+        return (BlobCommonList)getList(queryParams);
+    }
+
+    @Deprecated
+    public BlobCommonList getBlobList(List<String> csidList) {
+        return (BlobCommonList) getList(csidList);
+    }
+
+    protected BlobCommonList search(MultivaluedMap<String,String> queryParams,String keywords) {
+         return (BlobCommonList) super.search(queryParams, keywords);
+    }
+
+    
+}
diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobConstants.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobConstants.java
new file mode 100644 (file)
index 0000000..afbe67b
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *  This document is a part of the source code and related artifacts
+ *  for CollectionSpace, an open source collections management system
+ *  for museums and related institutions:
+
+ *  http://www.collectionspace.org
+ *  http://wiki.collectionspace.org
+
+ *  Copyright 2009 University of California at Berkeley
+
+ *  Licensed under the Educational Community License (ECL), Version 2.0.
+ *  You may not use this file except in compliance with this License.
+
+ *  You may obtain a copy of the ECL 2.0 License at
+
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.collectionspace.services.blob.nuxeo;
+
+/**
+ * BlobConstants specifies constants for the Loans Out service
+ *
+ */
+public class BlobConstants {
+
+    public final static String NUXEO_DOCTYPE = "Blob";
+    public final static String NUXEO_SCHEMA_NAME = "blob";
+    public final static String NUXEO_DC_TITLE = "CollectionSpace-Blob";
+}
diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..e791ec2
--- /dev/null
@@ -0,0 +1,167 @@
+/**
+ *  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.blob.nuxeo;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.collectionspace.services.BlobJAXBSchema;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.blob.BlobCommon;
+import org.collectionspace.services.blob.BlobCommonList;
+import org.collectionspace.services.blob.BlobCommonList.BlobListItem;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The Class BlobDocumentModelHandler.
+ */
+public class BlobDocumentModelHandler
+        extends RemoteDocumentModelHandlerImpl<BlobCommon, BlobCommonList> {
+
+    /** The logger. */
+    private final Logger logger = LoggerFactory.getLogger(BlobDocumentModelHandler.class);
+    
+    /** The blob. */
+    private BlobCommon blob;
+    
+    /** The blob list. */
+    private BlobCommonList blobList;
+
+
+    /**
+     * Gets the common part.
+     *
+     * @return the common part
+     */
+    @Override
+    public BlobCommon getCommonPart() {
+        return blob;
+    }
+
+    /**
+     * Sets the common part.
+     *
+     * @param blob the new common part
+     */
+    @Override
+    public void setCommonPart(BlobCommon blob) {
+        this.blob = blob;
+    }
+
+    /**
+     * Gets the common part list.
+     *
+     * @return the common part list
+     */
+    @Override
+    public BlobCommonList getCommonPartList() {
+        return blobList;
+    }
+
+    /**
+     * Sets the common part list.
+     *
+     * @param blobList the new common part list
+     */
+    @Override
+    public void setCommonPartList(BlobCommonList blobList) {
+        this.blobList = blobList;
+    }
+
+    /**
+     * Extract common part.
+     *
+     * @param wrapDoc the wrap doc
+     * @return the blob common
+     * @throws Exception the exception
+     */
+    @Override
+    public BlobCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
+            throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Fill common part.
+     *
+     * @param blobObject the blob object
+     * @param wrapDoc the wrap doc
+     * @throws Exception the exception
+     */
+    @Override
+    public void fillCommonPart(BlobCommon blobObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Extract common part list.
+     *
+     * @param wrapDoc the wrap doc
+     * @return the blob common list
+     * @throws Exception the exception
+     */
+    @Override
+    public BlobCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
+        BlobCommonList coList = extractPagingInfo(new BlobCommonList(), wrapDoc);
+        AbstractCommonList commonList = (AbstractCommonList) coList;
+        //CSPACE-3209 don't use all fields.  commonList.setFieldsReturned("currentOwner|depositor|exitDate|exitMethod|exitNote|exitNumber|exitReason|packingNote|uri|csid");
+        commonList.setFieldsReturned("exitNumber|currentOwner|uri|csid");  //CSPACE-3209 now do this
+        List<BlobCommonList.BlobListItem> list = coList.getBlobListItem();
+        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
+        while(iter.hasNext()){
+            DocumentModel docModel = iter.next();
+            BlobListItem ilistItem = new BlobListItem();
+
+            String label = getServiceContext().getCommonPartLabel();
+            ilistItem.setExitNumber((String) docModel.getProperty(label, BlobJAXBSchema.OBJECT_EXIT_NUMBER));
+            //CSPACE-3209 ilistItem.setExitDate((String) docModel.getProperty(label, BlobJAXBSchema.OBJECT_EXIT_DATE));
+            ilistItem.setCurrentOwner((String) docModel.getProperty(label, BlobJAXBSchema.OBJECT_EXIT_CURRENT_OWNER));  //CSPACE-3209
+            String id = NuxeoUtils.extractId(docModel.getPathAsString());
+            ilistItem.setUri(getServiceContextPath() + id);
+            ilistItem.setCsid(id);
+            list.add(ilistItem);
+        }
+
+        return coList;
+    }
+
+    /**
+     * Gets the q property.
+     *
+     * @param prop the prop
+     * @return the q property
+     */
+    @Override
+    public String getQProperty(String prop) {
+        return BlobConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    }
+}
+
diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobValidatorHandler.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobValidatorHandler.java
new file mode 100644 (file)
index 0000000..fe161dc
--- /dev/null
@@ -0,0 +1,18 @@
+package org.collectionspace.services.blob.nuxeo;
+
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandler;
+import org.collectionspace.services.common.document.DocumentHandler.Action;
+
+public class BlobValidatorHandler implements ValidatorHandler {
+
+       @Override
+       public void validate(Action action, ServiceContext ctx)
+                       throws InvalidDocumentException {
+               // TODO Auto-generated method stub
+               System.out.println("BlobValidatorHandler executed.");
+
+       }
+
+}
diff --git a/services/blob/service/src/test/java/org/collectionspace/services/test/BlobServiceTest.java b/services/blob/service/src/test/java/org/collectionspace/services/test/BlobServiceTest.java
new file mode 100644 (file)
index 0000000..50eb4b7
--- /dev/null
@@ -0,0 +1,13 @@
+package org.collectionspace.services.test;
+
+//import org.collectionspace.services.blob.Blob;
+//import org.collectionspace.services.blob.BlobList;
+
+/**
+ * Placeholder for server-side testing of Loan Out service code.
+ * 
+ * @version $Revision: 2108 $
+ */
+public class BlobServiceTest {
+       //empty
+}
diff --git a/services/blob/service/src/test/resources/log4j.xml b/services/blob/service/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..52121cb
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.TTCCLayout">
+                       <param name="DateFormat" value="ISO8601" />
+               </layout>
+       </appender>
+
+
+       <appender name="unit-tests"
+               class="org.apache.log4j.RollingFileAppender">
+               <param name="File" value="./target/unit-tests.log" />
+               <param name="MaxFileSize" value="10240KB" />
+               <param name="MaxBackupIndex" value="6" />
+               <layout class="org.apache.log4j.TTCCLayout">
+                       <param name="DateFormat" value="ISO8601" />
+               </layout>
+       </appender>
+
+       <logger name="org.apache.commons.httpclient" additivity="false">
+               <level value="warn" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </logger>
+
+       <logger name="httpclient.wire" additivity="false">
+               <level value="info" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </logger>
+
+       <root>
+               <priority value="debug" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </root>
+
+</log4j:configuration>
+
+
+
+
index c230d6c0a5d5285d9a8cd9acfd8f9eb2ebf48f0a..ce2dc96731d35605c00d925c8b60905bff0fd52f 100644 (file)
             description="deploy services in ${jboss.server.cspace}">\r
         <ant antfile="authentication/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="authorization/build.xml" target="deploy" inheritAll="false"/>\r
+        <ant antfile="blob/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="common/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="account/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="relation/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="loanout/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="objectexit/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="location/build.xml" target="deploy" inheritAll="false"/>\r
+        <ant antfile="media/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="movement/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="report/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="vocabulary/build.xml" target="deploy" inheritAll="false"/>\r
         <ant antfile="movement/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="loanout/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="loanin/build.xml" target="undeploy" inheritAll="false"/>\r
+        <ant antfile="media/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="note/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="relation/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="account/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="common/build.xml" target="undeploy" inheritAll="false"/>\r
+        <ant antfile="media/build.xml" target="undeploy" inheritAll="false"/>\r
+        <ant antfile="blob/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="authorization/build.xml" target="undeploy" inheritAll="false"/>\r
         <ant antfile="authentication/build.xml" target="undeploy" inheritAll="false"/>\r
     </target>\r
         <ant antfile="authentication/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="authorization/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="account/build.xml" target="dist" inheritAll="false"/>\r
+        <ant antfile="blob/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="common/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="relation/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="id/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="loanout/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="location/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="objectexit/build.xml" target="dist" inheritAll="false"/>\r
+        <ant antfile="media/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="movement/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="report/build.xml" target="dist" inheritAll="false"/>\r
         <ant antfile="vocabulary/build.xml" target="dist" inheritAll="false"/>\r
diff --git a/services/media/3rdparty/build.xml b/services/media/3rdparty/build.xml
new file mode 100644 (file)
index 0000000..a074d60
--- /dev/null
@@ -0,0 +1,127 @@
+
+<project name="media.3rdparty" default="package" basedir=".">
+    <description>
+        media service 3rdparty
+    </description>
+  <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="init" >
+    <!-- Create the time stamp -->
+        <tstamp/>
+    </target>
+
+    <target name="package" depends="package-unix,package-windows"
+  description="Package CollectionSpace Services" />
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="install" depends="install-unix,install-windows"
+  description="Install" />
+    <target name="install-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="install-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    
+    <target name="clean" depends="clean-unix,clean-windows"
+  description="Delete target directories" >
+        <delete dir="${build}"/>
+    </target>
+    <target name="clean-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="clean-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />
+    <target name="test-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="test-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="deploy" depends="install"
+    description="deploy media in ${jboss.server.nuxeo}">
+        <ant antfile="nuxeo-platform-cs-media/build.xml" target="deploy" inheritall="false"/>
+    </target>
+
+    <target name="undeploy"
+    description="undeploy media from ${jboss.server.nuxeo}">
+        <ant antfile="nuxeo-platform-cs-media/build.xml" target="undeploy" inheritall="false"/>
+    </target>
+
+    <target name="dist"
+    description="generate distribution for media" depends="package">
+        <ant antfile="nuxeo-platform-cs-media/build.xml" target="dist" inheritall="false"/>
+    </target>
+
+
+</project>
diff --git a/services/media/3rdparty/nuxeo-platform-cs-media/build.xml b/services/media/3rdparty/nuxeo-platform-cs-media/build.xml
new file mode 100644 (file)
index 0000000..1c2ee8e
--- /dev/null
@@ -0,0 +1,143 @@
+
+<project name="nuxeo-platform-cs-media" default="package" basedir=".">
+    <description>
+        media nuxeo document type
+    </description>
+    <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+    <property name="nuxeo.media.jar"
+        value="org.collectionspace.services.media.3rdparty.nuxeo-${cspace.release}.jar"/>
+    <property name="nuxeo.media.jars.all"
+        value="org.collectionspace.services.media.3rdparty.nuxeo-*.jar"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="init" >
+        <!-- Create the time stamp -->
+        <tstamp/>
+    </target>
+
+    <target name="package" depends="package-unix,package-windows"
+        description="Package CollectionSpace Services" />
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="install" depends="install-unix,install-windows"
+        description="Install" />
+    <target name="install-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="install-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="clean" depends="clean-unix,clean-windows"
+        description="Delete target directories" >
+        <delete dir="${build}"/>
+    </target>
+    <target name="clean-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="clean-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />
+    <target name="test-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="test-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="deploy" depends="install"
+        description="deploy media doctype in ${jboss.server.nuxeo}">
+        <copy file="${basedir}/target/${nuxeo.media.jar}"
+        todir="${jboss.deploy.nuxeo.plugins}"/>
+    </target>
+
+    <target name="undeploy"
+        description="undeploy media doctype from ${jboss.server.nuxeo}">
+        <delete>
+            <fileset dir="${jboss.deploy.nuxeo.plugins}">
+                <include name="${nuxeo.media.jars.all}"/>
+            </fileset>
+            <!-- Legacy deployment location through release 0.6 -->
+            <fileset dir="${jboss.deploy.nuxeo.system}">
+                <include name="${nuxeo.media.jars.all}"/>
+            </fileset>
+        </delete>
+    </target>
+
+
+    <target name="dist"
+        description="generate distribution for media doctype" depends="package">
+        <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+            <fileset file="${basedir}/target/${nuxeo.media.jar}"/>
+        </copy>
+    </target>
+
+</project>
+
diff --git a/services/media/3rdparty/nuxeo-platform-cs-media/pom.xml b/services/media/3rdparty/nuxeo-platform-cs-media/pom.xml
new file mode 100644 (file)
index 0000000..a13c35d
--- /dev/null
@@ -0,0 +1,38 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.media.3rdparty</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.media.3rdparty.nuxeo</artifactId>
+    <name>services.media.3rdparty.nuxeo</name>
+    <packaging>jar</packaging>
+    <description>
+        Media Nuxeo Document Type
+    </description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile> src/main/resources/META-INF/MANIFEST.MF </manifestFile>
+                        <manifestEntries>
+                            <Bundle-Version>${eclipseVersion}</Bundle-Version>
+                            <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/META-INF/MANIFEST.MF b/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..56b84ac
--- /dev/null
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.media;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.ws,\r
+ org.collectionspace.collectionspace_core\r
+Provide-Package: org.collectionspace.media\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/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/core-types-contrib.xml
new file mode 100644 (file)
index 0000000..7c0bb9e
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.media.coreTypes">
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+    <schema name="media_common" prefix="media_common" src="schemas/media_common.xsd"/>
+  </extension>
+  
+  <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+    <doctype name="Media" extends="Document">
+      <schema name="common"/>
+      <schema name="dublincore"/>
+      <schema name="collectionspace_core"/>
+      <schema name="media_common"/>
+    </doctype>
+  </extension>
+</component>
diff --git a/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/media/3rdparty/nuxeo-platform-cs-media/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/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/ecm-types-contrib.xml
new file mode 100644 (file)
index 0000000..9d96b4b
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.media.ecm.types">
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="Media" coretype="Media">
+      <label>org.collectionspace.media</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>collectionspace_core</layout>
+        <layout>media</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>Media</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>Media</type>
+      </subtypes>
+    </type>
+
+  </extension>
+</component>
diff --git a/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/OSGI-INF/layouts-contrib.xml
new file mode 100644 (file)
index 0000000..a9aecba
--- /dev/null
@@ -0,0 +1,212 @@
+<?xml version="1.0"?>
+
+<!--
+layouts-contrib.xml
+
+Layout file for configuring screen layouts in the
+user interface of Nuxeo EP's web application, for
+viewing or editing CollectionSpace records stored
+in the Nuxeo repository,
+
+See the "Nuxeo Book" for an introductory description
+of how to edit this file.  For instance, for Nuxeo EP 5.3:
+http://doc.nuxeo.org/5.3/books/nuxeo-book/html/
+
+$LastChangedRevision: $
+$LastChangedDate: $
+-->
+
+<component name="org.collectionspace.media.layouts.webapp">
+
+    <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+               point="layouts">
+
+        <layout name="media">
+            <templates>
+                <template mode="any">/layouts/layout_default_template.xhtml</template>
+            </templates>       
+            
+            <rows>
+                <row><widget>mediaNumber</widget></row>
+                <row><widget>borrower</widget></row>
+                <row><widget>borrowersContact</widget></row>
+                <row><widget>lendersAuthorizer</widget></row>
+                <row><widget>lendersAuthorizationDate</widget></row>
+                <row><widget>lendersContact</widget></row>
+                
+                <!--
+                     Omitting loaned object status fields in release 0.5.2,
+                     as these are likely to be repeatable or else handled
+                     in some alternate way in release 0.7.
+                -->
+                <!-- <row><widget>loanedObjectStatus</widget></row> -->
+                <!-- <row><widget>loanedObjectStatusDate</widget></row> -->
+                <!-- <row><widget>loanedObjectStatusNote</widget></row> -->
+                
+                <row><widget>mediaDate</widget></row>
+                <row><widget>loanReturnDate</widget></row>
+                <row><widget>loanRenewalApplicationDate</widget></row>
+                <row><widget>specialConditionsOfLoan</widget></row>
+                <row><widget>mediaNote</widget></row>
+                <row><widget>loanPurpose</widget></row>
+            </rows>
+
+            <widget name="mediaNumber" type="text">
+                <labels>
+                    <label mode="any">mediaNumber</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">mediaNumber</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="borrower" type="text">
+                <labels>
+                    <label mode="any">borrower</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">borrower</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+            
+            <widget name="borrowersContact" type="text">
+                <labels>
+                    <label mode="any">borrowersContact</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">borrowersContact</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="lendersAuthorizer" type="text">
+                <labels>
+                    <label mode="any">lendersAuthorizer</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">lendersAuthorizer</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="lendersAuthorizationDate" type="text">
+                <labels>
+                    <label mode="any">lendersAuthorizationDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">lendersAuthorizationDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="lendersContact" type="text">
+                <labels>
+                    <label mode="any">lendersContact</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">lendersContact</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="mediaDate" type="text">
+                <labels>
+                    <label mode="any">mediaDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">mediaDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="loanReturnDate" type="text">
+                <labels>
+                    <label mode="any">loanReturnDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">loanReturnDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="loanRenewalApplicationDate" type="text">
+                <labels>
+                    <label mode="any">loanRenewalApplicationDate</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">loanRenewalApplicationDate</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="specialConditionsOfLoan" type="text">
+                <labels>
+                    <label mode="any">specialConditionsOfLoan</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">specialConditionsOfLoan</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+          </widget>
+
+          <widget name="mediaNote" type="text">
+                <labels>
+                    <label mode="any">mediaNote</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">mediaNote</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+            <widget name="loanPurpose" type="text">
+                <labels>
+                    <label mode="any">loanPurpose</label>
+                </labels>
+                <translated>true</translated>
+                <fields>
+                    <field schema="media_common">loanPurpose</field>
+                </fields>
+                <properties widgetMode="edit">
+                    <property name="styleClass">dataInputText</property>
+                </properties>
+            </widget>
+
+        </layout>
+    </extension>
+</component>
diff --git a/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/schemas/media_common.xsd b/services/media/3rdparty/nuxeo-platform-cs-media/src/main/resources/schemas/media_common.xsd
new file mode 100644 (file)
index 0000000..ff5ac83
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+\r
+<!--\r
+    Loan Out schema (XSD)\r
+    \r
+    Entity  : Media\r
+    Part    : Common\r
+    Used for: Nuxeo EP core document type\r
+\r
+    $LastChangedRevision: 2316 $\r
+    $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $\r
+-->\r
+\r
+<xs:schema \r
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+    xmlns:ns="http://collectionspace.org/media/"\r
+    xmlns="http://collectionspace.org/media/"\r
+    targetNamespace="http://collectionspace.org/media/"\r
+    version="0.1">\r
+    \r
+    <!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->\r
+\r
+    <!--  Media Information Group -->\r
+    <xs:element name="currentOwner" type="xs:string"/>\r
+    <xs:element name="depositor" type="xs:string"/>\r
+    <xs:element name="exitDate" type="xs:string"/>\r
+    <xs:element name="exitMethods">\r
+        <xs:complexType>\r
+            <xs:sequence>\r
+                <xs:element name="exitMethod" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>\r
+            </xs:sequence>\r
+        </xs:complexType>\r
+   </xs:element>\r
+    <xs:element name="exitNote" type="xs:string"/>\r
+    <xs:element name="exitNumber" type="xs:string"/>\r
+    <xs:element name="exitReason" type="xs:string"/>\r
+    <xs:element name="packingNote" type="xs:string"/>    \r
+</xs:schema>\r
diff --git a/services/media/3rdparty/pom.xml b/services/media/3rdparty/pom.xml
new file mode 100644 (file)
index 0000000..04bfff6
--- /dev/null
@@ -0,0 +1,24 @@
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>org.collectionspace.services.media</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.media.3rdparty</artifactId>
+    <name>services.media.3rdparty</name>
+    <packaging>pom</packaging>
+    
+    <description>
+        3rd party build for media service
+    </description>
+
+    <modules>
+        <module>nuxeo-platform-cs-media</module>
+    </modules>
+</project>
diff --git a/services/media/build.xml b/services/media/build.xml
new file mode 100644 (file)
index 0000000..804c980
--- /dev/null
@@ -0,0 +1,124 @@
+
+<project name="media" default="package" basedir=".">
+    <description>
+        media service
+    </description>
+  <!-- set global properties for this build -->
+    <property name="services.trunk" value="../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="package" depends="package-unix,package-windows"
+  description="Package CollectionSpace Services" />
+  
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+
+    <target name="install" depends="install-unix,install-windows"
+  description="Install" />
+    <target name="install-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="install-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="install" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="clean" depends="clean-unix,clean-windows"
+  description="Delete target directories" >
+        <delete dir="${build}"/>
+    </target>
+    <target name="clean-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="clean-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="clean" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />
+    <target name="test-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="test-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.bat" />
+            <arg value="test" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+
+    <target name="deploy" depends="install"
+    description="deploy media service">
+        <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+    </target>
+
+    <target name="undeploy"
+    description="undeploy media service">
+        <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+    </target>
+
+    <target name="dist" depends="package"
+    description="distribute media service">
+        <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>
+    </target>
+
+</project>
diff --git a/services/media/client/pom.xml b/services/media/client/pom.xml
new file mode 100644 (file)
index 0000000..15e2f0a
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.media</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.media.client</artifactId>
+    <name>services.media.client</name>
+    
+    <dependencies>
+        <!-- keep slf4j dependencies on the top -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+<!-- CollectionSpace dependencies -->
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <optional>true</optional>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+         <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.media.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.person.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+<!-- External dependencies -->        
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <!-- filter out unwanted jars -->
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-media-client</finalName>
+    </build>
+</project>
diff --git a/services/media/client/src/main/java/org/collectionspace/services/client/MediaClient.java b/services/media/client/src/main/java/org/collectionspace/services/client/MediaClient.java
new file mode 100644 (file)
index 0000000..1c34bec
--- /dev/null
@@ -0,0 +1,150 @@
+/**    
+ * 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 (c) 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
+ */
+package org.collectionspace.services.client;
+
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+//import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.media.MediaCommonList;
+
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * MediaClient.java
+ *
+ * $LastChangedRevision: 2108 $
+ * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $
+ *
+ */
+public class MediaClient extends AbstractServiceClientImpl {
+
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
+     */
+    public String getServicePathComponent() {
+        return "media"; //Laramie20100824 was medias, but label was a mismatch.
+    }
+    /**
+     *
+     */
+//    private static final MediaClient instance = new MediaClient();
+    /**
+     *
+     */
+    private MediaProxy mediaProxy;
+
+    /**
+     *
+     * Default constructor for MediaClient class.
+     *
+     */
+    public MediaClient() {
+        ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+        RegisterBuiltin.register(factory);
+        setProxy();
+    }
+
+    @Override
+    public CollectionSpaceProxy getProxy() {
+       return this.mediaProxy;
+    }    
+
+    /**
+     * allow to reset proxy as per security needs
+     */
+    public void setProxy() {
+        if (useAuth()) {
+            mediaProxy = ProxyFactory.create(MediaProxy.class,
+                    getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
+        } else {
+            mediaProxy = ProxyFactory.create(MediaProxy.class,
+                    getBaseURL());
+        }
+    }
+
+    /**
+     * FIXME Comment this
+     *
+     * @return
+     */
+//    public static MediaClient getInstance() {
+//        return instance;
+//    }
+
+    /**
+     * @return
+     * @see org.collectionspace.services.client.MediaProxy#getMedia()
+     */
+    public ClientResponse<MediaCommonList> readList() {
+        return mediaProxy.readList();
+    }
+    
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.services.client.MediaProxy#getAuthorityRefs(java.lang.String)
+     */
+    public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+        return mediaProxy.getAuthorityRefs(csid);
+    }
+
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.services.client.MediaProxy#getMedia(java.lang.String)
+     */
+    public ClientResponse<MultipartInput> read(String csid) {
+        return mediaProxy.read(csid);
+    }
+
+    /**
+     * @param media
+     * @return
+     *
+     */
+    public ClientResponse<Response> create(MultipartOutput multipart) {
+        return mediaProxy.create(multipart);
+    }
+
+    /**
+     * @param csid
+     * @param media
+     * @return
+     */
+    public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
+        return mediaProxy.update(csid, multipart);
+
+    }
+
+    /**
+     * @param csid
+     * @return
+     * @see org.collectionspace.services.client.MediaProxy#deleteMedia(java.lang.Long)
+     */
+    public ClientResponse<Response> delete(String csid) {
+        return mediaProxy.delete(csid);
+    }
+}
diff --git a/services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java b/services/media/client/src/main/java/org/collectionspace/services/client/MediaProxy.java
new file mode 100644 (file)
index 0000000..2422b76
--- /dev/null
@@ -0,0 +1,57 @@
+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.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.media.MediaCommonList;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+
+/**
+ * @version $Revision: 2108 $
+ */
+@Path("/media/")
+@Produces({"multipart/mixed"})
+@Consumes({"multipart/mixed"})
+public interface MediaProxy extends CollectionSpaceProxy {
+
+    //(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);
+    
+    // List
+    @GET
+    @Produces({"application/xml"})
+    ClientResponse<MediaCommonList> readList();
+
+    // List Authority References
+    @GET
+    @Produces({"application/xml"})
+    @Path("/{csid}/authorityrefs/")
+    ClientResponse<AuthorityRefList> getAuthorityRefs(@PathParam("csid") String csid);
+    
+}
diff --git a/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java b/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java
new file mode 100644 (file)
index 0000000..5be0229
--- /dev/null
@@ -0,0 +1,227 @@
+/**
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.MediaClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.media.MediaCommon;
+
+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.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * MediaAuthRefsTest, carries out Authority References tests against a deployed and running Media (aka Loans Out) Service.
+ * $LastChangedRevision:  $
+ * $LastChangedDate:  $
+ */
+public class MediaAuthRefsTest extends BaseServiceTest {
+
+    private final String CLASS_NAME = MediaAuthRefsTest.class.getName();
+    private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+    final String SERVICE_PATH_COMPONENT = "media";
+    final String PERSON_AUTHORITY_NAME = "MediaPersonAuth";
+    private String knownResourceId = null;
+    private List<String> mediaIdsCreated = new ArrayList<String>();
+    private List<String> personIdsCreated = new ArrayList<String>();
+    private String personAuthCSID = null;
+    private String depositorRefName = null;
+    private String exitDate = null;
+    private String exitNumber = null;
+
+    @Override
+    protected CollectionSpaceClient getClientInstance() {
+        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+    }
+
+    @Override
+    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+        throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+    }
+
+    @Override
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
+    }
+
+    private MultipartOutput createMediaInstance(String depositorRefName, String exitNumber, String exitDate) {
+        this.exitDate = exitDate;
+        this.exitNumber = exitNumber;
+        this.depositorRefName = depositorRefName;
+        MediaCommon media = new MediaCommon();
+        media.setDepositor(depositorRefName);
+        media.setExitNumber(exitNumber);
+        media.setExitDate(exitDate);
+
+        MultipartOutput multipart = new MultipartOutput();
+        OutputPart commonPart = multipart.addPart(media, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", new MediaClient().getCommonPartName());
+        logger.debug("to be created, media common: " + objectAsXmlString(media, MediaCommon.class));
+        return multipart;
+    }
+
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    public void createWithAuthRefs(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+        String identifier = createIdentifier(); // Submit the request to the service and store the response.
+        createPersonRefs();// Create all the person refs and entities
+        // Create a new Loans In resource. One or more fields in this resource will be PersonAuthority
+        //    references, and will refer to Person resources by their refNames.
+        MediaClient mediaClient = new MediaClient();
+        MultipartOutput multipart = createMediaInstance(depositorRefName, "exitNumber-" + identifier, "exitDate-" + identifier);
+        ClientResponse<Response> res = mediaClient.create(multipart);
+        assertStatusCode(res, testName);
+        if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below.
+            knownResourceId = extractId(res);
+        }
+        mediaIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup
+    }
+
+    protected void createPersonRefs() {
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified.
+        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+        ClientResponse<Response> res = personAuthClient.create(multipart);
+        assertStatusCode(res, "createPersonRefs (not a surefire test)");
+        personAuthCSID = extractId(res);
+        String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+        // Create temporary Person resources, and their corresponding refNames by which they can be identified.
+        String csid = "";
+
+        csid = createPerson("Owen the Cur", "Owner", "owenCurOwner", authRefName);
+        personIdsCreated.add(csid);
+        depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+
+        csid = createPerson("Davenport", "Depositor", "davenportDepositor", authRefName);
+        personIdsCreated.add(csid);
+        depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+    }
+
+    protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        Map<String, String> personInfo = new HashMap<String, String>();
+        personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+        personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+        personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
+        MultipartOutput multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName());
+        ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+        assertStatusCode(res, "createPerson (not a surefire test)");
+        return extractId(res);
+    }
+
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"})
+    public void readAndCheckAuthRefs(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        testSetup(STATUS_OK, ServiceRequestType.READ);
+        MediaClient mediaClient = new MediaClient();
+        ClientResponse<MultipartInput> res = mediaClient.read(knownResourceId);
+        assertStatusCode(res, testName);
+        MultipartInput input = (MultipartInput) res.getEntity();
+        MediaCommon media = (MediaCommon) extractPart(input, mediaClient.getCommonPartName(), MediaCommon.class);
+        Assert.assertNotNull(media);
+        logger.debug(objectAsXmlString(media, MediaCommon.class));
+
+        // Check a couple of fields
+        Assert.assertEquals(media.getDepositor(), depositorRefName);
+        Assert.assertEquals(media.getExitDate(), exitDate);
+        Assert.assertEquals(media.getExitNumber(), exitNumber);
+
+        // Get the auth refs and check them
+        ClientResponse<AuthorityRefList> res2 = mediaClient.getAuthorityRefs(knownResourceId);
+        assertStatusCode(res2, testName);
+        AuthorityRefList list = res2.getEntity();
+        List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
+        int numAuthRefsFound = items.size();
+        logger.debug("Authority references, found " + numAuthRefsFound);
+        //Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED,
+        //                    "Did not find all expected authority references! " +
+        //                    "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound);
+        if (logger.isDebugEnabled()) {
+            int i = 0;
+            for (AuthorityRefList.AuthorityRefItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] Field:" + item.getSourceField() + "= " + item.getAuthDisplayName() + item.getItemDisplayName());
+                logger.debug(testName + ": list-item[" + i + "] refName=" + item.getRefName());
+                logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+                i++;
+            }
+        }
+    }
+
+    /**
+     * Deletes all resources created by tests, after all tests have been run.
+     * <p/>
+     * This cleanup method will always be run, even if one or more tests fail.
+     * For this reason, it attempts to remove all resources created
+     * at any point during testing, even if some of those resources
+     * may be expected to be deleted by certain tests.
+     */
+    @AfterClass(alwaysRun = true)
+    public void cleanUp() {
+        String noTest = System.getProperty("noTestCleanup");
+        if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) {
+            logger.debug("Skipping Cleanup phase ...");
+            return;
+        }
+        logger.debug("Cleaning up temporary resources created for testing ...");
+        PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+        // Delete Person resource(s) (before PersonAuthority resources).
+        for (String resourceId : personIdsCreated) {
+            // Note: Any non-success responses are ignored and not reported.
+            personAuthClient.deleteItem(personAuthCSID, resourceId);
+        }
+        // Delete PersonAuthority resource(s).
+        // Note: Any non-success response is ignored and not reported.
+        if (personAuthCSID != null) {
+            personAuthClient.delete(personAuthCSID);
+            // Delete Loans In resource(s).
+            MediaClient mediaClient = new MediaClient();
+            for (String resourceId : mediaIdsCreated) {
+                // Note: Any non-success responses are ignored and not reported.
+                mediaClient.delete(resourceId);
+            }
+        }
+    }
+
+}
diff --git a/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaServiceTest.java b/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaServiceTest.java
new file mode 100644 (file)
index 0000000..cfbb981
--- /dev/null
@@ -0,0 +1,268 @@
+/**
+ * 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.CollectionSpaceClient;
+import org.collectionspace.services.client.MediaClient;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.media.MediaCommon;
+import org.collectionspace.services.media.MediaCommonList;
+
+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;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * MediaServiceTest, carries out tests against a deployed and running Media Service. <p/>
+ * $LastChangedRevision:  $
+ * $LastChangedDate:  $
+ */
+public class MediaServiceTest extends AbstractServiceTestImpl {
+
+    private final String CLASS_NAME = MediaServiceTest.class.getName();
+    private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+    final String SERVICE_PATH_COMPONENT = "media";
+    private String knownResourceId = null;
+
+    @Override
+    protected CollectionSpaceClient getClientInstance() {
+        return new MediaClient();
+    }
+
+    @Override
+    protected AbstractCommonList getAbstractCommonList(ClientResponse<AbstractCommonList> response) {
+        return response.getEntity(MediaCommonList.class);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+    public void create(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupCreate();
+        MediaClient client = new MediaClient();
+        MultipartOutput multipart = createMediaInstance(createIdentifier());
+        ClientResponse<Response> res = client.create(multipart);
+        assertStatusCode(res, testName);
+        if (knownResourceId == null) {
+            knownResourceId = extractId(res);  // Store the ID returned from the first resource created for additional tests below.
+            logger.debug(testName + ": knownResourceId=" + knownResourceId);
+        }
+        allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run.
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    public void createList(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        for (int i = 0; i < 3; i++) {
+            create(testName);
+        }
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"})
+    public void read(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupRead();
+        MediaClient client = new MediaClient();
+        ClientResponse<MultipartInput> res = client.read(knownResourceId);
+        assertStatusCode(res, testName);
+        MultipartInput input = (MultipartInput) res.getEntity();
+        MediaCommon media = (MediaCommon) extractPart(input, client.getCommonPartName(), MediaCommon.class);
+        Assert.assertNotNull(media);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"})
+    public void readList(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupReadList();
+        MediaClient client = new MediaClient();
+        ClientResponse<MediaCommonList> res = client.readList();
+        MediaCommonList list = res.getEntity();
+        assertStatusCode(res, testName);
+        if (logger.isDebugEnabled()) {
+            List<MediaCommonList.MediaListItem> items = list.getMediaListItem();
+            int i = 0;
+            for (MediaCommonList.MediaListItem item : items) {
+                logger.debug(testName + ": list-item[" + i + "] csid=" + item.getCsid());
+                logger.debug(testName + ": list-item[" + i + "] mediaNumber=" + item.getExitNumber());
+                logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri());
+                i++;
+            }
+        }
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
+    public void update(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupUpdate();
+        MediaClient client = new MediaClient();
+        ClientResponse<MultipartInput> res = client.read(knownResourceId);
+        assertStatusCode(res, testName);
+        logger.debug("got object to update with ID: " + knownResourceId);
+        MultipartInput input = (MultipartInput) res.getEntity();
+        MediaCommon media = (MediaCommon) extractPart(input, client.getCommonPartName(), MediaCommon.class);
+        Assert.assertNotNull(media);
+
+        media.setExitNumber("updated-" + media.getExitNumber());
+        logger.debug("Object to be updated:"+objectAsXmlString(media, MediaCommon.class));
+        MultipartOutput output = new MultipartOutput();
+        OutputPart commonPart = output.addPart(media, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", client.getCommonPartName());
+        res = client.update(knownResourceId, output);
+        assertStatusCode(res, testName);
+        input = (MultipartInput) res.getEntity();
+        MediaCommon updatedMedia = (MediaCommon) extractPart(input, client.getCommonPartName(), MediaCommon.class);
+        Assert.assertNotNull(updatedMedia);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"})
+    public void updateNonExistent(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        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.
+        MediaClient client = new MediaClient();
+        MultipartOutput multipart = createMediaInstance(NON_EXISTENT_ID);
+        ClientResponse<MultipartInput> res = client.update(NON_EXISTENT_ID, multipart);
+        assertStatusCode(res, testName);
+    }
+
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"})
+    public void delete(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupDelete();
+        MediaClient client = new MediaClient();
+        ClientResponse<Response> res = client.delete(knownResourceId);
+        assertStatusCode(res, testName);
+    }
+
+    // ---------------------------------------------------------------
+    // Failure outcome tests : means we expect response to fail, but test to succeed
+    // ---------------------------------------------------------------
+
+    // Failure outcome
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"})
+    public void readNonExistent(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupReadNonExistent();
+        MediaClient client = new MediaClient();
+        ClientResponse<MultipartInput> res = client.read(NON_EXISTENT_ID);
+        assertStatusCode(res, testName);
+    }
+
+    // Failure outcome
+    @Override
+    @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"})
+    public void deleteNonExistent(String testName) throws Exception {
+        logger.debug(testBanner(testName, CLASS_NAME));
+        setupDeleteNonExistent();
+        MediaClient client = new MediaClient();
+        ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+        assertStatusCode(res, testName);
+    }
+
+    // Failure outcomes
+    // Placeholders until the tests below can be implemented. See Issue CSPACE-401.
+
+    @Override
+    public void createWithEmptyEntityBody(String testName) throws Exception {
+    }
+
+    @Override
+    public void createWithMalformedXml(String testName) throws Exception {
+    }
+
+    @Override
+    public void createWithWrongXmlSchema(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithEmptyEntityBody(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithMalformedXml(String testName) throws Exception {
+    }
+
+    @Override
+    public void updateWithWrongXmlSchema(String testName) throws Exception {
+    }
+
+    // ---------------------------------------------------------------
+    // Utility tests : tests of code used in tests above
+    // ---------------------------------------------------------------
+
+    @Test(dependsOnMethods = {"create", "read"})
+    public void testSubmitRequest() {
+        final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK
+        String method = ServiceRequestType.READ.httpMethodName();
+        String url = getResourceURL(knownResourceId);
+        int statusCode = submitRequest(method, url);
+        logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode);
+        Assert.assertEquals(statusCode, EXPECTED_STATUS);
+    }
+
+    // ---------------------------------------------------------------
+    // Utility methods used by tests above
+    // ---------------------------------------------------------------
+
+    @Override
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
+    }
+
+    private MultipartOutput createMediaInstance(String exitNumber) {
+        String identifier = "mediaNumber-" + exitNumber;
+        MediaCommon media = new MediaCommon();
+        media.setExitNumber(identifier);
+        media.setDepositor("urn:cspace:org.collectionspace.demo:orgauthority:name(TestOrgAuth):organization:name(Northern Climes Museum)'Northern Climes Museum'");
+        MultipartOutput multipart = new MultipartOutput();
+        OutputPart commonPart = multipart.addPart(media, MediaType.APPLICATION_XML_TYPE);
+        commonPart.getHeaders().add("label", new MediaClient().getCommonPartName());
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("to be created, media common");
+            logger.debug(objectAsXmlString(media, MediaCommon.class));
+        }
+
+        return multipart;
+    }
+}
diff --git a/services/media/client/src/test/resources/log4j.properties b/services/media/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/media/jaxb/pom.xml b/services/media/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..597fc45
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>org.collectionspace.services.media</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.media.jaxb</artifactId>
+    <name>services.media.jaxb</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>com.sun.xml.bind</groupId>
+            <artifactId>jaxb-impl</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2-commons</groupId>
+            <artifactId>property-listener-injector</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jvnet.jaxb2_commons</groupId>
+            <artifactId>runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-media-jaxb</finalName>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <groupId>org.jvnet.jaxb2.maven2</groupId>
+                <artifactId>maven-jaxb2-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/media/jaxb/src/main/java/org/collectionspace/services/MediaJAXBSchema.java b/services/media/jaxb/src/main/java/org/collectionspace/services/MediaJAXBSchema.java
new file mode 100644 (file)
index 0000000..0585581
--- /dev/null
@@ -0,0 +1,16 @@
+/**
+ * 
+ */
+package org.collectionspace.services;
+
+public interface MediaJAXBSchema {
+    final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner";
+    final static String OBJECT_EXIT_DEPOSITOR = "depositor";
+    final static String OBJECT_EXIT_DATE = "exitDate";
+    final static String OBJECT_EXIT_METHODS = "exitMethods";
+    final static String OBJECT_EXIT_METHOD = "exitMethod";
+    final static String OBJECT_EXIT_NOTE = "exitNote";
+    final static String OBJECT_EXIT_NUMBER = "exitNumber";
+    final static String OBJECT_EXIT_REASON = "exitReason";
+    final static String OBJECT_EXIT_PACKING_NOTE = "packingNote";
+}
diff --git a/services/media/jaxb/src/main/java/org/collectionspace/services/MediaListItemJAXBSchema.java b/services/media/jaxb/src/main/java/org/collectionspace/services/MediaListItemJAXBSchema.java
new file mode 100644 (file)
index 0000000..d423ad6
--- /dev/null
@@ -0,0 +1,9 @@
+package org.collectionspace.services;
+
+public interface MediaListItemJAXBSchema {
+    final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner";
+    final static String OBJECT_EXIT_NUMBER = "exitNumber";
+    
+       final static String CSID = "csid";
+       final static String URI = "url";
+}
diff --git a/services/media/jaxb/src/main/resources/media_common.xsd b/services/media/jaxb/src/main/resources/media_common.xsd
new file mode 100644 (file)
index 0000000..599d340
--- /dev/null
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Loan Out schema (XSD)
+    
+    Entity  : Media
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+
+    $LastChangedRevision: 2316 $
+    $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  jaxb:version="1.0" elementFormDefault="unqualified"
+  xmlns:ns="http://collectionspace.org/services/media"
+  xmlns="http://collectionspace.org/services/media"
+  targetNamespace="http://collectionspace.org/services/media"
+  version="0.1"
+>
+
+<!--
+    Avoid XmlRootElement nightmare:
+    See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Loans+Out+Schema -->    
+    
+    <!-- media -->
+    <xs:element name="media_common">
+        <xs:complexType>
+            <xs:sequence>
+                <!--  Media Information Group -->
+                <xs:element name="currentOwner" type="xs:string"/>
+                <xs:element name="depositor" type="xs:string"/>
+                <xs:element name="exitDate" type="xs:string"/>
+                <xs:element name="exitMethods" type="exitMethods"/>
+                <xs:element name="exitNote" type="xs:string"/>
+                <xs:element name="exitNumber" type="xs:string"/>
+                <xs:element name="exitReason" type="xs:string"/>
+                <xs:element name="packingNote" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+    <xs:complexType name="exitMethods">
+        <xs:sequence>
+            <xs:element name="exitMethod" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <!-- This is the base class for paginated lists -->
+    <xs:complexType name="abstractCommonList">
+        <xs:annotation>
+            <xs:appinfo>
+                <jaxb:class ref="org.collectionspace.services.jaxb.AbstractCommonList"/>
+            </xs:appinfo>
+        </xs:annotation>
+    </xs:complexType>
+    
+    <!-- media records, as in nuxeo repository -->
+    <xs:element name="media_common_list">
+        <xs:complexType>
+            <xs:complexContent>
+                <xs:extension base="abstractCommonList">                    
+                    <xs:sequence>
+                        <xs:element name="media_list_item" maxOccurs="unbounded">
+                            <xs:complexType>
+                                <xs:sequence>
+                                    <xs:element name="exitNumber" type="xs:string"   minOccurs="1" />
+                                    <xs:element name="currentOwner" type="xs:string" minOccurs="1" />
+                                    <xs:element name="uri" type="xs:anyURI"          minOccurs="1" />
+                                    <xs:element name="csid" type="xs:string"         minOccurs="1" />
+                                    <!--
+                                    <xs:element name="depositor" type="xs:string"    minOccurs="1" />
+                                    <xs:element name="exitDate" type="xs:string"     minOccurs="1" />
+                                    <xs:element name="exitMethod" type="xs:string"   minOccurs="1" />
+                                    <xs:element name="exitNote" type="xs:string"     minOccurs="1" />
+                                    <xs:element name="exitReason" type="xs:string"   minOccurs="1" />
+                                    <xs:element name="packingNote" type="xs:string"  minOccurs="1" />
+                                    -->
+                                </xs:sequence>
+                            </xs:complexType>
+                        </xs:element>
+                    </xs:sequence>
+                </xs:extension>
+            </xs:complexContent>                    
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/services/media/pom.xml b/services/media/pom.xml
new file mode 100644 (file)
index 0000000..fe55a96
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- A comment. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.main</artifactId>
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.media</artifactId>
+    <name>services.media</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>jaxb</module>
+        <module>service</module>
+        <module>3rdparty</module>
+        <module>client</module>
+    </modules>
+
+</project>
+
diff --git a/services/media/service/pom.xml b/services/media/service/pom.xml
new file mode 100644 (file)
index 0000000..62bc6c0
--- /dev/null
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.media</artifactId>        
+        <version>1.1-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.media.service</artifactId>
+    <name>services.media.service</name>
+    <packaging>jar</packaging>       
+
+    <dependencies>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.media.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.collectionobject.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- External dependencies -->        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        
+      <!-- javax -->
+
+        <dependency>
+            <groupId>javax.security</groupId>
+            <artifactId>jaas</artifactId>
+            <version>1.0.01</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <!-- jboss -->
+
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+        </dependency>
+        
+        <!-- nuxeo -->
+
+        <dependency>
+            <groupId>org.nuxeo.ecm.core</groupId>
+            <artifactId>nuxeo-core-api</artifactId>
+            <version>${nuxeo.core.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jboss-remoting</artifactId>
+                    <groupId>jboss</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.restlet</groupId>
+            <artifactId>org.restlet</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.noelios.restlet</groupId>
+            <artifactId>com.noelios.restlet.ext.httpclient</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.noelios.restlet</groupId>
+            <artifactId>com.noelios.restlet</artifactId>
+            <version>1.0.7</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-media</finalName>
+    </build>
+</project>
+
diff --git a/services/media/service/profiles.xml b/services/media/service/profiles.xml
new file mode 100644 (file)
index 0000000..347b9df
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<profilesXml xmlns="http://maven.apache.org/PROFILES/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd">
+</profilesXml>
\ No newline at end of file
diff --git a/services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java b/services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java
new file mode 100644 (file)
index 0000000..408af96
--- /dev/null
@@ -0,0 +1,78 @@
+/**
+ *  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.media;
+
+import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ServiceMain;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MultivaluedMap;
+import java.util.List;
+
+@Path("/media")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class MediaResource extends ResourceBase {
+
+    @Override
+    public String getServiceName(){
+        return "media";
+    };
+
+    //FIXME retrieve client type from configuration
+    final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
+
+    @Override
+    protected String getVersionString() {
+       final String lastChangeRevision = "$LastChangedRevision: 2108 $";
+       return lastChangeRevision;
+    }
+
+    @Override
+    public Class<MediaCommon> getCommonPartClass() {
+       return MediaCommon.class;
+    }
+
+    public Class getResourceClass() {
+        return this.getClass();
+    }
+
+    public MediaCommonList getMediaList(MultivaluedMap<String, String> queryParams) {
+        return (MediaCommonList)getList(queryParams);
+    }
+
+    @Deprecated
+    public MediaCommonList getMediaList(List<String> csidList) {
+        return (MediaCommonList) getList(csidList);
+    }
+
+    protected MediaCommonList search(MultivaluedMap<String,String> queryParams,String keywords) {
+         return (MediaCommonList) super.search(queryParams, keywords);
+    }
+
+    
+}
diff --git a/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaConstants.java b/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaConstants.java
new file mode 100644 (file)
index 0000000..41f18d8
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *  This document is a part of the source code and related artifacts
+ *  for CollectionSpace, an open source collections management system
+ *  for museums and related institutions:
+
+ *  http://www.collectionspace.org
+ *  http://wiki.collectionspace.org
+
+ *  Copyright 2009 University of California at Berkeley
+
+ *  Licensed under the Educational Community License (ECL), Version 2.0.
+ *  You may not use this file except in compliance with this License.
+
+ *  You may obtain a copy of the ECL 2.0 License at
+
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.collectionspace.services.media.nuxeo;
+
+/**
+ * MediaConstants specifies constants for the Loans Out service
+ *
+ */
+public class MediaConstants {
+
+    public final static String NUXEO_DOCTYPE = "Media";
+    public final static String NUXEO_SCHEMA_NAME = "media";
+    public final static String NUXEO_DC_TITLE = "CollectionSpace-Media";
+}
diff --git a/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaDocumentModelHandler.java b/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..26ed8e1
--- /dev/null
@@ -0,0 +1,167 @@
+/**
+ *  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.media.nuxeo;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.collectionspace.services.MediaJAXBSchema;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.media.MediaCommon;
+import org.collectionspace.services.media.MediaCommonList;
+import org.collectionspace.services.media.MediaCommonList.MediaListItem;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The Class MediaDocumentModelHandler.
+ */
+public class MediaDocumentModelHandler
+        extends RemoteDocumentModelHandlerImpl<MediaCommon, MediaCommonList> {
+
+    /** The logger. */
+    private final Logger logger = LoggerFactory.getLogger(MediaDocumentModelHandler.class);
+    
+    /** The media. */
+    private MediaCommon media;
+    
+    /** The media list. */
+    private MediaCommonList mediaList;
+
+
+    /**
+     * Gets the common part.
+     *
+     * @return the common part
+     */
+    @Override
+    public MediaCommon getCommonPart() {
+        return media;
+    }
+
+    /**
+     * Sets the common part.
+     *
+     * @param media the new common part
+     */
+    @Override
+    public void setCommonPart(MediaCommon media) {
+        this.media = media;
+    }
+
+    /**
+     * Gets the common part list.
+     *
+     * @return the common part list
+     */
+    @Override
+    public MediaCommonList getCommonPartList() {
+        return mediaList;
+    }
+
+    /**
+     * Sets the common part list.
+     *
+     * @param mediaList the new common part list
+     */
+    @Override
+    public void setCommonPartList(MediaCommonList mediaList) {
+        this.mediaList = mediaList;
+    }
+
+    /**
+     * Extract common part.
+     *
+     * @param wrapDoc the wrap doc
+     * @return the media common
+     * @throws Exception the exception
+     */
+    @Override
+    public MediaCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
+            throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Fill common part.
+     *
+     * @param mediaObject the media object
+     * @param wrapDoc the wrap doc
+     * @throws Exception the exception
+     */
+    @Override
+    public void fillCommonPart(MediaCommon mediaObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Extract common part list.
+     *
+     * @param wrapDoc the wrap doc
+     * @return the media common list
+     * @throws Exception the exception
+     */
+    @Override
+    public MediaCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
+        MediaCommonList coList = extractPagingInfo(new MediaCommonList(), wrapDoc);
+        AbstractCommonList commonList = (AbstractCommonList) coList;
+        //CSPACE-3209 don't use all fields.  commonList.setFieldsReturned("currentOwner|depositor|exitDate|exitMethod|exitNote|exitNumber|exitReason|packingNote|uri|csid");
+        commonList.setFieldsReturned("exitNumber|currentOwner|uri|csid");  //CSPACE-3209 now do this
+        List<MediaCommonList.MediaListItem> list = coList.getMediaListItem();
+        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
+        while(iter.hasNext()){
+            DocumentModel docModel = iter.next();
+            MediaListItem ilistItem = new MediaListItem();
+
+            String label = getServiceContext().getCommonPartLabel();
+            ilistItem.setExitNumber((String) docModel.getProperty(label, MediaJAXBSchema.OBJECT_EXIT_NUMBER));
+            //CSPACE-3209 ilistItem.setExitDate((String) docModel.getProperty(label, MediaJAXBSchema.OBJECT_EXIT_DATE));
+            ilistItem.setCurrentOwner((String) docModel.getProperty(label, MediaJAXBSchema.OBJECT_EXIT_CURRENT_OWNER));  //CSPACE-3209
+            String id = NuxeoUtils.extractId(docModel.getPathAsString());
+            ilistItem.setUri(getServiceContextPath() + id);
+            ilistItem.setCsid(id);
+            list.add(ilistItem);
+        }
+
+        return coList;
+    }
+
+    /**
+     * Gets the q property.
+     *
+     * @param prop the prop
+     * @return the q property
+     */
+    @Override
+    public String getQProperty(String prop) {
+        return MediaConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    }
+}
+
diff --git a/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaValidatorHandler.java b/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaValidatorHandler.java
new file mode 100644 (file)
index 0000000..2d372b4
--- /dev/null
@@ -0,0 +1,18 @@
+package org.collectionspace.services.media.nuxeo;
+
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandler;
+import org.collectionspace.services.common.document.DocumentHandler.Action;
+
+public class MediaValidatorHandler implements ValidatorHandler {
+
+       @Override
+       public void validate(Action action, ServiceContext ctx)
+                       throws InvalidDocumentException {
+               // TODO Auto-generated method stub
+               System.out.println("MediaValidatorHandler executed.");
+
+       }
+
+}
diff --git a/services/media/service/src/test/java/org/collectionspace/services/test/MediaServiceTest.java b/services/media/service/src/test/java/org/collectionspace/services/test/MediaServiceTest.java
new file mode 100644 (file)
index 0000000..8957094
--- /dev/null
@@ -0,0 +1,13 @@
+package org.collectionspace.services.test;
+
+//import org.collectionspace.services.media.Media;
+//import org.collectionspace.services.media.MediaList;
+
+/**
+ * Placeholder for server-side testing of Loan Out service code.
+ * 
+ * @version $Revision: 2108 $
+ */
+public class MediaServiceTest {
+       //empty
+}
diff --git a/services/media/service/src/test/resources/log4j.xml b/services/media/service/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..52121cb
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.TTCCLayout">
+                       <param name="DateFormat" value="ISO8601" />
+               </layout>
+       </appender>
+
+
+       <appender name="unit-tests"
+               class="org.apache.log4j.RollingFileAppender">
+               <param name="File" value="./target/unit-tests.log" />
+               <param name="MaxFileSize" value="10240KB" />
+               <param name="MaxBackupIndex" value="6" />
+               <layout class="org.apache.log4j.TTCCLayout">
+                       <param name="DateFormat" value="ISO8601" />
+               </layout>
+       </appender>
+
+       <logger name="org.apache.commons.httpclient" additivity="false">
+               <level value="warn" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </logger>
+
+       <logger name="httpclient.wire" additivity="false">
+               <level value="info" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </logger>
+
+       <root>
+               <priority value="debug" />
+               <appender-ref ref="console" />
+               <appender-ref ref="unit-tests" />
+       </root>
+
+</log4j:configuration>
+
+
+
+
index f8f78c76d32838581d70c4eaff20a0d0d6a75258..ad8e1db42c7fdbfeba7a0c2f6155f57892516f8e 100644 (file)
@@ -22,6 +22,7 @@
     <modules>
         <module>authentication</module>
         <module>authorization</module>
+        <module>blob</module>
         <module>client</module>
         <module>jaxb</module>
         <module>hyperjaxb</module>
@@ -41,6 +42,7 @@
         <module>intake</module>
         <module>loanin</module>
         <module>loanout</module>
+        <module>media</module>
         <module>objectexit</module>
         <module>location</module>
         <module>movement</module>