]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-30, helloworddocservice interfaces with nuxeo repository using nuxeo restapis
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Mon, 23 Mar 2009 22:32:27 +0000 (22:32 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Mon, 23 Mar 2009 22:32:27 +0000 (22:32 +0000)
17 files changed:
HelloWorld/HelloWorldDocService/README.txt [new file with mode: 0644]
HelloWorld/HelloWorldDocService/build.properties [new file with mode: 0644]
HelloWorld/HelloWorldDocService/nb-configuration.xml [new file with mode: 0644]
HelloWorld/HelloWorldDocService/nbactions.xml [new file with mode: 0644]
HelloWorld/HelloWorldDocService/pom.all.xml [new file with mode: 0644]
HelloWorld/HelloWorldDocService/pom.xml [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/HelloworldDocApplication.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/PersonDocResource.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoCallback.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoCallbackHandler.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoLoginConfiguration.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoLoginContextFactory.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoRESTClient.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/PortalSSOAuthenticationProvider.java [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/resources/jndi.properties [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/resources/nuxeo.properties [new file with mode: 0644]
HelloWorld/HelloWorldDocService/src/main/webapp/WEB-INF/web.xml [new file with mode: 0644]

diff --git a/HelloWorld/HelloWorldDocService/README.txt b/HelloWorld/HelloWorldDocService/README.txt
new file mode 100644 (file)
index 0000000..bd38e83
--- /dev/null
@@ -0,0 +1,15 @@
+
+This project is a simple example showing usage of @Path, @GET, PUT, POST, and @PathParam.  It uses pure streaming
+output as well. 
+
+System Requirements:
+====================
+- Maven 2.0.9 or higher
+
+Building the project:
+====================
+1. In root directoy
+
+mvn clean install
+
+This will build a WAR and run it with embedded Jetty
\ No newline at end of file
diff --git a/HelloWorld/HelloWorldDocService/build.properties b/HelloWorld/HelloWorldDocService/build.properties
new file mode 100644 (file)
index 0000000..50c3738
--- /dev/null
@@ -0,0 +1,4 @@
+jboss.dir=C:/dev/jboss-4.2.3.GA\r
+nuxeo.dir=${jboss.dir}/server/default/deploy/nuxeo.ear/system\r
+nuxeo.local.repo.dir=file:///C:/dev/jboss-4.2.3.GA/server/default/deploy/nuxeo.ear/system\r
+nuxeo.local.repo.client.dir=file:///C:/dev/nuxeo/nuxeo-core/nuxeo-core-client/target\r
diff --git a/HelloWorld/HelloWorldDocService/nb-configuration.xml b/HelloWorld/HelloWorldDocService/nb-configuration.xml
new file mode 100644 (file)
index 0000000..3e5cd98
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project-shared-configuration>\r
+    <!--
+This file contains additional configuration written by modules in the NetBeans IDE.
+The configuration is intended to be shared among all the users of project and
+therefore it is assumed to be part of version control checkout.
+Without this configuration present, some functionality in the IDE may be limited or fail altogether.
+-->\r
+    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">\r
+        <!--
+Properties that influence various parts of the IDE, especially code formatting and the like. 
+You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
+That way multiple projects can share the same settings (useful for formatting rules for example).
+Any value defined here will override the pom.xml file value but is only applicable to the current project.
+-->\r
+        <org-netbeans-modules-editor-indent.CodeStyle.usedProfile>default</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>\r
+        <org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>8</org-netbeans-modules-editor-indent.CodeStyle.project.tab-size>\r
+        <org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>80</org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width>\r
+        <netbeans.hint.useExternalMaven>false</netbeans.hint.useExternalMaven>\r
+    </properties>\r
+</project-shared-configuration>\r
diff --git a/HelloWorld/HelloWorldDocService/nbactions.xml b/HelloWorld/HelloWorldDocService/nbactions.xml
new file mode 100644 (file)
index 0000000..9d30c23
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<actions>\r
+        <action>\r
+            <actionName>test</actionName>\r
+            <packagings>\r
+                <packaging>*</packaging>\r
+            </packagings>\r
+            <goals>\r
+                <goal>test</goal>\r
+            </goals>\r
+        </action>\r
+        <action>\r
+            <actionName>build</actionName>\r
+            <packagings>\r
+                <packaging>*</packaging>\r
+            </packagings>\r
+            <goals>\r
+                <goal>install</goal>\r
+            </goals>\r
+        </action>\r
+        <action>\r
+            <actionName>clean</actionName>\r
+            <packagings>\r
+                <packaging>*</packaging>\r
+            </packagings>\r
+            <goals>\r
+                <goal>clean</goal>\r
+            </goals>\r
+        </action>\r
+        <action>\r
+            <actionName>rebuild</actionName>\r
+            <packagings>\r
+                <packaging>*</packaging>\r
+            </packagings>\r
+            <goals>\r
+                <goal>clean</goal>\r
+                <goal>install</goal>\r
+            </goals>\r
+            <properties>\r
+                <maven.test.skip>true</maven.test.skip>\r
+            </properties>\r
+        </action>\r
+        <action>\r
+            <actionName>run</actionName>\r
+            <packagings>\r
+                <packaging>war</packaging>\r
+                <packaging>ear</packaging>\r
+                <packaging>ejb</packaging>\r
+            </packagings>\r
+            <goals>\r
+                <goal>package</goal>\r
+            </goals>\r
+            <properties>\r
+                \r
+                <netbeans.deploy>true</netbeans.deploy>\r
+            </properties>\r
+        </action>\r
+        <action>\r
+            <actionName>debug</actionName>\r
+            <packagings>\r
+                <packaging>war</packaging>\r
+                <packaging>ear</packaging>\r
+                <packaging>ejb</packaging>\r
+            </packagings>\r
+            <goals>\r
+                <goal>package</goal>\r
+            </goals>\r
+            <properties>\r
+                \r
+                <netbeans.deploy>true</netbeans.deploy>\r
+                <netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>\r
+            </properties>\r
+        </action>\r
+    </actions>\r
diff --git a/HelloWorld/HelloWorldDocService/pom.all.xml b/HelloWorld/HelloWorldDocService/pom.all.xml
new file mode 100644 (file)
index 0000000..5aa2f74
--- /dev/null
@@ -0,0 +1,1079 @@
+<?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>helloworld</artifactId>\r
+        <groupId>org.collectionspace.hello.services</groupId>\r
+        <version>0.1</version>\r
+    </parent>\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.hello.services</groupId>\r
+    <artifactId>helloworld-doc-service</artifactId>\r
+    <packaging>war</packaging>\r
+    <version>0.1</version>\r
+    <name>Helloworld Document Service</name>\r
+\r
+    <repositories>\r
+        <repository>\r
+            <id>java.net</id>\r
+            <url>http://download.java.net/maven/1</url>\r
+            <layout>legacy</layout>\r
+        </repository>\r
+        <repository>\r
+            <id>maven repo</id>\r
+            <name>maven repo</name>\r
+            <url>http://repo1.maven.org/maven2/</url>\r
+        </repository>\r
+        <!-- For resteasy -->\r
+        <repository>\r
+            <id>jboss</id>\r
+            <name>jboss repo</name>\r
+            <url>http://repository.jboss.org/maven2</url>\r
+        </repository>\r
+        <repository>\r
+            <id>mojo</id>\r
+            <name>mojo repo</name>\r
+            <url>http://svn.codehaus.org/mojo/trunk/mojo/jboss-maven-plugin</url>\r
+        </repository>\r
+        <repository>\r
+            <id>cspace.local.nuxeo</id>\r
+            <url>${nuxeo.local.repo.dir}</url>\r
+        </repository>\r
+        <repository>\r
+            <id>public</id>\r
+            <url>http://maven.nuxeo.org/public</url>\r
+            <releases>\r
+            </releases>\r
+            <snapshots>\r
+                <enabled>false</enabled>\r
+            </snapshots>\r
+        </repository>\r
+        <repository>\r
+            <id>public-snapshot</id>\r
+            <url>http://maven.nuxeo.org/public-snapshot</url>\r
+            <releases>\r
+                <enabled>false</enabled>\r
+            </releases>\r
+            <snapshots>\r
+            </snapshots>\r
+        </repository>\r
+\r
+\r
+    </repositories>\r
+\r
+    <pluginRepositories>\r
+        <pluginRepository>\r
+            <id>public</id>\r
+            <url>http://maven.nuxeo.org/public</url>\r
+            <name>Nuxeo virtual release repository</name>\r
+            <releases>\r
+            </releases>\r
+            <snapshots>\r
+                <enabled>false</enabled>\r
+            </snapshots>\r
+        </pluginRepository>\r
+        <pluginRepository>\r
+            <id>public-snapshot</id>\r
+            <url>http://maven.nuxeo.org/public-snapshot</url>\r
+            <name>Nuxeo virtual snapshot repository</name>\r
+            <releases>\r
+                <enabled>false</enabled>\r
+            </releases>\r
+            <snapshots>\r
+            </snapshots>\r
+        </pluginRepository>\r
+    </pluginRepositories>\r
+\r
+\r
+    <properties>\r
+        <jboss.version>4.2.3.GA</jboss.version>\r
+        <jboss.ejb.version>3.0</jboss.ejb.version>\r
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
+        <apacheds.version>1.5.1</apacheds.version>\r
+        <apachedshared.version>0.9.7</apachedshared.version>\r
+        <nuxeo.version.5.2>5.2-SNAPSHOT</nuxeo.version.5.2>\r
+        <nuxeo.version.1.5>1.5-SNAPSHOT</nuxeo.version.1.5>\r
+    </properties>\r
+\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>org.collectionspace.hello.services</groupId>\r
+            <artifactId>helloworld-jaxb</artifactId>\r
+            <version>0.1</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxrs</artifactId>\r
+            <version>1.0.2.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.0.2.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>junit</groupId>\r
+            <artifactId>junit</artifactId>\r
+            <version>4.1</version>\r
+            <scope>test</scope>\r
+        </dependency>\r
+\r
+      <!-- javax -->\r
+\r
+\r
+        <dependency>\r
+            <groupId>javax.ejb</groupId>\r
+            <artifactId>ejb</artifactId>\r
+            <version>3.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>javax.ejb</groupId>\r
+            <artifactId>ejb-api</artifactId>\r
+            <version>3.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>javax.annotation</groupId>\r
+            <artifactId>jsr250-api</artifactId>\r
+            <version>1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+      <!--\r
+        <dependency>\r
+            <groupId>javax.el</groupId>\r
+            <artifactId>el-api</artifactId>\r
+            <version>unknown</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.el</groupId>\r
+            <artifactId>el-ri</artifactId>\r
+            <version>unknown</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.faces</groupId>\r
+            <artifactId>jsf-api</artifactId>\r
+            <version>1.2_09_jboss</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.faces</groupId>\r
+            <artifactId>jsf-impl</artifactId>\r
+            <version>1.2_09_jboss</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.jms</groupId>\r
+            <artifactId>jms</artifactId>\r
+            <version>1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.jws</groupId>\r
+            <artifactId>jsr181</artifactId>\r
+            <version>1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.mail</groupId>\r
+            <artifactId>mail</artifactId>\r
+            <version>1.4</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.persistence</groupId>\r
+            <artifactId>persistence</artifactId>\r
+            <version>3.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.servlet.jsp</groupId>\r
+            <artifactId>jsp-api</artifactId>\r
+            <version>2.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.servlet</groupId>\r
+            <artifactId>jstl</artifactId>\r
+            <version>1.1.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.servlet</groupId>\r
+            <artifactId>servlet-api</artifactId>\r
+            <version>2.4</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.transaction</groupId>\r
+            <artifactId>jta</artifactId>\r
+            <version>1.0.1B</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.jcr</groupId>\r
+            <artifactId>jcr</artifactId>\r
+            <version>1.0.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.script</groupId>\r
+            <artifactId>script-api</artifactId>\r
+            <version>1.0</version>\r
+        </dependency>\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
+      <!-- commons -->\r
+      <!--\r
+        <dependency>\r
+            <groupId>commons-collections</groupId>\r
+            <artifactId>commons-collections</artifactId>\r
+            <version>3.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-fileupload</groupId>\r
+            <artifactId>commons-fileupload</artifactId>\r
+            <version>1.1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-io</groupId>\r
+            <artifactId>commons-io</artifactId>\r
+            <version>1.4</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-lang</groupId>\r
+            <artifactId>commons-lang</artifactId>\r
+            <version>2.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>commons-beanutils</groupId>\r
+            <artifactId>commons-beanutils</artifactId>\r
+            <version>1.6</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>commons-digester</groupId>\r
+            <artifactId>commons-digester</artifactId>\r
+            <version>1.8</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>commons-el</groupId>\r
+            <artifactId>commons-el</artifactId>\r
+            <version>1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-logging</groupId>\r
+            <artifactId>commons-logging</artifactId>\r
+            <version>1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>commons-logging</groupId>\r
+            <artifactId>commons-logging-api</artifactId>\r
+            <version>1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-jexl</groupId>\r
+            <artifactId>commons-jexl</artifactId>\r
+            <version>1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+      -->\r
+      <!-- apache \r
+        <dependency>\r
+            <groupId>org.apache.derby</groupId>\r
+            <artifactId>derby</artifactId>\r
+            <version>10.4.1.3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.derby</groupId>\r
+            <artifactId>derbyclient</artifactId>\r
+            <version>10.4.1.3</version>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.lucene</groupId>\r
+            <artifactId>lucene-core</artifactId>\r
+            <version>2.3.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.lucene</groupId>\r
+            <artifactId>lucene-analyzers</artifactId>\r
+            <version>2.3.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.shared</groupId>\r
+            <artifactId>shared-asn1</artifactId>\r
+            <version>${apachedshared.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.shared</groupId>\r
+            <artifactId>shared-ldap-constants</artifactId>\r
+            <version>${apachedshared.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.poi</groupId>\r
+            <artifactId>poi</artifactId>\r
+            <version>3.0.2-FINAL</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.poi</groupId>\r
+            <artifactId>poi-scratchpad</artifactId>\r
+            <version>3.0.2-FINAL</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.jackrabbit</groupId>\r
+            <artifactId>jackrabbit-text-extractors</artifactId>\r
+            <version>1.5.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.shared</groupId>\r
+            <artifactId>shared-ldap</artifactId>\r
+            <version>${apachedshared.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.server</groupId>\r
+            <artifactId>apacheds-protocol-shared</artifactId>\r
+            <version>${apacheds.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.server</groupId>\r
+            <artifactId>apacheds-core</artifactId>\r
+            <version>${apacheds.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.server</groupId>\r
+            <artifactId>apacheds-core-shared</artifactId>\r
+            <version>${apacheds.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.directory.server</groupId>\r
+            <artifactId>apacheds-bootstrap-partition</artifactId>\r
+            <version>${apacheds.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>xerces</groupId>\r
+            <artifactId>xmlParserAPIs</artifactId>\r
+            <scope>provided</scope>\r
+            <version>2.6.2</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>xml-apis</groupId>\r
+            <artifactId>xml-apis</artifactId>\r
+            <scope>provided</scope>\r
+            <version>1.0.b2</version>\r
+        </dependency>\r
+        -->\r
+        <!-- jboss -->\r
+\r
+\r
+        <dependency>\r
+            <groupId>dom4j</groupId>\r
+            <artifactId>dom4j</artifactId>\r
+            <version>1.6.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+      <!-- jboss (+ hibernate, richfaces...) >\r
+        <dependency>\r
+            <groupId>dom4j</groupId>\r
+            <artifactId>dom4j</artifactId>\r
+            <version>1.6.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jbpm.jbpm3</groupId>\r
+            <artifactId>jbpm-jpdl</artifactId>\r
+            <version>3.3.0.GA</version>\r
+        </dependency>\r
+        -->\r
+      <!-- overrides jackrabbit version 1.4.5 specified by jbpm \r
+        <dependency>\r
+            <groupId>org.apache.jackrabbit</groupId>\r
+            <artifactId>jackrabbit-core</artifactId>\r
+            <version>1.5.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-annotations-ejb3</artifactId>\r
+            <version>${jboss.ejb.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-aop-jdk50</artifactId>\r
+            <version>1.4.0.SP1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-cache</artifactId>\r
+            <version>1.4.0.BETA2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-cache-jdk50</artifactId>\r
+            <version>1.4.0.SP1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>cglib-jboss</artifactId>\r
+            <version>2.1.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-common</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-j2ee</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>javassist</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-jmx</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-remoting</artifactId>\r
+            <version>2.2.2.SP1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.seam</groupId>\r
+            <artifactId>jboss-seam</artifactId>\r
+            <version>2.0.3.CR1-NX2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.seam</groupId>\r
+            <artifactId>jboss-seam-remoting</artifactId>\r
+            <version>2.0.3.CR1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.seam</groupId>\r
+            <artifactId>jboss-seam-ui</artifactId>\r
+            <version>2.0.3.CR1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.seam</groupId>\r
+            <artifactId>jboss-seam-mail</artifactId>\r
+            <version>2.0.3.CR1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.seam</groupId>\r
+            <artifactId>jboss-seam-debug</artifactId>\r
+            <version>2.0.3.CR1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.el</groupId>\r
+            <artifactId>jboss-el</artifactId>\r
+            <version>2.0.1.GA</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-serialization</artifactId>\r
+            <version>1.0.3.GA</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jboss-system</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jbosssx</artifactId>\r
+            <version>${jboss.version}</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jgroups</artifactId>\r
+            <version>2.2.9</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jboss</groupId>\r
+            <artifactId>jnp-client</artifactId>\r
+            <version>4.0.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.hibernate</groupId>\r
+            <artifactId>hibernate</artifactId>\r
+            <version>3.2.0.ga</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.hibernate</groupId>\r
+            <artifactId>hibernate-annotations</artifactId>\r
+            <version>3.2.0.ga</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.hibernate</groupId>\r
+            <artifactId>hibernate-entitymanager</artifactId>\r
+            <version>3.2.0.ga</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.richfaces.framework</groupId>\r
+            <artifactId>richfaces-api</artifactId>\r
+            <scope>provided</scope>\r
+            <version>3.2.1.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.richfaces.framework</groupId>\r
+            <artifactId>richfaces-impl</artifactId>\r
+            <scope>provided</scope>\r
+            <version>3.2.1.GA-NX</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.richfaces.ui</groupId>\r
+            <artifactId>richfaces-ui</artifactId>\r
+            <scope>provided</scope>\r
+            <version>3.2.1.GA</version>\r
+        </dependency>\r
+-->\r
+      <!-- OpenOffice.org -->\r
+      <!--\r
+        <dependency>\r
+            <groupId>org.openoffice</groupId>\r
+            <artifactId>juh</artifactId>\r
+            <version>2.2.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.openoffice</groupId>\r
+            <artifactId>jurt</artifactId>\r
+            <version>2.2.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.openoffice</groupId>\r
+            <artifactId>ridl</artifactId>\r
+            <version>2.2.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.openoffice</groupId>\r
+            <artifactId>unoil</artifactId>\r
+            <version>2.2.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.artofsolving</groupId>\r
+            <artifactId>jodconverter</artifactId>\r
+            <version>2.1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+      -->\r
+      <!-- others \r
+        <dependency>\r
+            <groupId>com.h2database</groupId>\r
+            <artifactId>h2</artifactId>\r
+            <version>1.1.104</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>cssparser</groupId>\r
+            <artifactId>cssparser</artifactId>\r
+            <version>0.9.4-fix</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.sun.facelets</groupId>\r
+            <artifactId>jsf-facelets</artifactId>\r
+            <version>1.1.11</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.freemarker</groupId>\r
+            <artifactId>freemarker</artifactId>\r
+            <version>2.3.11</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>concurrent</groupId>\r
+            <artifactId>concurrent</artifactId>\r
+            <version>1.3.4</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>hsqldb</groupId>\r
+            <artifactId>hsqldb</artifactId>\r
+            <version>1.8.0.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>log4j</groupId>\r
+            <artifactId>log4j</artifactId>\r
+            <version>1.2.13</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>junit</groupId>\r
+            <artifactId>junit</artifactId>\r
+            <version>3.8.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>opensymphony</groupId>\r
+            <artifactId>quartz-all</artifactId>\r
+            <version>1.5.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-api</artifactId>\r
+            <version>1.3.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.slf4j</groupId>\r
+            <artifactId>slf4j-log4j12</artifactId>\r
+            <version>1.3.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>net.sf.ehcache</groupId>\r
+            <artifactId>ehcache</artifactId>\r
+            <version>1.2.3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>net.sf.json-lib</groupId>\r
+            <artifactId>json-lib</artifactId>\r
+            <version>2.2.1</version>\r
+            <scope>provided</scope>\r
+            <classifier>jdk15</classifier>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>net.sf.ezmorph</groupId>\r
+            <artifactId>ezmorph</artifactId>\r
+            <version>0.9</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>net.sf.opencsv</groupId>\r
+            <artifactId>opencsv</artifactId>\r
+            <version>1.7</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.osgi</groupId>\r
+            <artifactId>osgi-core</artifactId>\r
+            <version>4.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>oro</groupId>\r
+            <artifactId>oro</artifactId>\r
+            <version>2.0.8</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        -->\r
+      <!-- beanshell         <dependency>\r
+            <groupId>bsh</groupId>\r
+            <artifactId>bsh</artifactId>\r
+            <version>2.0b1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>taglibs</groupId>\r
+            <artifactId>standard</artifactId>\r
+            <version>1.1.2</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>antlr</groupId>\r
+            <artifactId>antlr</artifactId>\r
+            <version>2.7.7</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>postgresql</groupId>\r
+            <artifactId>postgresql</artifactId>\r
+            <version>8.2-507.jdbc3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jmock</groupId>\r
+            <artifactId>jmock</artifactId>\r
+            <version>1.0.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>pdfbox</groupId>\r
+            <artifactId>pdfbox</artifactId>\r
+            <version>0.7.3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>bouncycastle</groupId>\r
+            <artifactId>bcmail-jdk14</artifactId>\r
+            <version>136</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>bouncycastle</groupId>\r
+            <artifactId>bcprov-jdk14</artifactId>\r
+            <version>136</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.fontbox</groupId>\r
+            <artifactId>fontbox</artifactId>\r
+            <version>0.1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jempbox</groupId>\r
+            <artifactId>jempbox</artifactId>\r
+            <version>0.2.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.thoughtworks.xstream</groupId>\r
+            <artifactId>xstream</artifactId>\r
+            <version>1.1.3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.dojotoolkit</groupId>\r
+            <artifactId>custom_rhino</artifactId>\r
+            <version>0.4.3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>cglib</groupId>\r
+            <artifactId>cglib-nodep</artifactId>\r
+            <version>2.1_3</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>commons-jexl</groupId>\r
+            <artifactId>commons-jexl</artifactId>\r
+            <version>1.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>xml-apis</groupId>\r
+            <artifactId>xml-apis</artifactId>\r
+            <scope>provided</scope>\r
+            <version>1.0.b2</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>xerces</groupId>\r
+            <artifactId>xmlParserAPIs</artifactId>\r
+            <scope>provided</scope>\r
+            <version>2.6.2</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>jsr170</groupId>\r
+            <artifactId>jcr</artifactId>\r
+            <version>1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.codehaus.groovy</groupId>\r
+            <artifactId>groovy-all</artifactId>\r
+            <version>1.5.7</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.codehaus.groovy</groupId>\r
+            <artifactId>groovy</artifactId>\r
+            <version>1.5.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.script</groupId>\r
+            <artifactId>groovy-engine</artifactId>\r
+            <version>1.0</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-jbossws-wrapper</artifactId>\r
+            <version>4.0.5.GA</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+\r
+-->\r
+\r
+\r
+\r
+        <!-- nuxeo -->\r
+\r
+\r
+\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-api</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+        </dependency>\r
+        \r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+        </dependency>\r
+        \r
+        <!--\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.runtime</groupId>\r
+            <artifactId>nuxeo-runtime</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        \r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-io</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-query</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-schema</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-web-common</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-ui-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-ui-web</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-directory-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-publishing-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-mimetype-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+            <type>ejb</type>\r
+        </dependency>\r
+       \r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-actions-core</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+            <type>ejb</type>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-types-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-url-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-filemanager-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-usermanager-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.platform</groupId>\r
+            <artifactId>nuxeo-platform-search-api</artifactId>\r
+            <version>${nuxeo.version.5.2}</version>\r
+            <scope>compile</scope>\r
+        </dependency>\r
+-->\r
+\r
+    </dependencies>\r
+    \r
+    <build>\r
+        <finalName>helloworld</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
+                <executions>\r
+                    <execution>\r
+                        <id>jboss-undeploy</id>\r
+                        <phase>pre-integration-test</phase>\r
+                        <goals>\r
+                            <goal>undeploy</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <fileName>${basedir}/target/helloworld.war</fileName>\r
+                        </configuration>\r
+                    </execution>\r
+                    <execution>\r
+                        <id>jboss-deploy</id>\r
+                        <phase>pre-integration-test</phase>\r
+                        <goals>\r
+                            <goal>deploy</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <fileName>${basedir}/target/helloworld.war</fileName>\r
+                        </configuration>\r
+                    </execution>\r
+\r
+                </executions>\r
+            </plugin-->\r
+\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-surefire-plugin</artifactId>\r
+                <configuration></configuration>\r
+                <executions>\r
+                    <execution>\r
+                        <id>surefire-it</id>\r
+                        <phase>integration-test</phase>\r
+                        <goals>\r
+                            <goal>test</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <skip>false</skip>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-war-plugin</artifactId>\r
+                <version>2.0</version>\r
+            </plugin>\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
+        </plugins>\r
+    </build>\r
+</project>\r
diff --git a/HelloWorld/HelloWorldDocService/pom.xml b/HelloWorld/HelloWorldDocService/pom.xml
new file mode 100644 (file)
index 0000000..41b3e62
--- /dev/null
@@ -0,0 +1,270 @@
+<?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>helloworld</artifactId>\r
+        <groupId>org.collectionspace.hello.services</groupId>\r
+        <version>0.1</version>\r
+    </parent>\r
+    <modelVersion>4.0.0</modelVersion>\r
+    <groupId>org.collectionspace.hello.services</groupId>\r
+    <artifactId>helloworld-doc-service</artifactId>\r
+    <packaging>war</packaging>\r
+    <version>0.1</version>\r
+    <name>Helloworld Document Service</name>\r
+\r
+    <repositories>\r
+        <repository>\r
+            <id>java.net</id>\r
+            <url>http://download.java.net/maven/1</url>\r
+            <layout>legacy</layout>\r
+        </repository>\r
+        <repository>\r
+            <id>maven repo</id>\r
+            <name>maven repo</name>\r
+            <url>http://repo1.maven.org/maven2/</url>\r
+        </repository>\r
+        <!-- For resteasy -->\r
+        <repository>\r
+            <id>jboss</id>\r
+            <name>jboss repo</name>\r
+            <url>http://repository.jboss.org/maven2</url>\r
+        </repository>\r
+        <repository>\r
+            <id>mojo</id>\r
+            <name>mojo repo</name>\r
+            <url>http://svn.codehaus.org/mojo/trunk/mojo/jboss-maven-plugin</url>\r
+        </repository>\r
+\r
+        <repository>\r
+            <id>maven-restlet</id>\r
+            <name>Public online Restlet repository</name>\r
+            <url>http://maven.restlet.org</url>\r
+        </repository>\r
+        \r
+        <repository>\r
+            <id>cspace.local.nuxeo</id>\r
+            <url>${nuxeo.local.repo.dir}</url>\r
+        </repository>\r
+        <repository>\r
+            <id>cspace.local.nuxeo.client</id>\r
+            <url>${nuxeo.local.repo.client.dir}</url>\r
+        </repository>\r
+        <repository>\r
+            <id>public</id>\r
+            <url>http://maven.nuxeo.org/public</url>\r
+            <releases>\r
+            </releases>\r
+            <snapshots>\r
+                <enabled>false</enabled>\r
+            </snapshots>\r
+        </repository>\r
+        <repository>\r
+            <id>public-snapshot</id>\r
+            <url>http://maven.nuxeo.org/public-snapshot</url>\r
+            <releases>\r
+                <enabled>false</enabled>\r
+            </releases>\r
+            <snapshots>\r
+            </snapshots>\r
+        </repository>\r
+\r
+\r
+    </repositories>\r
+\r
+    <pluginRepositories>\r
+        <pluginRepository>\r
+            <id>public</id>\r
+            <url>http://maven.nuxeo.org/public</url>\r
+            <name>Nuxeo virtual release repository</name>\r
+            <releases>\r
+            </releases>\r
+            <snapshots>\r
+                <enabled>false</enabled>\r
+            </snapshots>\r
+        </pluginRepository>\r
+        <pluginRepository>\r
+            <id>public-snapshot</id>\r
+            <url>http://maven.nuxeo.org/public-snapshot</url>\r
+            <name>Nuxeo virtual snapshot repository</name>\r
+            <releases>\r
+                <enabled>false</enabled>\r
+            </releases>\r
+            <snapshots>\r
+            </snapshots>\r
+        </pluginRepository>\r
+    </pluginRepositories>\r
+\r
+\r
+    <properties>\r
+        <jboss.version>4.2.3.GA</jboss.version>\r
+        <jboss.ejb.version>3.0</jboss.ejb.version>\r
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\r
+        <apacheds.version>1.5.1</apacheds.version>\r
+        <apachedshared.version>0.9.7</apachedshared.version>\r
+        <nuxeo.version.5.2>5.2-SNAPSHOT</nuxeo.version.5.2>\r
+        <nuxeo.version.1.5>1.5-SNAPSHOT</nuxeo.version.1.5>\r
+    </properties>\r
+\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>org.collectionspace.hello.services</groupId>\r
+            <artifactId>helloworld-jaxb</artifactId>\r
+            <version>0.1</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.jboss.resteasy</groupId>\r
+            <artifactId>resteasy-jaxrs</artifactId>\r
+            <version>1.0.2.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.0.2.GA</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>junit</groupId>\r
+            <artifactId>junit</artifactId>\r
+            <version>4.1</version>\r
+            <scope>test</scope>\r
+        </dependency>\r
+\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
+        <dependency>\r
+            <groupId>dom4j</groupId>\r
+            <artifactId>dom4j</artifactId>\r
+            <version>1.6.1</version>\r
+            <scope>provided</scope>\r
+        </dependency>\r
+        \r
+        <!-- jboss -->\r
+\r
+        <!-- nuxeo -->\r
+\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-api</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+            <exclusions>\r
+                <exclusion>\r
+                    <artifactId>jboss-remoting</artifactId>\r
+                    <groupId>jboss</groupId>\r
+                </exclusion>\r
+            </exclusions>\r
+        </dependency>\r
+\r
+<!--\r
+        <dependency>\r
+            <groupId>org.nuxeo.ecm.core</groupId>\r
+            <artifactId>nuxeo-core-client</artifactId>\r
+            <version>${nuxeo.version.1.5}</version>\r
+        </dependency>\r
+-->\r
+\r
+        <dependency>\r
+            <groupId>org.restlet</groupId>\r
+            <artifactId>org.restlet</artifactId>\r
+            <version>1.0.7</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.noelios.restlet</groupId>\r
+            <artifactId>com.noelios.restlet.ext.httpclient</artifactId>\r
+            <version>1.0.7</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.noelios.restlet</groupId>\r
+            <artifactId>com.noelios.restlet</artifactId>\r
+            <version>1.0.7</version>\r
+        </dependency>\r
+\r
+        <dependency>\r
+            <groupId>jaxen</groupId>\r
+            <artifactId>jaxen</artifactId>\r
+            <version>1.1.1</version>\r
+        </dependency>\r
+\r
+\r
+    </dependencies>\r
+    \r
+    <build>\r
+        <finalName>helloworld</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
+                <executions>\r
+                    <execution>\r
+                        <id>jboss-undeploy</id>\r
+                        <phase>pre-integration-test</phase>\r
+                        <goals>\r
+                            <goal>undeploy</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <fileName>${basedir}/target/helloworld.war</fileName>\r
+                        </configuration>\r
+                    </execution>\r
+                    <execution>\r
+                        <id>jboss-deploy</id>\r
+                        <phase>pre-integration-test</phase>\r
+                        <goals>\r
+                            <goal>deploy</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <fileName>${basedir}/target/helloworld.war</fileName>\r
+                        </configuration>\r
+                    </execution>\r
+\r
+                </executions>\r
+            </plugin>\r
+\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-surefire-plugin</artifactId>\r
+                <configuration></configuration>\r
+                <executions>\r
+                    <execution>\r
+                        <id>surefire-it</id>\r
+                        <phase>integration-test</phase>\r
+                        <goals>\r
+                            <goal>test</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <skip>false</skip>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>org.apache.maven.plugins</groupId>\r
+                <artifactId>maven-war-plugin</artifactId>\r
+                <version>2.0</version>\r
+            </plugin>\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
+        </plugins>\r
+    </build>\r
+</project>\r
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/HelloworldDocApplication.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/HelloworldDocApplication.java
new file mode 100644 (file)
index 0000000..1ccfcac
--- /dev/null
@@ -0,0 +1,25 @@
+package org.collectionspace.hello.services;
+
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+public class HelloworldDocApplication extends Application {
+
+    private Set<Object> singletons = new HashSet<Object>();
+    private Set<Class<?>> empty = new HashSet<Class<?>>();
+
+    public HelloworldDocApplication() {
+        singletons.add(new PersonDocResource());
+    }
+
+    @Override
+    public Set<Class<?>> getClasses() {
+        return empty;
+    }
+
+    @Override
+    public Set<Object> getSingletons() {
+        return singletons;
+    }
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/PersonDocResource.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/PersonDocResource.java
new file mode 100644 (file)
index 0000000..ecad948
--- /dev/null
@@ -0,0 +1,111 @@
+package org.collectionspace.hello.services;
+
+import org.collectionspace.hello.services.nuxeo.NuxeoRESTClient;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import java.util.Map;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
+import org.collectionspace.hello.*;
+
+
+import org.collectionspace.hello.People.PeopleItem;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.restlet.resource.Representation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Path("/persons")
+@Consumes("application/xml")
+@Produces("application/xml")
+public class PersonDocResource {
+
+    final Logger logger = LoggerFactory.getLogger(PersonDocResource.class);
+
+    public PersonDocResource() {
+    }
+
+    @GET
+    public People getPeople(@Context UriInfo ui) {
+        People p = new People();
+        try {
+            List<People.PeopleItem> list = p.getPeopleItem();
+            NuxeoRESTClient nxClient = getClient();
+
+            List<String> pathParams = new ArrayList<String>();
+            Map<String, String> queryParams = new HashMap<String, String>();
+            //browse default repository for People
+            //For sanjay, People repository id is f084243e-4b81-42a1-9a05-518e974facbd
+            pathParams = Arrays.asList("default", "f084243e-4b81-42a1-9a05-518e974facbd", "browse");
+            Representation res = nxClient.get(pathParams, queryParams);
+            SAXReader reader = new SAXReader();
+            Document document = reader.read(res.getStream());
+            Element root = document.getRootElement();
+            for (Iterator i = root.elementIterator(); i.hasNext();) {
+                Element element = (Element) i.next();
+                PeopleItem pli = new PeopleItem();
+                pli.setTitle(element.attributeValue("title"));
+                pli.setUri(element.attributeValue("url"));
+                pli.setId(element.attributeValue("id"));
+                list.add(pli);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return p;
+    }
+
+
+//    private void getQueryModel() throws IOException {
+//        NuxeoRESTClient nxClient = getClient();
+//
+//        List<String> pathParams = new ArrayList<String>();
+//        Map<String, String> queryParams = new HashMap<String, String>();
+//
+//        //query model for user documents
+//        pathParams = Arrays.asList("execQueryModel", "USER_DOCUMENTS");
+//        queryParams.put("QP1", "Administrator");
+//        queryParams.put("format", "XML");
+//
+//
+//        Representation res = nxClient.get(pathParams, queryParams);
+//        String resStr = res.getText();
+//        verbose("getQueryModel:" + resStr);
+//
+//    }
+//
+//    private void getVocabulary() throws IOException {
+//        NuxeoRESTClient nxClient = getClient();
+//
+//        List<String> pathParams = new ArrayList<String>();
+//        Map<String, String> queryParams = new HashMap<String, String>();
+//        //get vocabulary
+//        pathParams = Arrays.asList("vocabulary", "continent_country");
+//        queryParams.put("lang", "en");
+//
+//        Representation res = nxClient.get(pathParams, queryParams);
+//        String resStr = res.getText();
+//        verbose("getVocabulary:" + resStr);
+//
+//    }
+    private NuxeoRESTClient getClient() {
+        NuxeoRESTClient nxClient = new NuxeoRESTClient("http://127.0.0.1:8080/nuxeo");
+        nxClient.setAuthType(NuxeoRESTClient.AUTH_TYPE_BASIC);
+        nxClient.setBasicAuthentication("Administrator", "Administrator");
+        return nxClient;
+    }
+
+    private void verbose(String msg) {
+        System.out.println("PersonDocResource: " + msg);
+    }
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoCallback.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoCallback.java
new file mode 100644 (file)
index 0000000..8e78e00
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.collectionspace.hello.services.nuxeo;
+
+
+import javax.security.auth.callback.Callback;
+
+/**
+ * Copied from jbossx
+ *
+ * An implementation of Callback that simply obtains an Object to be used
+ * as the authentication credential. Interpretation of the Object is up to
+ * the LoginModules that validate the credential.
+ *
+ * @author  Scott.Stark@jboss.org
+ */
+public class NuxeoCallback implements Callback {
+
+    private final String prompt;
+
+    private Object credential;
+
+    public NuxeoCallback() {
+        this("");
+    }
+
+    public NuxeoCallback(String prompt) {
+        this.prompt = prompt;
+    }
+
+    public String getPrompt() {
+        return prompt;
+    }
+
+    public Object getCredential() {
+        return credential;
+    }
+
+    public void setCredential(Object credential) {
+        this.credential = credential;
+    }
+
+    public void clearCredential() {
+        credential = null;
+    }
+
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoCallbackHandler.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoCallbackHandler.java
new file mode 100644 (file)
index 0000000..e8fff8c
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.collectionspace.hello.services.nuxeo;
+
+/**
+ *
+ * @author sanjaydalal
+ */
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+/**
+ * Copied from jbossx.
+ *
+ * @author Scott.Stark@jboss.org
+ */
+public class NuxeoCallbackHandler implements CallbackHandler {
+
+    private final String username;
+    private char[] password;
+    private final Object credential;
+
+    /**
+     * Initializes the UsernamePasswordHandler with the username and password to
+     * use.
+     *
+     * @param username the user name
+     * @param password the password for this user
+     */
+    public NuxeoCallbackHandler(String username, char[] password) {
+        this.username = username;
+        this.password = password;
+        credential = password;
+    }
+
+    public NuxeoCallbackHandler(String username, Object credential) {
+        this.username = username;
+        this.credential = credential;
+        if (credential instanceof char[]) {
+            password = (char[]) credential;
+        } else if (credential instanceof CharSequence) {
+            password = credential.toString().toCharArray();
+        }
+    }
+
+    /**
+     * Sets any NameCallback name property to the instance username, sets any
+     * PasswordCallback password property to the instance, and any password.
+     *
+     * @exception UnsupportedCallbackException,
+     *                thrown if any callback of type other than NameCallback or
+     *                PasswordCallback are seen.
+     */
+    public void handle(Callback[] callbacks)
+            throws UnsupportedCallbackException {
+        for (Callback c : callbacks) {
+            if (c instanceof NameCallback) {
+                NameCallback nc = (NameCallback) c;
+                nc.setName(username);
+            } else if (c instanceof PasswordCallback) {
+                PasswordCallback pc = (PasswordCallback) c;
+                if (password == null) {
+                    // We were given an opaque Object credential but a char[] is
+                    // requested?
+                    if (credential != null) {
+                        String tmp = credential.toString();
+                        password = tmp.toCharArray();
+                    }
+                }
+                pc.setPassword(password);
+            } else if (c instanceof NuxeoCallback) {
+                NuxeoCallback oc = (NuxeoCallback) c;
+                oc.setCredential(credential);
+            } else {
+                throw new UnsupportedCallbackException(c,
+                        "Unrecognized Callback");
+            }
+        }
+    }
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoLoginConfiguration.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoLoginConfiguration.java
new file mode 100644 (file)
index 0000000..81cedc3
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.collectionspace.hello.services.nuxeo;
+
+/**
+ *
+ * @author sanjaydalal
+ */
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.security.auth.login.AppConfigurationEntry;
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
+
+public class NuxeoLoginConfiguration extends Configuration {
+
+    private final Configuration parent;
+    public static final String LOGIN_DOMAIN = "nuxeo-client-login";
+
+    public NuxeoLoginConfiguration(Configuration parent) {
+        this.parent = parent;
+    }
+
+    @Override
+    public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
+
+        if (LOGIN_DOMAIN.equals(name)) {
+            AppConfigurationEntry[] entries = new AppConfigurationEntry[1];
+
+            Map<String, Object> options = new HashMap<String, Object>();
+
+            options.put("restore-login-identity", "True");
+            options.put("multi-threaded", "True");
+
+            entries[0] = new AppConfigurationEntry("org.jboss.security.ClientLoginModule", LoginModuleControlFlag.REQUIRED, options);
+
+
+            return entries;
+        } else {
+            return parent.getAppConfigurationEntry(name);
+        }
+    }
+
+    @Override
+    public void refresh() {
+        if (parent != null) {
+            parent.refresh();
+        }
+    }
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoLoginContextFactory.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoLoginContextFactory.java
new file mode 100644 (file)
index 0000000..d1d23f7
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.collectionspace.hello.services.nuxeo;
+
+/**
+ *
+ * @author sanjaydalal
+ */
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.Configuration;
+import javax.security.auth.login.LoginContext;
+import javax.security.auth.login.LoginException;
+
+public class NuxeoLoginContextFactory {
+
+
+    private static boolean initDone=false;
+
+    private static void initLoginConfig()
+    {
+        if (initDone)
+            return;
+
+        Configuration parentConfig = null;
+        try {
+            parentConfig = Configuration.getConfiguration();
+        } catch (Exception e) {
+            // do nothing - this can happen if default configuration provider is not correctly configured
+            // for examnple FileConfig fails if no config file was defined
+        }
+        Configuration config = new NuxeoLoginConfiguration(parentConfig);
+        Configuration.setConfiguration(config);
+
+        initDone=true;
+
+    }
+
+
+    public static LoginContext getLoginContext(CallbackHandler handler) throws LoginException
+    {
+        initLoginConfig();
+        return  new LoginContext(NuxeoLoginConfiguration.LOGIN_DOMAIN, handler);
+    }
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoRESTClient.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/NuxeoRESTClient.java
new file mode 100644 (file)
index 0000000..175dca7
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+ * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public License
+ * (LGPL) version 2.1 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Contributors:
+ *     Nuxeo - initial API and implementation
+ *
+ * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
+ */
+package org.collectionspace.hello.services.nuxeo;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+import java.util.Map;
+
+
+import org.restlet.Client;
+import org.restlet.data.ChallengeResponse;
+import org.restlet.data.ChallengeScheme;
+import org.restlet.data.Cookie;
+import org.restlet.data.Form;
+import org.restlet.data.MediaType;
+import org.restlet.data.Method;
+import org.restlet.data.Parameter;
+import org.restlet.data.Protocol;
+import org.restlet.data.Request;
+import org.restlet.resource.OutputRepresentation;
+import org.restlet.resource.Representation;
+import org.restlet.util.Series;
+
+public class NuxeoRESTClient {
+
+    public static final int AUTH_TYPE_NONE = 0;
+    public static final int AUTH_TYPE_BASIC = 1;
+    public static final int AUTH_TYPE_SECRET = 2;
+    protected String baseURL = "http://127.0.0.1:8080/nuxeo";
+    protected String restPrefix = "restAPI";
+    protected String davPrefix = "dav";
+    protected List<Cookie> cookies;
+    protected int authType = AUTH_TYPE_NONE;
+    protected String userName;
+    protected String password;
+    protected String secretToken;
+    protected Client restClient;
+
+    public NuxeoRESTClient(String baseURL) {
+        this.baseURL = baseURL;
+    }
+
+    public NuxeoRESTClient(String protocol, String serverIP, String serverPort) {
+        this(protocol, serverIP, serverPort, "nuxeo");
+    }
+
+    public NuxeoRESTClient(String protocol, String serverIP, String serverPort,
+            String servletPath) {
+        StringBuffer sb = new StringBuffer();
+        sb.append(protocol);
+        sb.append("://");
+        sb.append(serverIP);
+        if (serverPort != null && !serverIP.equals("80")) {
+            sb.append(':');
+            sb.append(serverPort);
+        }
+        sb.append(servletPath);
+        sb.append('/');
+        baseURL = sb.toString();
+    }
+
+    public void setBasicAuthentication(String userName, String password) {
+        authType = AUTH_TYPE_BASIC;
+        this.userName = userName;
+        this.password = password;
+    }
+
+    public void setSharedSecretAuthentication(String userName,
+            String secretToken) {
+        authType = AUTH_TYPE_SECRET;
+        this.userName = userName;
+        this.secretToken = secretToken;
+    }
+
+    public void setCookies(List<Cookie> cookies) {
+        this.cookies = cookies;
+    }
+
+    public Representation post(List<String> pathParams,
+            Map<String, String> queryParams, InputStream istream) {
+        String path = "";
+        StringBuffer pathBuffer = new StringBuffer();
+
+        if (pathParams != null) {
+            for (String p : pathParams) {
+                pathBuffer.append(p);
+                pathBuffer.append('/');
+            }
+            path = pathBuffer.toString();
+        }
+
+        return post(path, queryParams, istream);
+    }
+
+    public Representation post(String subPath,
+            Map<String, String> queryParams, InputStream istream) {
+        StringBuffer urlBuffer = new StringBuffer();
+
+        if (subPath.startsWith("/")) {
+            subPath = subPath.substring(1);
+        }
+        if (subPath.endsWith("/")) {
+            subPath = subPath.substring(0, subPath.length() - 1);
+        }
+
+        urlBuffer.append(baseURL);
+        urlBuffer.append('/');
+        urlBuffer.append(restPrefix);
+        urlBuffer.append('/');
+        urlBuffer.append(subPath);
+
+        if (queryParams != null) {
+            urlBuffer.append('?');
+            for (String qpName : queryParams.keySet()) {
+                urlBuffer.append(qpName);
+                urlBuffer.append('=');
+                urlBuffer.append(queryParams.get(qpName).replaceAll(" ", "%20"));
+                urlBuffer.append('&');
+            }
+        }
+
+        String completeURL = urlBuffer.toString();
+
+        Request request = new Request(Method.POST, completeURL);
+
+        setupAuth(request);
+        setupCookies(request);
+        final InputStream in = istream;
+        request.setEntity(new OutputRepresentation(
+                MediaType.MULTIPART_FORM_DATA) {
+
+            @Override
+            public void write(OutputStream outputStream) throws IOException {
+                byte[] buffer = new byte[1024 * 64];
+                int read;
+                while ((read = in.read(buffer)) != -1) {
+                    outputStream.write(buffer, 0, read);
+                }
+
+            }
+        });
+
+        return getRestClient().handle(request).getEntity();
+    }
+
+    public Representation get(List<String> pathParams,
+            Map<String, String> queryParams) {
+        String path = "";
+        StringBuffer pathBuffer = new StringBuffer();
+
+        if (pathParams != null) {
+            for (String p : pathParams) {
+                pathBuffer.append(p);
+                pathBuffer.append('/');
+            }
+            path = pathBuffer.toString();
+        }
+
+        return get(path, queryParams);
+    }
+
+    public Representation get(String subPath,
+            Map<String, String> queryParams) {
+        StringBuffer urlBuffer = new StringBuffer();
+
+        if (subPath.startsWith("/")) {
+            subPath = subPath.substring(1);
+        }
+        if (subPath.endsWith("/")) {
+            subPath = subPath.substring(0, subPath.length() - 1);
+        }
+
+        urlBuffer.append(baseURL);
+        urlBuffer.append('/');
+        urlBuffer.append(restPrefix);
+        urlBuffer.append('/');
+        urlBuffer.append(subPath);
+
+        if (queryParams != null) {
+            urlBuffer.append('?');
+            for (String qpName : queryParams.keySet()) {
+                urlBuffer.append(qpName);
+                urlBuffer.append('=');
+                urlBuffer.append(queryParams.get(qpName).replaceAll(" ", "%20"));
+                urlBuffer.append('&');
+            }
+        }
+
+        String completeURL = urlBuffer.toString();
+        System.out.println("\nNuxeoRESTClient: calling " + completeURL);
+        Request request = new Request(Method.GET, completeURL);
+        setupAuth(request);
+        setupCookies(request);
+
+        return getRestClient().handle(request).getEntity();
+    }
+
+    protected void setupAuth(Request request) {
+
+        if (authType == AUTH_TYPE_BASIC) {
+            ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;
+            ChallengeResponse authentication = new ChallengeResponse(scheme,
+                    userName, password);
+            request.setChallengeResponse(authentication);
+
+        } else if (authType == AUTH_TYPE_SECRET) {
+            Series<Parameter> additionnalHeaders = new Form();
+
+            Map<String, String> securityHeaders = PortalSSOAuthenticationProvider.getHeaders(
+                    secretToken, userName);
+
+            for (String hn : securityHeaders.keySet()) {
+                additionnalHeaders.add(hn, securityHeaders.get(hn));
+            }
+
+            request.getAttributes().put("org.restlet.http.headers",
+                    additionnalHeaders);
+        }
+    }
+
+    protected void setupCookies(Request request) {
+        if (cookies != null) {
+            request.getCookies().clear();
+            for (Cookie cookie : cookies) {
+                request.getCookies().add(cookie);
+            }
+        }
+
+    }
+
+    protected Client getRestClient() {
+        if (restClient == null) {
+            if (baseURL.startsWith("https")) {
+                restClient = new Client(Protocol.HTTPS);
+            } else {
+                restClient = new Client(Protocol.HTTP);
+            }
+        }
+
+        return restClient;
+    }
+
+    public int getAuthType() {
+        return authType;
+    }
+
+    public void setAuthType(int authType) {
+        this.authType = authType;
+    }
+
+    public String getDavPrefix() {
+        return davPrefix;
+    }
+
+    public void setDavPrefix(String davPrefix) {
+        this.davPrefix = davPrefix;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getRestPrefix() {
+        return restPrefix;
+    }
+
+    public void setRestPrefix(String restPrefix) {
+        this.restPrefix = restPrefix;
+    }
+
+    public String getSecretToken() {
+        return secretToken;
+    }
+
+    public void setSecretToken(String secretToken) {
+        this.secretToken = secretToken;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/PortalSSOAuthenticationProvider.java b/HelloWorld/HelloWorldDocService/src/main/java/org/collectionspace/hello/services/nuxeo/PortalSSOAuthenticationProvider.java
new file mode 100644 (file)
index 0000000..ef1a61a
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the GNU Lesser General Public License
+ * (LGPL) version 2.1 which accompanies this distribution, and is available at
+ * http://www.gnu.org/licenses/lgpl.html
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Contributors:
+ *     Nuxeo - initial API and implementation
+ *
+ * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
+ */
+
+package org.collectionspace.hello.services.nuxeo;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import com.noelios.restlet.util.Base64;
+
+public class PortalSSOAuthenticationProvider {
+
+    private static final String TOKEN_SEP = ":";
+
+    private static final String TS_HEADER = "NX_TS";
+
+    private static final String RANDOM_HEADER = "NX_RD";
+
+    private static final String TOKEN_HEADER = "NX_TOKEN";
+
+    private static final String USER_HEADER = "NX_USER";
+
+    public static Map<String, String> getHeaders(String secretKey,
+            String userName) {
+
+        Map<String, String> headers = new HashMap<String, String>();
+
+        Date timestamp = new Date();
+        int randomData = new Random(timestamp.getTime()).nextInt();
+
+        String clearToken = timestamp.getTime() + TOKEN_SEP + randomData
+                + TOKEN_SEP + secretKey + TOKEN_SEP + userName;
+
+        byte[] hashedToken;
+
+        try {
+            hashedToken = MessageDigest.getInstance("MD5").digest(
+                    clearToken.getBytes());
+        } catch (NoSuchAlgorithmException e) {
+            return null;
+        }
+
+        String base64HashedToken = Base64.encodeBytes(hashedToken);
+
+        headers.put(TS_HEADER, String.valueOf(timestamp.getTime()));
+        headers.put(RANDOM_HEADER, String.valueOf(randomData));
+        headers.put(TOKEN_HEADER, base64HashedToken);
+        headers.put(USER_HEADER, userName);
+
+        return headers;
+    }
+
+}
diff --git a/HelloWorld/HelloWorldDocService/src/main/resources/jndi.properties b/HelloWorld/HelloWorldDocService/src/main/resources/jndi.properties
new file mode 100644 (file)
index 0000000..a3aa407
--- /dev/null
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
diff --git a/HelloWorld/HelloWorldDocService/src/main/resources/nuxeo.properties b/HelloWorld/HelloWorldDocService/src/main/resources/nuxeo.properties
new file mode 100644 (file)
index 0000000..3c9d5af
--- /dev/null
@@ -0,0 +1,2 @@
+org.nuxeo.runtime.server.enabled=false
+org.nuxeo.runtime.streaming.isServer=false
diff --git a/HelloWorld/HelloWorldDocService/src/main/webapp/WEB-INF/web.xml b/HelloWorld/HelloWorldDocService/src/main/webapp/WEB-INF/web.xml
new file mode 100644 (file)
index 0000000..d6187fc
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">\r
+<web-app>\r
+    <display-name>HelloworldDoc</display-name>\r
+\r
+    <context-param>\r
+        <param-name>javax.ws.rs.Application</param-name>\r
+        <param-value>org.collectionspace.hello.services.HelloworldDocApplication</param-value>\r
+    </context-param>\r
+\r
+    <context-param>\r
+        <param-name>resteasy.servlet.mapping.prefix</param-name>\r
+        <param-value>/cspace-doc</param-value>\r
+    </context-param>\r
+\r
+    <listener>\r
+        <listener-class>\r
+            org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap\r
+        </listener-class>\r
+    </listener>\r
+\r
+    <servlet>\r
+        <servlet-name>Resteasy</servlet-name>\r
+        <servlet-class>\r
+            org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher\r
+        </servlet-class>\r
+    </servlet>\r
+\r
+    <servlet-mapping>\r
+        <servlet-name>Resteasy</servlet-name>\r
+        <url-pattern>/cspace-doc/*</url-pattern>\r
+    </servlet-mapping>\r
+\r
+</web-app>\r