1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.messaging.serviceconnectors;
17
18 import javax.xml.namespace.QName;
19
20 import org.kuali.rice.ksb.api.KsbApiServiceLocator;
21 import org.kuali.rice.ksb.api.bus.Endpoint;
22 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
23 import org.kuali.rice.ksb.messaging.bam.BAMClientProxy;
24
25
26
27
28
29
30 public class BusLocalConnector extends AbstractServiceConnector {
31
32 public BusLocalConnector(final ServiceConfiguration serviceConfiguration) {
33 super(serviceConfiguration);
34 }
35
36 private Object getServiceProxy(Object service) {
37 return BAMClientProxy.wrap(service, getServiceConfiguration());
38 }
39
40 public Object getService() {
41 QName serviceName = getServiceConfiguration().getServiceName();
42 Endpoint localServiceEndpoint = KsbApiServiceLocator.getServiceBus().getLocalEndpoint(serviceName);
43 if (localServiceEndpoint == null) {
44 throw new IllegalStateException("Failed to locate a local service with the name: " + serviceName);
45 }
46 return getServiceProxy(KsbApiServiceLocator.getServiceBus().getLocalEndpoint(serviceName));
47 }
48
49 }