1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.ksb.api.registry;
17
18 import java.io.Serializable;
19 import java.util.Collection;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlAnyElement;
24 import javax.xml.bind.annotation.XmlElement;
25 import javax.xml.bind.annotation.XmlRootElement;
26 import javax.xml.bind.annotation.XmlType;
27
28 import org.kuali.rice.core.api.CoreConstants;
29 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
30 import org.kuali.rice.core.api.mo.ModelBuilder;
31 import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
32 import org.w3c.dom.Element;
33
34
35
36
37
38
39
40
41
42 @XmlRootElement(name = ServiceDescriptor.Constants.ROOT_ELEMENT_NAME)
43 @XmlAccessorType(XmlAccessType.NONE)
44 @XmlType(name = ServiceDescriptor.Constants.TYPE_NAME, propOrder = {
45 ServiceDescriptor.Elements.ID,
46 ServiceDescriptor.Elements.DESCRIPTOR,
47 CoreConstants.CommonElements.VERSION_NUMBER,
48 CoreConstants.CommonElements.FUTURE_ELEMENTS
49 })
50 public final class ServiceDescriptor extends AbstractDataTransferObject
51 implements ServiceDescriptorContract
52 {
53
54 private static final long serialVersionUID = 4555599272613878634L;
55
56 @XmlElement(name = Elements.ID, required = false)
57 private final String id;
58
59 @XmlElement(name = Elements.DESCRIPTOR, required = false)
60 private final String descriptor;
61
62 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
63 private final Long versionNumber;
64
65 @SuppressWarnings("unused")
66 @XmlAnyElement
67 private final Collection<Element> _futureElements = null;
68
69
70
71
72
73 private ServiceDescriptor() {
74 this.id = null;
75 this.descriptor = null;
76 this.versionNumber = null;
77 }
78
79 private ServiceDescriptor(Builder builder) {
80 this.id = builder.getId();
81 this.descriptor = builder.getDescriptor();
82 this.versionNumber = builder.getVersionNumber();
83 }
84
85 @Override
86 public String getId() {
87 return this.id;
88 }
89
90 @Override
91 public String getDescriptor() {
92 return this.descriptor;
93 }
94
95 @Override
96 public Long getVersionNumber() {
97 return this.versionNumber;
98 }
99
100
101
102
103
104
105 public final static class Builder
106 implements Serializable, ModelBuilder, ServiceDescriptorContract
107 {
108
109 private static final long serialVersionUID = 4439417051199359358L;
110
111 private String id;
112 private String descriptor;
113 private Long versionNumber;
114
115 private Builder() {
116 }
117
118 public static Builder create() {
119 return new Builder();
120 }
121
122 public static Builder create(ServiceDescriptorContract contract) {
123 if (contract == null) {
124 throw new IllegalArgumentException("contract was null");
125 }
126 Builder builder = create();
127 builder.setId(contract.getId());
128 builder.setDescriptor(contract.getDescriptor());
129 builder.setVersionNumber(contract.getVersionNumber());
130 return builder;
131 }
132
133 public ServiceDescriptor build() {
134 return new ServiceDescriptor(this);
135 }
136
137 @Override
138 public String getId() {
139 return this.id;
140 }
141
142 @Override
143 public String getDescriptor() {
144 return this.descriptor;
145 }
146
147 @Override
148 public Long getVersionNumber() {
149 return this.versionNumber;
150 }
151
152 public void setId(String id) {
153 this.id = id;
154 }
155
156 public void setDescriptor(String descriptor) {
157 this.descriptor = descriptor;
158 }
159
160 public void setVersionNumber(Long versionNumber) {
161 this.versionNumber = versionNumber;
162 }
163
164 }
165
166
167
168
169
170
171 static class Constants {
172
173 final static String ROOT_ELEMENT_NAME = "serviceDescriptor";
174 final static String TYPE_NAME = "ServiceDescriptorType";
175 }
176
177
178
179
180
181
182 static class Elements {
183
184 final static String ID = "id";
185 final static String DESCRIPTOR = "descriptor";
186
187 }
188
189 }
190