2 * CollectionObjectClient.java
4 * {Purpose of This Class}
6 * {Other Notes Relating to This Class (Optional)}
9 * $LastChangedRevision: $
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:
16 * http://www.collectionspace.org
17 * http://wiki.collectionspace.org
19 * Copyright (C) 2009 {Contributing Institution}
21 * Licensed under the Educational Community License (ECL), Version 2.0.
22 * You may not use this file except in compliance with this License.
24 * You may obtain a copy of the ECL 2.0 License at
25 * https://source.collectionspace.org/collection-space/LICENSE.txt
27 package org.collectionspace.services.client;
29 import javax.ws.rs.core.Response;
31 import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
32 import org.collectionspace.services.common.authorityref.AuthorityRefList;
33 //import org.collectionspace.services.common.context.ServiceContext;
34 //import org.collectionspace.services.common.query.IQueryManager;
35 import org.jboss.resteasy.client.ProxyFactory;
36 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
37 import org.jboss.resteasy.client.ClientResponse;
38 import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
39 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
40 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
41 import org.jboss.resteasy.spi.ResteasyProviderFactory;
43 import org.slf4j.Logger;
46 * The Class CollectionObjectClient.
47 * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
49 public class CollectionObjectClient extends AbstractServiceClientImpl {
51 /** The collection object proxy. */
52 private CollectionObjectProxy collectionObjectProxy;
55 * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
58 public String getServicePathComponent() {
59 return "collectionobjects";
63 * Instantiates a new collection object client.
65 public CollectionObjectClient() {
66 ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
67 RegisterBuiltin.register(factory);
72 public CollectionSpaceProxy getProxy() {
73 return this.collectionObjectProxy;
79 public void setProxy() {
81 collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
82 getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
84 collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
92 * @see org.collectionspace.services.client.CollectionObjectProxy#readList()
93 * @return the client response< collectionobjects common list>
95 public ClientResponse<CollectionobjectsCommonList> readList() {
96 return collectionObjectProxy.readList();
101 // public ClientResponse<CollectionobjectsCommonList> readList(String pageSize,
102 // String pageNumber) {
103 // return collectionObjectProxy.readList(pageSize, pageNumber);
109 * This is an intentionally empty method that is used for performance test
110 * to get a rough time estimate of the client to server response-request overhead.
112 * @see org.collectionspace.services.client.CollectionObjectProxy#roundtrip()
113 * @return the client response< response>
115 public ClientResponse<Response> roundtrip(int ms) {
116 getLogger().debug(">>>>Roundtrip start.");
117 ClientResponse<Response> result = collectionObjectProxy.roundtrip(ms);
118 getLogger().debug("<<<<Roundtrip stop.");
125 * @param keywords the keywords
127 * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
128 * @return the client response< collectionobjects common list>
130 public ClientResponse<CollectionobjectsCommonList> keywordSearch(String keywords) {
131 return collectionObjectProxy.keywordSearch(keywords);
138 * @param csid the csid
140 * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
141 * @return the client response< multipart input>
143 public ClientResponse<MultipartInput> read(String csid) {
144 return collectionObjectProxy.read(csid);
150 * @see org.collectionspace.services.client.CollectionObjectProxy#getAuthorityRefs(java.lang.String)
152 public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
153 return collectionObjectProxy.getAuthorityRefs(csid);
160 * @param multipart the multipart
162 * @see org.collectionspace.services.client.CollectionObjectProxy#create()
163 * @return the client response< response>
165 public ClientResponse<Response> create(MultipartOutput multipart) {
166 return collectionObjectProxy.create(multipart);
172 * @param csid the csid
173 * @param multipart the multipart
175 * @see org.collectionspace.services.client.CollectionObjectProxy#update()
176 * @return the client response< multipart input>
178 public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
179 return collectionObjectProxy.update(csid, multipart);
185 * @param csid the csid
187 * @see org.collectionspace.services.client.CollectionObjectProxy#delete()
188 * @return the client response< response>
191 public ClientResponse<Response> delete(String csid) {
192 return collectionObjectProxy.delete(csid);