Coverage Report - org.kuali.rice.ksb.messaging.serviceconnectors.BusLocalConnector
 
Classes in this File Line Coverage Branch Coverage Complexity
BusLocalConnector
0%
0/8
0%
0/2
1.667
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.ksb.messaging.serviceconnectors;
 17  
 
 18  
 import javax.xml.namespace.QName;
 19  
 
 20  
 import org.kuali.rice.ksb.api.KsbApiServiceLocator;
 21  
 import org.kuali.rice.ksb.api.bus.Endpoint;
 22  
 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
 23  
 import org.kuali.rice.ksb.messaging.bam.BAMClientProxy;
 24  
 
 25  
 
 26  
 /**
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 public class BusLocalConnector extends AbstractServiceConnector {
 31  
 
 32  
         public BusLocalConnector(final ServiceConfiguration serviceConfiguration) {
 33  0
                 super(serviceConfiguration);
 34  0
         }
 35  
 
 36  
         private Object getServiceProxy(Object service) {
 37  0
                 return BAMClientProxy.wrap(service, getServiceConfiguration());
 38  
         }
 39  
         
 40  
         public Object getService() {
 41  0
                 QName serviceName = getServiceConfiguration().getServiceName();
 42  0
                 Endpoint localServiceEndpoint = KsbApiServiceLocator.getServiceBus().getLocalEndpoint(serviceName);
 43  0
                 if (localServiceEndpoint == null) {
 44  0
                         throw new IllegalStateException("Failed to locate a local service with the name: " + serviceName);
 45  
                 }
 46  0
             return getServiceProxy(KsbApiServiceLocator.getServiceBus().getLocalEndpoint(serviceName));
 47  
         }
 48  
         
 49  
 }