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