01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package edu.iu.uis.eden.messaging.serviceconnectors;
17:
18: import org.kuali.rice.security.credentials.CredentialsSource;
19: import org.springframework.util.Assert;
20:
21: import edu.iu.uis.eden.messaging.BusClientFailureProxy;
22: import edu.iu.uis.eden.messaging.ServiceInfo;
23: import edu.iu.uis.eden.messaging.bam.BAMClientProxy;
24:
25: /**
26: * Abstract implementation of the ServiceConnector that holds the ServiceInfo
27: * and the CredentialsSource as well as providing convenience proxy methods.
28: *
29: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
30: * @version $Revision: 1.2.16.1.6.1 $ $Date: 2007/10/17 20:32:04 $
31: * @since 0.9
32: *
33: */
34: public abstract class AbstractServiceConnector implements
35: ServiceConnector {
36:
37: /**
38: * Maintains the information about the service. This should never be null.
39: */
40: private ServiceInfo serviceInfo;
41:
42: /**
43: * Maintains the credentials needed by the service. This may be null.
44: */
45: private CredentialsSource credentialsSource;
46:
47: public AbstractServiceConnector(final ServiceInfo serviceInfo) {
48: Assert.notNull(serviceInfo, "serviceInfo cannot be null");
49: this .serviceInfo = serviceInfo;
50: }
51:
52: public ServiceInfo getServiceInfo() {
53: return this .serviceInfo;
54: }
55:
56: public void setServiceInfo(final ServiceInfo serviceInfo) {
57: this .serviceInfo = serviceInfo;
58: }
59:
60: public void setCredentialsSource(
61: final CredentialsSource credentialsSource) {
62: this .credentialsSource = credentialsSource;
63: }
64:
65: protected CredentialsSource getCredentialsSource() {
66: return this .credentialsSource;
67: }
68:
69: protected Object getServiceProxyWithFailureMode(
70: final Object service, final ServiceInfo serviceInfo) {
71: Object bamWrappedClientProxy = BAMClientProxy.wrap(service,
72: serviceInfo);
73: return BusClientFailureProxy.wrap(bamWrappedClientProxy,
74: serviceInfo);
75: }
76: }
|