Skip to content

Commit 3539354

Browse files
author
Aaron
committed
Action table metadata.
1 parent b812cab commit 3539354

File tree

14 files changed

+32
-312
lines changed

14 files changed

+32
-312
lines changed

build.gradle

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ subprojects {
55
apply plugin: 'maven'
66

77
group 'org.iot-dsa'
8-
version '0.49.0a1'
8+
version '0.49.0'
99

1010
sourceCompatibility = 1.8
1111
targetCompatibility = 1.8
@@ -38,11 +38,9 @@ subprojects {
3838

3939
}
4040

41-
if (JavaVersion.current().isJava8Compatible()) {
42-
allprojects {
43-
tasks.withType(Javadoc) {
44-
options.addStringOption('Xdoclint:none', '-quiet')
45-
}
41+
allprojects {
42+
tasks.withType(Javadoc) {
43+
options.addStringOption('Xdoclint:none', '-quiet')
4644
}
4745
}
4846

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,15 @@ private boolean isClosePending() {
356356
private void writeColumns(MessageWriter writer) {
357357
DSIWriter out = writer.getWriter();
358358
if (result instanceof ActionTable) {
359+
DSMap tableMeta = ((ActionTable) result).getMetadata();
360+
if (tableMeta == null) {
361+
tableMeta = new DSMap();
362+
}
359363
ActionSpec action = result.getAction();
360364
out.key("meta")
361365
.beginMap()
362366
.key("mode").value(action.getResultType().isStream() ? "stream" : "append")
363-
.key("meta").beginMap().endMap()
367+
.key("meta").value(tableMeta)
364368
.endMap();
365369
out.key("columns").beginList();
366370
ActionTable tbl = (ActionTable) result;

dslink-v2/src/main/java/org/iot/dsa/conn/DSBaseConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* Basic representation of a connection, which is subclassed by DSConnection for longer lived
12-
* connections. DSConnection should be subclassed but this can be:
12+
* connections. DSConnection should really be subclassed but this can if desired.
1313
* <p>
1414
* Subclasses must:<br>
1515
* <ul>

dslink-v2/src/main/java/org/iot/dsa/conn/DSConnection.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public abstract class DSConnection extends DSBaseConnection implements Runnable
4343
/**
4444
* The topic to subscribe to for connected events.
4545
*/
46-
public static final DSConnectionTopic CONNECTED = new DSConnectionTopic();
46+
public static final DSConnectionTopic CONNECTED = new DSConnectionTopic("CONNECTED");
4747

4848
/**
4949
* The topic to subscribe to for disconnected events.
5050
*/
51-
public static final DSConnectionTopic DISCONNECTED = new DSConnectionTopic();
51+
public static final DSConnectionTopic DISCONNECTED = new DSConnectionTopic("DISCONNECTED");
5252

5353
///////////////////////////////////////////////////////////////////////////
5454
// Instance Fields
@@ -327,8 +327,11 @@ private void notifyConnectedDescendants(DSNode node, DSConnection conn) {
327327
*/
328328
public static class DSConnectionTopic extends DSTopic implements DSIEvent {
329329

330+
String name;
331+
330332
// Prevent instantiation
331-
private DSConnectionTopic() {
333+
private DSConnectionTopic(String name) {
334+
this.name = name;
332335
}
333336

334337
/**
@@ -344,6 +347,11 @@ public DSITopic getTopic() {
344347
return this;
345348
}
346349

350+
@Override
351+
public String toString() {
352+
return name;
353+
}
354+
347355
}
348356

349357
}

dslink-v2/src/main/java/org/iot/dsa/node/DSRegistry.java

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

3-
43
import java.util.concurrent.ConcurrentHashMap;
54

65
/**
@@ -10,9 +9,6 @@
109
*/
1110
public class DSRegistry {
1211

13-
// Constants
14-
// ---------
15-
1612
// Fields
1713
// ------
1814

@@ -21,9 +17,6 @@ public class DSRegistry {
2117
private static ConcurrentHashMap<Class, DSNode> defaultMap =
2218
new ConcurrentHashMap<Class, DSNode>();
2319

24-
// Constructors
25-
// ------------
26-
2720
// Public Methods
2821
// --------------
2922

@@ -69,7 +62,4 @@ static DSNode removeDefault(Class clazz) {
6962
return defaultMap.remove(clazz);
7063
}
7164

72-
// Inner Classes
73-
// -------------
74-
7565
}

dslink-v2/src/main/java/org/iot/dsa/node/action/ActionSpec.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
public interface ActionSpec {
1212

1313
/**
14-
* Returns 0 or less if the result columns are unknown in advance.
14+
* Return 0 or less if the result columns are unknown in advance.
1515
*/
1616
public int getColumnCount();
1717

1818
/**
19-
* Adds the metadata for the column at the given index to the bucket. Only called before the
19+
* Add the metadata for the column at the given index to the bucket. Only called before the
2020
* action invocation.
2121
*/
2222
public void getColumnMetadata(int idx, DSMap bucket);
2323

2424
/**
25-
* Returns 0 or less if there are no parameters.
25+
* Return 0 or less if there are no parameters.
2626
*/
2727
public int getParameterCount();
2828

2929
/**
30-
* Adds the metadata for the parameter at the given index to the bucket.
30+
* Add the metadata for the parameter at the given index to the bucket.
3131
*/
3232
public void getParameterMetadata(int idx, DSMap bucket);
3333

dslink-v2/src/main/java/org/iot/dsa/node/action/ActionTable.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.iot.dsa.node.action;
22

3+
import org.iot.dsa.node.DSMap;
34
import org.iot.dsa.table.DSIRowCursor;
45

56
/**
@@ -9,4 +10,10 @@
910
*/
1011
public interface ActionTable extends ActionValues, DSIRowCursor {
1112

13+
/**
14+
* Metadata for the entire table, null by default.
15+
*/
16+
public default DSMap getMetadata() {
17+
return null;
18+
}
1219
}

dslink-v2/src/main/java/org/iot/dsa/time/DSInterval.java

Lines changed: 0 additions & 194 deletions
This file was deleted.

dslink-v2/src/test/java/org/iot/dsa/dslink/ActionValuesTest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ private void doit(DSLink link) throws Exception {
5151
ActionValuesTest.this.notifyAll();
5252
}
5353
});
54-
/*
55-
link.getConnection().subscribe(DSLinkConnection.CONNECTED, null, new DSISubscriber() {
56-
@Override
57-
public void onEvent(DSNode node, DSInfo child, DSIEvent event) {
58-
success = true;
59-
synchronized (ActionValuesTest.this) {
60-
ActionValuesTest.this.notifyAll();
61-
}
62-
}
63-
});
64-
*/
6554
Thread t = new Thread(link, "DSLink Runner");
6655
t.start();
6756
synchronized (this) {

0 commit comments

Comments
 (0)