]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
NOJIRA work in progress for account management. uses jaxb/jpa. still to write resource
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Sat, 14 Nov 2009 00:04:19 +0000 (00:04 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Sat, 14 Nov 2009 00:04:19 +0000 (00:04 +0000)
and handler. builds but is not linked to service build yet.

A    account
A    account/service
A    account/service/src
A    account/service/src/test
A    account/service/src/test/java
A    account/service/src/test/java/org
A    account/service/src/test/java/org/collectionspace
A    account/service/src/test/java/org/collectionspace/services
A    account/service/src/test/java/org/collectionspace/services/test
A    account/service/src/test/resources
A    account/service/src/test/resources/log4j.xml
A    account/service/src/main
A    account/service/src/main/java
A    account/service/src/main/java/org
A    account/service/src/main/java/org/collectionspace
A    account/service/src/main/java/org/collectionspace/services
A    account/service/src/main/java/org/collectionspace/services/account
A    account/service/src/main/java/org/collectionspace/services/account/storage
A    account/service/src/main/java/org/collectionspace/services/account/storage/AccountHandlerFactory.java
A    account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java
A    account/service/src/main/java/org/collectionspace/services/account/AccountResource.java
A    account/service/src/main/resources
A    account/service/pom.xml
AM   account/jaxb
A    account/jaxb/src
A    account/jaxb/src/test
A    account/jaxb/src/test/java
A    account/jaxb/src/test/java/org
A    account/jaxb/src/test/java/org/collectionspace
A    account/jaxb/src/test/java/org/collectionspace/services
A    account/jaxb/src/test/java/org/collectionspace/services/account
A    account/jaxb/src/test/java/org/collectionspace/services/account/test
A    account/jaxb/src/test/java/org/collectionspace/services/account/test/AccountTest.java
A    account/jaxb/src/test/resources
A    account/jaxb/src/test/resources/META-INF
A    account/jaxb/src/test/resources/META-INF/persistence.xml
A    account/jaxb/src/test/resources/log4j.properties
A    account/jaxb/src/test/resources/hibernate.cfg.xml
A    account/jaxb/src/main
A    account/jaxb/src/main/java
A    account/jaxb/src/main/java/org
A    account/jaxb/src/main/java/org/collectionspace
A    account/jaxb/src/main/java/org/collectionspace/services
A    account/jaxb/src/main/resources
A    account/jaxb/src/main/resources/META-INF
A    account/jaxb/src/main/resources/META-INF/persistence.xml
A    account/jaxb/src/main/resources/accounts_common.xsd
A    account/jaxb/src/main/resources/db
A    account/jaxb/src/main/resources/db/mysql
A    account/jaxb/src/main/resources/org
A    account/jaxb/src/main/resources/org/collectionspace
A    account/jaxb/src/main/resources/org/collectionspace/services
A    account/jaxb/src/main/resources/org/collectionspace/services/account
A    account/jaxb/pom.xml
A    account/3rdparty
A    account/3rdparty/pom.xml
A    account/3rdparty/build.xml
A    account/pom.xml
A    account/build.xml
A    account/client
A    account/client/src
A    account/client/src/test
A    account/client/src/test/java
A    account/client/src/test/java/org
A    account/client/src/test/java/org/collectionspace
A    account/client/src/test/java/org/collectionspace/services
A    account/client/src/test/java/org/collectionspace/services/client
A    account/client/src/test/java/org/collectionspace/services/client/test
A    account/client/src/test/resources
A    account/client/src/test/resources/log4j.properties
A    account/client/src/main
A    account/client/src/main/java
A    account/client/src/main/java/org
A    account/client/src/main/java/org/collectionspace
A    account/client/src/main/java/org/collectionspace/services
A    account/client/src/main/java/org/collectionspace/services/client
A    account/client/src/main/resources
A    account/client/pom.xml

18 files changed:
services/account/3rdparty/build.xml [new file with mode: 0644]
services/account/3rdparty/pom.xml [new file with mode: 0644]
services/account/build.xml [new file with mode: 0644]
services/account/client/pom.xml [new file with mode: 0644]
services/account/client/src/test/resources/log4j.properties [new file with mode: 0644]
services/account/jaxb/pom.xml [new file with mode: 0644]
services/account/jaxb/src/main/resources/META-INF/persistence.xml [new file with mode: 0644]
services/account/jaxb/src/main/resources/accounts_common.xsd [new file with mode: 0644]
services/account/jaxb/src/test/java/org/collectionspace/services/account/test/AccountTest.java [new file with mode: 0644]
services/account/jaxb/src/test/resources/META-INF/persistence.xml [new file with mode: 0644]
services/account/jaxb/src/test/resources/hibernate.cfg.xml [new file with mode: 0644]
services/account/jaxb/src/test/resources/log4j.properties [new file with mode: 0644]
services/account/pom.xml [new file with mode: 0644]
services/account/service/pom.xml [new file with mode: 0644]
services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java [new file with mode: 0644]
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java [new file with mode: 0644]
services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountHandlerFactory.java [new file with mode: 0644]
services/account/service/src/test/resources/log4j.xml [new file with mode: 0644]

diff --git a/services/account/3rdparty/build.xml b/services/account/3rdparty/build.xml
new file mode 100644 (file)
index 0000000..c0a1b94
--- /dev/null
@@ -0,0 +1,126 @@
+\r
+<project name="account.3rdparty" default="package" basedir=".">\r
+    <description>\r
+        account service 3rd party\r
+    </description>\r
+  <!-- set global properties for this build -->\r
+    <property name="services.trunk" value="../../.."/>\r
+    <property file="${services.trunk}/build.properties" />\r
+    <property name="mvn.opts" value="" />\r
+    <property name="src" location="src"/>\r
+    <property name="build" location="build"/>\r
+\r
+    <condition property="osfamily-unix">\r
+        <os family="unix" />\r
+    </condition>\r
+    <condition property="osfamily-windows">\r
+        <os family="windows" />\r
+    </condition>\r
+\r
+    <target name="init" >\r
+    <!-- Create the time stamp -->\r
+        <tstamp/>\r
+\r
+    </target>\r
+\r
+    <target name="package" depends="package-unix,package-windows"\r
+  description="Package CollectionSpace Services" />\r
+    <target name="package-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="package" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="package-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="package" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="install" depends="package,install-unix,install-windows"\r
+  description="Install" />\r
+    <target name="install-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="install" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="install-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="install" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    \r
+    <target name="clean" depends="clean-unix,clean-windows"\r
+  description="Delete target directories" >\r
+        <delete dir="${build}"/>\r
+    </target>\r
+    <target name="clean-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="clean" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="clean-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="clean" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+    <target name="test-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="test" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="test-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="test" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="deploy" depends="install"\r
+    description="deploy account in ${jboss.server.nuxeo}">\r
+        <ant antfile="nuxeo-platform-cs-account/build.xml" target="deploy" inheritall="false"/>\r
+    </target>\r
+\r
+    <target name="undeploy"\r
+    description="undeploy account from ${jboss.server.nuxeo}">\r
+        <ant antfile="nuxeo-platform-cs-account/build.xml" target="undeploy" inheritall="false"/>\r
+    </target>\r
+\r
+    <target name="dist"\r
+    description="generate distribution for account" depends="package">\r
+        <ant antfile="nuxeo-platform-cs-account/build.xml" target="dist" inheritall="false"/>\r
+    </target>\r
+\r
+</project>\r
diff --git a/services/account/3rdparty/pom.xml b/services/account/3rdparty/pom.xml
new file mode 100644 (file)
index 0000000..a4a7a16
--- /dev/null
@@ -0,0 +1,26 @@
+\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+\r
+    <parent>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <artifactId>org.collectionspace.services.account</artifactId>\r
+        <version>1.0</version>\r
+    </parent>\r
+\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <version>1.0</version>\r
+    <artifactId>org.collectionspace.services.account.3rdparty</artifactId>\r
+    <packaging>pom</packaging>\r
+    <name>services.account.3rdparty</name>\r
+    <description>\r
+    3rd party build for account service\r
+    </description>\r
+\r
+    <modules>\r
+\r
+    </modules>\r
+\r
+</project>\r
diff --git a/services/account/build.xml b/services/account/build.xml
new file mode 100644 (file)
index 0000000..8219b19
--- /dev/null
@@ -0,0 +1,123 @@
+\r
+<project name="collectionobject" default="package" basedir=".">\r
+    <description>\r
+        collectionobject service\r
+    </description>\r
+  <!-- set global properties for this build -->\r
+    <property name="services.trunk" value="../.."/>\r
+    <property file="${services.trunk}/build.properties" />\r
+    <property name="mvn.opts" value="" />\r
+    <property name="src" location="src"/>\r
+    <property name="build" location="build"/>\r
+\r
+    <condition property="osfamily-unix">\r
+        <os family="unix" />\r
+    </condition>\r
+    <condition property="osfamily-windows">\r
+        <os family="windows" />\r
+    </condition>\r
+\r
+    <target name="package" depends="package-unix,package-windows"\r
+  description="Package CollectionSpace Services" />\r
+  \r
+    <target name="package-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="package" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    \r
+    <target name="package-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="package" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+\r
+    <target name="install" depends="package,install-unix,install-windows"\r
+  description="Install" />\r
+    <target name="install-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="install" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="install-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="install" />\r
+            <arg value="-Dmaven.test.skip=true" />\r
+            <arg value="-f" />\r
+            <arg value="${basedir}/pom.xml" />\r
+            <arg value="-N" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="clean" depends="clean-unix,clean-windows"\r
+  description="Delete target directories" >\r
+        <delete dir="${build}"/>\r
+    </target>\r
+    <target name="clean-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="clean" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="clean-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="clean" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+    <target name="test-unix" if="osfamily-unix">\r
+        <exec executable="mvn" failonerror="true">\r
+            <arg value="test" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+    <target name="test-windows" if="osfamily-windows">\r
+        <exec executable="cmd" failonerror="true">\r
+            <arg value="/c" />\r
+            <arg value="mvn.bat" />\r
+            <arg value="test" />\r
+            <arg value="${mvn.opts}" />\r
+        </exec>\r
+    </target>\r
+\r
+    <target name="deploy" depends="install"\r
+    description="deploy collectionobject service">\r
+        <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>\r
+    </target>\r
+\r
+    <target name="undeploy"\r
+    description="undeploy collectionobject service">\r
+        <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>\r
+    </target>\r
+\r
+    <target name="dist" depends="package"\r
+    description="distribute collectionobject service}">\r
+        <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>\r
+    </target>\r
+\r
+</project>\r
diff --git a/services/account/client/pom.xml b/services/account/client/pom.xml
new file mode 100644 (file)
index 0000000..c350fe4
--- /dev/null
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+\r
+    <parent>\r
+        <artifactId>org.collectionspace.services.account</artifactId>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <version>1.0</version>\r
+    </parent>\r
+\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <artifactId>org.collectionspace.services.account.client</artifactId>\r
+    <version>1.0</version>\r
+    <name>services.account.client</name>\r
+    \r
+    <dependencies>\r
+        <!-- keep slf4j dependencies on the top -->\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-api</artifactId>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-log4j12</artifactId>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.account.jaxb</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.client</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
+<!-- Needed if/when client test framework files are moved into\r
+/services/client/src/test from /services/client/src/main -->     \r
+<!--    <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.client</artifactId>\r
+            <version>1.0</version>\r
+            <scope>test</scope>\r
+            <type>test-jar</type>\r
+        </dependency>-->\r
+        \r
+        <dependency>\r
+            <groupId>org.testng</groupId>\r
+            <artifactId>testng</artifactId>\r
+            <version>5.6</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxrs</artifactId>\r
+            <version>1.1.GA</version>\r
+            <!-- filter out unwanted jars -->\r
+            <exclusions>\r
+                <exclusion>\r
+                    <groupId>tjws</groupId>\r
+                    <artifactId>webserver</artifactId>\r
+                </exclusion>\r
+            </exclusions>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxb-provider</artifactId>\r
+            <version>1.1.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-multipart-provider</artifactId>\r
+            <version>1.1.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-httpclient</groupId>\r
+            <artifactId>commons-httpclient</artifactId>\r
+            <version>3.1</version>\r
+        </dependency>\r
+    </dependencies>\r
+    \r
+    <build>\r
+        <finalName>cspace-services-account-client</finalName>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-surefire-plugin</artifactId>\r
+                <configuration>\r
+                    <systemProperties>\r
+                        <property>\r
+                            <name>log4j.configuration</name>\r
+                            <value>file:target/test-classes/log4j.properties</value>\r
+                        </property>\r
+                    </systemProperties>\r
+                </configuration>\r
+            </plugin>\r
+            <plugin>\r
+                <artifactId>maven-compiler-plugin</artifactId>\r
+                <version>2.0.2</version>\r
+                <configuration>\r
+                    <source>1.6</source>\r
+                    <target>1.6</target>\r
+                </configuration>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>\r
+\r
diff --git a/services/account/client/src/test/resources/log4j.properties b/services/account/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/account/jaxb/pom.xml b/services/account/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..98f96b1
--- /dev/null
@@ -0,0 +1,213 @@
+<?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.account</artifactId>
+        <groupId>org.collectionspace.services</groupId>
+        <version>1.0</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.account.jaxb</artifactId>
+    <version>1.0</version>
+    <name>services.account.jaxb</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>
+        <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>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.persistence</groupId>
+            <artifactId>persistence-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>5.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.client</artifactId>
+            <version>1.0</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>collectionspace-services-account-jaxb</finalName>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <!-- maven-hyperjaxb3-plugin generates jaxb + jpa bindings -->
+                <groupId>org.jvnet.hyperjaxb3</groupId>
+                <artifactId>maven-hyperjaxb3-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <extension>true</extension>
+                    <jdk5>true</jdk5>
+                    <ejb3>false</ejb3>
+                </configuration>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+    <profiles>
+        <profile>
+            <!-- use profile as this task is not needed for every build and test -->
+            <id>ddl</id>
+            <build>
+                <plugins>
+                    <!--plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>hibernate3-maven-plugin</artifactId>
+                        <version>2.2</version>
+                        <executions>
+                            <execution>
+                            
+                                <phase>process-test-classes</phase>
+                                <goals>
+                                    <goal>hbm2ddl</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <components>
+                                <component>
+                                    <name>hbm2ddl</name>
+                                </component>
+                            </components>
+                            <componentProperties>
+                                <outputfilename>${basedir}/src/main/resources/db/mysql/account.sql</outputfilename>
+                                <implementation>jpaconfiguration</implementation>
+                                <drop>true</drop>
+                                <create>true</create>
+                                <export>true</export>
+                                <jdk5>true</jdk5>
+                                <ejb3>false</ejb3>
+                                <persistenceunit>org.collectionspace.services.account</persistenceunit>
+                            </componentProperties>
+                        </configuration>
+                        <dependencies>
+                            <dependency>
+                                <groupId>mysql</groupId>
+                                <artifactId>mysql-connector-java</artifactId>
+                                <version>5.0.5</version>
+                            </dependency>
+                        </dependencies>
+                    </plugin-->
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>process-classes</id>
+                                <phase>process-test-resources</phase>
+                                <configuration>
+                                    <tasks>
+                                        <property name="export" value="false"/>
+                                        <property name="test_classpath" refid="maven.test.classpath"/>
+                                        <property name="compile_classpath" refid="maven.compile.classpath"/>
+                                        <property name="runtime_classpath" refid="maven.runtime.classpath"/>
+                                        <property name="plugin_classpath" refid="maven.plugin.classpath"/>
+                                        <taskdef name="hibernatetool"
+                         classname="org.hibernate.tool.ant.HibernateToolTask"/>
+                                        <hibernatetool destdir="{basedir}/src/main/resources/db/mysql">
+                                            <hbm2ddl drop="true"
+                           create="true"
+                           export="${export}"
+                           outputfilename="${basedir}/src/main/resources/db/mysql/account.sql"
+                           delimiter=";" format="true"/>
+                                            <configuration configurationfile="${basedir}/src/test/resources/hibernate.cfg.xml"/>
+                                        </hibernatetool>
+                                    </tasks>
+                                </configuration>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.hibernate</groupId>
+                                <artifactId>hibernate-tools</artifactId>
+                                <version>3.2.3.GA</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>org.hibernate</groupId>
+                                <artifactId>hibernate</artifactId>
+                                <version>3.4.0.GA</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>org.hibernate</groupId>
+                                <artifactId>hibernate-entitymanager</artifactId>
+                                <version>3.4.0.GA</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>org.slf4j</groupId>
+                                <artifactId>slf4j-api</artifactId>
+                                <version>1.5.2</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>org.slf4j</groupId>
+                                <artifactId>slf4j-log4j12</artifactId>
+                                <version>1.5.2</version>
+                            </dependency>
+                            <dependency>
+                                <groupId>commons-logging</groupId>
+                                <artifactId>commons-logging</artifactId>
+                                <version>1.1</version>
+                            </dependency>
+                        </dependencies>
+                    </plugin>
+
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
+
diff --git a/services/account/jaxb/src/main/resources/META-INF/persistence.xml b/services/account/jaxb/src/main/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..70e1e5d
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
+http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <persistence-unit name="org.collectionspace.services.account">
+        <non-jta-data-source>java:/CSpaceDS</non-jta-data-source>
+        <class>org.collectionspace.services.account.AccountsCommon</class>
+        <class>org.collectionspace.services.account.AccountsCommonList</class>
+        <class>org.collectionspace.services.account.AccountsCommonList$AccountListItem</class>
+        <properties>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
+            <property name="hibernate.max_fetch_depth" value="3"/>
+            <!--property name="hibernate.hbm2ddl.auto" value="create-drop"/-->
+        </properties>
+
+    </persistence-unit>
+</persistence>
diff --git a/services/account/jaxb/src/main/resources/accounts_common.xsd b/services/account/jaxb/src/main/resources/accounts_common.xsd
new file mode 100644 (file)
index 0000000..fab3f58
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Account schema (XSD)
+    
+    Entity  : Account
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+    
+    $LastChangedRevision: 916 $
+    $LastChangedDate: 2009-11-05 16:59:20 -0800 (Thu, 05 Nov 2009) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations"
+  xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
+  xmlns:ns="http://collectionspace.org/servics/account"
+  xmlns="http://collectionspace.org/services/account"
+  targetNamespace="http://collectionspace.org/services/account"
+  version="0.1"
+  jaxb:extensionBindingPrefixes="hj orm"
+>
+
+<!--
+    Avoid XmlRootElement nightmare:
+    See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+
+    <!-- accounts-common -->
+    <!-- convention: <servicename>-common  -->
+    <xs:element name="accounts_common">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="csid" type="xs:string" minOccurs="1" maxOccurs="1" />
+                <xs:element name="anchorName" type="xs:string" minOccurs="1" maxOccurs="1" />
+                <xs:element name="firstName" type="xs:string" minOccurs="1" maxOccurs="1" />
+                <xs:element name="lastName" type="xs:string" minOccurs="1" maxOccurs="1" />
+                <xs:element name="mi" type="xs:string"/>
+                <xs:element name="email" type="xs:string" minOccurs="1" maxOccurs="1" />
+                <xs:element name="phone" type="xs:string"/>
+
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="accounts-common-list">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="account-list-item" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="anchorName" type="xs:string" minOccurs="1"/>
+                            <xs:element name="firstName" type="xs:string" minOccurs="1" />
+                            <xs:element name="lastName" type="xs:string" minOccurs="1" />
+                            <xs:element name="mi" type="xs:string"/>
+                            <xs:element name="email" type="xs:string" minOccurs="1" />
+                            <!-- uri to retrive collection object details -->
+                            <xs:element name="uri" type="xs:anyURI"
+                                minOccurs="1" />
+                            <xs:element name="csid" type="xs:string"
+                                minOccurs="1" />
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/services/account/jaxb/src/test/java/org/collectionspace/services/account/test/AccountTest.java b/services/account/jaxb/src/test/java/org/collectionspace/services/account/test/AccountTest.java
new file mode 100644 (file)
index 0000000..4a7a08e
--- /dev/null
@@ -0,0 +1,151 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.collectionspace.services.account.test;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.UUID;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import javax.persistence.Query;
+import org.collectionspace.services.account.AccountsCommon;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+
+/**
+ *
+ * @author 
+ */
+public class AccountTest {
+
+    private final Logger logger = LoggerFactory.getLogger(AccountTest.class);
+    private EntityManagerFactory emf;
+    private EntityManager em;
+
+    @BeforeMethod
+    public void init() {
+
+        emf = Persistence.createEntityManagerFactory("org.collectionspace.services.account");
+
+        em = emf.createEntityManager();
+//        if (logger.isDebugEnabled()) {
+//            logger.debug("created entity manager");
+//        }
+    }
+
+    @AfterMethod
+    public void cleanup() {
+        if (em != null) {
+            em.close();
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = AccountTest.class)
+    public void create(String testName) throws Exception {
+        // Begin transaction
+        em.getTransaction().begin();
+        AccountsCommon account = new AccountsCommon();
+        account.setAnchorName("sanjay");
+        account.setFirstName("Sanjay");
+        account.setLastName("Dalal");
+        account.setEmail("sanjay.dalal@berkeley.edu");
+        account.setCsid(UUID.randomUUID().toString());
+        em.persist(account);
+        // Commit the transaction
+        em.getTransaction().commit();
+        if (logger.isDebugEnabled()) {
+            logger.debug("created account " +
+                    " first name=" + account.getFirstName() +
+                    " email=" + account.getEmail());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = AccountTest.class,
+    dependsOnMethods = {"create"})
+    public void read(String testName) throws Exception {
+        AccountsCommon account = findAccount("sanjay");
+        Assert.assertNotNull(account);
+        if (logger.isDebugEnabled()) {
+            logger.debug("read account " +
+                    " first name=" + account.getFirstName());
+        }
+    }
+
+    private AccountsCommon findAccount(String anchorName) throws Exception {
+        Query q = em.createQuery("select a from org.collectionspace.services.account.AccountsCommon a where a.anchorName = :anchorname");
+        q.setParameter("anchorname", anchorName);
+        return (AccountsCommon) q.getSingleResult();
+
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = AccountTest.class,
+    dependsOnMethods = {"read"})
+    public void update(String testName) throws Exception {
+        // Begin transaction
+        em.getTransaction().begin();
+        AccountsCommon account = findAccount("sanjay");
+        Assert.assertNotNull(account);
+        account.setEmail("sanjay@berkeley.edu");
+        em.persist(account);
+        // Commit the transaction
+        em.getTransaction().commit();
+        if (logger.isDebugEnabled()) {
+            logger.debug("updated account " +
+                    " first name=" + account.getFirstName() +
+                    " email=" + account.getEmail());
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test(dataProvider = "testName", dataProviderClass = AccountTest.class,
+    dependsOnMethods = {"update"})
+    public void delete(String testName) throws Exception {
+        // Begin transaction
+        em.getTransaction().begin();
+        AccountsCommon account = findAccount("sanjay");
+        Assert.assertNotNull(account);
+        if (logger.isDebugEnabled()) {
+            logger.debug("deleting account " +
+                    " first name=" + account.getFirstName() +
+                    " email=" + account.getEmail());
+        }
+        em.remove(account);
+        // Commit the transaction
+        em.getTransaction().commit();
+        if (logger.isDebugEnabled()) {
+            logger.debug("deleted account " +
+                    " first name=" + account.getFirstName());
+        }
+    }
+
+    /**
+     * Returns the name of the currently running test.
+     *
+     * Note: although the return type is listed as Object[][],
+     * this method instead returns a String.
+     *
+     * @param   m  The currently running test method.
+     *
+     * @return  The name of the currently running test method.
+     */
+    @DataProvider(name = "testName")
+    public static Object[][] testName(Method m) {
+        return new Object[][]{
+                    new Object[]{m.getName()}
+                };
+    }
+}
diff --git a/services/account/jaxb/src/test/resources/META-INF/persistence.xml b/services/account/jaxb/src/test/resources/META-INF/persistence.xml
new file mode 100644 (file)
index 0000000..123eef2
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
+http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <persistence-unit name="org.collectionspace.services.account">
+        <class>org.collectionspace.services.account.AccountsCommon</class>
+        <class>org.collectionspace.services.account.AccountsCommonList</class>
+        <class>org.collectionspace.services.account.AccountsCommonList$AccountListItem</class>
+        <properties>
+            <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/>
+
+            <!--property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
+            <property name="hibernate.max_fetch_depth" value="3"/>
+            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
+            <property name="hibernate.connection.username" value="test"/>
+            <property name="hibernate.connection.password" value="test"/>
+            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/cspace"/-->
+        </properties>
+    </persistence-unit>
+</persistence>
diff --git a/services/account/jaxb/src/test/resources/hibernate.cfg.xml b/services/account/jaxb/src/test/resources/hibernate.cfg.xml
new file mode 100644 (file)
index 0000000..c7c6009
--- /dev/null
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : hibernate.cfg.xml.xml
+    Created on : November 12, 2009, 12:02 PM
+    Author     : sanjaydalal
+    Description:
+        Purpose of the document follows.
+-->
+<!DOCTYPE hibernate-configuration PUBLIC
+          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+    <session-factory>
+        <property name="connection.url">jdbc:mysql://localhost:3306/cspace</property>
+        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
+        <property name="connection.username">test</property>
+        <property name="connection.password">test</property>
+        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
+        <property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
+        <property name="current_session_context_class">thread</property>
+        <property name="hibernate.show_sql">true</property>
+    </session-factory>
+</hibernate-configuration>
diff --git a/services/account/jaxb/src/test/resources/log4j.properties b/services/account/jaxb/src/test/resources/log4j.properties
new file mode 100644 (file)
index 0000000..3aa34b3
--- /dev/null
@@ -0,0 +1,25 @@
+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
+log4j.logger.org.jvnet.hyperjaxb3=DEBUG\r
+log4j.logger.org.hibernate=WARN
\ No newline at end of file
diff --git a/services/account/pom.xml b/services/account/pom.xml
new file mode 100644 (file)
index 0000000..b739055
--- /dev/null
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+    <parent>\r
+        <artifactId>org.collectionspace.services.main</artifactId>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <version>1.0</version>\r
+    </parent>\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <version>1.0</version>\r
+    <artifactId>org.collectionspace.services.account</artifactId>\r
+    <packaging>pom</packaging>\r
+    <name>services.account</name>\r
+\r
+    <modules>\r
+        <module>jaxb</module>\r
+        <module>service</module>\r
+        <module>3rdparty</module>\r
+        <module>client</module>\r
+    </modules>\r
+\r
+    <build>\r
+        <pluginManagement>\r
+            <plugins>\r
+                <plugin>\r
+                    <groupId>org.apache.maven.plugins</groupId>\r
+                    <artifactId>maven-compiler-plugin</artifactId>\r
+                    <configuration>\r
+                        <source>1.5</source>\r
+                        <target>1.5</target>\r
+                    </configuration>\r
+                </plugin>\r
+                <plugin>\r
+                    <groupId>org.apache.maven.plugins</groupId>\r
+                    <artifactId>maven-site-plugin</artifactId>\r
+                    <configuration>\r
+                        <unzipCommand>/usr/bin/unzip -o &gt; err.txt</unzipCommand>\r
+                    </configuration>\r
+                </plugin>\r
+                <plugin>\r
+                    <groupId>org.apache.maven.plugins</groupId>\r
+                    <artifactId>maven-war-plugin</artifactId>\r
+                    <version>2.0.1</version>\r
+                    <configuration>\r
+                        <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>\r
+                        <archive>\r
+                            <manifest>\r
+                                <addClasspath>true</addClasspath>\r
+\r
+                            </manifest>\r
+                        </archive>\r
+                    </configuration>\r
+                </plugin>\r
+            </plugins>\r
+        </pluginManagement>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-compiler-plugin</artifactId>\r
+                <version>2.0.2</version>\r
+                <configuration>\r
+                    <source>1.6</source>\r
+                    <target>1.6</target>\r
+                </configuration>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>\r
+\r
diff --git a/services/account/service/pom.xml b/services/account/service/pom.xml
new file mode 100644 (file)
index 0000000..38c3fa0
--- /dev/null
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+\r
+    <parent>\r
+        <artifactId>org.collectionspace.services.account</artifactId>\r
+        <groupId>org.collectionspace.services</groupId>\r
+        <version>1.0</version>\r
+    </parent>\r
+    \r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.services</groupId>\r
+    <artifactId>org.collectionspace.services.account.service</artifactId>\r
+    <packaging>jar</packaging>\r
+    <version>1.0</version>\r
+    <name>services.account.service</name>\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.common</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.account.jaxb</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-api</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-log4j12</artifactId>\r
+        </dependency>\r
+        \r
+        <dependency>\r
+            <groupId>junit</groupId>\r
+            <artifactId>junit</artifactId>\r
+            <version>4.1</version>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.testng</groupId>\r
+            <artifactId>testng</artifactId>\r
+            <version>5.6</version>\r
+        </dependency>\r
+        \r
+        <!-- apache -->\r
+        <dependency>\r
+            <groupId>commons-beanutils</groupId>\r
+            <artifactId>commons-beanutils</artifactId>\r
+            <version>1.6.1</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-logging</groupId>\r
+            <artifactId>commons-logging</artifactId>\r
+            <version>1.1</version>\r
+        </dependency>\r
+      <!-- javax -->\r
+\r
+\r
+        <dependency>\r
+            <groupId>javax.security</groupId>\r
+            <artifactId>jaas</artifactId>\r
+            <version>1.0.01</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        \r
+        <!-- jboss -->\r
+\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxrs</artifactId>\r
+            <version>1.1.GA</version>\r
+            <exclusions>\r
+                <exclusion>\r
+                    <groupId>tjws</groupId>\r
+                    <artifactId>webserver</artifactId>\r
+                </exclusion>\r
+            </exclusions>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxb-provider</artifactId>\r
+            <version>1.1.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-multipart-provider</artifactId>\r
+            <version>1.1.GA</version>\r
+        </dependency>\r
+        \r
+\r
+    </dependencies>\r
+    \r
+    <build>\r
+        <finalName>collectionspace-services-account</finalName>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.codehaus.mojo</groupId>\r
+                <artifactId>jboss-maven-plugin</artifactId>\r
+                <configuration>\r
+                    <jbossHome>${jboss.dir}</jbossHome>\r
+                </configuration>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-compiler-plugin</artifactId>\r
+                <configuration>\r
+                    <source>1.6</source>\r
+                    <target>1.6</target>\r
+                </configuration>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>\r
+\r
diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java
new file mode 100644 (file)
index 0000000..6665462
--- /dev/null
@@ -0,0 +1,222 @@
+/**
+ *  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.account;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import org.collectionspace.services.common.AbstractCollectionSpaceResource;
+import org.collectionspace.services.common.context.RemoteServiceContext;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentNotFoundException;
+import org.collectionspace.services.common.document.DocumentHandler;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Path("/accounts")
+@Consumes("multipart/mixed")
+@Produces("multipart/mixed")
+public class AccountResource
+        extends AbstractCollectionSpaceResource {
+
+    final private String serviceName = "accounts";
+    final Logger logger = LoggerFactory.getLogger(AccountResource.class);
+
+    @Override
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    @Override
+    public DocumentHandler createDocumentHandler(RemoteServiceContext ctx) throws Exception {
+        throw new IllegalStateException();
+    }
+
+    @POST
+    public Response createAccount(MultipartInput input) {
+        try {
+            RemoteServiceContext ctx = createServiceContext(input);
+            String csid = "";
+            UriBuilder path = UriBuilder.fromResource(AccountResource.class);
+            path.path("" + csid);
+            Response response = Response.created(path.build()).build();
+            return response;
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in createAccount", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Create failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+    }
+
+    @GET
+    @Path("{csid}")
+    public MultipartOutput getAccount(
+            @PathParam("csid") String csid) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("getAccount with csid=" + csid);
+        }
+        if (csid == null || "".equals(csid)) {
+            logger.error("getAccount: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "get failed on Account csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        MultipartOutput result = null;
+        try {
+            RemoteServiceContext ctx = createServiceContext(null);
+
+            result = ctx.getOutput();
+        } catch (DocumentNotFoundException dnfe) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("getAccount", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Get failed on Account csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("getAccount", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Get failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+
+        if (result == null) {
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Get failed, the requested Account CSID:" + csid + ": was not found.").type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return result;
+    }
+
+    @GET
+    @Produces("application/xml")
+    public AccountsCommonList getAccountList(@Context UriInfo ui) {
+        AccountsCommonList accountList = new AccountsCommonList();
+        try {
+            RemoteServiceContext ctx = createServiceContext(null);
+
+            accountList = null;
+        } catch (Exception e) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("Caught exception in getAccountList", e);
+            }
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return accountList;
+    }
+
+    @PUT
+    @Path("{csid}")
+    public MultipartOutput updateAccount(
+            @PathParam("csid") String csid,
+            MultipartInput theUpdate) {
+        if (logger.isDebugEnabled()) {
+            logger.debug("updateAccount with csid=" + csid);
+        }
+        if (csid == null || "".equals(csid)) {
+            logger.error("updateAccount: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "update failed on Account csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        MultipartOutput result = null;
+        try {
+            RemoteServiceContext ctx = createServiceContext(theUpdate);
+
+            result = ctx.getOutput();
+        } catch (DocumentNotFoundException dnfe) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("caugth exception in updateAccount", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Update failed on Account csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Update failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        return result;
+    }
+
+    @DELETE
+    @Path("{csid}")
+    public Response deleteAccount(@PathParam("csid") String csid) {
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("deleteAccount with csid=" + csid);
+        }
+        if (csid == null || "".equals(csid)) {
+            logger.error("deleteAccount: missing csid!");
+            Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+                    "delete failed on Account csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        }
+        try {
+            ServiceContext ctx = createServiceContext(null);
+
+            return Response.status(HttpResponseCodes.SC_OK).build();
+        } catch (DocumentNotFoundException dnfe) {
+            if (logger.isDebugEnabled()) {
+                logger.debug("caught exception in deleteAccount", dnfe);
+            }
+            Response response = Response.status(Response.Status.NOT_FOUND).entity(
+                    "Delete failed on Account csid=" + csid).type(
+                    "text/plain").build();
+            throw new WebApplicationException(response);
+        } catch (Exception e) {
+            Response response = Response.status(
+                    Response.Status.INTERNAL_SERVER_ERROR).entity("Delete failed").type("text/plain").build();
+            throw new WebApplicationException(response);
+        }
+
+    }
+}
diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java
new file mode 100644 (file)
index 0000000..d76d734
--- /dev/null
@@ -0,0 +1,104 @@
+/**
+ *  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.account.storage;
+
+import org.collectionspace.services.account.AccountsCommon;
+import org.collectionspace.services.account.AccountsCommonList;
+import org.collectionspace.services.common.document.AbstractDocumentHandler;
+import org.collectionspace.services.common.document.DocumentWrapper;
+
+
+/**
+ *
+ * @author 
+ */
+public class AccountDocumentHandler
+        extends AbstractDocumentHandler<AccountsCommon, AccountsCommonList> {
+
+    @Override
+    public void handleCreate(DocumentWrapper wrapDoc) throws Exception {
+    }
+
+    @Override
+    public void handleUpdate(DocumentWrapper wrapDoc) throws Exception {
+    }
+
+    @Override
+    public void handleGet(DocumentWrapper wrapDoc) throws Exception {
+    }
+
+    @Override
+    public void handleGetAll(DocumentWrapper wrapDoc) throws Exception {
+    }
+
+    @Override
+    public void extractAllParts(DocumentWrapper wrapDoc)
+            throws Exception {
+    }
+
+    @Override
+    public void fillAllParts(DocumentWrapper wrapDoc)
+            throws Exception {
+    }
+
+    @Override
+    public AccountsCommon extractCommonPart(DocumentWrapper wrapDoc)
+            throws Exception {
+        return null;
+    }
+
+    @Override
+    public void fillCommonPart(AccountsCommon obj, DocumentWrapper wrapDoc)
+            throws Exception {
+    }
+
+    @Override
+    public AccountsCommonList extractCommonPartList(DocumentWrapper wrapDoc)
+            throws Exception {
+        return null;
+    }
+
+    @Override
+    public AccountsCommon getCommonPart() {
+        return null;
+    }
+
+    @Override
+    public void setCommonPart(AccountsCommon obj) {
+    }
+
+    @Override
+    public AccountsCommonList getCommonPartList() {
+        return null;
+    }
+
+    @Override
+    public void setCommonPartList(AccountsCommonList obj) {
+    }
+
+    @Override
+    public String getQProperty(String prop) {
+        return null;
+    }
+}
diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountHandlerFactory.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountHandlerFactory.java
new file mode 100644 (file)
index 0000000..c90280f
--- /dev/null
@@ -0,0 +1,55 @@
+/**
+ *  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.account.storage;
+
+import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.document.DocumentHandlerFactory;
+
+/**
+ * CollectionObjectHandlerFactory creates handlers for collectionobject based
+ * on type of Nuxeo client used
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class AccountHandlerFactory implements DocumentHandlerFactory {
+
+    private static final AccountHandlerFactory self = new AccountHandlerFactory();
+
+    private AccountHandlerFactory() {
+    }
+
+    public static AccountHandlerFactory getInstance() {
+        return self;
+    }
+
+    @Override
+    public DocumentHandler getHandler(String clientType) {
+        if(ClientType.JAVA.toString().equals(clientType)){
+            return new AccountDocumentHandler();
+        } 
+        throw new IllegalArgumentException("Not supported client=" + clientType);
+    }
+}
diff --git a/services/account/service/src/test/resources/log4j.xml b/services/account/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>
+
+
+
+