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