Skip to content

Commit 3ea6eaa

Browse files
authored
0.21.0
- Update gradle - Fix parameter encoding when listing actions
2 parents 5c116f3 + 2b5c118 commit 3ea6eaa

File tree

12 files changed

+150
-185
lines changed

12 files changed

+150
-185
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
* Version: 0.0.0
44
* JDK 1.6 Compatibility is required.
5-
* [Developer Guide](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/DeveloperGuide)
5+
* [Developer Guide](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/)
66
* [Javadoc](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/)
77
* [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
88

@@ -22,7 +22,7 @@ the DSA architecture, please visit
2222

2323
## Link Development
2424

25-
Please read the [developer guide](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/DeveloperGuide).
25+
Please read the [developer guide](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/).
2626

2727
## Acknowledgements
2828

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'java'
22
apply plugin: 'maven'
33

44
group 'org.iot.dsa'
5-
version '0.20.0'
5+
version '0.21.0'
66

77
sourceCompatibility = 1.6
88
targetCompatibility = 1.6

dslink-core/src/main/java/com/acuity/iot/dsa/dslink/protocol/responder/DSInboundList.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,15 @@ protected void encodeChild(ApiObject child, MessageWriter writer) {
215215
map.put("$is", "node");
216216
}
217217
if (child.isAction()) {
218-
ActionSpec action = child.getAction();
219218
e = cacheMap.remove("$invokable");
220219
if (e != null) {
221220
map.put("$invokable", e);
222221
} else {
223222
if (child.isAdmin()) {
224223
map.put("$invokable", DSPermission.CONFIG.toString());
225-
} else if (!child.isReadOnly()) {
224+
} else if (child.isReadOnly()) {
225+
map.put("$invokable", DSPermission.READ.toString());
226+
} else {
226227
map.put("$invokable", DSPermission.WRITE.toString());
227228
}
228229
}
@@ -308,13 +309,15 @@ private void encodeTargetAction(ApiObject object, MessageWriter writer) {
308309
if (e == null) {
309310
if (object.isAdmin()) {
310311
encode("$invokable", DSPermission.CONFIG.toString(), writer);
311-
} else if (!object.isReadOnly()) {
312+
} else if (object.isReadOnly()) {
313+
encode("$invokable", DSPermission.READ.toString(), writer);
314+
} else {
312315
encode("$invokable", DSPermission.WRITE.toString(), writer);
313316
}
314317
} else {
315318
encode("$invokable", e, writer);
316319
}
317-
e = cacheMap.remove("params");
320+
e = cacheMap.remove("$params");
318321
if (e == null) {
319322
DSList list = new DSList();
320323
Iterator<DSMap> params = action.getParameters();

dslink-core/src/main/java/com/acuity/iot/dsa/dslink/protocol/v1/DS1ConnectionInit.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public class DS1ConnectionInit extends DSNode {
2929
///////////////////////////////////////////////////////////////////////////
3030

3131
private static final String DSA_VERSION = "1.1.2";
32-
//private static final String[] SUPPORTED_FORMATS = new String[]{"msgpack", "json"};
33-
private static final String[] SUPPORTED_FORMATS = new String[]{"json"};
32+
private static final String[] SUPPORTED_FORMATS = new String[]{"msgpack", "json"};
33+
//private static final String[] SUPPORTED_FORMATS = new String[]{"json"};
3434

3535
private String BROKER_REQ = "Broker Request";
3636
private String BROKER_RES = "Broker Response";

dslink-core/src/main/java/com/acuity/iot/dsa/dslink/protocol/v1/DS1Session.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ protected void doRecvMessage() throws IOException {
118118
DSIReader reader = getReader();
119119
switch (reader.next()) {
120120
case BEGIN_MAP:
121+
getTransport().beginRecvMessage();
121122
processEnvelope(reader);
123+
getTransport().endRecvMessage();
122124
break;
123125
case END_MAP:
124126
case END_LIST:

dslink-core/src/main/java/org/iot/dsa/dslink/DSLink.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
package org.iot.dsa.dslink;
22

3-
import java.io.File;
4-
import java.io.FileInputStream;
5-
import java.io.FileOutputStream;
6-
import java.io.FilenameFilter;
7-
import java.io.IOException;
8-
import java.io.InputStream;
3+
import java.io.*;
94
import java.net.URL;
105
import java.util.Arrays;
116
import java.util.Calendar;
@@ -24,18 +19,14 @@
2419
import org.iot.dsa.util.DSException;
2520

2621
/**
27-
* Represents an upstream connection, a node tree, and manages the lifecycle of both.
22+
* The root node of a DSLink node tree with two children: main and sys. Main is the root
23+
* data or application node. Sys contains various services such as the upstream
24+
* connection to the broker.
2825
* <p>
26+
* This node can and should be used as the main class for launching a link process.
2927
* <p>
30-
* <p>
31-
* Links are created with DSLinkConfig object. The main method of the process is responsible for
32-
* creating the config. After instantiation, the link should call DSLink.run()
33-
* <p>
34-
* <p>
35-
* <p>
36-
* Lifecycle:
37-
* <p>
38-
* TODO
28+
* This node can be subclassed for specialized purposes. Testing uses a version that
29+
* creates a special transport for sending and receiving messages to itself.
3930
*
4031
* @author Aaron Hansen
4132
*/
@@ -199,8 +190,8 @@ public static DSLink load(DSLinkConfig config) {
199190
}
200191

201192
/**
202-
* This is a convenience for DSLink.load(new DSLinkConfig(args)).run() and can be used as the
203-
* the main class for any link. Use DSLink.shutdown() to stop running.
193+
* This is a convenience for DSLink.load(new DSLinkConfig(args)).run() and should be
194+
* used as the the main class for any link. Use DSLink.shutdown() to stop running.
204195
*/
205196
public static void main(String[] args) {
206197
try {
@@ -213,8 +204,8 @@ public static void main(String[] args) {
213204
}
214205

215206
/**
216-
* Calls starts, waits the stableDelay, then calls stable. Does not return until this node is
217-
* stopped.
207+
* Calls starts, waits the stableDelay, then calls stable. Does not return until
208+
* this node is stopped.
218209
*/
219210
public void run() {
220211
synchronized (this) {

dslink-core/src/main/java/org/iot/dsa/node/DSMetadata.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ public class DSMetadata {
1111
// Constants
1212
///////////////////////////////////////////////////////////////////////////
1313

14-
public static final String BOOLEAN_RANGE = "$booleanRange";
15-
public static final String DESCRIPTION = "$description";
16-
public static final String DECIMAL_PLACES = "$decimalPlaces";
17-
public static final String DEFAULT = "$default";
18-
public static final String DISPLAY_NAME = "$displayName";
19-
public static final String EDITOR = "$editor";
20-
public static final String ENUM_RANGE = "$enumRange";
21-
public static final String NAME = "$name";
22-
public static final String MAX_VALUE = "$maxValue";
23-
public static final String MIN_VALUE = "$minValue";
24-
public static final String PLACEHOLDER = "$placeholder";
25-
public static final String TYPE = "$type";
26-
public static final String UNIT = "$unit";
14+
public static final String BOOLEAN_RANGE = "booleanRange";
15+
public static final String DESCRIPTION = "description";
16+
public static final String DECIMAL_PLACES = "decimalPlaces";
17+
public static final String DEFAULT = "default";
18+
public static final String DISPLAY_NAME = "displayName";
19+
public static final String EDITOR = "editor";
20+
public static final String ENUM_RANGE = "enumRange";
21+
public static final String NAME = "name";
22+
public static final String MAX_VALUE = "maxValue";
23+
public static final String MIN_VALUE = "minValue";
24+
public static final String PLACEHOLDER = "placeholder";
25+
public static final String TYPE = "type";
26+
public static final String UNIT = "unit";
2727

2828
//public static final String EDITOR_DATE = "date";
2929
//public static final String EDITOR_DATE_RANGE = "daterange";

0 commit comments

Comments
 (0)