1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
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 | |
|
24 | |
|
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 | |
|
41 | |
|
42 | |
public boolean isJaxWsService() { |
43 | 0 | return this.jaxWsService; |
44 | |
} |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
public void setJaxWsService(boolean jaxWsService) { |
51 | 0 | this.jaxWsService = jaxWsService; |
52 | 0 | } |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
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 | |
|
75 | 0 | if (getServiceInterface() == null) { |
76 | |
|
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 | |
|
89 | |
|
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 | |
} |