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