Skip to content

Commit f4ea6d7

Browse files
authored
0.73.0
* Fix list and subscription streams for adds and removes * Code cleanup * More generic apis
2 parents 66cfb6f + 1d2f9ed commit f4ea6d7

File tree

124 files changed

+1763
-1063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+1763
-1063
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
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.72.1'
8+
version '0.73.0'
99

1010
targetCompatibility = JavaVersion.VERSION_1_8
1111
sourceCompatibility = JavaVersion.VERSION_1_8

dslink-v2-api/src/main/java/org/iot/dsa/DSRuntime.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,10 @@ public String toString() {
367367
return buf.toString();
368368
}
369369

370+
long nextRunNanos() {
371+
return nextRun;
372+
}
373+
370374
/**
371375
* Executes the task if it is time.
372376
*
@@ -394,10 +398,6 @@ boolean run(long now) {
394398
return computeNextRun(now);
395399
}
396400

397-
long nextRunNanos() {
398-
return nextRun;
399-
}
400-
401401
private boolean computeNextRun(long now) {
402402
if (interval <= 0) {
403403
done = true;

dslink-v2-api/src/main/java/org/iot/dsa/DSThreadPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void shutdown() {
137137
/////////////////////////////////////////////////////////////////
138138

139139
@Override
140-
protected void finalize() throws Throwable {
140+
protected void finalize() {
141141
alive = false;
142142
synchronized (this) {
143143
notifyAll();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ public interface DSIConnectionDescendant {
1313
* Called when the ancestral DSIConnectionDescendant changes state. The subtree of this instance will not
1414
* notified, that is the responsibility of the DSIConnectionDescendant implementation..
1515
*/
16-
public void onConnectionChange(DSConnection conn);
16+
void onConnectionChange(DSConnection conn);
1717

1818
}

