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.PayloadOutputPart;
30 import org.collectionspace.services.client.PoxPayloadIn;
31 import org.collectionspace.services.client.PoxPayloadOut;
32 import org.dom4j.Element;
33 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
34 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
35 import org.dom4j.Document;
38 * RemoteServiceContext is used to encapsulate the service context of a
39 * remotely invokable service
41 public interface MultipartServiceContext
42 extends RemoteServiceContext<PoxPayloadIn, PoxPayloadOut> {
45 * Get input parts as received over the wire from service consumer
49 public PoxPayloadIn getInput();
52 * setInput is used to set request input before starting to
57 public void setInput(PoxPayloadIn input);
60 * Get output parts to send over the wire to service consumer
64 public PoxPayloadOut getOutput();
67 * Set output parts to send over the wire to service consumer
71 public void setOutput(PoxPayloadOut output);
74 * getInputPart returns the input part object for given label and clazz
76 * @param clazz class of the object
80 public Object getInputPart(String label, Class<?> clazz) throws IOException;
83 * Gets the input part.
85 * @param label the label
86 * @return the input part
87 * @throws IOException Signals that an I/O exception has occurred.
89 public Object getInputPart(String label) throws IOException;
92 * getInputPartAsString returns the input part with given label in the string form
97 public String getInputPartAsString(String label) throws IOException;
100 * getInputPartAsStream returns input part as stream for given label
103 * @throws IOException
105 public InputStream getInputPartAsStream(String label) throws IOException;
107 * addOutputPart adds given XML part with given label and content type to output
110 * @param contentType media type
112 public void addOutputPart(String label, Element doc, String contentType) throws Exception;
114 public void addOutputPart(PayloadOutputPart outputPart) throws Exception;
116 public void setRespositoryWorkspaceName(String workspaceName);