]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
535b092e52fe4d800a6c471dcab7e8977eca8d90
[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.jboss.resteasy.plugins.providers.multipart.MultipartInput;
29 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
30
31 /**
32  *
33  * MultipartRemoteServiceContextFactory creates a service context for
34  * a service processing multipart messages
35  *
36  */
37 public class MultipartServiceContextFactory
38         implements ServiceContextFactory<MultipartInput, MultipartOutput> {
39
40     /** The Constant self. */
41     final private static MultipartServiceContextFactory self = new MultipartServiceContextFactory();
42
43     /**
44      * Instantiates a new multipart service context factory.
45      */
46     private MultipartServiceContextFactory() {} // private constructor as part of the singleton pattern
47
48     /**
49      * Gets the.
50      * 
51      * @return the multipart service context factory
52      */
53     public static MultipartServiceContextFactory get() {
54         return self;
55     }
56
57     /* (non-Javadoc)
58      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String)
59      */
60     @Override
61     public ServiceContext<MultipartInput, MultipartOutput> createServiceContext(String serviceName) throws Exception {
62         MultipartServiceContext ctx = new MultipartServiceContextImpl(serviceName);
63         return ctx;
64     }
65
66     /* (non-Javadoc)
67      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object)
68      */
69     @Override
70     public ServiceContext<MultipartInput, MultipartOutput> createServiceContext(String serviceName,
71                 MultipartInput input) throws Exception {
72         MultipartServiceContext ctx = new MultipartServiceContextImpl(serviceName, input);
73         return ctx;
74     }
75         
76     /* (non-Javadoc)
77      * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object, javax.ws.rs.core.MultivaluedMap)
78      */
79     @Override
80     public ServiceContext<MultipartInput, MultipartOutput> createServiceContext(String serviceName,
81                 MultipartInput input, 
82                 MultivaluedMap<String, String> queryParams)
83                         throws Exception {
84         ServiceContext<MultipartInput, MultipartOutput> ctx = new MultipartServiceContextImpl(serviceName,
85                         input,
86                         queryParams);
87         return ctx;
88     }
89     
90     /* (non-Javadoc)
91      * @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)
92      */
93     @Override
94     public ServiceContext<MultipartInput, MultipartOutput> createServiceContext(String serviceName, 
95                 MultipartInput input,
96                 MultivaluedMap<String, String> queryParams,
97                 String documentType,
98                 String entityName) throws Exception {
99         return this.createServiceContext(serviceName, input, queryParams);
100     }
101 }