| 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 | 0 |  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 | 0 |                  return cache; | 
  | 40 |  |          } | 
  | 41 |  |   | 
  | 42 |  |          public Class getObjectType() { | 
  | 43 | 0 |                  return RiceCacheAdministrator.class; | 
  | 44 |  |          } | 
  | 45 |  |   | 
  | 46 |  |          public boolean isSingleton() { | 
  | 47 | 0 |                  return true; | 
  | 48 |  |          } | 
  | 49 |  |   | 
  | 50 |  |          public String getServiceName() { | 
  | 51 | 0 |              return this.serviceName; | 
  | 52 |  |          } | 
  | 53 |  |   | 
  | 54 |  |          public void setServiceName(String serviceName) { | 
  | 55 | 0 |              this.serviceName = serviceName; | 
  | 56 | 0 |          } | 
  | 57 |  |   | 
  | 58 |  |          public void afterPropertiesSet() throws Exception { | 
  | 59 | 0 |                  if (cache == null) { | 
  | 60 | 0 |                          cache = new RiceCacheAdministratorImpl(); | 
  | 61 | 0 |                          cache.setServiceName(this.getServiceName()); | 
  | 62 | 0 |                          cache.setForceRegistryRefresh(false); | 
  | 63 | 0 |                          if (remotedServiceRegistry == null) { | 
  | 64 | 0 |                                  remotedServiceRegistry = KSBServiceLocator.getServiceDeployer(); | 
  | 65 |  |                          } | 
  | 66 | 0 |                          cache.setRemotedServiceRegistry(remotedServiceRegistry); | 
  | 67 | 0 |                          cache.start(); | 
  | 68 |  |                  } | 
  | 69 | 0 |          } | 
  | 70 |  |           | 
  | 71 |  |   | 
  | 72 |  |           | 
  | 73 |  |   | 
  | 74 |  |   | 
  | 75 |  |          public RemotedServiceRegistry getRemotedServiceRegistry() { | 
  | 76 | 0 |                  return this.remotedServiceRegistry; | 
  | 77 |  |          } | 
  | 78 |  |   | 
  | 79 |  |           | 
  | 80 |  |   | 
  | 81 |  |   | 
  | 82 |  |          public void setRemotedServiceRegistry( | 
  | 83 |  |                          RemotedServiceRegistry remotedServiceRegistry) { | 
  | 84 | 0 |                  this.remotedServiceRegistry = remotedServiceRegistry; | 
  | 85 | 0 |          } | 
  | 86 |  |   | 
  | 87 |  |  } |