]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
0b8df0143172a206d3468ca3d9c3c83d5f249714
[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 import javax.ws.rs.core.UriInfo;
28
29 import org.collectionspace.services.client.PoxPayloadIn;
30 import org.collectionspace.services.client.PoxPayloadOut;
31 import org.collectionspace.services.common.ResourceMap;
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(
83                 String serviceName,
84                 PoxPayloadIn input,
85                 ResourceMap resourceMap,
86                 UriInfo uriInfo)
87                         throws Exception {
88         ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = new MultipartServiceContextImpl(serviceName,
89                         input,
90                         resourceMap,
91                         uriInfo);
92         return ctx;
93     }
94     
95     /* (non-Javadoc)
96      * @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)
97      */
98     @Override
99     public ServiceContext<PoxPayloadIn, PoxPayloadOut> createServiceContext(
100                 String serviceName, 
101                 PoxPayloadIn input,
102                 ResourceMap resourceMap,
103                 UriInfo uriInfo,
104                 String documentType,
105                 String entityName) throws Exception {
106         return this.createServiceContext(serviceName, input, resourceMap, uriInfo);
107     }
108 }