Coverage Report - org.kuali.rice.ksb.api.bus.support.SoapServiceDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
SoapServiceDefinition
0%
0/27
0%
0/12
2.25
 
 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.config.ConfigurationException;
 19  
 import org.kuali.rice.ksb.api.KsbApiConstants;
 20  
 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
 21  
 
 22  
 /**
 23  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 24  
  * @since 0.9
 25  
  */
 26  
 public class SoapServiceDefinition extends AbstractServiceDefinition {
 27  
 
 28  
         private static final long serialVersionUID = 5892163789061959602L;
 29  
 
 30  
         private String serviceInterface;
 31  0
         private boolean jaxWsService = false;
 32  
 
 33  
         @Override
 34  
         public String getType() {
 35  0
                 return KsbApiConstants.ServiceTypes.SOAP;
 36  
         }
 37  
 
 38  
         
 39  
         /**
 40  
          * @return the jaxWsService
 41  
          */
 42  
         public boolean isJaxWsService() {
 43  0
                 return this.jaxWsService;
 44  
         }
 45  
 
 46  
         /**
 47  
          * @param jaxWsService
 48  
          *            define service as jaxws service.
 49  
          */
 50  
         public void setJaxWsService(boolean jaxWsService) {
 51  0
                 this.jaxWsService = jaxWsService;
 52  0
         }
 53  
 
 54  
         /**
 55  
          * Constructor that sets the bus security (i.e. digital signing) to FALSE by
 56  
          * default.
 57  
          */
 58  0
         public SoapServiceDefinition() {
 59  0
                 setBusSecurity(true);
 60  0
         }
 61  
 
 62  
         public String getServiceInterface() {
 63  0
                 return this.serviceInterface;
 64  
         }
 65  
 
 66  
         public void setServiceInterface(final String serviceInterface) {
 67  0
                 this.serviceInterface = serviceInterface;
 68  0
         }
 69  
 
 70  
         @Override
 71  
         public void validate() {
 72  
 
 73  0
                 super.validate();
 74  
                 // if interface is null grab the first one and use it
 75  0
                 if (getServiceInterface() == null) {
 76  
                         //gets the basic cases - not all
 77  0
             Class<?> cur = getService().getClass();
 78  0
             while(cur.getInterfaces().length == 0 && (cur.getSuperclass() != Object.class || cur.getSuperclass() != null)) {
 79  0
                 cur = cur.getSuperclass();
 80  
             }
 81  
 
 82  0
             if (cur.getInterfaces().length == 0) {
 83  0
                                 throw new ConfigurationException(getService().getClass().getName() +
 84  
                                                 " Service needs to implement interface to be exported as SOAP service");
 85  
                         }
 86  0
                         setServiceInterface(cur.getInterfaces()[0].getName());
 87  0
                 } else {
 88  
                         // Validate that the service interface set is an actual interface
 89  
                         // that exists
 90  
                         try {
 91  0
                                 if (!Class.forName(getServiceInterface()).isInterface()) {
 92  0
                                         throw new ConfigurationException(
 93  
                                                         "Service interface class '" + getServiceInterface() + "' must be a Java interface"); 
 94  
                                 }
 95  0
                         } catch (ClassNotFoundException e) {
 96  0
                                 throw new ConfigurationException(
 97  
                                                 "Service interface class '" + getServiceInterface() + "' could not be found in the classpath");
 98  0
                         }
 99  
                 }
 100  
 
 101  0
         }
 102  
         
 103  
         @Override
 104  
         protected ServiceConfiguration configure() {
 105  0
                 return SoapServiceConfiguration.fromServiceDefinition(this);
 106  
         }
 107  
 
 108  
         
 109  
 }