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 private boolean jaxWsService = false;
32
33 @Override
34 public String getType() {
35 return KsbApiConstants.ServiceTypes.SOAP;
36 }
37
38
39
40
41
42 public boolean isJaxWsService() {
43 return this.jaxWsService;
44 }
45
46
47
48
49
50 public void setJaxWsService(boolean jaxWsService) {
51 this.jaxWsService = jaxWsService;
52 }
53
54
55
56
57
58 public SoapServiceDefinition() {
59 setBusSecurity(true);
60 }
61
62 public String getServiceInterface() {
63 return this.serviceInterface;
64 }
65
66 public void setServiceInterface(final String serviceInterface) {
67 this.serviceInterface = serviceInterface;
68 }
69
70 @Override
71 public void validate() {
72
73 super.validate();
74
75 if (getServiceInterface() == null) {
76
77 Class<?> cur = getService().getClass();
78 while(cur.getInterfaces().length == 0 && (cur.getSuperclass() != Object.class || cur.getSuperclass() != null)) {
79 cur = cur.getSuperclass();
80 }
81
82 if (cur.getInterfaces().length == 0) {
83 throw new ConfigurationException(getService().getClass().getName() +
84 " Service needs to implement interface to be exported as SOAP service");
85 }
86 setServiceInterface(cur.getInterfaces()[0].getName());
87 } else {
88
89
90 try {
91 if (!Class.forName(getServiceInterface()).isInterface()) {
92 throw new ConfigurationException(
93 "Service interface class '" + getServiceInterface() + "' must be a Java interface");
94 }
95 } catch (ClassNotFoundException e) {
96 throw new ConfigurationException(
97 "Service interface class '" + getServiceInterface() + "' could not be found in the classpath");
98 }
99 }
100
101 }
102
103 @Override
104 protected ServiceConfiguration configure() {
105 return SoapServiceConfiguration.fromServiceDefinition(this);
106 }
107
108
109 }