dslink-v2-api/src/main/java/org/iot/dsa/dslink/Action.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,51 +12,51 @@ public interface Action extends Node {
1212
/**
1313
* Only needed for a VALUES type actions, and optional even then.
1414
*/
15-
public default int getColumnCount() {
15+
default int getColumnCount() {
1616
return 0;
1717
}
1818

1919
/**
2020
* Add the metadata for the column at the given index to the bucket. Only called before the
2121
* action invocation. Throws an IllegalStateException by default.
2222
*/
23-
public default void getColumnMetadata(int idx, DSMap bucket) {
23+
default void getColumnMetadata(int idx, DSMap bucket) {
2424
throw new IllegalStateException("Method not overridden");
2525
}
2626

2727
/**
2828
* Return 0 or less if there are no parameters. Returns 0 by default.
2929
*/
30-
public default int getParameterCount() {
30+
default int getParameterCount() {
3131
return 0;
3232
}
3333

3434
/**
3535
* Add the metadata for the parameter at the given index to the bucket. Throws an
3636
* IllegalStateException by default.
3737
*/
38-
public default void getParameterMetadata(int idx, DSMap bucket) {
38+
default void getParameterMetadata(int idx, DSMap bucket) {
3939
throw new IllegalStateException("Method not overridden");
4040
}
4141

4242
/**
4343
* What the action returns, returns VOID by default.
4444
*/
45-
public default ResultsType getResultsType() {
45+
default ResultsType getResultsType() {
4646
return ResultsType.VOID;
4747
}
4848

4949
/**
5050
* Whether or not the action requires write permission. Returns false by default.
5151
*/
52-
public default boolean isReadOnly() {
52+
default boolean isReadOnly() {
5353
return false;
5454
}
5555

5656
/**
5757
* Defines what the action returns.
5858
*/
59-
public enum ResultsType {
59+
enum ResultsType {
6060

6161
/**
6262
* A stream of rows. Clients can choose to trim rows for memory management.

dslink-v2-api/src/main/java/org/iot/dsa/dslink/ActionRequest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ public interface ActionRequest {
1515
/**
1616
* For use with streams and AsyncActionResults, will have no effect if already closed.
1717
*/
18-
public void close();
18+
void close();
1919

2020
/**
2121
* Close and send an error. For use with streams and AsyncActionResults, will have no effect
2222
* if already closed.
2323
*/
24-
public void close(Exception reason);
24+
void close(Exception reason);
2525

2626
/**
2727
* A convenience for getting a single parameter out of the parameters map.
2828
*/
29-
public default DSElement getParameter(String key) {
29+
default DSElement getParameter(String key) {
3030
DSMap map = getParameters();
3131
if (map == null) {
3232
return null;
@@ -37,17 +37,17 @@ public default DSElement getParameter(String key) {
3737
/**
3838
* The parameters supplied by the invoker, or null.
3939
*/
40-
public DSMap getParameters();
40+
DSMap getParameters();
4141

4242
/**
4343
* The permission level of the invoker.
4444
*/
45-
public DSPermission getPermission();
45+
DSPermission getPermission();
4646

4747
/**
4848
* Whether or not response is still open.
4949
*/
50-
public boolean isOpen();
50+
boolean isOpen();
5151

5252
/**
5353
* This is for streams and AsyncActionResults. Call this after returning false
@@ -56,6 +56,6 @@ public default DSElement getParameter(String key) {
5656
*
5757
* @see AsyncActionResults
5858
*/
59-
public void sendResults();
59+
void sendResults();
6060

6161
}

dslink-v2-api/src/main/java/org/iot/dsa/dslink/ActionResults.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ public interface ActionResults {
1616
/**
1717
* Unless the result type is void, this should return a value greater than zero.
1818
*/
19-
public int getColumnCount();
19+
int getColumnCount();
2020

2121
/**
2222
* Only needed if the column count is greater than 0.
2323
*/
24-
public void getColumnMetadata(int idx, DSMap bucket);
24+
void getColumnMetadata(int idx, DSMap bucket);
2525

2626
/**
2727
* The implementation should add the values of the current row to the given bucket. The
2828
* bucket can be reused across calls, the implementation should not cache references to it.
2929
*/
30-
public void getResults(DSList bucket);
30+
void getResults(DSList bucket);
3131

3232
/**
3333
* Determines how the results should be used.
3434
*/
35-
public ResultsType getResultsType();
35+
ResultsType getResultsType();
3636

3737
/**
3838
* Initially, this cursor must be positioned before the first set of results. Return true to
@@ -42,12 +42,12 @@ public interface ActionResults {
4242
* will be closed once this returns false. This will only be called once for a results
4343
* type of VALUES.
4444
*/
45-
public boolean next();
45+
boolean next();
4646

4747
/**
4848
* Always called, does nothing by default.
4949
*/
50-
public default void onClose() {
50+
default void onClose() {
5151
}
5252

5353
}

dslink-v2-api/src/main/java/org/iot/dsa/dslink/DSIRequester.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public interface DSIRequester {
2525
* @return The handler parameter.
2626
* @see AbstractInvokeHandler
2727
*/
28-
public OutboundInvokeHandler invoke(String path, DSMap params, OutboundInvokeHandler handler);
28+
OutboundInvokeHandler invoke(String path, DSMap params, OutboundInvokeHandler handler);
2929

3030
/**
3131
* Submits a list request. Child names do not need to be encoded unless they contain
@@ -38,7 +38,7 @@ public interface DSIRequester {
3838
* @see org.iot.dsa.node.DSPath#encodeName(String)
3939
* @see org.iot.dsa.node.DSPath#decodeName(String)
4040
*/
41-
public OutboundListHandler list(String path, OutboundListHandler handler);
41+
OutboundListHandler list(String path, OutboundListHandler handler);
4242

4343
/**
4444
* Submits request to remove an attribute.
@@ -47,7 +47,7 @@ public interface DSIRequester {
4747
* @return The handler parameter.
4848
* @see SimpleRequestHandler
4949
*/
50-
public OutboundRequestHandler remove(String path, OutboundRequestHandler handler);
50+
OutboundRequestHandler remove(String path, OutboundRequestHandler handler);
5151

5252
/**
5353
* Submits a set request.
@@ -56,7 +56,7 @@ public interface DSIRequester {
5656
* @return The handler parameter.
5757
* @see SimpleRequestHandler
5858
*/
59-
public OutboundRequestHandler set(String path, DSIValue value, OutboundRequestHandler handler);
59+
OutboundRequestHandler set(String path, DSIValue value, OutboundRequestHandler handler);
6060

6161
/**
6262
* Submits a subscribe request.
@@ -66,8 +66,8 @@ public interface DSIRequester {
6666
* @return The handler parameter.
6767
* @see AbstractSubscribeHandler
6868
*/
69-
public OutboundSubscribeHandler subscribe(String path, DSIValue qos,
70-
OutboundSubscribeHandler handler);
69+
OutboundSubscribeHandler subscribe(String path, DSIValue qos,
70+
OutboundSubscribeHandler handler);
7171

7272
}
7373

dslink-v2-api/src/main/java/org/iot/dsa/dslink/DSIResponder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public interface DSIResponder {
3232
* @return The initial response and close notification mechanism, can be null if the if the
3333
* result type is void.
3434
*/
35-
public ActionResults onInvoke(InboundInvokeRequest request);
35+
ActionResults onInvoke(InboundInvokeRequest request);
3636

3737
/**
3838
* The implementation should quickly create an object for responding to the request, but do no
@@ -42,15 +42,15 @@ public interface DSIResponder {
4242
* @param request The details of the request and the mechanism for providing updates.
4343
* @return The initial response and close mechanism.
4444
*/
45-
public ListCloseHandler onList(InboundListRequest request);
45+
ListCloseHandler onList(InboundListRequest request);
4646

4747
/**
4848
* The implementation should do no processing of it on the calling thread. Simply throw a
4949
* descriptive exception to report an error with the request.
5050
*
5151
* @param request The details of the request.
5252
*/
53-
public void onSet(InboundSetRequest request);
53+
void onSet(InboundSetRequest request);
5454

5555
/**
5656
* The implementation should quickly create an object for responding to the request, but do no
@@ -60,6 +60,6 @@ public interface DSIResponder {
6060
* @param request The details of the request and the mechanism for sending updates.
6161
* @return Who to notify when the subscription is closed.
6262
*/
63-
public SubscriptionCloseHandler onSubscribe(InboundSubscribeRequest request);
63+
SubscriptionCloseHandler onSubscribe(InboundSubscribeRequest request);
6464

6565
}

dslink-v2-api/src/main/java/org/iot/dsa/dslink/DSISession.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,23 @@
99
*/
1010
public interface DSISession extends DSIObject {
1111

12-
public DSLinkConnection getConnection();
12+
DSLinkConnection getConnection();
1313

14-
public DSIRequester getRequester();
14+
DSIRequester getRequester();
1515

16-
public boolean isRequesterAllowed();
16+
boolean isRequesterAllowed();
1717

1818
/**
1919
* Read the next message. Intended to be called by the transport.
2020
*
2121
* @param async If false, the messsage will be read on the calling thread.
2222
*/
23-
public void recvMessage(boolean async);
23+
void recvMessage(boolean async);
24+
25+
/**
26+
* An object has been added to the tree, use this to update existing list and
27+
* subscription requests for everything starting with this path.
28+
*/
29+
void update(String path);
2430

2531
}

0 commit comments

Comments
 (0)