1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  package org.kuali.rice.ksb.messaging;
18  
19  import org.kuali.rice.core.config.ConfigurationException;
20  
21  
22  
23  
24  
25  public class SOAPServiceDefinition extends ServiceDefinition {
26  
27  	private static final long serialVersionUID = 5892163789061959602L;
28  
29  	private String serviceInterface;
30  	private boolean jaxWsService = false;
31  
32  	
33  
34  
35  	public boolean isJaxWsService() {
36  		return this.jaxWsService;
37  	}
38  
39  	
40  
41  
42  
43  	public void setJaxWsService(boolean jaxWsService) {
44  		this.jaxWsService = jaxWsService;
45  	}
46  
47  	
48  
49  
50  
51  	public SOAPServiceDefinition() {
52  		super(Boolean.TRUE);
53  	}
54  
55  	public String getServiceInterface() {
56  		return this.serviceInterface;
57  	}
58  
59  	public void setServiceInterface(final String serviceInterface) {
60  		this.serviceInterface = serviceInterface;
61  	}
62  
63  	@Override
64  	public void validate() {
65  
66  		super.validate();
67  		
68  		if (getServiceInterface() == null) {
69  			if (this.getService().getClass().getInterfaces().length == 0) {
70  				throw new ConfigurationException(
71  						"Service needs to implement interface to be exported as SOAP service");
72  			}
73  			setServiceInterface(this.getService().getClass().getInterfaces()[0]
74  					.getName());
75  		} else {
76  			
77  			
78  			try {
79  				if (!Class.forName(getServiceInterface()).isInterface()) {
80  					throw new ConfigurationException(
81  							"Service interface class '" + getServiceInterface() + "' must be a Java interface"); 
82  				}
83  			} catch (ClassNotFoundException e) {
84  				throw new ConfigurationException(
85  						"Service interface class '" + getServiceInterface() + "' could not be found in the classpath");
86  			}
87  		}
88  		if (getBusSecurity() == null) {
89  			setBusSecurity(false);
90  		}
91  	}
92  
93  	@Override
94  	public boolean isSame(final ServiceDefinition serviceDefinition) {
95  		boolean same = super.isSame(serviceDefinition)
96  				&& serviceDefinition instanceof SOAPServiceDefinition;
97  		if (!same) {
98  			return same;
99  		}
100 		return ((SOAPServiceDefinition) serviceDefinition)
101 				.getServiceInterface().equals(this.getServiceInterface());
102 	}
103 }