]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
a342a9580d7b81565fa1d55ab915ab30a62791c2
[tmp/jakarta-migration.git] /
1 /**     
2  * CollectionObjectClient.java
3  *
4  * {Purpose of This Class}
5  *
6  * {Other Notes Relating to This Class (Optional)}
7  *
8  * $LastChangedBy: $
9  * $LastChangedRevision: $
10  * $LastChangedDate: $
11  *
12  * This document is a part of the source code and related artifacts
13  * for CollectionSpace, an open source collections management system
14  * for museums and related institutions:
15  *
16  * http://www.collectionspace.org
17  * http://wiki.collectionspace.org
18  *
19  * Copyright (C) 2009 {Contributing Institution}
20  *
21  * Licensed under the Educational Community License (ECL), Version 2.0.
22  * You may not use this file except in compliance with this License.
23  *
24  * You may obtain a copy of the ECL 2.0 License at
25  * https://source.collectionspace.org/collection-space/LICENSE.txt
26  */
27 package org.collectionspace.services.client;
28
29 import javax.ws.rs.GET;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.QueryParam;
32 import javax.ws.rs.core.Context;
33 import javax.ws.rs.core.Response;
34 import javax.ws.rs.core.UriInfo;
35
36
37 import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
38 import org.collectionspace.services.common.context.ServiceContext;
39 import org.collectionspace.services.common.query.IQueryManager;
40 import org.jboss.resteasy.client.ProxyFactory;
41 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
42 import org.jboss.resteasy.client.ClientResponse;
43 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
44 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
45 import org.jboss.resteasy.spi.ResteasyProviderFactory;
46
47 /**
48  * The Class CollectionObjectClient.
49  */
50 public class CollectionObjectClient extends AbstractServiceClientImpl {
51
52     /** The collection object proxy. */
53     private CollectionObjectProxy collectionObjectProxy;
54     
55         /* (non-Javadoc)
56          * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
57          */
58         public String getServicePathComponent() {
59                 return "collectionobjects";
60         }
61
62     /**
63      * Instantiates a new collection object client.
64      */
65     public CollectionObjectClient() {
66         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
67         RegisterBuiltin.register(factory);
68         setProxy();
69     }
70
71     /**
72      * Sets the proxy.
73      */
74     public void setProxy() {
75         if(useAuth()){
76             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
77                     getBaseURL(), getHttpClient());
78         }else{
79             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
80                     getBaseURL());
81         }
82     }
83
84     /**
85      * Read list.
86      * 
87      * @return the client response< collectionobjects common list>
88      */
89     public ClientResponse<CollectionobjectsCommonList> readList() {
90         return collectionObjectProxy.readList();
91
92     }
93     
94     /**
95      * Roundtrip.
96      * 
97      * This is an intentionally empty method that is used for performance test 
98      * to get a rough time estimate of the client to server response-request overhead.
99      * 
100      * @return the client response< response>
101      */
102     public ClientResponse<Response> roundtrip() {
103         return collectionObjectProxy.roundtrip();
104     }
105     
106     /**
107      * Keyword search.
108      * 
109      * @param keywords the keywords
110      * 
111      * @return the client response< collectionobjects common list>
112      */
113     public ClientResponse<CollectionobjectsCommonList> keywordSearch(String keywords) {
114         return collectionObjectProxy.keywordSearch(keywords);
115
116     }
117     
118     /**
119      * Read.
120      * 
121      * @param csid the csid
122      * 
123      * @return the client response< multipart input>
124      */
125     public ClientResponse<MultipartInput> read(String csid) {
126         return collectionObjectProxy.read(csid);
127     }
128
129     /**
130      * Creates the.
131      * 
132      * @param multipart the multipart
133      * 
134      * @return the client response< response>
135      */
136     public ClientResponse<Response> create(MultipartOutput multipart) {
137         return collectionObjectProxy.create(multipart);
138     }
139
140     /**
141      * Update.
142      * 
143      * @param csid the csid
144      * @param multipart the multipart
145      * 
146      * @return the client response< multipart input>
147      */
148     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
149         return collectionObjectProxy.update(csid, multipart);
150     }
151
152     /**
153      * Delete.
154      * 
155      * @param csid the csid
156      * 
157      * @return the client response< response>
158      */
159     public ClientResponse<Response> delete(String csid) {
160         return collectionObjectProxy.delete(csid);
161     }
162 }