]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
ba86262068e44e8628f6de074c75f265480b19d0
[tmp/jakarta-migration.git] /
1 /**
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:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
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.
23  */
24 package org.collectionspace.services.common.context;
25
26 import javax.ws.rs.core.MultivaluedMap;
27
28 import org.collectionspace.services.client.PoxPayloadIn;
29 import org.collectionspace.services.client.PoxPayloadOut;
30 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
31 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
32
33 /**
34  *
35  * MultipartRemoteServiceContextFactory creates a service context for
36  * a service processing multipart messages
37  *
38  */
39 public class MultipartServiceContextFactory
40         implements ServiceContextFactory<PoxPayloadIn, PoxPayloadOut> {
41
42     /** The Constant self. */
43     final private static MultipartServiceContextFactory self = new MultipartServiceContextFactory();
44
45     /**
46      * Instantiates a new multipart service context factory.
47      */
48     private MultipartServiceContextFactory() {} // private constructor as part of the singleton pattern
49
50     /**
51      * Gets the.
52      * 
53      * @return the multipart service context factory
54      */
55     public static MultipartServiceContextFactory get() {
56         return self;
57     }
58
59     /* (non-Javadoc)
60      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String)
61      */
62     @Override
63     public ServiceContext<PoxPayloadIn, PoxPayloadOut> createServiceContext(String serviceName) throws Exception {
64         MultipartServiceContext ctx = new MultipartServiceContextImpl(serviceName);
65         return ctx;
66     }
67
68     /* (non-Javadoc)
69      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object)
70      */
71     @Override
72     public ServiceContext<PoxPayloadIn, PoxPayloadOut> createServiceContext(String serviceName,
73                 PoxPayloadIn input) throws Exception {
74         MultipartServiceContext ctx = new MultipartServiceContextImpl(serviceName, input);
75         return ctx;
76     }
77         
78     /* (non-Javadoc)
79      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object, javax.ws.rs.core.MultivaluedMap)
80      */
81     @Override
82     public ServiceContext<PoxPayloadIn, PoxPayloadOut> createServiceContext(String serviceName,
83                 PoxPayloadIn input, 
84                 MultivaluedMap<String, String> queryParams)
85                         throws Exception {
86         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = new MultipartServiceContextImpl(serviceName,
87                         input,
88                         queryParams);
89         return ctx;
90     }
91     
92     /* (non-Javadoc)
93      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object, javax.ws.rs.core.MultivaluedMap, java.lang.String, java.lang.String)
94      */
95     @Override
96     public ServiceContext<PoxPayloadIn, PoxPayloadOut> createServiceContext(String serviceName, 
97                 PoxPayloadIn input,
98                 MultivaluedMap<String, String> queryParams,
99                 String documentType,
100                 String entityName) throws Exception {
101         return this.createServiceContext(serviceName, input, queryParams);
102     }
103 }