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 java.util.ArrayList; |
20 | |
import java.util.List; |
21 | |
|
22 | |
import org.kuali.rice.core.util.ClassLoaderUtils; |
23 | |
import org.kuali.rice.ksb.api.KsbApiConstants; |
24 | |
import org.kuali.rice.ksb.api.bus.ServiceConfiguration; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 2 | public class JavaServiceDefinition extends AbstractServiceDefinition { |
30 | |
|
31 | 2 | private List<String> serviceInterfaces = new ArrayList<String>(); |
32 | |
|
33 | |
@Override |
34 | |
public String getType() { |
35 | 2 | return KsbApiConstants.ServiceTypes.HTTP_INVOKER; |
36 | |
} |
37 | |
|
38 | |
public List<String> getServiceInterfaces() { |
39 | 2 | return this.serviceInterfaces; |
40 | |
} |
41 | |
public void setServiceInterfaces(List<String> serviceInterfaces) { |
42 | 1 | this.serviceInterfaces = serviceInterfaces; |
43 | 1 | } |
44 | |
public void setServiceInterface(String serviceName) { |
45 | 0 | this.serviceInterfaces.add(serviceName); |
46 | 0 | } |
47 | |
public String getServiceInterface() { |
48 | 0 | return this.serviceInterfaces.get(0); |
49 | |
} |
50 | |
|
51 | |
@Override |
52 | |
public void validate() { |
53 | 0 | super.validate(); |
54 | 0 | if (this.serviceInterfaces == null || this.serviceInterfaces.isEmpty()) { |
55 | 0 | Class<?>[] interfaces = ClassLoaderUtils.getInterfacesToProxy(getService(), null, null); |
56 | 0 | for (Class<?> serviceInterfaceClass : interfaces) { |
57 | 0 | this.serviceInterfaces.add(serviceInterfaceClass.getName()); |
58 | |
} |
59 | |
} |
60 | 0 | } |
61 | |
|
62 | |
protected ServiceConfiguration configure() { |
63 | 0 | return JavaServiceConfiguration.fromServiceDefinition(this); |
64 | |
} |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | 0 | static class Constants { |
70 | |
final static String ROOT_ELEMENT_NAME = "javaServiceDefinition"; |
71 | |
final static String TYPE_NAME = "JavaServiceDefinitionType"; |
72 | |
} |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | 0 | protected static class Elements { |
79 | |
protected final static String SERVICE_INTERFACES = "serviceInterfaces"; |
80 | |
protected final static String SERVICE_INTERFACE = "serviceInterface"; |
81 | |
} |
82 | |
|
83 | |
} |