Coverage Report - org.kuali.rice.ksb.messaging.JavaServiceDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
JavaServiceDefinition
0%
0/26
0%
0/16
2.833
 
 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 java.util.ArrayList;
 20  
 import java.util.List;
 21  
 
 22  
 import org.kuali.rice.core.resourceloader.ContextClassLoaderProxy;
 23  
 
 24  
 /**
 25  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 26  
  */
 27  0
 public class JavaServiceDefinition extends ServiceDefinition {
 28  
 
 29  
         private static final long serialVersionUID = -5267226536419496719L;
 30  
         
 31  0
         private List<String> serviceInterfaces = new ArrayList<String>();
 32  
 
 33  
         public List<String> getServiceInterfaces() {
 34  0
                 return this.serviceInterfaces;
 35  
         }
 36  
         public void setServiceInterfaces(List<String> serviceInterfaces) {
 37  0
                 this.serviceInterfaces = serviceInterfaces;
 38  0
         }
 39  
         public void setServiceInterface(String serviceName) {
 40  0
             this.serviceInterfaces.add(serviceName);
 41  0
         }
 42  
         public String getServiceInterface() {
 43  0
                 return this.serviceInterfaces.get(0);
 44  
         }
 45  
         
 46  
         @Override
 47  
         public void validate() {
 48  0
                 super.validate();
 49  0
                 if (this.serviceInterfaces == null || this.serviceInterfaces.isEmpty()) {
 50  0
                         Class[] interfaces = ContextClassLoaderProxy.getInterfacesToProxy(getService());
 51  0
                         for (Class serviceInterfaceClass : interfaces) {
 52  0
                             this.serviceInterfaces.add(serviceInterfaceClass.getName());
 53  
                         }
 54  
                 }
 55  0
                 if (getBusSecurity() == null) {
 56  0
                         setBusSecurity(true);
 57  
                 }
 58  0
         }
 59  
         
 60  
         @Override
 61  
         public boolean isSame(ServiceDefinition serviceDefinition) {
 62  0
                 boolean same = serviceDefinition instanceof JavaServiceDefinition;
 63  0
                 if (! same) {
 64  0
                         return same;
 65  
                 }
 66  0
                 same = super.isSame(serviceDefinition);
 67  0
                 if (! same) {
 68  0
                         return same;
 69  
                 }
 70  0
                 for (String interfaceName : this.serviceInterfaces) {
 71  0
                         if (! ((JavaServiceDefinition)serviceDefinition).getServiceInterfaces().contains(interfaceName)) {
 72  0
                                 return false;
 73  
                         }
 74  
                 }
 75  0
                 return same;
 76  
         }
 77  
         
 78  
         
 79  
 }