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