1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.ksb.messaging;
18
19 import org.kuali.rice.ksb.service.KSBServiceLocator;
20 import org.springframework.beans.factory.InitializingBean;
21 import org.springframework.context.ApplicationContext;
22 import org.springframework.context.ApplicationContextAware;
23
24
25
26
27
28
29 public class KSBExporter implements InitializingBean, ApplicationContextAware {
30
31 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KSBExporter.class);
32
33 private ServiceDefinition serviceDefinition;
34 private boolean forceRefresh = false;
35 protected RemotedServiceRegistry remotedServiceRegistry;
36 protected ApplicationContext applicationContext;
37
38 public void afterPropertiesSet() throws Exception {
39 this.getServiceDefinition().validate();
40 if ( LOG.isInfoEnabled() ) {
41 LOG.info("Attempting to expose service with localServiceName '" + this.getServiceDefinition().getLocalServiceName() + "' and QName '" + this.getServiceDefinition().getServiceName() + "'");
42 }
43 if(getRemotedServiceRegistry()!=null) {
44 getRemotedServiceRegistry().registerService(this.getServiceDefinition(), this.isForceRefresh());
45 } else if ( KSBServiceLocator.getServiceDeployer() != null ) {
46 KSBServiceLocator.getServiceDeployer().registerService(this.getServiceDefinition(), this.isForceRefresh());
47 } else {
48 ((RemotedServiceRegistry)applicationContext.getBean( KSBServiceLocator.REMOTED_SERVICE_REGISTRY )).registerService(this.getServiceDefinition(), this.isForceRefresh());
49 }
50 }
51
52 public ServiceDefinition getServiceDefinition() {
53 return serviceDefinition;
54 }
55
56 public void setServiceDefinition(ServiceDefinition serviceDefinition) {
57 this.serviceDefinition = serviceDefinition;
58 }
59
60 public boolean isForceRefresh() {
61 return forceRefresh;
62 }
63
64 public void setForceRefresh(boolean forceRefresh) {
65 this.forceRefresh = forceRefresh;
66 }
67
68
69
70
71 public RemotedServiceRegistry getRemotedServiceRegistry() {
72 return this.remotedServiceRegistry;
73 }
74
75
76
77
78 public void setRemotedServiceRegistry(
79 RemotedServiceRegistry remotedServiceRegistry) {
80 this.remotedServiceRegistry = remotedServiceRegistry;
81 }
82
83 public void setApplicationContext(ApplicationContext applicationContext) {
84 this.applicationContext = applicationContext;
85 }
86
87 }