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