2 * RemoteServiceContextFactory.java
\r
4 * {Purpose of This Class}
\r
6 * {Other Notes Relating to This Class (Optional)}
\r
9 * $LastChangedRevision: $
\r
10 * $LastChangedDate: $
\r
12 * This document is a part of the source code and related artifacts
\r
13 * for CollectionSpace, an open source collections management system
\r
14 * for museums and related institutions:
\r
16 * http://www.collectionspace.org
\r
17 * http://wiki.collectionspace.org
\r
19 * Copyright © 2009 {Contributing Institution}
\r
21 * Licensed under the Educational Community License (ECL), Version 2.0.
\r
22 * You may not use this file except in compliance with this License.
\r
24 * You may obtain a copy of the ECL 2.0 License at
\r
25 * https://source.collectionspace.org/collection-space/LICENSE.txt
\r
27 package org.collectionspace.services.common.context;
\r
29 import javax.ws.rs.core.MultivaluedMap;
\r
30 import javax.ws.rs.core.UriInfo;
\r
32 import org.collectionspace.services.common.ResourceMap;
\r
36 * A factory for creating RemoteServiceContext objects.
\r
38 public class RemoteServiceContextFactory<IT, OT>
\r
39 implements ServiceContextFactory<IT, OT>{
\r
41 // create a Factory singleton
\r
42 /** The Constant self. */
\r
43 final private static RemoteServiceContextFactory self = new RemoteServiceContextFactory();
\r
46 * Instantiates a new remote service context factory.
\r
48 private RemoteServiceContextFactory() {} // private constructor
\r
53 * @return the remote service context factory
\r
55 public static RemoteServiceContextFactory get() {
\r
60 * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String)
\r
63 public ServiceContext<IT, OT> createServiceContext(String serviceName, UriInfo uriInfo) throws Exception {
\r
64 RemoteServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName, uriInfo);
\r
69 * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object)
\r
72 public ServiceContext<IT, OT> createServiceContext(String serviceName,
\r
73 IT theInput, UriInfo uriInfo) throws Exception {
\r
74 RemoteServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName, theInput, uriInfo);
\r
79 * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object, javax.ws.rs.core.MultivaluedMap)
\r
82 public ServiceContext<IT, OT> createServiceContext(
\r
85 ResourceMap resourceMap,
\r
86 UriInfo uriInfo) throws Exception {
\r
87 ServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName,
\r
96 public ServiceContext<IT, OT> createServiceContext(String serviceName,
\r
98 ResourceMap resourceMap,
\r
100 String documentType,
\r
101 String entityName) throws Exception {
\r
102 ServiceContext<IT, OT> ctx = createServiceContext(
\r
107 ctx.setDocumentType(documentType); //persistence unit
\r
108 ctx.setProperty(ServiceContextProperties.ENTITY_NAME, entityName);
\r