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