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 | 0 | public class KSBExporter implements InitializingBean, ApplicationContextAware { |
30 | |
|
31 | 0 | private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KSBExporter.class); |
32 | |
|
33 | |
private ServiceDefinition serviceDefinition; |
34 | 0 | private boolean forceRefresh = false; |
35 | |
protected RemotedServiceRegistry remotedServiceRegistry; |
36 | |
protected ApplicationContext applicationContext; |
37 | |
|
38 | |
public void afterPropertiesSet() throws Exception { |
39 | 0 | this.getServiceDefinition().validate(); |
40 | 0 | if ( LOG.isInfoEnabled() ) { |
41 | 0 | LOG.info("Attempting to expose service with localServiceName '" + this.getServiceDefinition().getLocalServiceName() + "' and QName '" + this.getServiceDefinition().getServiceName() + "'"); |
42 | |
} |
43 | 0 | if(getRemotedServiceRegistry()!=null) { |
44 | 0 | getRemotedServiceRegistry().registerService(this.getServiceDefinition(), this.isForceRefresh()); |
45 | 0 | } else if ( KSBServiceLocator.getServiceDeployer() != null ) { |
46 | 0 | KSBServiceLocator.getServiceDeployer().registerService(this.getServiceDefinition(), this.isForceRefresh()); |
47 | |
} else { |
48 | 0 | ((RemotedServiceRegistry)applicationContext.getBean( KSBServiceLocator.REMOTED_SERVICE_REGISTRY )).registerService(this.getServiceDefinition(), this.isForceRefresh()); |
49 | |
} |
50 | 0 | } |
51 | |
|
52 | |
public ServiceDefinition getServiceDefinition() { |
53 | 0 | return serviceDefinition; |
54 | |
} |
55 | |
|
56 | |
public void setServiceDefinition(ServiceDefinition serviceDefinition) { |
57 | 0 | this.serviceDefinition = serviceDefinition; |
58 | 0 | } |
59 | |
|
60 | |
public boolean isForceRefresh() { |
61 | 0 | return forceRefresh; |
62 | |
} |
63 | |
|
64 | |
public void setForceRefresh(boolean forceRefresh) { |
65 | 0 | this.forceRefresh = forceRefresh; |
66 | 0 | } |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
public RemotedServiceRegistry getRemotedServiceRegistry() { |
72 | 0 | return this.remotedServiceRegistry; |
73 | |
} |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
public void setRemotedServiceRegistry( |
79 | |
RemotedServiceRegistry remotedServiceRegistry) { |
80 | 0 | this.remotedServiceRegistry = remotedServiceRegistry; |
81 | 0 | } |
82 | |
|
83 | |
public void setApplicationContext(ApplicationContext applicationContext) { |
84 | 0 | this.applicationContext = applicationContext; |
85 | 0 | } |
86 | |
|
87 | |
} |