Skip to content

Package: KapuaMessage

KapuaMessage

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.message;
14:
15: import org.eclipse.kapua.message.device.data.KapuaDataMessage;
16: import org.eclipse.kapua.message.xml.MessageXmlRegistry;
17: import org.eclipse.kapua.model.id.KapuaId;
18: import org.eclipse.kapua.model.id.KapuaIdAdapter;
19:
20: import javax.xml.bind.annotation.XmlAccessType;
21: import javax.xml.bind.annotation.XmlAccessorType;
22: import javax.xml.bind.annotation.XmlElement;
23: import javax.xml.bind.annotation.XmlRootElement;
24: import javax.xml.bind.annotation.XmlSeeAlso;
25: import javax.xml.bind.annotation.XmlType;
26: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
27: import java.util.Date;
28: import java.util.UUID;
29:
30: /**
31: * {@link KapuaMessage} definition.
32: *
33: * @param <C> channel type
34: * @param <P> payload type
35: * @since 1.0.0
36: */
37: @XmlRootElement(name = "message")
38: @XmlAccessorType(XmlAccessType.PROPERTY)
39: @XmlType(propOrder = { //
40: "id", //
41: "scopeId", //
42: "deviceId", //
43: "clientId", //
44: "receivedOn", //
45: "sentOn", //
46: "capturedOn", //
47: "position", //
48: "channel", //
49: "payload", //
50: }, factoryClass = MessageXmlRegistry.class, factoryMethod = "newKapuaMessage")
51: @XmlSeeAlso(KapuaDataMessage.class)
52: public interface KapuaMessage<C extends KapuaChannel, P extends KapuaPayload> extends Message<C, P> {
53:
54: /**
55: * Gets the unique identifier.
56: *
57: * @return The unique identifier.
58: * @since 1.0.0
59: */
60: @XmlElement(name = "id")
61: UUID getId();
62:
63: /**
64: * Sets the unique identifier.
65: *
66: * @param id The unique identifier.
67: * @since 1.0.0
68: */
69: void setId(UUID id);
70:
71: /**
72: * Gets the scope {@link KapuaId}
73: *
74: * @return The scope {@link KapuaId}
75: * @since 1.0.0
76: */
77: @XmlElement(name = "scopeId")
78: @XmlJavaTypeAdapter(KapuaIdAdapter.class)
79: KapuaId getScopeId();
80:
81: /**
82: * Sets the scope {@link KapuaId}.
83: *
84: * @param scopeId The scope {@link KapuaId}
85: * @since 1.0.0
86: */
87: void setScopeId(KapuaId scopeId);
88:
89: /**
90: * Gets the device client identifier
91: *
92: * @return The device client identifier.
93: * @since 1.0.0
94: */
95: @XmlElement(name = "clientId")
96: String getClientId();
97:
98: /**
99: * Sets the device client identifier.
100: *
101: * @param clientId The device client identifier.
102: * @since 1.0.0
103: */
104: void setClientId(String clientId);
105:
106: /**
107: * Gets the device {@link KapuaId}.
108: *
109: * @return The device {@link KapuaId}.
110: * @since 1.0.0
111: */
112: @XmlElement(name = "deviceId")
113: @XmlJavaTypeAdapter(KapuaIdAdapter.class)
114: KapuaId getDeviceId();
115:
116: /**
117: * Sets the device {@link KapuaId}.
118: *
119: * @param deviceId The device {@link KapuaId}.
120: * @since 1.0.0
121: */
122: void setDeviceId(KapuaId deviceId);
123:
124: /**
125: * Gets the received on {@link Date}.
126: *
127: * @return The received on {@link Date}.
128: * @since 1.0.0
129: */
130: @XmlElement(name = "receivedOn")
131: Date getReceivedOn();
132:
133: /**
134: * Sets the received on {@link Date}.
135: *
136: * @param receivedOn The received on {@link Date}.
137: * @since 1.0.0
138: */
139: void setReceivedOn(Date receivedOn);
140:
141: /**
142: * Gets the sent on {@link Date}.
143: *
144: * @return The sent on {@link Date}.
145: * @since 1.0.0
146: */
147: @XmlElement(name = "sentOn")
148: Date getSentOn();
149:
150: /**
151: * Sets the sent on {@link Date}.
152: *
153: * @param sentOn The sent on {@link Date}.
154: * @since 1.0.0
155: */
156: void setSentOn(Date sentOn);
157:
158: /**
159: * Gets the captured on {@link Date}.
160: *
161: * @return The captured on {@link Date}.
162: * @since 1.0.0
163: */
164: @XmlElement(name = "capturedOn")
165: Date getCapturedOn();
166:
167: /**
168: * Sets the captured on {@link Date}.
169: *
170: * @param capturedOn The captured on {@link Date}.
171: * @since 1.0.0
172: */
173: void setCapturedOn(Date capturedOn);
174:
175: /**
176: * Gets the device {@link KapuaPosition}.
177: *
178: * @return The device {@link KapuaPosition}.
179: * @since 1.0.0
180: */
181: @XmlElement(name = "position")
182: KapuaPosition getPosition();
183:
184: /**
185: * Sets the device {@link KapuaPosition}.
186: *
187: * @param position The device {@link KapuaPosition}.
188: * @since 1.0.0
189: */
190: void setPosition(KapuaPosition position);
191:
192: /**
193: * Gets the {@link KapuaChannel}.
194: *
195: * @return The {@link KapuaChannel}.
196: * @since 1.0.0
197: */
198: @XmlElement(name = "channel")
199: C getChannel();
200:
201: /**
202: * Sets the {@link KapuaChannel}.
203: *
204: * @param semanticChannel The {@link KapuaChannel}.
205: * @since 1.0.0
206: */
207: void setChannel(C semanticChannel);
208:
209: /**
210: * Gets the {@link KapuaPayload}.
211: *
212: * @return The {@link KapuaPayload}.
213: * @since 1.0.0
214: */
215: @XmlElement(name = "payload")
216: P getPayload();
217:
218: /**
219: * Sets the {@link KapuaPayload}.
220: *
221: * @param payload The {@link KapuaPayload}.
222: * @since 1.0.0
223: */
224: void setPayload(P payload);
225:
226: }