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.capture.admin.api;
23
24 import org.opencastproject.util.HashtableAdapter;
25
26 import java.util.Properties;
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 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
34
35
36
37
38 @XmlType(name = "agent-state-update", namespace = "http://capture.admin.opencastproject.org")
39 @XmlRootElement(name = "agent-state-update", namespace = "http://capture.admin.opencastproject.org")
40 @XmlAccessorType(XmlAccessType.FIELD)
41 public class AgentStateUpdate {
42
43
44
45
46 @XmlElement(name = "name")
47 private String name;
48
49
50
51
52
53
54
55 @XmlElement(name = "state")
56 private String state;
57
58
59
60
61 @XmlElement(name = "url")
62 private String url;
63
64
65
66
67
68 @XmlElement(name = "time-since-last-update")
69 private Long timeSinceLastUpdate;
70
71 @XmlJavaTypeAdapter(HashtableAdapter.class)
72 private Properties capabilities;
73
74
75
76
77 public AgentStateUpdate() {
78 }
79
80
81
82
83
84
85
86 public AgentStateUpdate(Agent a) {
87 name = a.getName();
88 state = a.getState();
89 url = a.getUrl();
90 capabilities = a.getCapabilities();
91 timeSinceLastUpdate = System.currentTimeMillis() - a.getLastHeardFrom();
92 }
93
94
95
96
97
98
99 public String getName() {
100 return name;
101 }
102
103
104
105
106
107
108 public String getUrl() {
109 return url;
110 }
111
112
113
114
115
116
117 public String getState() {
118 return state;
119 }
120
121
122
123
124
125
126 public Properties getCapabilities() {
127 return capabilities;
128 }
129
130
131
132
133
134
135 public Long getTimeSinceLastUpdate() {
136 return timeSinceLastUpdate;
137 }
138
139 }