Coverage Report - org.kuali.rice.ksb.messaging.RiceCacheExporterFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
RiceCacheExporterFactoryBean
0%
0/19
0%
0/4
1.25
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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  
  * Returns a {@link RiceCacheAdministrator}.  Starts and registers this 
 28  
  * cache with the bus.
 29  
  * 
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
          * @return the remotedServiceRegistry
 74  
          */
 75  
         public RemotedServiceRegistry getRemotedServiceRegistry() {
 76  0
                 return this.remotedServiceRegistry;
 77  
         }
 78  
 
 79  
         /**
 80  
          * @param remotedServiceRegistry the remotedServiceRegistry to set
 81  
          */
 82  
         public void setRemotedServiceRegistry(
 83  
                         RemotedServiceRegistry remotedServiceRegistry) {
 84  0
                 this.remotedServiceRegistry = remotedServiceRegistry;
 85  0
         }
 86  
 
 87  
 }