| 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 java.util.ArrayList; |
| 19 | |
import java.util.Collections; |
| 20 | |
import java.util.List; |
| 21 | |
|
| 22 | |
import javax.xml.bind.annotation.XmlAccessType; |
| 23 | |
import javax.xml.bind.annotation.XmlAccessorType; |
| 24 | |
import javax.xml.bind.annotation.XmlElement; |
| 25 | |
import javax.xml.bind.annotation.XmlElementWrapper; |
| 26 | |
import javax.xml.bind.annotation.XmlRootElement; |
| 27 | |
import javax.xml.bind.annotation.XmlType; |
| 28 | |
|
| 29 | |
@XmlRootElement(name = JavaServiceConfiguration.Constants.ROOT_ELEMENT_NAME) |
| 30 | |
@XmlAccessorType(XmlAccessType.NONE) |
| 31 | |
@XmlType(name = JavaServiceConfiguration.Constants.TYPE_NAME, propOrder = { |
| 32 | |
JavaServiceConfiguration.Elements.SERVICE_INTERFACES |
| 33 | |
}) |
| 34 | 0 | public final class JavaServiceConfiguration extends AbstractServiceConfiguration { |
| 35 | |
|
| 36 | |
private static final long serialVersionUID = -4226512121638441108L; |
| 37 | |
|
| 38 | |
@XmlElementWrapper(name = Elements.SERVICE_INTERFACES, required = false) |
| 39 | |
@XmlElement(name = Elements.SERVICE_INTERFACE, required = false) |
| 40 | |
private final List<String> serviceInterfaces; |
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
|
| 45 | |
private JavaServiceConfiguration() { |
| 46 | 0 | super(); |
| 47 | 0 | this.serviceInterfaces = null; |
| 48 | 0 | } |
| 49 | |
|
| 50 | |
|
| 51 | |
private JavaServiceConfiguration(Builder builder) { |
| 52 | 0 | super(builder); |
| 53 | 0 | this.serviceInterfaces = builder.getServiceInterfaces() == null ? null : new ArrayList<String>(builder.getServiceInterfaces()); |
| 54 | 0 | } |
| 55 | |
|
| 56 | |
public static JavaServiceConfiguration fromServiceDefinition(JavaServiceDefinition javaServiceDefinition) { |
| 57 | 0 | return Builder.create(javaServiceDefinition).build(); |
| 58 | |
} |
| 59 | |
|
| 60 | |
public List<String> getServiceInterfaces() { |
| 61 | 0 | if (this.serviceInterfaces == null) { |
| 62 | 0 | return Collections.emptyList(); |
| 63 | |
} |
| 64 | 0 | return Collections.unmodifiableList(this.serviceInterfaces); |
| 65 | |
} |
| 66 | |
|
| 67 | 0 | public static final class Builder extends AbstractServiceConfiguration.Builder<JavaServiceConfiguration> { |
| 68 | |
|
| 69 | |
private static final long serialVersionUID = 4300659121377259098L; |
| 70 | |
|
| 71 | |
private List<String> serviceInterfaces; |
| 72 | |
|
| 73 | |
public List<String> getServiceInterfaces() { |
| 74 | 0 | return serviceInterfaces; |
| 75 | |
} |
| 76 | |
|
| 77 | |
public void setServiceInterfaces(List<String> serviceInterfaces) { |
| 78 | 0 | if (serviceInterfaces == null) { |
| 79 | 0 | this.serviceInterfaces = null; |
| 80 | |
} else { |
| 81 | 0 | this.serviceInterfaces = new ArrayList<String>(serviceInterfaces); |
| 82 | |
} |
| 83 | 0 | } |
| 84 | |
|
| 85 | 0 | private Builder() {} |
| 86 | |
|
| 87 | |
public static Builder create() { |
| 88 | 0 | return new Builder(); |
| 89 | |
} |
| 90 | |
|
| 91 | |
public static Builder create(JavaServiceDefinition javaServiceDefinition) { |
| 92 | 0 | Builder builder = create(); |
| 93 | 0 | builder.copyServiceDefinitionProperties(javaServiceDefinition); |
| 94 | 0 | builder.setServiceInterfaces(javaServiceDefinition.getServiceInterfaces()); |
| 95 | 0 | return builder; |
| 96 | |
} |
| 97 | |
|
| 98 | |
@Override |
| 99 | |
public JavaServiceConfiguration build() { |
| 100 | 0 | return new JavaServiceConfiguration(this); |
| 101 | |
} |
| 102 | |
|
| 103 | |
} |
| 104 | |
|
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | 0 | static class Constants { |
| 109 | |
final static String ROOT_ELEMENT_NAME = "javaServiceConfiguration"; |
| 110 | |
final static String TYPE_NAME = "JavaServiceConfigurationType"; |
| 111 | |
} |
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
|
| 116 | |
|
| 117 | 0 | static class Elements { |
| 118 | |
protected final static String SERVICE_INTERFACES = "serviceInterfaces"; |
| 119 | |
protected final static String SERVICE_INTERFACE = "serviceInterface"; |
| 120 | |
} |
| 121 | |
|
| 122 | |
} |