]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
0331788d2526ed50526fc0e9dba317cae5ca6f00
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.client;
2
3 import javax.ws.rs.core.Response;
4
5 import org.collectionspace.services.collectionobject.CollectionObject;
6 import org.collectionspace.services.collectionobject.CollectionObjectList;
7
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;
12
13 /**
14  * A CollectionObjectClient.
15
16  * @version $Revision:$
17  */
18 public class CollectionObjectClient extends CollectionSpaceClient {
19
20     /**
21      *
22      */
23     private static final CollectionObjectClient instance = new CollectionObjectClient();
24     /**
25      *
26      */
27     private CollectionObjectProxy collectionObjectProxy;
28
29     /**
30      *
31      * Default constructor for CollectionObjectClient class.
32      *
33      */
34     private CollectionObjectClient() {
35         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
36         RegisterBuiltin.register(factory);
37         if(useAuth()){
38             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
39                     getBaseURL(), getHttpClient());
40         }else{
41             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
42                     getBaseURL());
43         }
44     }
45
46     /**
47      * FIXME Comment this
48      *
49      * @return
50      */
51     public static CollectionObjectClient getInstance() {
52         return instance;
53     }
54
55     /**
56      * @return
57      * @see org.collectionspace.hello.client.CollectionObjectProxy#getCollectionObject()
58      */
59     public ClientResponse<CollectionObjectList> getCollectionObjectList() {
60         return collectionObjectProxy.getCollectionObjectList();
61     }
62
63     /**
64      * @param csid
65      * @return
66      * @see org.collectionspace.hello.client.CollectionObjectProxy#getCollectionObject(java.lang.String)
67      */
68     public ClientResponse<CollectionObject> getCollectionObject(String csid) {
69         return collectionObjectProxy.getCollectionObject(csid);
70     }
71
72     /**
73      * @param collectionobject
74      * @return
75      * @see org.collectionspace.hello.client.CollectionObjectProxy#createCollectionObject(org.collectionspace.hello.CollectionObject)
76      */
77     public ClientResponse<Response> createCollectionObject(CollectionObject collectionObject) {
78         return collectionObjectProxy.createCollectionObject(collectionObject);
79     }
80
81     /**
82      * @param csid
83      * @param collectionobject
84      * @return
85      * @see org.collectionspace.hello.client.CollectionObjectProxy#updateCollectionObject(java.lang.Long, org.collectionspace.hello.CollectionObject)
86      */
87     public ClientResponse<CollectionObject> updateCollectionObject(String csid, CollectionObject collectionObject) {
88         return collectionObjectProxy.updateCollectionObject(csid, collectionObject);
89     }
90
91     /**
92      * @param csid
93      * @return
94      * @see org.collectionspace.hello.client.CollectionObjectProxy#deleteCollectionObject(java.lang.Long)
95      */
96     public ClientResponse<Response> deleteCollectionObject(String csid) {
97         return collectionObjectProxy.deleteCollectionObject(csid);
98     }
99 }