2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 package org.collectionspace.services.common.context;
26 import java.io.IOException;
27 import java.io.InputStream;
29 import org.collectionspace.services.client.PoxPayloadIn;
30 import org.collectionspace.services.client.PoxPayloadOut;
31 import org.dom4j.Element;
32 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
33 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
34 import org.dom4j.Document;
37 * RemoteServiceContext is used to encapsulate the service context of a
38 * remotely invokable service
40 public interface MultipartServiceContext
41 extends RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> {
44 * Get input parts as received over the wire from service consumer
48 public PoxPayloadIn getInput();
51 * setInput is used to set request input before starting to
56 public void setInput(PoxPayloadIn input);
59 * Get output parts to send over the wire to service consumer
63 public PoxPayloadOut getOutput();
66 * Set output parts to send over the wire to service consumer
70 public void setOutput(PoxPayloadOut output);
73 * getInputPart returns the input part object for given label and clazz
75 * @param clazz class of the object
79 public Object getInputPart(String label, Class<?> clazz) throws IOException;
82 * Gets the input part.
84 * @param label the label
85 * @return the input part
86 * @throws IOException Signals that an I/O exception has occurred.
88 public Object getInputPart(String label) throws IOException;
91 * getInputPartAsString returns the input part with given label in the string form
96 public String getInputPartAsString(String label) throws IOException;
99 * getInputPartAsStream returns input part as stream for given label
102 * @throws IOException
104 public InputStream getInputPartAsStream(String label) throws IOException;
106 * addOutputPart adds given XML part with given label and content type to output
109 * @param contentType media type
111 public void addOutputPart(String label, Element doc, String contentType) throws Exception;
113 public void setRespositoryWorkspaceName(String workspaceName);