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