Coverage Report - org.kuali.rice.ksb.messaging.KSBExporter
 
Classes in this File Line Coverage Branch Coverage Complexity
KSBExporter
0%
0/23
0%
0/6
1.375
 
 1  
 /*
 2  
  * Copyright 2005-2008 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.service.KSBServiceLocator;
 20  
 import org.springframework.beans.factory.InitializingBean;
 21  
 import org.springframework.context.ApplicationContext;
 22  
 import org.springframework.context.ApplicationContextAware;
 23  
 
 24  
 /**
 25  
  * Used from Spring to register service definitions from an already configured and started KSB.
 26  
  * 
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  0
 public class KSBExporter implements InitializingBean, ApplicationContextAware {
 30  
         
 31  0
         private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KSBExporter.class);
 32  
         
 33  
         private ServiceDefinition serviceDefinition;
 34  0
         private boolean forceRefresh = false;
 35  
         protected RemotedServiceRegistry remotedServiceRegistry;
 36  
         protected ApplicationContext applicationContext;
 37  
 
 38  
         public void afterPropertiesSet() throws Exception {
 39  0
                 this.getServiceDefinition().validate();
 40  0
                 if ( LOG.isInfoEnabled() ) {
 41  0
                         LOG.info("Attempting to expose service with localServiceName '" + this.getServiceDefinition().getLocalServiceName() + "' and QName '" + this.getServiceDefinition().getServiceName() + "'");
 42  
                 }
 43  0
                 if(getRemotedServiceRegistry()!=null) {
 44  0
                         getRemotedServiceRegistry().registerService(this.getServiceDefinition(), this.isForceRefresh());
 45  0
                 } else if ( KSBServiceLocator.getServiceDeployer() != null ) {
 46  0
                         KSBServiceLocator.getServiceDeployer().registerService(this.getServiceDefinition(), this.isForceRefresh());
 47  
                 } else {
 48  0
                         ((RemotedServiceRegistry)applicationContext.getBean( KSBServiceLocator.REMOTED_SERVICE_REGISTRY )).registerService(this.getServiceDefinition(), this.isForceRefresh());
 49  
                 }
 50  0
         }
 51  
 
 52  
         public ServiceDefinition getServiceDefinition() {
 53  0
                 return serviceDefinition;
 54  
         }
 55  
 
 56  
         public void setServiceDefinition(ServiceDefinition serviceDefinition) {
 57  0
                 this.serviceDefinition = serviceDefinition;
 58  0
         }
 59  
 
 60  
         public boolean isForceRefresh() {
 61  0
                 return forceRefresh;
 62  
         }
 63  
 
 64  
         public void setForceRefresh(boolean forceRefresh) {
 65  0
                 this.forceRefresh = forceRefresh;
 66  0
         }
 67  
 
 68  
         /**
 69  
          * @return the remotedServiceRegistry
 70  
          */
 71  
         public RemotedServiceRegistry getRemotedServiceRegistry() {
 72  0
                 return this.remotedServiceRegistry;
 73  
         }
 74  
 
 75  
         /**
 76  
          * @param remotedServiceRegistry the remotedServiceRegistry to set
 77  
          */
 78  
         public void setRemotedServiceRegistry(
 79  
                         RemotedServiceRegistry remotedServiceRegistry) {
 80  0
                 this.remotedServiceRegistry = remotedServiceRegistry;
 81  0
         }
 82  
 
 83  
         public void setApplicationContext(ApplicationContext applicationContext) {
 84  0
                 this.applicationContext = applicationContext;
 85  0
         }
 86  
 
 87  
 }