1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.opencastproject.serviceregistry.api;
23
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
27
28 import javax.xml.bind.annotation.XmlAccessType;
29 import javax.xml.bind.annotation.XmlAccessorType;
30 import javax.xml.bind.annotation.XmlElement;
31 import javax.xml.bind.annotation.XmlRootElement;
32 import javax.xml.bind.annotation.XmlType;
33
34
35
36
37 @XmlAccessorType(XmlAccessType.NONE)
38 @XmlType(name = "services", namespace = "http://serviceregistry.opencastproject.org")
39 @XmlRootElement(name = "services", namespace = "http://serviceregistry.opencastproject.org")
40 public class JaxbServiceRegistrationList {
41
42 @XmlElement(name = "service")
43 protected List<JaxbServiceRegistration> registrations = new ArrayList<JaxbServiceRegistration>();
44
45 public JaxbServiceRegistrationList() {
46 }
47
48 public JaxbServiceRegistrationList(JaxbServiceRegistration registration) {
49 this.registrations.add(registration);
50 }
51
52 public JaxbServiceRegistrationList(Collection<JaxbServiceRegistration> registrations) {
53 for (JaxbServiceRegistration stat : registrations)
54 this.registrations.add((JaxbServiceRegistration) stat);
55 }
56
57
58
59
60 public List<JaxbServiceRegistration> getRegistrations() {
61 return registrations;
62 }
63
64
65
66
67
68 public void setStats(List<JaxbServiceRegistration> registrations) {
69 this.registrations = registrations;
70 }
71
72 public void add(ServiceRegistration registration) {
73 if (registration instanceof JaxbServiceRegistration) {
74 registrations.add((JaxbServiceRegistration) registration);
75 } else {
76 throw new IllegalArgumentException("Service registrations must be an instance of JaxbServiceRegistration");
77 }
78 }
79 }