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
33 * A factory for creating RemoteServiceContext objects.
\r
35 public class RemoteServiceContextFactory<IT, OT>
\r
36 implements ServiceContextFactory<IT, OT>{
\r
38 // create a Factory singleton
\r
39 /** The Constant self. */
\r
40 final private static RemoteServiceContextFactory self = new RemoteServiceContextFactory();
\r
43 * Instantiates a new remote service context factory.
\r
45 private RemoteServiceContextFactory() {} // private constructor
\r
50 * @return the remote service context factory
\r
52 public static RemoteServiceContextFactory get() {
\r
57 * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String)
\r
60 public ServiceContext<IT, OT> createServiceContext(String serviceName) throws Exception {
\r
61 RemoteServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName);
\r
66 * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object)
\r
69 public ServiceContext<IT, OT> createServiceContext(String serviceName,
\r
70 IT theInput) throws Exception {
\r
71 RemoteServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName, theInput);
\r
76 * @see org.collectionspace.services.common.context.ServiceContextFactory#createServiceContext(java.lang.String, java.lang.Object, javax.ws.rs.core.MultivaluedMap)
\r
79 public ServiceContext<IT, OT> createServiceContext(
\r
82 MultivaluedMap<String, String> queryParams) throws Exception {
\r
83 ServiceContext<IT, OT> ctx = new RemoteServiceContextImpl<IT, OT>(serviceName,
\r
91 public ServiceContext<IT, OT> createServiceContext(String serviceName,
\r
93 MultivaluedMap<String, String> queryParams,
\r
94 String documentType,
\r
95 String entityName) throws Exception {
\r
96 ServiceContext<IT, OT> ctx = createServiceContext(
\r
100 ctx.setDocumentType(documentType); //persistence unit
\r
101 ctx.setProperty(ServiceContextProperties.ENTITY_NAME, entityName);
\r