]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-30 hello.xsd schema changed (made it flat) to accommodate requirements of
authorSanjay Dalal <sanjay.dalal@berkeley.edu>
Thu, 26 Mar 2009 19:06:38 +0000 (19:06 +0000)
committerSanjay Dalal <sanjay.dalal@berkeley.edu>
Thu, 26 Mar 2009 19:06:38 +0000 (19:06 +0000)
 nuxeo repository and rest apis. HelloWorldDocService renamed to HelloWorldNuxeo
Service. Added support for create, update and delete in addition to list.

HelloWorld/HelloWorldClient/src/main/java/org/collectionspace/hello/client/PersonNuxeoClient.java [new file with mode: 0644]
HelloWorld/HelloWorldClient/src/main/java/org/collectionspace/hello/client/PersonNuxeoProxy.java [new file with mode: 0644]

diff --git a/HelloWorld/HelloWorldClient/src/main/java/org/collectionspace/hello/client/PersonNuxeoClient.java b/HelloWorld/HelloWorldClient/src/main/java/org/collectionspace/hello/client/PersonNuxeoClient.java
new file mode 100644 (file)
index 0000000..cc99f11
--- /dev/null
@@ -0,0 +1,93 @@
+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);
+    }
+}
diff --git a/HelloWorld/HelloWorldClient/src/main/java/org/collectionspace/hello/client/PersonNuxeoProxy.java b/HelloWorld/HelloWorldClient/src/main/java/org/collectionspace/hello/client/PersonNuxeoProxy.java
new file mode 100644 (file)
index 0000000..53265de
--- /dev/null
@@ -0,0 +1,42 @@
+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