]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
ea9c5b865bf1afcb1b9d0032026e4fc45dcc43fc
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.client;
2
3 import javax.ws.rs.core.Response;
4
5
6 import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
7 import org.jboss.resteasy.client.ProxyFactory;
8 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
9 import org.jboss.resteasy.client.ClientResponse;
10 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
11 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
12 import org.jboss.resteasy.spi.ResteasyProviderFactory;
13
14 /**
15  * A CollectionObjectClient.
16
17  * @version $Revision:$
18  */
19 public class CollectionObjectClient extends BaseServiceClient {
20
21     /**
22      *
23      */
24     private CollectionObjectProxy collectionObjectProxy;
25
26     /**
27      *
28      * Default constructor for CollectionObjectClient class.
29      *
30      */
31     public CollectionObjectClient() {
32         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
33         RegisterBuiltin.register(factory);
34         setProxy();
35     }
36
37     /**
38      * allow to reset proxy as per security needs
39      */
40     public void setProxy() {
41         if(useAuth()){
42             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
43                     getBaseURL(), getHttpClient());
44         }else{
45             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
46                     getBaseURL());
47         }
48     }
49
50     /**
51      * @return
52      * @see org.collectionspace.hello.client.CollectionObjectProxy#readList()
53      */
54     public ClientResponse<CollectionobjectsCommonList> readList() {
55         return collectionObjectProxy.readList();
56
57     }
58
59     /**
60      * @param csid
61      * @return
62      * @see org.collectionspace.hello.client.CollectionObjectProxy#getCollectionObject(java.lang.String)
63      */
64     public ClientResponse<MultipartInput> read(String csid) {
65         return collectionObjectProxy.read(csid);
66     }
67
68     /**
69      * @param collectionobject
70      * @return
71      * @see org.collectionspace.hello.client.CollectionObjectProxy#create(org.collectionspace.services.collectionobject.CollectionobjectsCommon)
72      */
73     public ClientResponse<Response> create(MultipartOutput multipart) {
74         return collectionObjectProxy.create(multipart);
75     }
76
77     /**
78      * @param csid
79      * @param collectionobject
80      * @return
81      * @see org.collectionspace.hello.client.CollectionObjectProxy#updateCollectionObject(java.lang.Long, org.collectionspace.services.collectionobject.CollectionobjectsCommon)
82      */
83     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
84         return collectionObjectProxy.update(csid, multipart);
85     }
86
87     /**
88      * @param csid
89      * @return
90      * @see org.collectionspace.hello.client.CollectionObjectProxy#deleteCollectionObject(java.lang.Long)
91      */
92     public ClientResponse<Response> delete(String csid) {
93         return collectionObjectProxy.delete(csid);
94     }
95 }