1 package org.collectionspace.hello.client;
3 import javax.ws.rs.core.Response;
5 import org.collectionspace.hello.CollectionObject;
6 import org.collectionspace.hello.CollectionObjectList;
8 import org.jboss.resteasy.client.ProxyFactory;
9 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
10 import org.jboss.resteasy.client.ClientResponse;
11 import org.jboss.resteasy.spi.ResteasyProviderFactory;
14 * A CollectionObjectClient.
16 * @version $Revision:$
18 public class CollectionObjectClient {
20 private static final String HOST = "http://localhost:8080";
21 private static final String URI = "/helloworld/cspace-nuxeo";
26 private static final CollectionObjectClient instance = new CollectionObjectClient();
30 private CollectionObjectProxy collectionObjectProxy;
34 * Default constructor for CollectionObjectClient class.
37 private CollectionObjectClient() {
38 ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
39 RegisterBuiltin.register(factory);
40 collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class, HOST + URI);
48 public static CollectionObjectClient getInstance() {
54 * @see org.collectionspace.hello.client.CollectionObjectProxy#getCollectionObject()
56 public ClientResponse<CollectionObjectList> getCollectionObjectList() {
57 return collectionObjectProxy.getCollectionObjectList();
63 * @see org.collectionspace.hello.client.CollectionObjectProxy#getCollectionObject(java.lang.String)
65 public ClientResponse<CollectionObject> getCollectionObject(String csid) {
66 return collectionObjectProxy.getCollectionObject(csid);
70 * @param collectionobject
72 * @see org.collectionspace.hello.client.CollectionObjectProxy#createCollectionObject(org.collectionspace.hello.CollectionObject)
74 public ClientResponse<Response> createCollectionObject(CollectionObject collectionObject) {
75 return collectionObjectProxy.createCollectionObject(collectionObject);
80 * @param collectionobject
82 * @see org.collectionspace.hello.client.CollectionObjectProxy#updateCollectionObject(java.lang.Long, org.collectionspace.hello.CollectionObject)
84 public ClientResponse<CollectionObject> updateCollectionObject(String csid, CollectionObject collectionObject) {
85 return collectionObjectProxy.updateCollectionObject(csid, collectionObject);
91 * @see org.collectionspace.hello.client.CollectionObjectProxy#deleteCollectionObject(java.lang.Long)
93 public ClientResponse<Response> deleteCollectionObject(String csid) {
94 return collectionObjectProxy.deleteCollectionObject(csid);