Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

Expand All @@ -22,7 +22,7 @@ the DSA architecture, please visit

## Link Development

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

## Acknowledgements

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'java'
apply plugin: 'maven'

group 'org.iot.dsa'
version '0.20.0'
version '0.21.0'

sourceCompatibility = 1.6
targetCompatibility = 1.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,15 @@ protected void encodeChild(ApiObject child, MessageWriter writer) {
map.put("$is", "node");
}
if (child.isAction()) {
ActionSpec action = child.getAction();
e = cacheMap.remove("$invokable");
if (e != null) {
map.put("$invokable", e);
} else {
if (child.isAdmin()) {
map.put("$invokable", DSPermission.CONFIG.toString());
} else if (!child.isReadOnly()) {
} else if (child.isReadOnly()) {
map.put("$invokable", DSPermission.READ.toString());
} else {
map.put("$invokable", DSPermission.WRITE.toString());
}
}
Expand Down Expand Up @@ -308,13 +309,15 @@ private void encodeTargetAction(ApiObject object, MessageWriter writer) {
if (e == null) {
if (object.isAdmin()) {
encode("$invokable", DSPermission.CONFIG.toString(), writer);
} else if (!object.isReadOnly()) {
} else if (object.isReadOnly()) {
encode("$invokable", DSPermission.READ.toString(), writer);
} else {
encode("$invokable", DSPermission.WRITE.toString(), writer);
}
} else {
encode("$invokable", e, writer);
}
e = cacheMap.remove("params");
e = cacheMap.remove("$params");
if (e == null) {
DSList list = new DSList();
Iterator<DSMap> params = action.getParameters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class DS1ConnectionInit extends DSNode {
///////////////////////////////////////////////////////////////////////////

private static final String DSA_VERSION = "1.1.2";
//private static final String[] SUPPORTED_FORMATS = new String[]{"msgpack", "json"};
private static final String[] SUPPORTED_FORMATS = new String[]{"json"};
private static final String[] SUPPORTED_FORMATS = new String[]{"msgpack", "json"};
//private static final String[] SUPPORTED_FORMATS = new String[]{"json"};

private String BROKER_REQ = "Broker Request";
private String BROKER_RES = "Broker Response";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ protected void doRecvMessage() throws IOException {
DSIReader reader = getReader();
switch (reader.next()) {
case BEGIN_MAP:
getTransport().beginRecvMessage();
processEnvelope(reader);
getTransport().endRecvMessage();
break;
case END_MAP:
case END_LIST:
Expand Down
31 changes: 11 additions & 20 deletions dslink-core/src/main/java/org/iot/dsa/dslink/DSLink.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
package org.iot.dsa.dslink;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.net.URL;
import java.util.Arrays;
import java.util.Calendar;
Expand All @@ -24,18 +19,14 @@
import org.iot.dsa.util.DSException;

/**
* Represents an upstream connection, a node tree, and manages the lifecycle of both.
* The root node of a DSLink node tree with two children: main and sys. Main is the root
* data or application node. Sys contains various services such as the upstream
* connection to the broker.
* <p>
* This node can and should be used as the main class for launching a link process.
* <p>
* <p>
* Links are created with DSLinkConfig object. The main method of the process is responsible for
* creating the config. After instantiation, the link should call DSLink.run()
* <p>
* <p>
* <p>
* Lifecycle:
* <p>
* TODO
* This node can be subclassed for specialized purposes. Testing uses a version that
* creates a special transport for sending and receiving messages to itself.
*
* @author Aaron Hansen
*/
Expand Down Expand Up @@ -199,8 +190,8 @@ public static DSLink load(DSLinkConfig config) {
}

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

/**
* Calls starts, waits the stableDelay, then calls stable. Does not return until this node is
* stopped.
* Calls starts, waits the stableDelay, then calls stable. Does not return until
* this node is stopped.
*/
public void run() {
synchronized (this) {
Expand Down
26 changes: 13 additions & 13 deletions dslink-core/src/main/java/org/iot/dsa/node/DSMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ public class DSMetadata {
// Constants
///////////////////////////////////////////////////////////////////////////

public static final String BOOLEAN_RANGE = "$booleanRange";
public static final String DESCRIPTION = "$description";
public static final String DECIMAL_PLACES = "$decimalPlaces";
public static final String DEFAULT = "$default";
public static final String DISPLAY_NAME = "$displayName";
public static final String EDITOR = "$editor";
public static final String ENUM_RANGE = "$enumRange";
public static final String NAME = "$name";
public static final String MAX_VALUE = "$maxValue";
public static final String MIN_VALUE = "$minValue";
public static final String PLACEHOLDER = "$placeholder";
public static final String TYPE = "$type";
public static final String UNIT = "$unit";
public static final String BOOLEAN_RANGE = "booleanRange";
public static final String DESCRIPTION = "description";
public static final String DECIMAL_PLACES = "decimalPlaces";
public static final String DEFAULT = "default";
public static final String DISPLAY_NAME = "displayName";
public static final String EDITOR = "editor";
public static final String ENUM_RANGE = "enumRange";
public static final String NAME = "name";
public static final String MAX_VALUE = "maxValue";
public static final String MIN_VALUE = "minValue";
public static final String PLACEHOLDER = "placeholder";
public static final String TYPE = "type";
public static final String UNIT = "unit";

//public static final String EDITOR_DATE = "date";
//public static final String EDITOR_DATE_RANGE = "daterange";
Expand Down
Loading