Skip to content

Commit f1bc178

Browse files
author
Aaron
committed
- DSInfo
- Hidden -> Private - Default on copy - DSStatusNode - DSEnabledNode - DSTimeRange
1 parent 80e3807 commit f1bc178

File tree

15 files changed

+693
-264
lines changed

15 files changed

+693
-264
lines changed

dslink-v2-poc/src/main/java/org/iot/dsa/dslink/poc/MainNode.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ public void getDynamicActions(DSInfo target, Collection<String> bucket) {
8989
}
9090

9191
@Override
92-
public ActionResult invoke(DSInfo action, DSInfo target, ActionInvocation invocation) {
92+
public ActionResult invoke(DSInfo action, DSInfo target, ActionInvocation request) {
9393
if (action == this.reset) {
9494
put(incrementingInt, DSElement.make(0));
95-
DSMap map = invocation.getParameters();
95+
DSMap map = request.getParameters();
9696
DSElement arg = null;
9797
if (map != null) {
98-
arg = invocation.getParameters().get("Arg");
98+
arg = request.getParameters().get("Arg");
9999
put("Message", arg);
100100
}
101101
clear();
@@ -108,7 +108,7 @@ public ActionResult invoke(DSInfo action, DSInfo target, ActionInvocation invoca
108108
.addResult(DSBool.TRUE)
109109
.addResult(DSLong.valueOf(1234));
110110
}
111-
return super.invoke(action, target, invocation);
111+
return super.invoke(action, target, request);
112112
}
113113

114114
/**

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/protocol/DSSession.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public boolean isRequesterAllowed() {
132132
}
133133

134134
@Override
135-
public void onChange(DSConnection connection) {
135+
public void onConnectionChange(DSConnection connection) {
136136
switch (connection.getConnectionState()) {
137137
case CONNECTED:
138138
onConnected();
Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,74 @@
1-
package com.acuity.iot.dsa.dslink.sys.cert;
2-
3-
import org.iot.dsa.node.DSInfo;
4-
import org.iot.dsa.node.DSString;
5-
import org.iot.dsa.node.DSValueNode;
6-
import org.iot.dsa.node.action.ActionInvocation;
7-
import org.iot.dsa.node.action.ActionResult;
8-
import org.iot.dsa.node.action.DSAction;
9-
10-
/**
11-
* @author Daniel Shapiro
12-
*/
13-
public class CertNode extends DSValueNode {
14-
15-
private static final String VALUE = "value";
16-
private static final String ALLOW = "Allow";
17-
private static final String REMOVE = "Remove";
18-
private SysCertService certManager;
19-
private DSInfo value = getInfo(VALUE);
20-
21-
public SysCertService getCertManager() {
22-
if (certManager == null) {
23-
certManager = (SysCertService) getAncestor(SysCertService.class);
24-
}
25-
return certManager;
26-
}
27-
28-
@Override
29-
public DSInfo getValueChild() {
30-
return value;
31-
}
32-
33-
public CertNode updateValue(String newVal) {
34-
put(VALUE, newVal);
35-
return this;
36-
}
37-
38-
@Override
39-
protected void declareDefaults() {
40-
super.declareDefaults();
41-
declareDefault(VALUE, DSString.valueOf("")).setHidden(true).setReadOnly(true);
42-
declareDefault(ALLOW, new AllowAction());
43-
declareDefault(REMOVE, new RemoveAction());
44-
}
45-
46-
private void allow() {
47-
getCertManager().allow(getInfo());
48-
}
49-
50-
private void remove() {
51-
getParent().remove(getInfo());
52-
}
53-
54-
private static class AllowAction extends DSAction.Parameterless {
55-
56-
@Override
57-
public ActionResult invoke(DSInfo target, ActionInvocation invocation) {
58-
((CertNode) target.get()).allow();
59-
return null;
60-
}
61-
62-
}
63-
64-
private static class RemoveAction extends DSAction.Parameterless {
65-
66-
@Override
67-
public ActionResult invoke(DSInfo target, ActionInvocation invocation) {
68-
((CertNode) target.get()).remove();
69-
return null;
70-
}
71-
72-
}
73-
74-
}
1+
package com.acuity.iot.dsa.dslink.sys.cert;
2+
3+
import org.iot.dsa.node.DSInfo;
4+
import org.iot.dsa.node.DSString;
5+
import org.iot.dsa.node.DSValueNode;
6+
import org.iot.dsa.node.action.ActionInvocation;
7+
import org.iot.dsa.node.action.ActionResult;
8+
import org.iot.dsa.node.action.DSAction;
9+
10+
/**
11+
* @author Daniel Shapiro
12+
*/
13+
public class CertNode extends DSValueNode {
14+
15+
private static final String VALUE = "value";
16+
private static final String ALLOW = "Allow";
17+
private static final String REMOVE = "Remove";
18+
private SysCertService certManager;
19+
private DSInfo value = getInfo(VALUE);
20+
21+
public SysCertService getCertManager() {
22+
if (certManager == null) {
23+
certManager = (SysCertService) getAncestor(SysCertService.class);
24+
}
25+
return certManager;
26+
}
27+
28+
@Override
29+
public DSInfo getValueChild() {
30+
return value;
31+
}
32+
33+
public CertNode updateValue(String newVal) {
34+
put(VALUE, newVal);
35+
return this;
36+
}
37+
38+
@Override
39+
protected void declareDefaults() {
40+
super.declareDefaults();
41+
declareDefault(VALUE, DSString.valueOf("")).setPrivate(true).setReadOnly(true);
42+
declareDefault(ALLOW, new AllowAction());
43+
declareDefault(REMOVE, new RemoveAction());
44+
}
45+
46+
private void allow() {
47+
getCertManager().allow(getInfo());
48+
}
49+
50+
private void remove() {
51+
getParent().remove(getInfo());
52+
}
53+
54+
private static class AllowAction extends DSAction.Parameterless {
55+
56+
@Override
57+
public ActionResult invoke(DSInfo target, ActionInvocation invocation) {
58+
((CertNode) target.get()).allow();
59+
return null;
60+
}
61+
62+
}
63+
64+
private static class RemoveAction extends DSAction.Parameterless {
65+
66+
@Override
67+
public ActionResult invoke(DSInfo target, ActionInvocation invocation) {
68+
((CertNode) target.get()).remove();
69+
return null;
70+
}
71+
72+
}
73+
74+
}

dslink-v2/src/main/java/com/acuity/iot/dsa/dslink/sys/cert/SysCertService.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,12 @@ public void onStarted() {
194194
error("Existing keystore not found and new one could not be generated");
195195
}
196196
}
197-
generateCsr.setHidden(true);
198-
importCaCert.setHidden(true);
199-
importPrimaryCert.setHidden(true);
200-
generateSSCert.setHidden(true);
201-
getKSEntry.setHidden(true);
202-
deleteKSEntry.setHidden(true);
197+
generateCsr.setPrivate(true);
198+
importCaCert.setPrivate(true);
199+
importPrimaryCert.setPrivate(true);
200+
generateSSCert.setPrivate(true);
201+
getKSEntry.setPrivate(true);
202+
deleteKSEntry.setPrivate(true);
203203
}
204204

205205
try {

0 commit comments

Comments
 (0)