Coverage Report - org.kuali.rice.ksb.api.bus.support.JavaServiceDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
JavaServiceDefinition
41%
7/17
0%
0/6
1.429
JavaServiceDefinition$Constants
0%
0/1
N/A
1.429
JavaServiceDefinition$Elements
0%
0/1
N/A
1.429
 
 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.api.bus.support;
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.rice.core.util.ClassLoaderUtils;
 23  
 import org.kuali.rice.ksb.api.KsbApiConstants;
 24  
 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
 25  
 
 26  
 /**
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  2
 public class JavaServiceDefinition extends AbstractServiceDefinition {
 30  
         
 31  2
         private List<String> serviceInterfaces = new ArrayList<String>();
 32  
 
 33  
         @Override
 34  
         public String getType() {
 35  2
                 return KsbApiConstants.ServiceTypes.HTTP_INVOKER;
 36  
         }
 37  
         
 38  
         public List<String> getServiceInterfaces() {
 39  2
                 return this.serviceInterfaces;
 40  
         }
 41  
         public void setServiceInterfaces(List<String> serviceInterfaces) {
 42  1
                 this.serviceInterfaces = serviceInterfaces;
 43  1
         }
 44  
         public void setServiceInterface(String serviceName) {
 45  0
             this.serviceInterfaces.add(serviceName);
 46  0
         }
 47  
         public String getServiceInterface() {
 48  0
                 return this.serviceInterfaces.get(0);
 49  
         }
 50  
         
 51  
         @Override
 52  
         public void validate() {
 53  0
                 super.validate();
 54  0
                 if (this.serviceInterfaces == null || this.serviceInterfaces.isEmpty()) {
 55  0
                         Class<?>[] interfaces = ClassLoaderUtils.getInterfacesToProxy(getService(), null, null);
 56  0
                         for (Class<?> serviceInterfaceClass : interfaces) {
 57  0
                             this.serviceInterfaces.add(serviceInterfaceClass.getName());
 58  
                         }
 59  
                 }
 60  0
         }
 61  
         
 62  
         protected ServiceConfiguration configure() {
 63  0
                 return JavaServiceConfiguration.fromServiceDefinition(this);
 64  
         }
 65  
         
 66  
         /**
 67  
      * Defines some internal constants used on this class.
 68  
      */
 69  0
     static class Constants {
 70  
             final static String ROOT_ELEMENT_NAME = "javaServiceDefinition";
 71  
         final static String TYPE_NAME = "JavaServiceDefinitionType";
 72  
     }
 73  
 
 74  
     /**
 75  
      * A private class which exposes constants which define the XML element names to use
 76  
      * when this object is marshalled to XML.
 77  
      */
 78  0
     protected static class Elements {
 79  
             protected final static String SERVICE_INTERFACES = "serviceInterfaces";
 80  
             protected final static String SERVICE_INTERFACE = "serviceInterface";
 81  
     }
 82  
         
 83  
 }