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