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.api.KsbApiServiceLocator; |
20 | |
import org.kuali.rice.ksb.api.bus.ServiceBus; |
21 | |
import org.kuali.rice.ksb.api.cache.RiceCacheAdministrator; |
22 | |
import org.kuali.rice.ksb.cache.RiceCacheAdministratorImpl; |
23 | |
import org.springframework.beans.factory.FactoryBean; |
24 | |
import org.springframework.beans.factory.InitializingBean; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class RiceCacheExporterFactoryBean implements FactoryBean<RiceCacheAdministrator>, InitializingBean { |
34 | |
|
35 | |
private String serviceName; |
36 | |
private RiceCacheAdministratorImpl cache; |
37 | |
protected ServiceBus serviceBus; |
38 | |
|
39 | |
public RiceCacheAdministrator getObject() { |
40 | 0 | return cache; |
41 | |
} |
42 | |
|
43 | |
public Class<RiceCacheAdministrator> getObjectType() { |
44 | 0 | return RiceCacheAdministrator.class; |
45 | |
} |
46 | |
|
47 | |
public boolean isSingleton() { |
48 | 0 | return true; |
49 | |
} |
50 | |
|
51 | |
public String getServiceName() { |
52 | 0 | return this.serviceName; |
53 | |
} |
54 | |
|
55 | |
public void setServiceName(String serviceName) { |
56 | 0 | this.serviceName = serviceName; |
57 | 0 | } |
58 | |
|
59 | |
public void afterPropertiesSet() throws Exception { |
60 | 0 | if (cache == null) { |
61 | 0 | cache = new RiceCacheAdministratorImpl(); |
62 | 0 | cache.setServiceName(this.getServiceName()); |
63 | 0 | cache.setForceRegistryRefresh(false); |
64 | 0 | if (serviceBus == null) { |
65 | 0 | serviceBus = KsbApiServiceLocator.getServiceBus(); |
66 | |
} |
67 | 0 | cache.setServiceBus(serviceBus); |
68 | 0 | cache.start(); |
69 | |
} |
70 | 0 | } |
71 | |
|
72 | |
public void setServiceBus(ServiceBus serviceBus) { |
73 | 0 | this.serviceBus = serviceBus; |
74 | 0 | } |
75 | |
|
76 | |
} |