Coverage Report - org.kuali.rice.ksb.messaging.RiceCacheExporterFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
RiceCacheExporterFactoryBean
0%
0/18
0%
0/4
1.286
 
 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.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  
  * Returns a {@link RiceCacheAdministrator}.  Starts and registers this 
 29  
  * cache with the bus.
 30  
  * 
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
 }