1 package org.lsst.ccs.localdb.statusdb.server;
2
3 import java.io.Serializable;
4 import java.util.HashMap;
5 import java.util.List;
6 import java.util.Map;
7
8 import javax.xml.bind.annotation.XmlElement;
9 import javax.xml.bind.annotation.XmlElementWrapper;
10 import javax.xml.bind.annotation.XmlRootElement;
11
12 import org.lsst.ccs.localdb.statusdb.model.DataDesc;
13
14
15
16
17
18
19 @XmlRootElement(name = "datachannel")
20 public class DataChannel implements Serializable {
21
22
23
24
25 private static final long serialVersionUID = -9154127909107314678L;
26
27 public DataChannel(DataDesc desc) {
28 this.desc = desc;
29 path = desc.getPath();
30 setId(desc.getId());
31 }
32
33 public DataChannel() {
34 }
35
36 protected DataDesc desc;
37
38 protected long id;
39
40 @XmlElement
41 public long getId() {
42 return id;
43 }
44
45 public void setId(long id) {
46 this.id = id;
47 }
48
49
50
51
52
53
54 @XmlElement(name = "pathelement")
55 @XmlElementWrapper
56 protected String[] path;
57
58
59
60 Map<String, String> metadata = new HashMap<String, String>();
61
62
63
64 public String[] getPath() {
65 return path;
66 }
67
68 public String getPathAsString() {
69 return DataDesc.encodePath(path);
70 }
71
72 public Map<String, String> getMetadata() {
73 return metadata;
74 }
75
76 public DataDesc getDataDescription() {
77 return desc;
78 }
79
80 @XmlElement(name = "metadata")
81 List<HashMapEntry4XML> getMetadataList() {
82 return HashMapEntry4XML.marshal(metadata);
83 }
84
85
86
87 @XmlRootElement(name="datachannels")
88 public static class DataChannelList {
89 @XmlElement(name="datachannel")
90 public List<DataChannel> list;
91
92 public DataChannelList(List<DataChannel> list) {
93 this.list = list;
94 }
95
96 public DataChannelList() {}
97 }
98
99 }