--- /dev/null
+#Mon Mar 30 16:16:36 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.5\r
--- /dev/null
+#Thu Mar 26 12:47:04 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="lib" path="/helloworld-jaxb/target/helloworld-jaxb-0.1.jar"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>javaee-addressbook-client</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+#Thu Mar 26 13:03:04 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.5\r
--- /dev/null
+#Thu Feb 26 16:30:28 PST 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?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
+ </properties>\r
+</project-shared-configuration>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<actions>\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
+ \r
+ </actions>\r
--- /dev/null
+<?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
+ <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-client</artifactId>\r
+ <packaging>jar</packaging>\r
+ <version>0.1</version>\r
+ <name>Helloworld Client</name>\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.testng</groupId>\r
+ <artifactId>testng</artifactId>\r
+ <version>5.6</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
+ <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>commons-httpclient</groupId>\r
+ <artifactId>commons-httpclient</artifactId>\r
+ </dependency>\r
+ </dependencies>\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <artifactId>maven-compiler-plugin</artifactId>\r
+ <version>2.0.2</version>\r
+ <configuration>\r
+ <source>1.5</source>\r
+ <target>1.5</target>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+</project>\r
--- /dev/null
+package org.collectionspace.hello.client;
+
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.hello.Identifier;
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * A IdentifierClient.
+
+ * @version $Revision:$
+ */
+public class IdentifierClient {
+
+ /**
+ *
+ */
+ private static final IdentifierClient instance = new IdentifierClient();
+ /**
+ *
+ */
+ private IdentifierProxy identifierProxy;
+
+ /**
+ *
+ * Create a new IdentifierClient.
+ *
+ */
+ private IdentifierClient() {
+ ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+ RegisterBuiltin.register(factory);
+ identifierProxy = ProxyFactory.create(IdentifierProxy.class, "http://localhost:8080/helloworld/cspace");
+ }
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ public static IdentifierClient getInstance() {
+ return instance;
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.IdentifierProxy#getIdentifier(java.lang.Long)
+ */
+ public ClientResponse<Identifier> getIdentifier(Long id) {
+ return identifierProxy.getIdentifier(id);
+ }
+
+ /**
+ * @param identifier
+ * @return
+ * @see org.collectionspace.hello.client.IdentifierProxy#createIdentifier(org.collectionspace.hello.client.entity.Identifier)
+ */
+ public ClientResponse<Response> createIdentifier(Identifier identifier) {
+ return identifierProxy.createIdentifier(identifier);
+ }
+}
--- /dev/null
+package org.collectionspace.hello.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.hello.Identifier;
+import org.jboss.resteasy.client.ClientResponse;
+
+/**
+ * @version $Revision:$
+ */
+@Path("/identifiers/")
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface IdentifierProxy {
+
+ /**
+ * @param id
+ * @return
+ */
+ @GET
+ @Path("/{id}")
+ ClientResponse<Identifier> getIdentifier(@PathParam("id") Long id);
+
+ @POST
+ ClientResponse<Response> createIdentifier(Identifier so);
+}
\ No newline at end of file
--- /dev/null
+package org.collectionspace.hello.client;
+
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.hello.Person;
+import org.collectionspace.hello.Persons;
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * A PersonClient.
+
+ * @version $Revision:$
+ */
+public class PersonClient {
+
+ /**
+ *
+ */
+ private static final PersonClient instance = new PersonClient();
+ /**
+ *
+ */
+ private PersonProxy personProxy;
+
+ /**
+ *
+ * Create a new PersonClient.
+ *
+ */
+ private PersonClient() {
+ ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+ RegisterBuiltin.register(factory);
+ personProxy = ProxyFactory.create(PersonProxy.class, "http://localhost:8080/helloworld/cspace");
+ }
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ public static PersonClient getInstance() {
+ return instance;
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.PersonProxy#getPerson()
+ */
+ public ClientResponse<Persons> getPersons() {
+ return personProxy.getPersons();
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.PersonProxy#getPerson(java.lang.Long)
+ */
+ public ClientResponse<Person> getPerson(Long id) {
+ return personProxy.getPerson(id);
+ }
+
+ /**
+ * @param person
+ * @return
+ * @see org.collectionspace.hello.client.PersonProxy#createPerson(org.collectionspace.hello.client.entity.Person)
+ */
+ public ClientResponse<Response> createPerson(Person person) {
+ return personProxy.createPerson(person);
+ }
+
+ /**
+ * @param id
+ * @param person
+ * @return
+ * @see org.collectionspace.hello.client.PersonProxy#updatePerson(java.lang.Long, org.collectionspace.hello.client.entity.Person)
+ */
+ public ClientResponse<Person> updatePerson(Long id, Person person) {
+ return personProxy.updatePerson(id, person);
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.PersonProxy#deletePerson(java.lang.Long)
+ */
+ public ClientResponse<Response> deletePerson(Long id) {
+ return personProxy.deletePerson(id);
+ }
+}
--- /dev/null
+package org.collectionspace.hello.client;
+
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.hello.PersonNuxeo;
+import org.collectionspace.hello.People;
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * A PersonNuxeoClient.
+
+ * @version $Revision:$
+ */
+public class PersonNuxeoClient {
+
+ /**
+ *
+ */
+ private static final PersonNuxeoClient instance = new PersonNuxeoClient();
+ /**
+ *
+ */
+ private PersonNuxeoProxy personProxy;
+
+ /**
+ *
+ * Create a new PersonNuxeoClient.
+ *
+ */
+ private PersonNuxeoClient() {
+ ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+ RegisterBuiltin.register(factory);
+ personProxy = ProxyFactory.create(PersonNuxeoProxy.class, "http://localhost:8080/helloworld/cspace-nuxeo");
+ }
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ public static PersonNuxeoClient getInstance() {
+ return instance;
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.PersonNuxeoProxy#getPerson()
+ */
+ public ClientResponse<People> getPeople() {
+ return personProxy.getPeople();
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.PersonNuxeoProxy#getPerson(java.lang.String)
+ */
+ public ClientResponse<PersonNuxeo> getPerson(String id) {
+ return personProxy.getPerson(id);
+ }
+
+ /**
+ * @param person
+ * @return
+ * @see org.collectionspace.hello.client.PersonNuxeoProxy#createPerson(org.collectionspace.hello.PersonNuxeo)
+ */
+ public ClientResponse<Response> createPerson(PersonNuxeo person) {
+ return personProxy.createPerson(person);
+ }
+
+ /**
+ * @param id
+ * @param person
+ * @return
+ * @see org.collectionspace.hello.client.PersonNuxeoProxy#updatePerson(java.lang.Long, org.collectionspace.hello.PersonNuxeo)
+ */
+ public ClientResponse<PersonNuxeo> updatePerson(String id, PersonNuxeo person) {
+ return personProxy.updatePerson(id, person);
+ }
+
+ /**
+ * @param id
+ * @return
+ * @see org.collectionspace.hello.client.PersonNuxeoProxy#deletePerson(java.lang.Long)
+ */
+ public ClientResponse<Response> deletePerson(String id) {
+ return personProxy.deletePerson(id);
+ }
+}
--- /dev/null
+package org.collectionspace.hello.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.hello.PersonNuxeo;
+import org.collectionspace.hello.People;
+import org.jboss.resteasy.client.ClientResponse;
+
+/**
+ * @version $Revision:$
+ */
+@Path("/persons/")
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface PersonNuxeoProxy {
+
+ @GET
+ ClientResponse<People> getPeople();
+
+ @GET
+ @Path("/{id}")
+ ClientResponse<PersonNuxeo> getPerson(@PathParam("id") String id);
+
+ @POST
+ ClientResponse<Response> createPerson(PersonNuxeo so);
+
+ @PUT
+ @Path("/{id}")
+ ClientResponse<PersonNuxeo> updatePerson(@PathParam("id") String id, PersonNuxeo so);
+
+ @DELETE
+ @Path("/{id}")
+ ClientResponse<Response> deletePerson(@PathParam("id") String id);
+}
\ No newline at end of file
--- /dev/null
+package org.collectionspace.hello.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.hello.Person;
+import org.collectionspace.hello.Persons;
+import org.jboss.resteasy.client.ClientResponse;
+
+/**
+ * @version $Revision:$
+ */
+@Path("/persons/")
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface PersonProxy {
+
+ @GET
+ ClientResponse<Persons> getPersons();
+
+ @GET
+ @Path("/{id}")
+ ClientResponse<Person> getPerson(@PathParam("id") Long id);
+
+ @POST
+ ClientResponse<Response> createPerson(Person so);
+
+ @PUT
+ @Path("/{id}")
+ ClientResponse<Person> updatePerson(@PathParam("id") Long id, Person so);
+
+ @DELETE
+ @Path("/{id}")
+ ClientResponse<Response> deletePerson(@PathParam("id") Long id);
+}
\ No newline at end of file
--- /dev/null
+package org.collectionspace.hello.client.test;
+
+import org.collectionspace.hello.client.*;
+import java.util.ArrayList;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import org.collectionspace.hello.Identifier;
+import org.jboss.resteasy.client.ClientResponse;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * A IdentifierServiceTest.
+ *
+ * @version $Revision:$
+ */
+public class IdentifierServiceTest {
+
+ private IdentifierClient identifierClient = IdentifierClient.getInstance();
+ private Long id = 0L;
+
+ @Test
+ public void createIdentifier() {
+ Identifier identifier = new Identifier();
+ identifier.setNamespace("org.bnhm");
+ ClientResponse<Response> res = identifierClient.createIdentifier(identifier);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+ id = extractId(res);
+ }
+
+ @Test(dependsOnMethods = {"createIdentifier"})
+ public void getIdentifier() {
+ Identifier i = identifierClient.getIdentifier(id).getEntity();
+ verbose("got Identifier", i);
+ }
+
+ private Long extractId(ClientResponse<Response> res) {
+ MultivaluedMap mvm = res.getMetadata();
+ String uri = (String) ((ArrayList) mvm.get("Location")).get(0);
+ String[] segments = uri.split("/");
+ verbose("id=" + segments[segments.length - 1]);
+ return Long.valueOf(segments[segments.length - 1]);
+ }
+
+ private void verbose(String msg) {
+ System.out.println("IdentifierServiceTest : " + msg);
+ }
+
+ private void verbose(String msg, Identifier p) {
+ try {
+ verbose(msg);
+ JAXBContext jc = JAXBContext.newInstance(Identifier.class);
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
+ Boolean.TRUE);
+ m.marshal(p, System.out);
+ //m.marshal(new JAXBElement(new QName("uri", "local"), Identifier.class, p), System.out);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
--- /dev/null
+package org.collectionspace.hello.client.test;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import org.collectionspace.hello.PersonNuxeo;
+import org.collectionspace.hello.People;
+import org.collectionspace.hello.client.PersonNuxeoClient;
+import org.jboss.resteasy.client.ClientResponse;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * A PersonNuxeoServiceTest.
+ *
+ * @version $Revision:$
+ */
+public class PersonNuxeoServiceTest {
+
+ private PersonNuxeoClient personClient = PersonNuxeoClient.getInstance();
+ private String updateId = "";
+ private String deleteId = "";
+
+ @Test
+ public void createPerson() {
+ PersonNuxeo person = createPerson("Chris", "Hoffman");
+ ClientResponse<Response> res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+ //store updateId locally
+ updateId = extractId(res);
+ }
+
+ @Test
+ public void createTeam() {
+ PersonNuxeo person = createPerson("Sanjay", "Dalal");
+ ClientResponse<Response> res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+ deleteId = extractId(res);
+
+ person = createPerson("Aron", "Roberts");
+ res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+
+ person = createPerson("Richard", "Millet");
+ res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+
+ }
+
+ @Test(dependsOnMethods = {"createPerson"})
+ public void updatePerson() {
+ PersonNuxeo touPerson = personClient.getPerson(updateId).getEntity();
+ touPerson.setId(updateId);
+ verbose("got person to update", touPerson, PersonNuxeo.class);
+ touPerson.setFirstName("Patrick");
+ touPerson.setLastName("Schmitz");
+ PersonNuxeo uPerson = personClient.updatePerson(updateId, touPerson).getEntity();
+ verbose("updated person", uPerson, PersonNuxeo.class);
+ //Assert.assertNotSame(uPerson.getVersion(), initialVersion);
+ Assert.assertEquals(uPerson.getFirstName(), "Patrick");
+ }
+
+ @Test(dependsOnMethods = {"createTeam"})
+ public void getPeople() {
+ //the resource method is expected to return at least an empty list
+ People people = personClient.getPeople().getEntity();
+ List<People.PeopleItem> list = people.getPeopleItem();
+ int i = 0;
+ for(People.PeopleItem pli : list){
+ verbose("getPeople: list-item[" + i + "] title=" + pli.getTitle());
+ verbose("getPeople: list-item[" + i + "] id=" + pli.getId());
+ verbose("getPeople: list-item[" + i + "] uri=" + pli.getUri());
+ i++;
+ }
+ }
+
+ @Test(dependsOnMethods = {"updatePerson"})
+ public void deletePerson() {
+ ClientResponse<Response> res = personClient.deletePerson(deleteId);
+ verbose("deletePerson: id=" + deleteId);
+ verbose("deletePerson: status = " + res.getStatus());
+ Assert.assertEquals(res.getStatus(), Response.Status.NO_CONTENT.getStatusCode());
+ }
+
+ private PersonNuxeo createPerson(String firstName, String lastName) {
+ PersonNuxeo person = new PersonNuxeo();
+ person.setFirstName(firstName);
+ person.setLastName(lastName);
+ person.setStreet("2195 Hearst Ave.");
+ person.setCity("Berkeley");
+ person.setState("CA");
+ person.setZip("94704");
+ person.setCountry("US");
+ person.setVersion("1.0");
+ return person;
+ }
+
+ private String extractId(ClientResponse<Response> res) {
+ MultivaluedMap mvm = res.getMetadata();
+ String uri = (String) ((ArrayList) mvm.get("Location")).get(0);
+ String[] segments = uri.split("/");
+ String id = segments[segments.length - 1];
+ verbose("id=" + id);
+ return id;
+ }
+
+ private void verbose(String msg) {
+ System.out.println("PersonServiceTest : " + msg);
+ }
+
+ private void verbose(String msg, Object o, Class clazz) {
+ try{
+ verbose(msg);
+ JAXBContext jc = JAXBContext.newInstance(clazz);
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
+ Boolean.TRUE);
+ m.marshal(o, System.out);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ private void verboseMap(MultivaluedMap map) {
+ for(Object entry : map.entrySet()){
+ MultivaluedMap.Entry mentry = (MultivaluedMap.Entry) entry;
+ verbose(" name=" + mentry.getKey() + " value=" + mentry.getValue());
+ }
+ }
+}
--- /dev/null
+package org.collectionspace.hello.client.test;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import org.collectionspace.hello.Person;
+import org.collectionspace.hello.Persons;
+import org.collectionspace.hello.client.PersonClient;
+import org.jboss.resteasy.client.ClientResponse;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * A PersonServiceTest.
+ *
+ * @version $Revision:$
+ */
+public class PersonServiceTest {
+
+ private PersonClient personClient = PersonClient.getInstance();
+ private Long updateId = 0L;
+
+ @Test
+ public void createPerson() {
+ Person person = createPerson("Chris", "Hoffman");
+ ClientResponse<Response> res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+ //store updateId locally
+ updateId = extractId(res);
+ }
+
+ @Test
+ public void createPersons() {
+ Person person = createPerson("Aron", "Roberts");
+ ClientResponse<Response> res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+ person = createPerson("Dan", "Sheppard");
+ res = personClient.createPerson(person);
+ Assert.assertEquals(res.getStatus(), Response.Status.CREATED.getStatusCode());
+ }
+
+ @Test(dependsOnMethods = {"createPerson"})
+ public void updatePerson() {
+ Person touPerson = personClient.getPerson(updateId).getEntity();
+ verbose("got person to update", touPerson, Person.class);
+ touPerson.setFirstName("Richard");
+ touPerson.setLastName("Millet");
+ int initialVersion = touPerson.getVersion();
+ Person uPerson = personClient.updatePerson(updateId, touPerson).getEntity();
+ verbose("updated person", uPerson, Person.class);
+ Assert.assertNotSame(uPerson.getVersion(), initialVersion);
+ Assert.assertEquals(uPerson.getFirstName(), "Richard");
+ }
+
+ @Test(dependsOnMethods = {"createPerson"})
+ public void getPersons() {
+ //the resource method is expected to return at least an empty list
+ Persons persons = personClient.getPersons().getEntity();
+ List<Persons.PersonListItem> list = persons.getPersonListItem();
+ int i = 0;
+ for (Persons.PersonListItem pli : list) {
+ verbose("getPersons: list-item[" + i + "] firstName=" + pli.getFirstName());
+ verbose("getPersons: list-item[" + i + "] lastName=" + pli.getLastName());
+ verbose("getPersons: list-item[" + i + "] uri=" + pli.getUri());
+ i++;
+ }
+ }
+
+
+ @Test
+ public void getNonExistingPerson() {
+ ClientResponse<Person> res = personClient.getPerson(999L);
+
+ Response.Status status = res.getResponseStatus();
+ verbose(this.getClass().getName() + ": " +
+ "getNonExistingPerson: Status: code=" + status.getStatusCode() +
+ " message=" + status.toString());
+ verbose("getNonExistingPerson: Metadata:");
+ verboseMap(res.getMetadata());
+ verbose("getNonExistingPerson: Headers:");
+ verboseMap(res.getHeaders());
+ if (status.equals(Response.Status.NOT_FOUND)) {
+ String msg = res.getEntity(String.class, String.class);
+ verbose("getNonExistingPerson: error message=" + msg);
+ }
+ }
+
+ @Test(dependsOnMethods = {"updatePerson"})
+ public void updateWrongPerson() {
+ Person touPerson = personClient.getPerson(updateId).getEntity();
+ verbose("updateWrongPerson: got person to update", touPerson, Person.class);
+ touPerson.setFirstName("Richard");
+ touPerson.setLastName("Millet");
+ //use non existing person to update
+ ClientResponse<Person> res = personClient.updatePerson(9999L, touPerson);
+ if (res.getResponseStatus().equals(Response.Status.NOT_FOUND)) {
+ verbose("updateWrongPerson: Status=" + res.getResponseStatus().toString());
+ String msg = res.getEntity(String.class, String.class);
+ verbose("updateWrongPerson: application error message=" + msg);
+ }
+ }
+
+
+ @Test(dependsOnMethods = {"updateWrongPerson"})
+ public void deletePerson() {
+ ClientResponse<Response> res = personClient.deletePerson(updateId);
+ verbose("deletePerson: id=" + updateId);
+ verbose("deletePerson: status = " + res.getStatus());
+ Assert.assertEquals(res.getStatus(), Response.Status.NO_CONTENT.getStatusCode());
+ }
+
+ private Person createPerson(String firstName, String lastName) {
+ Person person = new Person();
+ person.setFirstName(firstName);
+ person.setLastName(lastName);
+ person.setStreet("2195 Hearst Ave.");
+ person.setCity("Berkeley");
+ person.setState("CA");
+ person.setZip("94704");
+ person.setCountry("US");
+ return person;
+ }
+
+ private Long extractId(ClientResponse<Response> res) {
+ MultivaluedMap mvm = res.getMetadata();
+ String uri = (String) ((ArrayList) mvm.get("Location")).get(0);
+ String[] segments = uri.split("/");
+ verbose("id=" + segments[segments.length - 1]);
+ return Long.valueOf(segments[segments.length - 1]);
+ }
+
+ private void verbose(String msg) {
+ System.out.println("PersonServiceTest : " + msg);
+ }
+
+ private void verbose(String msg, Object o, Class clazz) {
+ try {
+ verbose(msg);
+ JAXBContext jc = JAXBContext.newInstance(clazz);
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
+ Boolean.TRUE);
+ m.marshal(o, System.out);
+ //m.marshal(new JAXBElement(new QName("uri", "local"), Person.class, p), System.out);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void verboseMap(MultivaluedMap map) {
+ for (Object entry : map.entrySet()) {
+ MultivaluedMap.Entry mentry = (MultivaluedMap.Entry) entry;
+ verbose(" name=" + mentry.getKey() + " value=" + mentry.getValue());
+ }
+ }
+}
--- /dev/null
+<?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>
+
+
+
+
--- /dev/null
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="javaee-addressbook-client">
+ <test verbose="2" name="org.jboss.resteasy.examples.addressbook.client.AddressBookTest" annotations="JDK">
+ <classes>
+ <class name="org.jboss.resteasy.examples.addressbook.client.AddressBookTest"/>
+ </classes>
+ </test>
+</suite>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>javaee-addressbook-jaxb</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
--- /dev/null
+#Thu Feb 26 16:32:52 PST 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.source=1.5\r
--- /dev/null
+#Thu Feb 26 16:30:28 PST 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?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
+ </properties>\r
+</project-shared-configuration>\r
--- /dev/null
+<?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>helloworld</artifactId>
+ <groupId>org.collectionspace.hello.services</groupId>
+ <version>0.1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.hello.services</groupId>
+ <artifactId>helloworld-jaxb</artifactId>
+ <version>0.1</version>
+ <name>Helloworld Client JAXB</name>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2-commons</groupId>
+ <artifactId>property-listener-injector</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.4.1.4</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <dependencies>
+ <!-- javax.activation.DataSource provider is required by spec -->
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.2</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://collectionspace.org/hello"
+ xmlns="http://collectionspace.org/hello"
+ targetNamespace="http://collectionspace.org/hello"
+ version="0.1"
+>
+
+<!-- avoid XmlRootElement nightnmare, see http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html-->
+ <xs:element name="person">
+ <xs:complexType>
+
+ <xs:sequence>
+ <xs:element name="firstName" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="lastName" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="street" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="city" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="state" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="zip" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="country" type="xs:string"
+ minOccurs="1" />
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:long" />
+ <xs:attribute name="version" type="xs:int" />
+
+ </xs:complexType>
+ </xs:element>
+
+
+ <!-- person short is returned by getPersons method -->
+ <xs:element name="persons">
+ <xs:complexType>
+ <xs:sequence>
+
+ <!-- person list item is returned by getPersons method -->
+ <xs:element name="person-list-item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="firstName" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="lastName" type="xs:string"
+ minOccurs="1" />
+ <!-- uri to retrive person details -->
+ <xs:element name="uri" type="xs:anyURI"
+ minOccurs="1" />
+ <xs:element name="id" type="xs:long"
+ minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+<!-- person-nuxeo uses both id and version as string -->
+ <xs:element name="person-nuxeo">
+ <xs:complexType>
+
+ <xs:sequence>
+ <xs:element name="id" type="xs:string" minOccurs="1" />
+ <xs:element name="version" 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="street" type="xs:string" minOccurs="1" />
+ <xs:element name="city" type="xs:string" minOccurs="1" />
+ <xs:element name="state" type="xs:string" minOccurs="1" />
+ <xs:element name="zip" type="xs:string" minOccurs="1" />
+ <xs:element name="country" type="xs:string" minOccurs="1" />
+ </xs:sequence>
+
+ </xs:complexType>
+ </xs:element>
+
+
+ <!-- people as in nuxeo repository -->
+ <xs:element name="people">
+ <xs:complexType>
+ <xs:sequence>
+
+ <xs:element name="people-item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="title" type="xs:string"
+ minOccurs="1" />
+ <!-- uri to retrive person details -->
+ <xs:element name="uri" type="xs:anyURI"
+ minOccurs="1" />
+ <xs:element name="id" type="xs:string"
+ minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="identifier">
+ <xs:complexType>
+
+ <xs:sequence>
+ <xs:element name="namespace" type="xs:string"
+ minOccurs="1" />
+ <xs:element name="value" type="xs:string"
+ minOccurs="0" />
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:long" />
+ <xs:attribute name="version" type="xs:int" />
+
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+
--- /dev/null
+Helloworld service interfacing with Nuxeo repository through Nuxeo
+REST apis.
+
+System Requirements:
+====================
+- Maven 2.0.9 or higher
+- Nuxeo CollectionSpace Extensions
+
+Building the project:
+====================
+In root directoy...
+1. customize build.properties for your environment
+2. mvn clean package
+3. ant
--- /dev/null
+jboss.dir=C:/dev/tools/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
--- /dev/null
+<?xml version="1.0"?>
+<project name="helloworld" default="deploy" basedir=".">
+
+ <property file="build.properties" />
+
+
+ <target name="deploy" description="Deploy">
+ <copy todir="${jboss.dir}/server/default/deploy">
+ <fileset file="${basedir}/target/helloworld.war" />
+ </copy>
+ </target>
+
+</project>
--- /dev/null
+<?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
--- /dev/null
+<?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
--- /dev/null
+<?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-nuxeo-service</artifactId>\r
+ <packaging>war</packaging>\r
+ <version>0.1</version>\r
+ <name>Helloworld Nuxeo 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
--- /dev/null
+package org.collectionspace.hello.services;
+
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+public class HelloworldNuxeoApplication extends Application {
+
+ private Set<Object> singletons = new HashSet<Object>();
+ private Set<Class<?>> empty = new HashSet<Class<?>>();
+
+ public HelloworldNuxeoApplication() {
+ singletons.add(new PersonNuxeoResource());
+ }
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ return empty;
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ return singletons;
+ }
+}
--- /dev/null
+package org.collectionspace.hello.services;
+
+import java.io.ByteArrayInputStream;
+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.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import org.collectionspace.hello.*;
+
+
+import org.collectionspace.hello.People.PeopleItem;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+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 PersonNuxeoResource {
+
+ final Logger logger = LoggerFactory.getLogger(PersonNuxeoResource.class);
+
+ public PersonNuxeoResource() {
+ }
+
+ @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
+ //For Richard, workspace repos ID is 77187c27-0467-4c3d-b395-122b82113f4d
+ pathParams = Arrays.asList("default", "1b58eef7-4fff-430b-b773-8c98724f19de", "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;
+ }
+
+ @POST
+ public Response createPerson(PersonNuxeo p) {
+
+ NuxeoRESTClient nxClient = getClient();
+
+ List<String> pathParams = new ArrayList<String>();
+ Map<String, String> queryParams = new HashMap<String, String>();
+ pathParams.add("default");
+ pathParams.add("1b58eef7-4fff-430b-b773-8c98724f19de");
+ pathParams.add("createDocument");
+ queryParams.put("docType", "Hello");
+ queryParams.put("dublincore:title", p.getFirstName() + " " + p.getLastName());
+ queryParams.put("hello:cversion", Integer.valueOf(1).toString());
+ queryParams.put("hello:firstName", p.getFirstName());
+ queryParams.put("hello:lastName", p.getLastName());
+ queryParams.put("hello:street", p.getStreet());
+ queryParams.put("hello:city", p.getCity());
+ queryParams.put("hello:state", p.getState());
+ queryParams.put("hello:zip", p.getZip());
+ queryParams.put("hello:country", p.getCountry());
+ ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]);
+ Representation res = nxClient.post(pathParams, queryParams, bais);
+
+ SAXReader reader = new SAXReader();
+ try{
+ Document document = reader.read(res.getStream());
+ Element root = document.getRootElement();
+ for(Iterator i = root.elementIterator(); i.hasNext();){
+ Element element = (Element) i.next();
+ if("docRef".equals(element.getName())){
+ String id = (String) element.getData();
+ p.setId(id);
+ }
+ }
+ }catch(Exception e){
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Create failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+
+ verbose("created person", p);
+ UriBuilder path = UriBuilder.fromResource(PersonNuxeoResource.class);
+ path.path("" + p.getId());
+ Response response = Response.created(path.build()).build();
+ return response;
+ }
+
+ @GET
+ @Path("{id}")
+ public PersonNuxeo getPerson(@PathParam("id") String id) {
+
+ PersonNuxeo p = null;
+ try{
+
+ NuxeoRESTClient nxClient = getClient();
+
+ List<String> pathParams = new ArrayList<String>();
+ Map<String, String> queryParams = new HashMap<String, String>();
+
+ pathParams.add("default");
+ pathParams.add(id);
+ pathParams.add("export");
+ queryParams.put("format", "XML");
+
+ Representation res = nxClient.get(pathParams, queryParams);
+ SAXReader reader = new SAXReader();
+
+ Document document = reader.read(res.getStream());
+ Element root = document.getRootElement();
+ p = new PersonNuxeo();
+ //TODO: recognize schema thru namespace uri
+// Namespace ns = new Namespace("hello", "http://collectionspace.org/hello");
+ Iterator<Element> siter = root.elementIterator("schema");
+ while(siter.hasNext()){
+
+ Element s = siter.next();
+
+ System.err.println("PersonNuxeo.getPerson() called.");
+
+ //TODO: recognize schema thru namespace uri
+ if("hello".equals(s.attribute("name").getValue())){
+ p.setId(id);
+ Element ele = s.element("cversion");
+ if(ele != null){
+ p.setVersion((String) ele.getData());
+ }
+ ele = s.element("firstName");
+ if(ele != null){
+ p.setFirstName((String) ele.getData());
+ }
+ ele = s.element("lastName");
+ if(ele != null){
+ p.setLastName((String) ele.getData());
+ }
+ ele = s.element("city");
+ if(ele != null){
+ p.setCity((String) ele.getData());
+ }
+ ele = s.element("state");
+ if(ele != null){
+ p.setState((String) ele.getData());
+ }
+ ele = s.element("zip");
+ if(ele != null){
+ p.setZip((String) ele.getData());
+ }
+ ele = s.element("country");
+ if(ele != null){
+ p.setCountry((String) ele.getData());
+ }
+ }
+ }
+
+ }catch(Exception e){
+ e.printStackTrace();
+ Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(
+ "Get failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ if(p == null){
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Get failed, the requested person ID:" + id + ": was not found.").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ verbose("get person", p);
+ return p;
+ }
+
+ @PUT
+ @Path("{id}")
+ public PersonNuxeo updatePerson(
+ @PathParam("id") String id,
+ PersonNuxeo update) {
+
+ verbose("updating person input", update);
+
+ NuxeoRESTClient nxClient = getClient();
+
+ List<String> pathParams = new ArrayList<String>();
+ Map<String, String> queryParams = new HashMap<String, String>();
+ pathParams.add("default");
+ pathParams.add(update.getId());
+ pathParams.add("updateDocumentRestlet");
+ queryParams.put("dublincore:title", "change title");
+ //todo: intelligent merge needed
+ if(update.getFirstName() != null){
+ queryParams.put("hello:firstName", update.getFirstName());
+ }
+
+ if(update.getLastName() != null){
+ queryParams.put("hello:lastName", update.getLastName());
+ }
+
+ if(update.getFirstName() != null && update.getLastName() != null){
+ queryParams.put("dublincore:title", update.getFirstName() + " " + update.getLastName());
+ }
+
+ if(update.getStreet() != null){
+ queryParams.put("hello:street", update.getStreet());
+ }
+
+ if(update.getCity() != null){
+ queryParams.put("hello:city", update.getCity());
+ }
+
+ if(update.getState() != null){
+ queryParams.put("hello:state", update.getState());
+ }
+
+ if(update.getZip() != null){
+ queryParams.put("hello:zip", update.getZip());
+ }
+
+ if(update.getCountry() != null){
+ queryParams.put("hello:country", update.getCountry());
+ }
+
+ Representation res = nxClient.get(pathParams, queryParams);
+ SAXReader reader = new SAXReader();
+ String status = "";
+ try{
+ Document document = reader.read(res.getStream());
+ Element root = document.getRootElement();
+ for(Iterator i = root.elementIterator(); i.hasNext();){
+ Element element = (Element) i.next();
+ if("docRef".equals(element.getName())){
+ status = (String) element.getData();
+ verbose("updatePerson: response=" + status);
+ }
+
+ }
+ }catch(Exception e){
+ //FIXME: NOT_FOUND?
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Update failed ").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return update;
+ }
+
+ @DELETE
+ @Path("{id}")
+ public void deletePerson(@PathParam("id") String id) {
+ verbose("deleting person with id=" + id);
+ NuxeoRESTClient nxClient = getClient();
+ List<String> pathParams = new ArrayList<String>();
+ Map<String, String> queryParams = new HashMap<String, String>();
+ pathParams.add("default");
+ pathParams.add(id);
+ pathParams.add("deleteDocumentRestlet");
+ Representation res = nxClient.get(pathParams, queryParams);
+ SAXReader reader = new SAXReader();
+ String status = "";
+ try{
+ Document document = reader.read(res.getStream());
+ Element root = document.getRootElement();
+ for(Iterator i = root.elementIterator(); i.hasNext();){
+ Element element = (Element) i.next();
+ if("docRef".equals(element.getName())){
+ status = (String) element.getData();
+ verbose("deletePerson: response=" + status);
+ }
+
+ }
+ }catch(Exception e){
+ //FIXME: NOT_FOUND?
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Delete failed ").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+
+ }
+
+ private void verbose(String msg, PersonNuxeo p) {
+ try{
+ verbose(msg);
+ JAXBContext jc = JAXBContext.newInstance(
+ PersonNuxeo.class);
+
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
+ Boolean.TRUE);
+ m.marshal(p, System.out);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+// 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("PersonNuxeoResource: " + msg);
+ }
+}
--- /dev/null
+/*
+ * 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;
+ }
+
+}
--- /dev/null
+/*
+ * 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");
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * 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();
+ }
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+/*
+ * (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;
+ }
+}
--- /dev/null
+/*
+ * (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;
+ }
+
+}
--- /dev/null
+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
--- /dev/null
+org.nuxeo.runtime.server.enabled=false
+org.nuxeo.runtime.streaming.isServer=false
--- /dev/null
+<?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>HelloworldNuxeo</display-name>\r
+\r
+ <context-param>\r
+ <param-name>javax.ws.rs.Application</param-name>\r
+ <param-value>org.collectionspace.hello.services.HelloworldNuxeoApplication</param-value>\r
+ </context-param>\r
+\r
+ <context-param>\r
+ <param-name>resteasy.servlet.mapping.prefix</param-name>\r
+ <param-value>/cspace-nuxeo</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-nuxeo/*</url-pattern>\r
+ </servlet-mapping>\r
+\r
+</web-app>\r
--- /dev/null
+<?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">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.hello.services</groupId>
+ <version>0.1</version>
+ <artifactId>helloworld</artifactId>
+ <packaging>pom</packaging>
+ <name>HelloWorld</name>
+ <modules>
+ <module>HelloWorldJaxb</module>
+ <module>HelloWorldClient</module>
+ <module>HelloWorldNuxeoService</module>
+ </modules>
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>sun</id>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ <repository>
+ <id>java.net</id>
+ <name>java.net Maven Repository</name>
+ <url>
+ https://maven-repository.dev.java.net/nonav/repository
+ </url>
+ <layout>legacy</layout>
+ </repository>
+ <repository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Maven 2 Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+
+ <pluginRepository>
+ <id>java.net</id>
+ <name>java.net Maven Repository</name>
+ <url>
+ https://maven-repository.dev.java.net/nonav/repository
+ </url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ <pluginRepository>
+ <id>maven2-repository.dev.java.net</id>
+ <name>Java.net Maven 2 Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <configuration>
+ <unzipCommand>
+ /usr/bin/unzip -o > err.txt
+ </unzipCommand>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.0.1</version>
+ <configuration>
+
+ <warSourceExcludes>
+ WEB-INF/lib/*.jar
+ </warSourceExcludes>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <args>
+ <arg>-XtoString</arg>
+ <arg>-Xinject-listener-code</arg>
+
+ <!-- <arg>-Xcollection-setter-injector</arg>
+ <arg>-Xfluent-api</arg> -->
+ </args>
+ <plugins>
+ <plugin>
+ <groupId>
+ org.jvnet.jaxb2_commons
+ </groupId>
+ <artifactId>basic</artifactId>
+ <version>0.4.1</version>
+ </plugin>
+ <plugin>
+ <groupId>
+ org.jvnet.jaxb2-commons
+ </groupId>
+ <artifactId>
+ property-listener-injector
+ </artifactId>
+ <version>1.0</version>
+ </plugin>
+ <!--
+ <plugin>
+ <groupId>
+ net.java.dev.jaxb2-commons
+ </groupId>
+ <artifactId>jaxb-fluent-api</artifactId>
+ <version>2.0.1</version>
+ </plugin>
+ -->
+ </plugins>
+ <generatePackage>
+ org.collectionspace.hello
+ </generatePackage>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>net.java.dev.jaxb2-commons</groupId>
+ <artifactId>jaxb-fluent-api</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.6</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>jaxrs-api</artifactId>
+ <version>1.0.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>net.java.dev.jaxb2-commons</groupId>
+ <artifactId>jaxb-fluent-api</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2-commons</groupId>
+ <artifactId>property-listener-injector</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ <version>1.0.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.6</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </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>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.jgoodies</groupId>
+ <artifactId>binding</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jgoodies</groupId>
+ <artifactId>forms</artifactId>
+ <version>1.2.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>