diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md deleted file mode 100644 index dde02181..00000000 --- a/docs/DeveloperGuide.md +++ /dev/null @@ -1,359 +0,0 @@ -# DSLink Java Developer Guide - -[Home](https://github.com/iot-dsa-v2/sdk-dslink-java-v2) • [Javadoc](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/) - -## Warning - -Only use org.iot.dsa APIs, do not use or depend on anything in the com.* packages. - -Please utilize the -[Javadoc](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/) -for the core sdk. It's not perfect, but the more it is referenced, the better it will get. - -## Overview - -The purpose of this document is to guide the reader through the development of Java DSA links using -this SDK. Developers will build links using the org.iot.dsa.* packages found in -dslink-core sub-project. - -Key objectives of this SDK: - - - Pluggable architecture: - - Protocol independence. Primarily to support DSA V1 and V2. - - Transport independence. Websockets, plain sockets, http, and whatever else comes along. - - Support multiple Java links in the same process. - - Support JDK 1.6 for Distech Controls. - - High performance for activities such as video streaming. - - Support very large configuration databases (100K+ points). - - Support poll on demand whenever possible. - - 3rd party library independence. Some environments such as Niagara provide transport libraries - while others do not. SLF4J and Netty were explicitly bound to the original SDK but can not be - used in Niagara because of it's very strict Security Manager. - -## Creating a Link - -These are the major steps you'll take when creating a link: - -1. Copy example link. -2. Create application nodes. - -## Copy Example Link - -Copy the -[dslink-java-v2-example](https://github.com/iot-dsa-v2/dslink-java-v2-example) -project to create a new repository. It's README provides -detailed instructions for customization. - -The example link is a very simple but fully functioning link with a single root node. It is -recommended you get that running within a broker before continuing with this documentation. - -## Create Application Nodes - -Nodes are where application specific logic is bound to the link architecture. Node developers -will use various lifecycle callbacks to trigger their logic. - -<<<<<<< HEAD -First you must create a root node. It is the hook for the rest of your functionality. The -convention is to name it MainNode, but make sure it is in a unique package so that multiple links -======= -First you must create a root application node. It is the hook for the rest of your functionality. -The convention is to name it MainNode, but make sure it is in a unique package so that multiple links ->>>>>>> 22064982f1faddb35f2da7c8a183dbbc8602cbe9 -can be run in the same process. - -Then you will probably create additional nodes that will be descendants in the tree rooted by your -main node. - -### Main Node - -<<<<<<< HEAD -All links require a single root node and it must subclass -[org.iot.dsa.dslink.DSMainNode](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/dslink/DSMainNode.html). -The convention is to name the class MainNode but the package must be unique from any other -MainNodes so that multiple links can be run in the same process. - -When a link launches the first time, the type of the root node is looked up **dslink.json**. -The config _mainType_ must store the fully qualified class name of the root node. After the first -launch, the configuration database is serialized and the _mainType_ config will longer have an -======= -All links require a single root data node and it must subclass -[org.iot.dsa.dslink.DSMainNode](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/dslink/DSMainNode.html). -The convention is to name the class MainNode but the package must be unique from any other -MainNodes (other links) so that multiple links can be run in the same process. - -When a link launches the first time, the type of the main node is looked up **dslink.json**. -The config _handler_class_ must store the fully qualified class name of the root node. After the first -launch, the configuration database is serialized and the _handler_class_ config will longer have an ->>>>>>> 22064982f1faddb35f2da7c8a183dbbc8602cbe9 -impact. - -### Additional Nodes - -[org.iot.dsa.node.DSNode](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/DSNode.html) -is the organizational unit of a link. It can contain values, actions and other nodes. Most if not -all of a link's custom functionality will be implemented as DSNode subclasses. - -Subclassing DSNode requires to key steps: - -1. Configure the default children (nodes, values and actions). -2. Use various lifecycle callbacks to trigger custom functionality. - -### Constructors - -DSNode sub-classes must support the public no-arg constructor. This is how they will be -instantiated when deserializing the configuration database. - -### Defaults - -Every subclass of DSNode has a private default instance, all other instances are copies of the -default instance. It is an instanced based inheritance scheme that will allow subtypes to remove or -reorder 'fields' declared in super classes. - -Since there is a default instance in memory, You should never perform application logic unless -triggered by a callback and your node is running (started or stable). - -If a DSNode subtype needs to have specific child nodes or values (most will), it should override -the declareDefaults method. The method should: - -1. Call super.declareDefaults(). It's not always necessary but it's safest to do so. -2. Call DSNode.declareDefault(String name, DSIObject child) for each non-removable child. Do not -add dynamic children in declareDefaults, because if they are removed, they will be re-added the -next time the link is restarted. - -```java - @Override - protected void declareDefaults() { - super.declareDefaults(); - declareDefault("Do Something", DSAction.DEFAULT); - declareDefault("An Integer Value", DSInt.valueOf(0)); - declareDefault("Child Node", new DSNode()); - } -``` - -During node serialization (configuration database, not DSA interop), child values that match their -declared default are omitted. This has two benefits: - -1. A smaller node database means faster serialization / deserialization. -2. Default values can be modified in code and all existing databases with values at the default -will be automatically upgraded the next time the updated class is loaded. - -### Node Lifecycle - -It is important to know the application lifecycle. Use lifecycle callbacks to trigger custom link -functionality. - -_Nodes should not execute any application logic unless they are running (started or stable)._ - -**Stopped** - -A node is instantiated in the stopped state. If a node tree has been persisted, it will be be fully -restored in the stopped state. DSNode.onStopped will not be called, it is only called when nodes -transition from running to stopped. - -When nodes are removed from a running parent node, they will be stopped. DSNode.onStopped will be -called after all child nodes have been stopped. - -When a link is stopped, an attempt to stop the tree will be made, but it cannot be guaranteed. - -**Started** - -After the node tree is fully deserialized it will be started. A node's onStart method will be -called after all of its child nodes have been started. The only guarantee is that all child -nodes have been started. - -Nodes will also started when they are added to an already running parent node. - -**Stable** - -Stable is called after the entire tree has been started. The first time the node tree is loaded, -there is a stable delay of 5 seconds. - -Nodes added to an already stable parent will have onStart and onStable called immediately. - -When in doubt of whether to use onStarted or onStable, use onStable. - -**Callbacks** - -When a node is stable, there are several callbacks for various state changes. All callbacks -begin with **on** such as _onChildAdded()_. See the -[DSNode Javadoc](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/DSNode.html) -for a complete list. - -### Subscriptions - -Nodes should suspend, or minimize activity when nothing is interested in them. For example, if -nothing is interested in a point, it is best to not poll the point on the foreign system. - -To do this you use the following APIs: - -* DSNode.onSubscribed - Called when the node transitions from unsubscribed to subscribed. This is -not called for subsequent subscribers once in the subscribed state. -* DSNode.onUnsubscribed - Called when the node transitions from subscribed to unsubscribed. If -there are multiple subscribers, this is only called when the last one unsubscribes. -* DSNode.isSubscribed - Tells the caller whether or not the node is subscribed. - -### Values - -Values mostly represent leaf members of the node tree. There are two types of values: - -1. [org.io.dsa.node.DSElement](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/DSElement.html) - -These are the primitives that mostly map to the JSON type system and will be leaf members of the tree. -2. [org.io.dsa.node.DSIValue](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/DSIValue.html) - -These have to be able to convert to DSElements, but they carry additional meaning such as timestamp. -Nodes can implement this to have both a value and children. DSValueNode is a convenience abstract -class for this purpose. - -The node model encourages values to be immutable and singletons. This is for efficiency, the same -value instance (e.g. DSBoolean.TRUE) can be stored in many nodes. - -Whenever possible, values should also have NULL instance. Rather than storing a generic null, -this helps the system decode the proper type such as when a requester is attempting to set -a value. - -### Actions - -Actions allow allow responders to expose functionality in DSA that can't be modeled as values. - -Add actions to your node using -[org.iot.dsa.node.action.DSAction](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/action/DSAction.html). - -Override DSNode.onInvoke to handle invocations. - -```java - private DSInfo doSomething = getInfo("Do Something"); - - @Override - protected void declareDefaults() { - DSAction action = new DSAction(); - action.addParameter("Arg", DSString.valueOf("arg"), "A description"); - declareDefault("Do Something", action); - } - - private void doSomething(String arg) {} - - @Override - public ActionResult onInvoke(DSInfo actionInfo, ActionInvocation invocation) { - if (actionInfo == doSomething) { - DSElement arg = invocation.getParameters().get("Arg"); - doSomething(arg.toString()); - return null; - } - return super.onInvoke(actionInfo, invocation); - } -``` - -DSAction can be subclassed. Actions should also be singleton instances for efficiency. For -parameter-less actions that have no return value, use the DSAction.DEFAULT instance. - -### DSInfo - -All node children have corresponding DSInfo instances. This type serves serves two purposes: - -1. It carries some meta-data about the relationship between the parent node and the child. -2. It tracks whether or not the child matches a declared default. - -Important things for developers to know about DSInfo are: - -* You can configure state such as transient, readonly and hidden. -* You can declare fields in the your Java class for info instances to avoid looking up the child -every time it is needed. This is can be used to create fast getters and setters. - -Without declaring fields (lookups required): - -```java - public void declareDefaults() { - super.declareDefaults(); - declareDefault("The Int", DSInt.valueOf(0)); - } - public int getTheInt() { - DSInt theInt = (DSInt) get("The Int"); //map lookup - return theInt.toInt(); - } - public void setTheInt(int value) { - put("The Int", DSInt.valueOf(value)); //map lookup - } -``` - - -With declared fields: - -```java - private DSInfo theInt = getInfo("The Int"); //will be null in the default instance - public void declareDefaults() { - super.declareDefaults(); - declareDefault("The Int", DSInt.valueOf(0)); - } - public int getTheInt() { - return theInt.toInt(); //no lookup - } - public void setTheInt(int value) { - put(theInt, DSInt.valueOf(value)); //no lookup - } -``` - -### Metadata - -Metadata can be information such as units for number types and ranges for enums. - -When the system collects metadata about an object, it uses these steps: - -1. If the target value or node implements -[org.iot.dsa.node.DSIMetadata](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/DSIMetadata.html). -it will be given the opportunity to provide metadata first. -2. Then getMetadata on the parent node will be called with the DSInfo representing the child. -This will be useful when nodes want to store user editable metadata. - -To simplify configuring metadata, use the utility class -[org.iot.dsa.node.DSMetadata](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/node/DSMetadata.html). - -## Timers and Threads - -Use [org.iot.dsa.DSRuntime](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/DSRuntime.html). - -Please avoid using Java executors if possible. In the future we will probably monitor DSRuntime -to help determine when a system is becoming overloaded. - -Creating your own threads for long lived activities is perfectly acceptable but not necessary. - -## Logging - -Use Java Util Logging (JUL). A high performance async logger is automatically installed as the -root logger. - -Most types subclass -[org.iot.dsa.logging.DSLogger](https://iot-dsa-v2.github.io/sdk-dslink-java-v2/javadoc/index.html?org/iot/dsa/logging/DSLogger.html) -as a convenience. - -The most efficient logging will not submit a log message if the level isn't enabled. This is -how it is normally achieved with JUL: - -```java - if (myLogger.isLoggable(Level.FINE)) { - myLogger.fine(someMessage()); - } -``` - - -DSLogger enables the same but with more concise syntax: - -```java - fine(fine() ? someMessage() : null); -``` - - -DSA has it's own log levels (there can be links in many different languages). All standard -Java log level are mapped into it, but try to use the DSA levels: - -Level Guidelines - -DSA Level = Java Level - -- trace = Level.FINEST; -- debug = Level.FINER; -- fine = Level.FINE; -- warn = custom -- info = Level.INFO; -- error = Level.WARNING; -- admin = custom -- fatal = Level.SEVERE; - diff --git a/docs/javadoc/allclasses-frame.html b/docs/javadoc/allclasses-frame.html deleted file mode 100644 index f311ea10..00000000 --- a/docs/javadoc/allclasses-frame.html +++ /dev/null @@ -1,137 +0,0 @@ - - - -
-<<<<<<< HEAD - -| Modifier and Type | -Constant Field | -Value | -
|---|---|---|
-
-public static final java.lang.String |
-CFG_AUTH_TOKEN |
-"token" |
-
-
-public static final java.lang.String |
-CFG_BROKER_URL |
-"broker" |
-
-
-public static final java.lang.String |
-CFG_CONNECTION_TYPE |
-"connectionType" |
-
-
-public static final java.lang.String |
-CFG_KEY_FILE |
-"key" |
-
-
-public static final java.lang.String |
-CFG_LOG_LEVEL |
-"log" |
-
-
-public static final java.lang.String |
-CFG_NODE_FILE |
-"nodes" |
-
-
-public static final java.lang.String |
-CFG_READ_TIMEOUT |
-"readTimeout" |
-
-
-public static final java.lang.String |
-CFG_SAVE_INTERVAL |
-"saveInterval" |
-
-
-public static final java.lang.String |
-CFG_STABLE_DELAY |
-"stableDelay" |
-
-
-public static final java.lang.String |
-CFG_WS_TRANSPORT_FACTORY |
-"wsTransportFactory" |
-
| Modifier and Type | -Constant Field | -Value | -
|---|---|---|
-
-public static final java.lang.String |
-DBL_NAN |
-"\u001bNaN" |
-
-
-public static final java.lang.String |
-DBL_NEG_INF |
-"\u001b-Infinity" |
-
-
-public static final java.lang.String |
-DBL_POS_INF |
-"\u001bInfinity" |
-
| Modifier and Type | -Constant Field | -Value | -
|---|---|---|
-
-public static final int |
-ADMIN |
-950 |
-
-
-public static final int |
-CONFIG |
-700 |
-
-
-public static final int |
-DEBUG |
-400 |
-
-
-public static final int |
-ERROR |
-900 |
-
-
-public static final int |
-FATAL |
-1000 |
-
-
-public static final int |
-FINE |
-500 |
-
-
-public static final int |
-INFO |
-800 |
-
-
-public static final int |
-TRACE |
-300 |
-
-
-public static final int |
-WARN |
-750 |
-
| Modifier and Type | -Constant Field | -Value | -|
|---|---|---|---|
-
-public static final java.lang.String |
-BOOLEAN_RANGE |
-"$booleanRange" |
-|
-
-public static final java.lang.String |
-DECIMAL_PLACES |
-"$decimalPlaces" |
-|
-
-public static final java.lang.String |
-DEFAULT |
-"$default" |
-|
-
-public static final java.lang.String |
-DESCRIPTION |
-"$description" |
-|
-
-public static final java.lang.String |
-DISPLAY_NAME |
-<<<<<<< HEAD
-"displayName" |
-=======
-"$displayName" |
->>>>>>> 22064982f1faddb35f2da7c8a183dbbc8602cbe9
-
-
-public static final java.lang.String |
-EDITOR |
-"$editor" |
-|
-
-public static final java.lang.String |
-ENUM_RANGE |
-"$enumRange" |
-|
-
-public static final java.lang.String |
-MAX_VALUE |
-"$maxValue" |
-|
-
-public static final java.lang.String |
-MIN_VALUE |
-"$minValue" |
-|
-
-public static final java.lang.String |
-NAME |
-"$name" |
-|
-
-public static final java.lang.String |
-PLACEHOLDER |
-"$placeholder" |
-|
-
-public static final java.lang.String |
-TYPE |
-"$type" |
-|
-
-public static final java.lang.String |
-UNIT |
-"$unit" |
-
| Modifier and Type | -Constant Field | -Value | -
|---|---|---|
-
-public static final int |
-CONFIG_FAULT |
-2048 |
-
-
-public static final java.lang.String |
-CONFIG_FAULT_STR |
-"configFault" |
-
-
-public static final int |
-DISABLED |
-4096 |
-
-
-public static final java.lang.String |
-DISABLED_STR |
-"disabled" |
-
-
-public static final int |
-DOWN |
-512 |
-
-
-public static final java.lang.String |
-DOWN_STR |
-"down" |
-
-
-public static final int |
-FAULT |
-1024 |
-
-
-public static final java.lang.String |
-FAULT_STR |
-"fault" |
-
-
-public static final int |
-OK |
-0 |
-
-
-public static final int |
-OK_OVERRIDE |
-1 |
-
-
-public static final java.lang.String |
-OK_OVERRIDE_STR |
-"override" |
-
-
-public static final int |
-OK_REMOTE_OVERRIDE |
-2 |
-
-
-public static final java.lang.String |
-OK_REMOTE_OVERRIDE_STR |
-"remoteOverride" |
-
-
-public static final java.lang.String |
-OK_STR |
-"ok" |
-
-
-public static final int |
-REMOTE_CONFIG_FAULT |
-524288 |
-
-
-public static final java.lang.String |
-REMOTE_CONFIG_FAULT_STR |
-"remoteConfigFault" |
-
-
-public static final int |
-REMOTE_DISABLED |
-1048576 |
-
-
-public static final java.lang.String |
-REMOTE_DISABLED_STR |
-"remoteDisabled" |
-
-
-public static final int |
-REMOTE_DOWN |
-131072 |
-
-
-public static final java.lang.String |
-REMOTE_DOWN_STR |
-"remoteDown" |
-
-
-public static final int |
-REMOTE_FAULT |
-262144 |
-
-
-public static final java.lang.String |
-REMOTE_FAULT_STR |
-"remoteFault" |
-
-
-public static final int |
-REMOTE_STALE |
-65536 |
-
-
-public static final java.lang.String |
-REMOTE_STALE_STR |
-"remoteStale" |
-
-
-public static final int |
-REMOTE_UNKNOWN |
-2097152 |
-
-
-public static final java.lang.String |
-REMOTE_UNKNOWN_STR |
-"remoteUnknown" |
-
-
-public static final int |
-STALE |
-256 |
-
-
-public static final java.lang.String |
-STALE_STR |
-"stale" |
-
-
-public static final int |
-UNKNOWN |
-8192 |
-
-
-public static final java.lang.String |
-UNKNOWN_STR |
-"unknown" |
-
| Modifier and Type | -Constant Field | -Value | -
|---|---|---|
-
-public static final int |
-MILLIS_DAY |
-86400000 |
-
-
-public static final int |
-MILLIS_FIFTEEN_MINUTES |
-900000 |
-
-
-public static final int |
-MILLIS_FIFTEEN_SECONDS |
-15000 |
-
-
-public static final int |
-MILLIS_FIVE_MINUTES |
-300000 |
-
-
-public static final int |
-MILLIS_FIVE_SECONDS |
-5000 |
-
-
-public static final int |
-MILLIS_FOUR_HOURS |
-14400000 |
-
-
-public static final int |
-MILLIS_HOUR |
-3600000 |
-
-
-public static final int |
-MILLIS_MINUTE |
-60000 |
-
-
-public static final long |
-MILLIS_MONTH |
-2592000000L |
-
-
-public static final long |
-MILLIS_QUARTER |
-7776000000L |
-
-
-public static final int |
-MILLIS_SECOND |
-1000 |
-
-
-public static final int |
-MILLIS_SIX_HOURS |
-21600000 |
-
-
-public static final int |
-MILLIS_TEN_MINUTES |
-600000 |
-
-
-public static final int |
-MILLIS_TEN_SECONDS |
-10000 |
-
-
-public static final int |
-MILLIS_THIRTY_MINUTES |
-1800000 |
-
-
-public static final int |
-MILLIS_THIRTY_SECONDS |
-30000 |
-
-
-public static final int |
-MILLIS_THREE_HOURS |
-10800000 |
-
-
-public static final int |
-MILLIS_TWELVE_HOURS |
-43200000 |
-
-
-public static final int |
-MILLIS_TWENTY_MINUTES |
-1200000 |
-
-
-public static final int |
-MILLIS_TWO_HOURS |
-7200000 |
-
-
-public static final int |
-MILLIS_WEEK |
-604800000 |
-
-
-public static final long |
-MILLIS_YEAR |
-31104000000L |
-
-
-public static final long |
-NANOS_IN_MS |
-1000000L |
-
-
-public static final long |
-NANOS_IN_SEC |
-1000000000L |
-
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
-Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
-Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
-Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
-Each annotation type has its own separate page with the following sections:
-Each enum has its own separate page with the following sections:
-There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
-The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
-These links take you to the next or previous class, interface, package, or related page.
-These links show and hide the HTML frames. All pages are available with or without frames.
-The All Classes link shows all classes and interfaces except non-static nested types.
-Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
-The Constant Field Values page lists the static final fields and their values.
-public static class DSRuntime.Timer
-extends java.lang.Object
-implements java.lang.Runnable
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-cancel()
-Cancel execution, will not impact current running tasks and will have no effect if
- already cancelled.
- |
-
long |
-getInterval()
-The interval between runs, zero or less for no interval.
- |
-
java.lang.Runnable |
-getRunnable()
-The runnable being managed by this timer.
- |
-
boolean |
-isCancelled() |
-
boolean |
-isFinished()
-True if cancelled or was a one time execution and that has finished.
- |
-
boolean |
-isRunning()
-True when the runnable is being actually being executed.
- |
-
long |
-lastRun()
-The lastRun run or -1 if it hasn't run yet.
- |
-
long |
-nextRun()
-The next scheduled time to run.
- |
-
void |
-run()
-Do not call.
- |
-
long |
-runCount()
-The number of completed runs.
- |
-
DSRuntime.Timer |
-setSkipMissedIntervals(boolean skipMissed)
-The default is true, set this to false if all intervals should be run, even if they run
- later than scheduled.
- |
-
java.lang.String |
-toString() |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic void cancel()-
public long getInterval()-
public java.lang.Runnable getRunnable()-
public boolean isCancelled()-
public boolean isFinished()-
public boolean isRunning()-
public long lastRun()-
public long nextRun()-
public void run()-
run in interface java.lang.Runnablepublic long runCount()-
public DSRuntime.Timer setSkipMissedIntervals(boolean skipMissed)-
skipMissed - False if intervals should be run after they were scheduled to.public java.lang.String toString()-
toString in class java.lang.Objectpublic class DSRuntime
-extends java.lang.Object
-| Modifier and Type | -Class and Description | -
|---|---|
static class |
-DSRuntime.Timer
-Can be used to inspect and cancel tasks passed to the run methods in DSRuntime.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
static void |
-run(java.lang.Runnable arg)
-Run as soon as possible on the application's thread pool and run only once.
- |
-
static DSRuntime.Timer |
-run(java.lang.Runnable arg,
- long start,
- long interval)
-Run periodically starting at the given time and repeat at the given millisecond interval.
- |
-
static DSRuntime.Timer |
-runAt(java.lang.Runnable arg,
- long at)
-Run once at the given time.
- |
-
static DSRuntime.Timer |
-runDelayed(java.lang.Runnable arg,
- long delayMillis)
-Run once after the given delay.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static void run(java.lang.Runnable arg)-
public static DSRuntime.Timer run(java.lang.Runnable arg, - long start, - long interval)-
arg - What to runAt.start - First absolute execution time, or if less or equal to 0, start immediately.interval - The millisecond interval at which to run.public static DSRuntime.Timer runAt(java.lang.Runnable arg, - long at)-
arg - What to runAt.at - Execution time. If the time is past, it'll run right away.public static DSRuntime.Timer runDelayed(java.lang.Runnable arg, - long delayMillis)-
arg - What to runAt.delayMillis - The number of millis to wait before running.public interface DSIRequester
-| Modifier and Type | -Method and Description | -
|---|---|
OutboundInvokeHandler |
-invoke(java.lang.String path,
- DSMap params,
- OutboundInvokeHandler handler)
-Submits an invoke request.
- |
-
OutboundListHandler |
-list(java.lang.String path,
- OutboundListHandler handler)
-Submits a list request.
- |
-
OutboundRequestHandler |
-remove(java.lang.String path,
- OutboundRequestHandler handler)
-Submits request to remove an attribute.
- |
-
OutboundRequestHandler |
-set(java.lang.String path,
- DSIValue value,
- OutboundRequestHandler handler)
-Submits a set request.
- |
-
OutboundSubscribeHandler |
-subscribe(java.lang.String path,
- int qos,
- OutboundSubscribeHandler handler)
-Submits a subscribe request.
- |
-
OutboundInvokeHandler invoke(java.lang.String path, - DSMap params, - OutboundInvokeHandler handler)-
handler - Callback mechanism.AbstractInvokeHandlerOutboundListHandler list(java.lang.String path, - OutboundListHandler handler)-
handler - Callback mechanism.AbstractListHandlerOutboundRequestHandler remove(java.lang.String path, - OutboundRequestHandler handler)-
handler - Callback mechanism.SimpleRequestHandlerOutboundRequestHandler set(java.lang.String path, - DSIValue value, - OutboundRequestHandler handler)-
handler - Callback mechanism.SimpleRequestHandlerOutboundSubscribeHandler subscribe(java.lang.String path, - int qos, - OutboundSubscribeHandler handler)-
handler - Callback mechanism.AbstractSubscribeHandlerpublic interface DSIResponder
-DSInvalidPathException,
-DSPermissionException,
-DSRequestException| Modifier and Type | -Method and Description | -
|---|---|
ActionResult |
-onInvoke(InboundInvokeRequest request)
-The implementation should quickly create an object for responding to the request, but do no
- processing of it on the calling thread.
- |
-
OutboundListResponse |
-onList(InboundListRequest request)
-The implementation should quickly create an object for responding to the request, but do no
- processing of it on the calling thread.
- |
-
void |
-onSet(InboundSetRequest request)
-The implementation should do no processing of it on the calling thread.
- |
-
SubscriptionCloseHandler |
-onSubscribe(InboundSubscribeRequest request)
-The implementation should quickly create an object for responding to the request, but do no
- processing of it on the calling thread.
- |
-
ActionResult onInvoke(InboundInvokeRequest request)-
request - The details of the request and the mechanism for providing updates.OutboundListResponse onList(InboundListRequest request)-
request - The details of the request and the mechanism for providing updates.SubscriptionCloseHandler onSubscribe(InboundSubscribeRequest request)-
request - The details of the request and the mechanism for sending updates.void onSet(InboundSetRequest request)-
request - The details of the request.public class DSInternalErrorException
-extends java.lang.RuntimeException
-| Constructor and Description | -
|---|
DSInternalErrorException() |
-
DSInternalErrorException(java.lang.String message) |
-
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic class DSInvalidPathException -extends DSRequestException-
| Constructor and Description | -
|---|
DSInvalidPathException(java.lang.String path) |
-
getDetail, setDetail, setDetailaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic class DSLink -extends DSNode -implements java.lang.Runnable-
-
-
- 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() -
-
-
- Lifecycle: -
- TODO
INFO_TOPIC, VALUE_TOPIC| Constructor and Description | -
|---|
DSLink()
-Use the load method to create links.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
protected void |
-declareDefaults()
-Adds the save action, overrides should call super if they want this action.
- |
-
DSLinkConfig |
-getConfig() |
-
DSLinkConnection |
-getConnection() |
-
java.lang.String |
-getDsId()
-Returns the unique id of the connection.
- |
-
DSKeys |
-getKeys()
-Public / private keys of the link, used to prove identity with brokers.
- |
-
java.lang.String |
-getLinkName()
-As defined in dslink.json.
- |
-
protected java.lang.String |
-getLogName()
-Override point, returns the simple class name by default.
- |
-
DSMainNode |
-getMain() |
-
DSSysNode |
-getSys() |
-
protected DSLink |
-init(DSLinkConfig config)
-Configures a link instance including creating the appropriate connection.
- |
-
static DSLink |
-load(DSLinkConfig config)
-Creates a link by first testing for an existing serialized database.
- |
-
static void |
-main(java.lang.String[] args)
-This is a convenience for DSLink.load(new DSLinkConfig(args)).run() and can be used as the
- the main class for any link.
- |
-
protected void |
-onStopped()
-Called once this node and its entire subtree is stopped.
- |
-
void |
-run()
-Calls starts, waits the stableDelay, then calls stable.
- |
-
void |
-save()
-Serializes the configuration database.
- |
-
DSLink |
-setNodes(DSMainNode node) |
-
protected DSLink |
-setSaveEnabled(boolean enabled)
-This is a transient option intended for unit tests.
- |
-
void |
-shutdown()
-Properly shuts down the link when a thread is executing the run method.
- |
-
add, childCount, clear, contains, copy, declareDefault, fire, fire, get, getElement, getFirst, getFirstInfo, getFirstNodeInfo, getInfo, getInfo, getLast, getLastInfo, getMetadata, getName, getNode, getParent, getPath, getValue, isDefaultInstance, isEqual, isIdentical, isNode, isNull, isRunning, isStable, isStarted, isStopped, isSubscribed, isSubscribed, isSubscribed, iterateNodes, iterateValues, iterator, onChildAdded, onChildChanged, onChildRemoved, onInfoChanged, onInvoke, onSet, onSet, onStable, onStarted, onSubscribe, onSubscribed, onSubscribed, onUnsubscribe, onUnsubscribed, onUnsubscribed, put, put, put, put, put, put, put, put, remove, remove, stable, start, stop, subscribe, toNode, unsubscribe, validateChild, validateParentadmin, admin, admin, debug, debug, debug, error, error, error, fatal, fatal, fatal, fine, fine, fine, info, info, info, trace, trace, trace, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic DSLink()-
load(DSLinkConfig)protected void declareDefaults()-
declareDefaults in class DSNodeTo create non-removable children.public DSLinkConfig getConfig()-
public DSLinkConnection getConnection()-
public java.lang.String getDsId()-
public DSKeys getKeys()-
public java.lang.String getLinkName()-
protected java.lang.String getLogName()-
DSLoggergetLogName in class DSNodepublic DSMainNode getMain()-
public DSSysNode getSys()-
protected DSLink init(DSLinkConfig config)-
public static DSLink load(DSLinkConfig config)-
config - Configuration optionspublic static void main(java.lang.String[] args)-
public void run()-
run in interface java.lang.Runnableprotected void onStopped()-
DSNodepublic void save()-
public void shutdown()-
public DSLink setNodes(DSMainNode node)-
protected DSLink setSaveEnabled(boolean enabled)-
public class DSLinkConfig -extends java.lang.Object -implements DSILevels-
| Modifier and Type | -Field and Description | -
|---|---|
static java.lang.String |
-CFG_AUTH_TOKEN |
-
static java.lang.String |
-CFG_BROKER_URL |
-
static java.lang.String |
-CFG_CONNECTION_TYPE |
-
static java.lang.String |
-CFG_KEY_FILE |
-
static java.lang.String |
-CFG_LOG_LEVEL |
-
static java.lang.String |
-CFG_NODE_FILE |
-
static java.lang.String |
-CFG_READ_TIMEOUT |
-
static java.lang.String |
-CFG_SAVE_INTERVAL |
-
static java.lang.String |
-CFG_STABLE_DELAY |
-
static java.lang.String |
-CFG_WS_TRANSPORT_FACTORY |
-
| Constructor and Description | -
|---|
DSLinkConfig()
-This will create an empty unvalidated getConfig.
- |
-
DSLinkConfig(java.io.File workingDir)
-Can be use to change the working dir from the default process working dir.
- |
-
DSLinkConfig(java.lang.String args)
-Constructor for simulating a command line invocation, the argument will be split on the space
- character.
- |
-
DSLinkConfig(java.lang.String[] args)
-Constructor for the arguments pass to a main method.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-getBrokerUri()
-If not set, will look for the getConfig in dslink.json.
- |
-
boolean |
-getConfig(java.lang.String name,
- boolean fallback)
-Looks for the value in dslink.json and if not found, returns the fallback.
- |
-
double |
-getConfig(java.lang.String name,
- double fallback)
-Looks for the value in dslink.json and if not found, returns the fallback.
- |
-
int |
-getConfig(java.lang.String name,
- int fallback)
-Looks for the value in dslink.json and if not found, returns the fallback.
- |
-
long |
-getConfig(java.lang.String name,
- long fallback)
-Looks for the value in dslink.json and if not found, returns the fallback.
- |
-
java.lang.String |
-getConfig(java.lang.String name,
- java.lang.String fallback)
-Looks for the value in dslink.json and if not found, returns the fallback.
- |
-
java.lang.String |
-getDsaVersion() |
-
DSMap |
-getDslinkJson()
-If not set, this will attempt to open dslink.json in the working the process directory.
- |
-
static java.lang.String |
-getHelpText()
-Help text for command line options.
- |
-
DSKeys |
-getKeys()
-If not set, will attempt to use the getConfig in dslink.json and fall back to '.key' in the
- process directory if necessary.
- |
-
java.lang.String |
-getLinkName() |
-
java.util.logging.Level |
-getLogLevel()
-If not set, will attempt to use the getConfig in dslink.json but fall back to 'info' if
- necessary.
- |
-
java.lang.String |
-getMainType()
-The type of the root node.
- |
-
java.io.File |
-getNodesFile()
-If not set, will attempt to use the getConfig in dslink.json but fall back to 'nodes.zip' in
- the process directory if necessary.
- |
-
java.lang.String |
-getToken()
-Authentication token for the broker, this can return null.
- |
-
protected void |
-parse(java.lang.String[] args)
-Parses command line args to set the internal state of this object.
- |
-
DSLinkConfig |
-setBrokerUri(java.lang.String arg) |
-
DSLinkConfig |
-setConfig(java.lang.String name,
- boolean value)
-Modifies the in-memory representation of dslink.json, but it will not be saved back to disk.
- |
-
DSLinkConfig |
-setConfig(java.lang.String name,
- double value)
-Modifies the in-memory representation of dslink.json, but it will not be saved back to disk.
- |
-
DSLinkConfig |
-setConfig(java.lang.String name,
- int value)
-Modifies the in-memory representation of dslink.json, but it will not be saved back to disk.
- |
-
DSLinkConfig |
-setConfig(java.lang.String name,
- long value)
-Modifies the in-memory representation of dslink.json, but it will not be saved back to disk.
- |
-
DSLinkConfig |
-setConfig(java.lang.String name,
- java.lang.String value)
-Modifies the in-memory representation of dslink.json, but it will not be saved back to disk.
- |
-
DSLinkConfig |
-setDslinkJson(DSMap map)
-Directly set the map without using file io.
- |
-
DSLinkConfig |
-setDslinkJson(java.io.File file)
-Sets the link map by file path.
- |
-
DSLinkConfig |
-setKeys(DSKeys keys)
-Directly set the keys without using file io.
- |
-
DSLinkConfig |
-setKeys(java.io.File file)
-Sets the link keys by file path.
- |
-
DSLinkConfig |
-setLinkName(java.lang.String arg)
-Overrides dslink.json.
- |
-
DSLinkConfig |
-setLogLevel(java.util.logging.Level level)
-Overrides dslink.json.
- |
-
DSLinkConfig |
-setLogLevel(java.lang.String level)
-Should be one of the following (case insensitive): all, finest, finer, fine, config, info,
- warning, severe, off.
- |
-
DSLinkConfig |
-setMainType(java.lang.Class clazz)
-The type of the root node.
- |
-
DSLinkConfig |
-setNodesFile(java.io.File file)
-Overrides dslink.json.
- |
-
DSLinkConfig |
-setToken(java.lang.String arg)
-Overrides dslink.json.
- |
-
boolean |
-wasHelpRequested()
-Whether or not -h or --help was provided.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final java.lang.String CFG_AUTH_TOKEN-
public static final java.lang.String CFG_BROKER_URL-
public static final java.lang.String CFG_KEY_FILE-
public static final java.lang.String CFG_LOG_LEVEL-
public static final java.lang.String CFG_NODE_FILE-
public static final java.lang.String CFG_CONNECTION_TYPE-
public static final java.lang.String CFG_READ_TIMEOUT-
public static final java.lang.String CFG_SAVE_INTERVAL-
public static final java.lang.String CFG_STABLE_DELAY-
public static final java.lang.String CFG_WS_TRANSPORT_FACTORY-
public DSLinkConfig()-
public DSLinkConfig(java.io.File workingDir)-
workingDir - Base directory used to resolve other files.public DSLinkConfig(java.lang.String args)-
public DSLinkConfig(java.lang.String[] args)-
public java.lang.String getBrokerUri()-
public boolean getConfig(java.lang.String name, - boolean fallback)-
public double getConfig(java.lang.String name, - double fallback)-
public int getConfig(java.lang.String name, - int fallback)-
public long getConfig(java.lang.String name, - long fallback)-
public java.lang.String getConfig(java.lang.String name, - java.lang.String fallback)-
public java.lang.String getDsaVersion()-
public DSMap getDslinkJson()-
public static java.lang.String getHelpText()-
public DSKeys getKeys()-
public java.lang.String getLinkName()-
public java.util.logging.Level getLogLevel()-
public java.io.File getNodesFile()-
public java.lang.String getMainType()-
public java.lang.String getToken()-
protected void parse(java.lang.String[] args)-
args - The argument passed to a main method.java.lang.RuntimeException - if there are any problems.public DSLinkConfig setBrokerUri(java.lang.String arg)-
public DSLinkConfig setConfig(java.lang.String name, - boolean value)-
public DSLinkConfig setConfig(java.lang.String name, - double value)-
public DSLinkConfig setConfig(java.lang.String name, - int value)-
public DSLinkConfig setConfig(java.lang.String name, - long value)-
public DSLinkConfig setConfig(java.lang.String name, - java.lang.String value)-
public DSLinkConfig setDslinkJson(DSMap map)-
public DSLinkConfig setDslinkJson(java.io.File file)-
public DSLinkConfig setKeys(DSKeys keys)-
public DSLinkConfig setKeys(java.io.File file)-
public DSLinkConfig setLinkName(java.lang.String arg)-
public DSLinkConfig setLogLevel(java.lang.String level)-
Overrides dslink.json.
public DSLinkConfig setLogLevel(java.util.logging.Level level)-
public DSLinkConfig setNodesFile(java.io.File file)-
public DSLinkConfig setMainType(java.lang.Class clazz)-
public DSLinkConfig setToken(java.lang.String arg)-
public boolean wasHelpRequested()-
public static interface DSLinkConnection.Listener
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-onConnect(DSLinkConnection connection)
-Called asynchronously after the connection with the endpoint is opened.
- |
-
void |
-onDisconnect(DSLinkConnection connection)
-Called synchronously after the connection with the endpoint is closed.
- |
-
void onConnect(DSLinkConnection connection)-
void onDisconnect(DSLinkConnection connection)-
public abstract class DSLinkConnection -extends DSNode-
- Implementations must have a no-arg public constructor. It will be dynamically added as - a child of the DSLink.
| Modifier and Type | -Class and Description | -
|---|---|
static interface |
-DSLinkConnection.Listener
-Intended for requester functionality so that requesters can know when to
- start and stop making requests.
- |
-
INFO_TOPIC, VALUE_TOPIC| Constructor and Description | -
|---|
DSLinkConnection() |
-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-addListener(DSLinkConnection.Listener listener)
-Adds a listener for connection events.
- |
-
abstract void |
-disconnect()
-Forcefully closes an open connection.
- |
-
java.lang.String |
-getConnectionId()
-A unique descriptive tag such as a combination of the link name and the broker host.
- |
-
DSLink |
-getLink()
-The link using this connection.
- |
-
protected java.lang.String |
-getLogName()
-Override point, returns the simple class name by default.
- |
-
abstract DSIRequester |
-getRequester() |
-
abstract com.acuity.iot.dsa.dslink.protocol.DSSession |
-getSession() |
-
DSSysNode |
-getSys() |
-
abstract com.acuity.iot.dsa.dslink.transport.DSTransport |
-getTransport() |
-
boolean |
-isConnected()
-True when a connection is established with the remote endpoint.
- |
-
protected abstract void |
-onConnect()
-Called after onInitialize and before onRun.
- |
-
protected abstract void |
-onDisconnect()
-Called when this network connection has been closed.
- |
-
protected abstract void |
-onInitialize()
-Always called before onConnect.
- |
-
protected abstract void |
-onRun()
-The long term management of the connection (reading and writing).
- |
-
protected void |
-onStable()
-Starts the connection.
- |
-
void |
-removeListener(DSLinkConnection.Listener listener)
-Removes a listener for connection events.
- |
-
add, childCount, clear, contains, copy, declareDefault, declareDefaults, fire, fire, get, getElement, getFirst, getFirstInfo, getFirstNodeInfo, getInfo, getInfo, getLast, getLastInfo, getMetadata, getName, getNode, getParent, getPath, getValue, isDefaultInstance, isEqual, isIdentical, isNode, isNull, isRunning, isStable, isStarted, isStopped, isSubscribed, isSubscribed, isSubscribed, iterateNodes, iterateValues, iterator, onChildAdded, onChildChanged, onChildRemoved, onInfoChanged, onInvoke, onSet, onSet, onStarted, onStopped, onSubscribe, onSubscribed, onSubscribed, onUnsubscribe, onUnsubscribed, onUnsubscribed, put, put, put, put, put, put, put, put, remove, remove, stable, start, stop, subscribe, toNode, unsubscribe, validateChild, validateParentadmin, admin, admin, debug, debug, debug, error, error, error, fatal, fatal, fatal, fine, fine, fine, info, info, info, trace, trace, trace, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic void addListener(DSLinkConnection.Listener listener)-
public abstract void disconnect()-
public java.lang.String getConnectionId()-
public DSLink getLink()-
protected java.lang.String getLogName()-
DSLoggergetLogName in class DSNodepublic DSSysNode getSys()-
public abstract DSIRequester getRequester()-
public abstract com.acuity.iot.dsa.dslink.protocol.DSSession getSession()-
public abstract com.acuity.iot.dsa.dslink.transport.DSTransport getTransport()-
public boolean isConnected()-
protected abstract void onConnect()-
protected abstract void onDisconnect()-
protected abstract void onInitialize()-
protected abstract void onRun()-
protected void onStable()-
public void removeListener(DSLinkConnection.Listener listener)-
INFO_TOPIC, VALUE_TOPIC| Constructor and Description | -
|---|
DSMainNode() |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSLink |
-getLink()
-The parent link or null.
- |
-
protected java.lang.String |
-getLogName()
-Override point, returns the simple class name by default.
- |
-
boolean |
-isRequester()
-Override point, returns true by default.
- |
-
boolean |
-isResponder()
-Override point, returns true by default.
- |
-
void |
-validateParent(DSNode node)
-The parent must be a DSLink instance.
- |
-
add, childCount, clear, contains, copy, declareDefault, declareDefaults, fire, fire, get, getElement, getFirst, getFirstInfo, getFirstNodeInfo, getInfo, getInfo, getLast, getLastInfo, getMetadata, getName, getNode, getParent, getPath, getValue, isDefaultInstance, isEqual, isIdentical, isNode, isNull, isRunning, isStable, isStarted, isStopped, isSubscribed, isSubscribed, isSubscribed, iterateNodes, iterateValues, iterator, onChildAdded, onChildChanged, onChildRemoved, onInfoChanged, onInvoke, onSet, onSet, onStable, onStarted, onStopped, onSubscribe, onSubscribed, onSubscribed, onUnsubscribe, onUnsubscribed, onUnsubscribed, put, put, put, put, put, put, put, put, remove, remove, stable, start, stop, subscribe, toNode, unsubscribe, validateChildadmin, admin, admin, debug, debug, debug, error, error, error, fatal, fatal, fatal, fine, fine, fine, info, info, info, trace, trace, trace, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic DSLink getLink()-
protected java.lang.String getLogName()-
DSLoggergetLogName in class DSNodepublic boolean isRequester()-
public boolean isResponder()-
public void validateParent(DSNode node)-
validateParent in class DSNodepublic class DSPermissionException -extends DSRequestException-
| Constructor and Description | -
|---|
DSPermissionException() |
-
DSPermissionException(java.lang.String message) |
-
getDetail, setDetail, setDetailaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic class DSRequestException
-extends java.lang.RuntimeException
-| Constructor and Description | -
|---|
DSRequestException() |
-
DSRequestException(java.lang.String message) |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-getDetail()
-Additional information to supply to the remote endpoint.
- |
-
void |
-setDetail(java.lang.String detail)
-Overrides the default detail which is the stack trace of this exception.
- |
-
void |
-setDetail(java.lang.Throwable arg)
-Overrides the default detail which is the stack trace of this exception.
- |
-
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic DSRequestException()-
public DSRequestException(java.lang.String message)-
public java.lang.String getDetail()-
public void setDetail(java.lang.String detail)-
public void setDetail(java.lang.Throwable arg)-
INFO_TOPIC, VALUE_TOPIC| Modifier and Type | -Method and Description | -
|---|---|
protected void |
-declareDefaults()
-The is only called once for each class.
- |
-
DSLinkConnection |
-getConnection() |
-
DSLink |
-getLink() |
-
protected java.lang.String |
-getLogName()
-Override point, returns the simple class name by default.
- |
-
ActionResult |
-onInvoke(DSInfo action,
- ActionInvocation invocation)
-Override point, called by the default implementation of DSAction.invoke.
- |
-
protected void |
-validateParent(DSNode node)
-Override point, throw a meaningful IllegalArgumentException if the parent is not allowed
- |
-
add, childCount, clear, contains, copy, declareDefault, fire, fire, get, getElement, getFirst, getFirstInfo, getFirstNodeInfo, getInfo, getInfo, getLast, getLastInfo, getMetadata, getName, getNode, getParent, getPath, getValue, isDefaultInstance, isEqual, isIdentical, isNode, isNull, isRunning, isStable, isStarted, isStopped, isSubscribed, isSubscribed, isSubscribed, iterateNodes, iterateValues, iterator, onChildAdded, onChildChanged, onChildRemoved, onInfoChanged, onSet, onSet, onStable, onStarted, onStopped, onSubscribe, onSubscribed, onSubscribed, onUnsubscribe, onUnsubscribed, onUnsubscribed, put, put, put, put, put, put, put, put, remove, remove, stable, start, stop, subscribe, toNode, unsubscribe, validateChildadmin, admin, admin, debug, debug, debug, error, error, error, fatal, fatal, fatal, fine, fine, fine, info, info, info, trace, trace, trace, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorprotected void declareDefaults()-
DSNodedeclareDefaults in class DSNodeTo create non-removable children.public DSLinkConnection getConnection()-
public DSLink getLink()-
protected java.lang.String getLogName()-
DSLoggergetLogName in class DSNodepublic ActionResult onInvoke(DSInfo action, - ActionInvocation invocation)-
DSNodeonInvoke in class DSNodeaction - Child info for the action, you can declare a field for the action info for
- quick instance comparison.invocation - Details about the incoming invoke as well as the mechanism to send updates
- over an open stream.DSAction.invoke(DSInfo, ActionInvocation)protected void validateParent(DSNode node)-
DSNodevalidateParent in class DSNodepublic class DSUnsupportedException -extends DSRequestException-
| Constructor and Description | -
|---|
DSUnsupportedException() |
-
DSUnsupportedException(java.lang.String message) |
-
getDetail, setDetail, setDetailaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitSee: Description
-| Interface | -Description | -
|---|---|
| DSIRequester | -
- Interface for submitting outbound requests.
- |
-
| DSIResponder | -
- Interface for nodes in the node tree to manually handle requests.
- |
-
| DSLinkConnection.Listener | -
- Intended for requester functionality so that requesters can know when to
- start and stop making requests.
- |
-
| Class | -Description | -
|---|---|
| DSLink | -
- Represents an upstream connection, a node tree, and manages the lifecycle of both.
- |
-
| DSLinkConfig | -
- Configuration options for starting a link.
- |
-
| DSLinkConnection | -
- Represents an upstream connection with a broker.
- |
-
| DSMainNode | -
- The root DSNode that triggers a link's custom functionality .
- |
-
| DSSysNode | -
- The root of the system nodes.
- |
-
| Exception | -Description | -
|---|---|
| DSInternalErrorException | -
- Indicates an unsupported method.
- |
-
| DSInvalidPathException | -
- Indicates a request path was invalid.
- |
-
| DSPermissionException | -
- Indicates a request has insufficient permissions.
- |
-
| DSRequestException | -
- Indicates something was wrong with a request.
- |
-
| DSUnsupportedException | -
- Indicates an unsupported method.
- |
-
public abstract class AbstractInvokeHandler -extends java.lang.Object -implements OutboundInvokeHandler-
OutboundInvokeHandler.Mode| Constructor and Description | -
|---|
AbstractInvokeHandler() |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSMap |
-getParams()
-Returns the value passed to onInit.
- |
-
java.lang.String |
-getPath()
-Returns the value passed to onInit.
- |
-
OutboundStream |
-getStream()
-Returns the value passed to onInit.
- |
-
void |
-onInit(java.lang.String path,
- DSMap params,
- OutboundStream stream)
-Sets the fields so they can be access via the corresponding getters.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonColumns, onInsert, onMode, onReplace, onTableMeta, onUpdateonClose, onErrorpublic DSMap getParams()-
public java.lang.String getPath()-
public OutboundStream getStream()-
public void onInit(java.lang.String path, - DSMap params, - OutboundStream stream)-
- - Called by the requester before returning from the invoke method.
onInit in interface OutboundInvokeHandlerpath - Path being listed.params - Parameter to the invoke method.stream - Mechanism to close the request stream.public abstract class AbstractListHandler -extends java.lang.Object -implements OutboundListHandler-
- - onUpdate will be called until the initial state is fully loaded. After which onInitialized will - be called. After that, onUpdate and onRemove will be called for state changes. - -
- - Configs, or node metadata names start with $. Attributes start with @. Anything else represents - a child. Child maps will only contain configs/node metadata.
| Constructor and Description | -
|---|
AbstractListHandler() |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-getPath()
-Returns the value passed to onInit.
- |
-
OutboundStream |
-getStream()
-Returns the value passed to onInit.
- |
-
void |
-onInit(java.lang.String path,
- OutboundStream stream)
-Sets the fields so they can be accessed with the corresponding getters.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonInitialized, onRemove, onUpdateonClose, onErrorpublic java.lang.String getPath()-
public OutboundStream getStream()-
public void onInit(java.lang.String path, - OutboundStream stream)-
- - Called by the requester before returning from the list method.
onInit in interface OutboundListHandlerpath - Parameter to the list method.stream - Mechanism to close the request stream.public abstract class AbstractSubscribeHandler -extends java.lang.Object -implements OutboundSubscribeHandler-
| Constructor and Description | -
|---|
AbstractSubscribeHandler() |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-getPath()
-Returns the value passed to onInit.
- |
-
int |
-getQos()
-Returns the value passed to onInit.
- |
-
OutboundStream |
-getStream()
-Returns the value passed to onInit.
- |
-
void |
-onInit(java.lang.String path,
- int qos,
- OutboundStream stream)
-Sets the fields so they can be accessed via the corresponding getters.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonUpdateonClose, onErrorpublic AbstractSubscribeHandler()-
public java.lang.String getPath()-
public int getQos()-
public OutboundStream getStream()-
public void onInit(java.lang.String path, - int qos, - OutboundStream stream)-
- - Called by the requester before returning from the subscribe method.
onInit in interface OutboundSubscribeHandlerpath - Who is being subscribed.qos - Quality of service, 0-3.stream - Mechanism to close the request stream.| Enum Constant and Description | -
|---|
badRequest |
-
internalError |
-
notSupported |
-
permissionDenied |
-
| Modifier and Type | -Method and Description | -
|---|---|
static java.lang.RuntimeException |
-makeException(ErrorType type,
- java.lang.String message) |
-
static ErrorType |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static ErrorType[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final ErrorType badRequest-
public static final ErrorType internalError-
public static final ErrorType notSupported-
public static final ErrorType permissionDenied-
public static ErrorType[] values()-
-for (ErrorType c : ErrorType.values()) - System.out.println(c); -
public static ErrorType valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static java.lang.RuntimeException makeException(ErrorType type, - java.lang.String message)-
public static enum OutboundInvokeHandler.Mode -extends java.lang.Enum<OutboundInvokeHandler.Mode>-
| Enum Constant and Description | -
|---|
APPEND |
-
REFRESH |
-
STREAM |
-
| Modifier and Type | -Method and Description | -
|---|---|
static OutboundInvokeHandler.Mode |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static OutboundInvokeHandler.Mode[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final OutboundInvokeHandler.Mode APPEND-
public static final OutboundInvokeHandler.Mode REFRESH-
public static final OutboundInvokeHandler.Mode STREAM-
public static OutboundInvokeHandler.Mode[] values()-
-for (OutboundInvokeHandler.Mode c : OutboundInvokeHandler.Mode.values()) - System.out.println(c); -
public static OutboundInvokeHandler.Mode valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic interface OutboundInvokeHandler -extends OutboundRequestHandler-
| Modifier and Type | -Interface and Description | -
|---|---|
static class |
-OutboundInvokeHandler.Mode |
-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-onColumns(DSList list)
-Called whenever columns are received.
- |
-
void |
-onInit(java.lang.String path,
- DSMap params,
- OutboundStream stream)
-Called by the requester before returning from the invoke method.
- |
-
void |
-onInsert(int index,
- DSList rows)
-Called when the given rows should be inserted at the given index.
- |
-
void |
-onMode(OutboundInvokeHandler.Mode mode)
-Called whenever a mode is received.
- |
-
void |
-onReplace(int start,
- int end,
- DSList rows)
-The rows starting and ending with the given indexes should be removed and the given rows
- inserted at the start index.
- |
-
void |
-onTableMeta(DSMap map)
-Called whenever metadata for the entire table is received.
- |
-
void |
-onUpdate(DSList row)
-Called for every row.
- |
-
onClose, onErrorvoid onColumns(DSList list)-
list - A list of maps.void onInit(java.lang.String path, - DSMap params, - OutboundStream stream)-
path - Path being listed.params - Parameter to the invoke method.stream - Mechanism to close the request stream.void onInsert(int index, - DSList rows)-
index - Where to insert the given rows.rows - What to insert at the given index.void onMode(OutboundInvokeHandler.Mode mode)-
void onReplace(int start, - int end, - DSList rows)-
start - First inclusive of rows to be replaced.end - Last inclusive index of rows to be replaced.rows - What to insert at the starting index.void onTableMeta(DSMap map)-
void onUpdate(DSList row)-
public interface OutboundListHandler -extends OutboundRequestHandler-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-onInit(java.lang.String path,
- OutboundStream stream)
-Called by the requester before returning from the list method.
- |
-
void |
-onInitialized()
-Called once the initial state of the target has been transmitted.
- |
-
void |
-onRemove(java.lang.String name)
-Only called after onOpen(), indicates something about the target of the request has been
- removed.
- |
-
void |
-onUpdate(java.lang.String name,
- DSElement value)
-Called to provide a value for node metadata, attribute or child.
- |
-
onClose, onErrorvoid onInit(java.lang.String path, - OutboundStream stream)-
path - Parameter to the list method.stream - Mechanism to close the request stream.void onInitialized()-
void onRemove(java.lang.String name)-
name - Name of the the thing that has been removed.void onUpdate(java.lang.String name, - DSElement value)-
name - Node metadata starts with $, attributes @, otherwise represents a child.value - If a child, will be a map.public interface OutboundRequestHandler
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-onClose()
-Callback for when the request stream is closed, no matter how or by who.
- |
-
void |
-onError(ErrorType type,
- java.lang.String msg)
-Callback for when an error is received.
- |
-
void onClose()-
void onError(ErrorType type, - java.lang.String msg)-
public interface OutboundStream
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-closeStream()
-Allows the requester to close the stream.
- |
-
boolean |
-isStreamOpen()
-Whether or not the request is open.
- |
-
public interface OutboundSubscribeHandler -extends OutboundRequestHandler-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-onInit(java.lang.String path,
- int qos,
- OutboundStream stream)
-Called by the requester before returning from the subscribe method.
- |
-
void |
-onUpdate(DSDateTime dateTime,
- DSElement value,
- DSStatus status)
-Subscription update mechanism.
- |
-
onClose, onErrorvoid onInit(java.lang.String path, - int qos, - OutboundStream stream)-
path - Who is being subscribed.qos - Quality of service, 0-3.stream - Mechanism to close the request stream.void onUpdate(DSDateTime dateTime, - DSElement value, - DSStatus status)-
dateTime - Timestamp of the value.value - The update value.status - The status of the value, never null.public class SimpleInvokeHandler -extends AbstractInvokeHandler-
- Call getResult(long timeout) to block until the invocation is complete. It will either return - the result (possibly null), or throw an exception.
OutboundInvokeHandler.Mode| Constructor and Description | -
|---|
SimpleInvokeHandler() |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSList |
-getResult(long timeout)
-Waits for the stream to close before returning, or the timeout to occur.
- |
-
boolean |
-isAutoClose()
-True by default, whether or not to close the stream upon receiving the first result.
- |
-
void |
-onClose()
-Causes getResult to return.
- |
-
void |
-onColumns(DSList list)
-Does nothing.
- |
-
void |
-onError(ErrorType type,
- java.lang.String msg)
-Will create an exception to be thrown by getResult.
- |
-
void |
-onInsert(int index,
- DSList rows)
-Will result in an error since tables and streams are not supported.
- |
-
void |
-onMode(OutboundInvokeHandler.Mode mode)
-Does nothing.
- |
-
void |
-onReplace(int start,
- int end,
- DSList rows)
-Will result in an error since tables and streams are not supported.
- |
-
void |
-onTableMeta(DSMap map)
-Called whenever metadata for the entire table is received.
- |
-
void |
-onUpdate(DSList row)
-Captures the result and if auto-close is true, closes the stream.
- |
-
SimpleInvokeHandler |
-setAutoClose(boolean arg)
-Whether or not to auto close the stream on the first update.
- |
-
getParams, getPath, getStream, onInitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic DSList getResult(long timeout)-
timeout - Passed to Object.waitjava.lang.RuntimeException - if there is a timeout, or if there are any errors.public boolean isAutoClose()-
public void onClose()-
public void onError(ErrorType type, - java.lang.String msg)-
public void onColumns(DSList list)-
list - A list of maps.public void onInsert(int index, - DSList rows)-
index - Where to insert the given rows.rows - What to insert at the given index.public void onMode(OutboundInvokeHandler.Mode mode)-
public void onReplace(int start, - int end, - DSList rows)-
start - First inclusive of rows to be replaced.end - Last inclusive index of rows to be replaced.rows - What to insert at the starting index.public void onTableMeta(DSMap map)-
OutboundInvokeHandlerpublic void onUpdate(DSList row)-
public SimpleInvokeHandler setAutoClose(boolean arg)-
public class SimpleRequestHandler -extends java.lang.Object -implements OutboundRequestHandler-
| Modifier and Type | -Field and Description | -
|---|---|
static SimpleRequestHandler |
-DEFAULT
-An instance that can be used for those requests where the callbacks don't really matter.
- |
-
| Constructor and Description | -
|---|
SimpleRequestHandler() |
-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-onClose()
-Does nothing by default.
- |
-
void |
-onError(ErrorType type,
- java.lang.String msg)
-Does nothing by default.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final SimpleRequestHandler DEFAULT-
public void onClose()-
- - Callback for when the request stream is closed, no matter how or by who. Will be called if - there is an error as well.
onClose in interface OutboundRequestHandlerpublic void onError(ErrorType type, - java.lang.String msg)-
- - Callback for when an error is received. onClose will also be called after this. - Does nothing by default.
onError in interface OutboundRequestHandlerSee: Description
-| Interface | -Description | -
|---|---|
| OutboundInvokeHandler | -
- Callback mechanism passed to the invoke method on DSIRequester.
- |
-
| OutboundListHandler | -
- Callback mechanism passed to the list method on DSIRequester.
- |
-
| OutboundRequestHandler | -
- Callbacks common to all outbound requests.
- |
-
| OutboundStream | -
- Mechanism for the requester to close outbound requests.
- |
-
| OutboundSubscribeHandler | -
- Callback mechanism passed to the subscribe method in the requester.
- |
-
| Class | -Description | -
|---|---|
| AbstractInvokeHandler | -
- Convenience implementation of the callback passed to the invoke method in the requester.
- |
-
| AbstractListHandler | -
- Convenience implementation of the handler passed to the invoke method in the requester.
- |
-
| AbstractSubscribeHandler | -
- Convenience implementation of the handler passed to the subscribe method in the requester.
- |
-
| SimpleInvokeHandler | -
- Action handler for non-tables/streams.
- |
-
| SimpleRequestHandler | -
- Empty callback implementations.
- |
-
| Enum | -Description | -
|---|---|
| ErrorType | -- |
| OutboundInvokeHandler.Mode | -- |
public interface ApiObject
-| Modifier and Type | -Method and Description | -
|---|---|
ActionSpec |
-getAction()
-The action, should only be called if isAction() returns true.
- |
-
java.util.Iterator<ApiObject> |
-getChildren()
-Iterator of child objects, should only be called if hasChildren() returns true.
- |
-
void |
-getMetadata(DSMap bucket) |
-
java.lang.String |
-getName()
-The display name.
- |
-
DSIValue |
-getValue()
-Value of the object, should only be called if isValue() returns true.
- |
-
boolean |
-hasChildren()
-True if getChildren() can be called.
- |
-
boolean |
-isAction()
-True if the object is an action.
- |
-
boolean |
-isAdmin()
-Whether or not this object requires configuration permission to read/write.
- |
-
boolean |
-isHidden()
-True if the object should ignored (not be exposed through the api).
- |
-
boolean |
-isReadOnly()
-True if the object is a value and cannot be written.
- |
-
boolean |
-isValue()
-True if getValue() can be called.
- |
-
ActionSpec getAction()-
java.util.Iterator<ApiObject> getChildren()-
void getMetadata(DSMap bucket)-
java.lang.String getName()-
DSIValue getValue()-
boolean hasChildren()-
boolean isAction()-
boolean isAdmin()-
boolean isHidden()-
boolean isReadOnly()-
boolean isValue()-
public interface InboundInvokeRequest -extends InboundRequest, ActionInvocation-
ActionInvocationgetPath, getRequestIdclearAllRows, close, close, getParameters, getPermission, insert, isOpen, replace, sendpublic interface InboundListRequest -extends InboundRequest-
DSIResponder.onList(InboundListRequest)| Modifier and Type | -Method and Description | -
|---|---|
void |
-childAdded(ApiObject child)
-The responder should call this whenever a child is added.
- |
-
void |
-childRemoved(ApiObject child)
-The responder should call this whenever a child is removed.
- |
-
void |
-close()
-Allows the responder to forcefully close the list stream.
- |
-
void |
-close(java.lang.Exception reason)
-Allows the responder to forcefully close the list stream.
- |
-
boolean |
-isOpen()
-Whether or not the list stream is still open.
- |
-
getPath, getRequestIdvoid childAdded(ApiObject child)-
void childRemoved(ApiObject child)-
void close()-
void close(java.lang.Exception reason)-
boolean isOpen()-
public interface InboundRequest
-| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-getPath()
-The target of the request.
- |
-
java.lang.Integer |
-getRequestId()
-Unique ID of the request, or 0 for subscriptions.
- |
-
public interface InboundSetRequest -extends InboundRequest-
| Modifier and Type | -Method and Description | -
|---|---|
DSPermission |
-getPermission()
-The permission to set with.
- |
-
DSElement |
-getValue()
-The value to set.
- |
-
getPath, getRequestIdDSElement getValue()-
DSPermission getPermission()-
public interface InboundSubscribeRequest -extends InboundRequest-
DSIResponder.onSubscribe(InboundSubscribeRequest)| Modifier and Type | -Method and Description | -
|---|---|
void |
-close()
-Allows the responder to forcefully terminate the subscription.
- |
-
java.lang.Integer |
-getSubscriptionId()
-Unique subscription id for this path.
- |
-
void |
-update(long timestamp,
- DSIValue value,
- DSStatus quality)
-The responder should call this when first received and then whenever the value or status
- changes.
- |
-
getPath, getRequestIdpublic interface OutboundListResponse
-DSIResponder.onList(InboundListRequest)| Modifier and Type | -Method and Description | -
|---|---|
ApiObject |
-getTarget()
-The object that represents the path of the request.
- |
-
void |
-onClose()
-Will be called no matter how the stream is closed.
- |
-
public interface SubscriptionCloseHandler
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-onClose(java.lang.Integer subscriptionId)
-Will be called no matter how the subscription is terminated.
- |
-
See: Description
-| Interface | -Description | -
|---|---|
| ApiObject | -
- Can be a node, value or an action.
- |
-
| InboundInvokeRequest | -
- See ActionInvocation for the real meat.
- |
-
| InboundListRequest | -
- The details about an incoming list request passed to the responder.
- |
-
| InboundRequest | -
- Common to all incoming requests.
- |
-
| InboundSetRequest | -- |
| InboundSubscribeRequest | -
- The details about an incoming subscribe request passed to the responder.
- |
-
| OutboundListResponse | -
- The responder is responsible for returning this upon notification of a list request.
- |
-
| SubscriptionCloseHandler | -
- The responder returns this from the subscription request notification method so the link can
- notify the responder whenever a subscription is terminated.
- |
-
public abstract class AbstractReader -extends java.lang.Object -implements DSIReader-
DSIReader.Token| Modifier and Type | -Field and Description | -
|---|---|
protected boolean |
-valBoolean |
-
protected byte[] |
-valBytes |
-
protected long |
-valLong |
-
protected double |
-valReal |
-
protected java.lang.String |
-valString |
-
| Constructor and Description | -
|---|
AbstractReader() |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-getBoolean()
-Returns the value when last() == BOOLEAN.
- |
-
byte[] |
-getBytes()
-Returns the value when last() == BYTES.
- |
-
double |
-getDouble()
-Returns the value when last() == DOUBLE.
- |
-
DSElement |
-getElement()
-Returns the DSElement when last() == raw type or ROOT.
- |
-
DSList |
-getList()
-This should only be called when last() == BEGIN_LIST and it will decodeKeys the entire
- list.
- |
-
long |
-getLong()
-Returns the value when last() == LONG.
- |
-
DSMap |
-getMap()
-This should only be called when last() == BEGIN_MAP and it will decodeKeys the entire map.
- |
-
java.lang.String |
-getString()
-Returns the value when last() == STRING.
- |
-
DSIReader.Token |
-last()
-The last value returned from next().
- |
-
abstract DSIReader.Token |
-next()
-Subclasses must override this, read the next item from the stream, then call one of the
- setXxx methods.
- |
-
AbstractReader |
-reset()
-Sets last() == ROOT.
- |
-
protected DSIReader.Token |
-setBeginList() |
-
protected DSIReader.Token |
-setBeginMap() |
-
protected DSIReader.Token |
-setEndInput() |
-
protected DSIReader.Token |
-setEndList() |
-
protected DSIReader.Token |
-setEndMap() |
-
protected DSIReader.Token |
-setNextValue(boolean arg) |
-
protected DSIReader.Token |
-setNextValue(byte[] arg) |
-
protected DSIReader.Token |
-setNextValue(double arg) |
-
protected DSIReader.Token |
-setNextValue(long arg) |
-
protected DSIReader.Token |
-setNextValue(java.lang.String arg) |
-
protected DSIReader.Token |
-setNextValueNull() |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected boolean valBoolean-
protected byte[] valBytes-
protected double valReal-
protected long valLong-
protected java.lang.String valString-
public boolean getBoolean()-
DSIReadergetBoolean in interface DSIReaderpublic byte[] getBytes()-
DSIReaderpublic double getDouble()-
DSIReaderpublic DSElement getElement()-
DSIReadergetElement in interface DSIReaderpublic DSList getList()-
DSIReaderpublic long getLong()-
DSIReaderpublic DSMap getMap()-
DSIReaderpublic java.lang.String getString()-
DSIReaderpublic DSIReader.Token last()-
DSIReaderpublic abstract DSIReader.Token next()-
- - Advances the reader to the next item and returns the token representing it's current state.
protected DSIReader.Token setBeginList()-
protected DSIReader.Token setBeginMap()-
protected DSIReader.Token setEndList()-
protected DSIReader.Token setEndMap()-
protected DSIReader.Token setEndInput()-
protected DSIReader.Token setNextValue(boolean arg)-
protected DSIReader.Token setNextValue(byte[] arg)-
protected DSIReader.Token setNextValue(double arg)-
protected DSIReader.Token setNextValue(long arg)-
protected DSIReader.Token setNextValue(java.lang.String arg)-
protected DSIReader.Token setNextValueNull()-
public AbstractReader reset()-
DSIReaderpublic abstract class AbstractWriter -extends java.lang.Object -implements java.io.Closeable, DSIWriter-
DSIWriter| Modifier and Type | -Field and Description | -
|---|---|
protected boolean |
-prettyPrint
-Subclasses can use this if applicable.
- |
-
| Constructor and Description | -
|---|
AbstractWriter() |
-
| Modifier and Type | -Method and Description | -
|---|---|
AbstractWriter |
-beginList()
-Start a new list and return this.
- |
-
AbstractWriter |
-beginList(int size)
-Start a new list of the given size and return this.
- |
-
AbstractWriter |
-beginMap()
-Start a new map and return this.
- |
-
AbstractWriter |
-beginMap(int size)
-Start a new map of the given size and return this.
- |
-
AbstractWriter |
-endList()
-End the current list.
- |
-
AbstractWriter |
-endMap()
-End the current map.
- |
-
protected int |
-getDepth()
-Current depth in the tree, will be needed by writeNewLineIndent.
- |
-
AbstractWriter |
-key(java.lang.CharSequence arg)
-Write a key in the current map.
- |
-
int |
-length()
-Returns 0 by default.
- |
-
AbstractWriter |
-reset()
-Clears the state of the writer.
- |
-
AbstractWriter |
-value(boolean arg)
-Write a value to the map or list.
- |
-
AbstractWriter |
-value(byte[] arg)
-Write a value to the map or list.
- |
-
AbstractWriter |
-value(double arg)
-Write a value to the map or list.
- |
-
AbstractWriter |
-value(DSElement arg)
-Write a value to the map or list.
- |
-
AbstractWriter |
-value(int arg)
-Write a value to the map or list.
- |
-
AbstractWriter |
-value(long arg)
-Write a value to the map or list.
- |
-
AbstractWriter |
-value(java.lang.String arg)
-Write a value to the map or list.
- |
-
protected abstract void |
-write(boolean arg)
-Write the value.
- |
-
protected abstract void |
-write(byte[] arg)
-Write the value.
- |
-
protected abstract void |
-write(double arg)
-Write the value.
- |
-
protected abstract void |
-write(long arg)
-Write the value.
- |
-
protected abstract void |
-writeKey(java.lang.CharSequence arg)
-Write string key of a map entry.
- |
-
protected abstract void |
-writeKeyValueSeparator()
-Separate the key from the value in a map.
- |
-
protected abstract void |
-writeListEnd()
-End the current list.
- |
-
protected abstract void |
-writeListStart(int size)
-Start a new list.
- |
-
protected abstract void |
-writeMapEnd()
-End the current map.
- |
-
protected abstract void |
-writeMapStart(int size)
-Start a new map.
- |
-
protected void |
-writeNewLineIndent()
-Override point for subclasses which perform use pretty printing, such as json.
- |
-
protected abstract void |
-writeNull()
-Write a null value.
- |
-
protected abstract void |
-writeSeparator()
-Write a value separator, such as the comma in json.
- |
-
protected abstract void |
-writeValue(java.lang.CharSequence arg)
-Write the value, which will never be null.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected boolean prettyPrint-
public AbstractWriter beginList()-
DSIWriterpublic AbstractWriter beginList(int size)-
DSIWriterpublic AbstractWriter beginMap()-
DSIWriterpublic AbstractWriter beginMap(int size)-
DSIWriterpublic AbstractWriter endList()-
DSIWriterpublic AbstractWriter endMap()-
DSIWriterprotected int getDepth()-
public AbstractWriter key(java.lang.CharSequence arg)-
DSIWriterpublic int length()-
public AbstractWriter reset()-
DSIWriterpublic AbstractWriter value(DSElement arg)-
DSIWriterpublic AbstractWriter value(boolean arg)-
DSIWriterpublic AbstractWriter value(byte[] arg)-
DSIWriterpublic AbstractWriter value(double arg)-
DSIWriterpublic AbstractWriter value(int arg)-
DSIWriterpublic AbstractWriter value(long arg)-
DSIWriterpublic AbstractWriter value(java.lang.String arg)-
DSIWriterprotected abstract void write(boolean arg) - throws java.io.IOException-
java.io.IOExceptionprotected abstract void write(byte[] arg) - throws java.io.IOException-
java.io.IOExceptionprotected abstract void write(double arg) - throws java.io.IOException-
java.io.IOExceptionprotected abstract void write(long arg) - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeKey(java.lang.CharSequence arg) - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeKeyValueSeparator() - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeListEnd() - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeListStart(int size) - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeMapEnd() - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeMapStart(int size) - throws java.io.IOException-
java.io.IOExceptionprotected void writeNewLineIndent() - throws java.io.IOException-
java.io.IOExceptiongetDepth()protected abstract void writeNull() - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeSeparator() - throws java.io.IOException-
java.io.IOExceptionprotected abstract void writeValue(java.lang.CharSequence arg) - throws java.io.IOException-
java.io.IOExceptionpublic class DSBase64
-extends java.lang.Object
-| Modifier and Type | -Method and Description | -
|---|---|
static byte[] |
-decode(java.lang.String str)
-Decodes a base 64 encoded string.
- |
-
static java.lang.String |
-encode(byte[] buf)
-Encodes the bytes into a single line string with no padding.
- |
-
static java.lang.String |
-encode(byte[] buf,
- int linelen)
-Encodes the buffer into a String with the given line length.
- |
-
static java.lang.String |
-encodeUrl(byte[] bytes)
-Encodes to a URL safe base64 string.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static byte[] decode(java.lang.String str)-
str - Most not be null.java.lang.IllegalArgumentException - If anything is wrong with the parameter.public static java.lang.String encode(byte[] buf)-
buf - The bytes to encode.public static java.lang.String encode(byte[] buf, - int linelen)-
buf - The bytes to encode.linelen - A number greater than zero limits the number of characters before an
- interleaving newline.public static java.lang.String encodeUrl(byte[] bytes)-
public static enum DSIReader.Token -extends java.lang.Enum<DSIReader.Token>-
| Enum Constant and Description | -
|---|
BEGIN_LIST |
-
BEGIN_MAP |
-
BOOLEAN |
-
BYTES |
-
DOUBLE |
-
END_INPUT |
-
END_LIST |
-
END_MAP |
-
LONG |
-
NULL |
-
ROOT |
-
STRING |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSIReader.Token |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSIReader.Token[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSIReader.Token BEGIN_LIST-
public static final DSIReader.Token BEGIN_MAP-
public static final DSIReader.Token BOOLEAN-
public static final DSIReader.Token BYTES-
public static final DSIReader.Token END_INPUT-
public static final DSIReader.Token END_LIST-
public static final DSIReader.Token END_MAP-
public static final DSIReader.Token DOUBLE-
public static final DSIReader.Token LONG-
public static final DSIReader.Token NULL-
public static final DSIReader.Token ROOT-
public static final DSIReader.Token STRING-
public static DSIReader.Token[] values()-
-for (DSIReader.Token c : DSIReader.Token.values()) - System.out.println(c); -
public static DSIReader.Token valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic interface DSIReader
-extends java.io.Closeable
-- - When next() returns: - -
- - Be aware that if the underlying encoding (such as JSON) doesn't provide a mechanism to - differentiate between data types (such as numbers), values might not get as the same type they - were encoded.
| Modifier and Type | -Interface and Description | -
|---|---|
static class |
-DSIReader.Token
-Represents the state of the reader, and determines which getter should be called next.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-close()
-Close the input.
- |
-
boolean |
-getBoolean()
-Returns the value when last() == BOOLEAN.
- |
-
byte[] |
-getBytes()
-Returns the value when last() == BYTES.
- |
-
double |
-getDouble()
-Returns the value when last() == DOUBLE.
- |
-
DSElement |
-getElement()
-Returns the DSElement when last() == raw type or ROOT.
- |
-
DSList |
-getList()
-This should only be called when last() == BEGIN_LIST and it will decodeKeys the entire
- list.
- |
-
long |
-getLong()
-Returns the value when last() == LONG.
- |
-
DSMap |
-getMap()
-This should only be called when last() == BEGIN_MAP and it will decodeKeys the entire map.
- |
-
java.lang.String |
-getString()
-Returns the value when last() == STRING.
- |
-
DSIReader.Token |
-last()
-The last value returned from next().
- |
-
DSIReader.Token |
-next()
-Advances the reader to the next item and returns the token representing it's current state.
- |
-
DSIReader |
-reset()
-Sets last() == ROOT.
- |
-
void close()-
close in interface java.lang.AutoCloseableclose in interface java.io.Closeableboolean getBoolean()-
byte[] getBytes()-
double getDouble()-
DSElement getElement()-
long getLong()-
DSList getList()-
DSMap getMap()-
java.lang.String getString()-
DSIReader.Token last()-
DSIReader.Token next()-
DSIReader reset()-
public interface DSIWriter
-extends java.io.Closeable
-- - To simply encode a DSMap or DSList, use the value(DSElement) method. - - For example: - -
- - Otherwise, you can stream data struct without using any DSIObject instances: - -
- - Be aware that if the underlying encoding (such as JSON) doesn't provide a mechanism to - differentiate between data types (such as numbers), values might not get as the same type they - were encoded.
| Modifier and Type | -Method and Description | -
|---|---|
DSIWriter |
-beginList()
-Start a new list and return this.
- |
-
DSIWriter |
-beginList(int size)
-Start a new list of the given size and return this.
- |
-
DSIWriter |
-beginMap()
-Start a new map and return this.
- |
-
DSIWriter |
-beginMap(int size)
-Start a new map of the given size and return this.
- |
-
void |
-close()
-Close the stream.
- |
-
DSIWriter |
-endList()
-End the current list.
- |
-
DSIWriter |
-endMap()
-End the current map.
- |
-
DSIWriter |
-flush()
-Flush the stream.
- |
-
DSIWriter |
-key(java.lang.CharSequence key)
-Write a key in the current map.
- |
-
int |
-length()
-If the writer is buffering output, this returns the size of that buffer.
- |
-
DSIWriter |
-reset()
-Clears the state of the writer.
- |
-
DSIWriter |
-value(boolean arg)
-Write a value to the map or list.
- |
-
DSIWriter |
-value(byte[] arg)
-Write a value to the map or list.
- |
-
DSIWriter |
-value(double arg)
-Write a value to the map or list.
- |
-
DSIWriter |
-value(DSElement arg)
-Write a value to the map or list.
- |
-
DSIWriter |
-value(int arg)
-Write a value to the map or list.
- |
-
DSIWriter |
-value(long arg)
-Write a value to the map or list.
- |
-
DSIWriter |
-value(java.lang.String arg)
-Write a value to the map or list.
- |
-
DSIWriter beginList()-
java.lang.IllegalStateException - when improperly called.DSIWriter beginList(int size)-
size - Less than zero means the size is unknown.java.lang.IllegalStateException - when improperly called.DSIWriter beginMap()-
java.lang.IllegalStateException - when improperly called.DSIWriter beginMap(int size)-
size - Less than zero means the size is unknown.java.lang.IllegalStateException - when improperly called.void close()-
close in interface java.lang.AutoCloseableclose in interface java.io.CloseableDSIWriter endList()-
java.lang.IllegalStateException - when improperly called.DSIWriter endMap()-
java.lang.IllegalStateException - when improperly called.DSIWriter flush()-
DSIWriter key(java.lang.CharSequence key)-
java.lang.IllegalStateException - when improperly called.int length()-
DSIWriter reset()-
DSIWriter value(DSElement arg)-
java.lang.IllegalStateException - when improperly called.DSIWriter value(boolean arg)-
java.lang.IllegalStateException - when improperly called.DSIWriter value(byte[] arg)-
java.lang.IllegalStateException - when improperly called.DSIWriter value(double arg)-
java.lang.IllegalStateException - when improperly called.DSIWriter value(int arg)-
java.lang.IllegalStateException - when improperly called.DSIWriter value(long arg)-
java.lang.IllegalStateException - when improperly called.DSIWriter value(java.lang.String arg)-
java.lang.IllegalStateException - when improperly called.public class NodeDecoder
-extends java.lang.Object
-- - This is for storing the configuration database, not for DSA interop.
NodeEncoder| Modifier and Type | -Method and Description | -
|---|---|
static DSNode |
-decode(DSIReader in)
-Reads a node tree from the given input.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic class NodeEncoder
-extends java.lang.Object
-- - This is for saving a configuration database, not for DSA interop.
NodeDecoder| Modifier and Type | -Method and Description | -
|---|---|
static DSIWriter |
-encode(DSIWriter out,
- DSNode node)
-Writes the node tree to the given writer.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static DSIWriter encode(DSIWriter out, - DSNode node)-
out - Where to write the node, also the return value (unclosed).node - What to encode.public abstract class AbstractJsonWriter -extends AbstractWriter -implements java.lang.Appendable, DSIWriter, JsonConstants-
prettyPrintDBL_NAN, DBL_NEG_INF, DBL_POS_INF| Constructor and Description | -
|---|
AbstractJsonWriter() |
-
| Modifier and Type | -Method and Description | -
|---|---|
abstract AbstractJsonWriter |
-append(char[] ch,
- int off,
- int len)
-Append the characters and return this.
- |
-
AbstractJsonWriter |
-setPrettyPrint(boolean arg) |
-
AbstractWriter |
-value(DSElement arg)
-Write a value to the map or list.
- |
-
protected void |
-write(boolean arg)
-Write the value.
- |
-
protected void |
-write(byte[] arg)
-Write the value.
- |
-
protected void |
-write(double arg)
-Write the value.
- |
-
protected void |
-write(long arg)
-Write the value.
- |
-
protected void |
-writeKey(java.lang.CharSequence arg)
-Write string key of a map entry.
- |
-
protected void |
-writeKeyValueSeparator()
-Separate the key from the value in a map.
- |
-
protected void |
-writeListEnd()
-End the current list.
- |
-
protected void |
-writeListStart(int size)
-Start a new list.
- |
-
protected void |
-writeMapEnd()
-End the current map.
- |
-
protected void |
-writeMapStart(int size)
-Start a new map.
- |
-
void |
-writeNewLineIndent()
-Two spaces per level.
- |
-
protected void |
-writeNull()
-Write a null value.
- |
-
protected void |
-writeSeparator()
-Write a value separator, such as the comma in json.
- |
-
protected void |
-writeValue(java.lang.CharSequence arg)
-Write the value, which will never be null.
- |
-
beginList, beginList, beginMap, beginMap, endList, endMap, getDepth, key, length, reset, value, value, value, value, value, valueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappend, append, appendpublic abstract AbstractJsonWriter append(char[] ch, - int off, - int len)-
public AbstractJsonWriter setPrettyPrint(boolean arg)-
public AbstractWriter value(DSElement arg)-
DSIWritervalue in interface DSIWritervalue in class AbstractWriterprotected void writeSeparator() - throws java.io.IOException-
AbstractWriterwriteSeparator in class AbstractWriterjava.io.IOExceptionpublic void writeNewLineIndent()-
writeNewLineIndent in class AbstractWriterAbstractWriter.getDepth()protected void write(boolean arg) - throws java.io.IOException-
AbstractWriterwrite in class AbstractWriterjava.io.IOExceptionprotected void write(byte[] arg) - throws java.io.IOException-
AbstractWriterwrite in class AbstractWriterjava.io.IOExceptionprotected void write(double arg) - throws java.io.IOException-
AbstractWriterwrite in class AbstractWriterjava.io.IOExceptionprotected void write(long arg) - throws java.io.IOException-
AbstractWriterwrite in class AbstractWriterjava.io.IOExceptionprotected void writeKey(java.lang.CharSequence arg) - throws java.io.IOException-
AbstractWriterwriteKey in class AbstractWriterjava.io.IOExceptionprotected void writeKeyValueSeparator() - throws java.io.IOException-
AbstractWriterwriteKeyValueSeparator in class AbstractWriterjava.io.IOExceptionprotected void writeListEnd() - throws java.io.IOException-
AbstractWriterwriteListEnd in class AbstractWriterjava.io.IOExceptionprotected void writeListStart(int size) - throws java.io.IOException-
AbstractWriterwriteListStart in class AbstractWriterjava.io.IOExceptionprotected void writeMapEnd() - throws java.io.IOException-
AbstractWriterwriteMapEnd in class AbstractWriterjava.io.IOExceptionprotected void writeMapStart(int size) - throws java.io.IOException-
AbstractWriterwriteMapStart in class AbstractWriterjava.io.IOExceptionprotected void writeNull() - throws java.io.IOException-
AbstractWriterwriteNull in class AbstractWriterjava.io.IOExceptionprotected void writeValue(java.lang.CharSequence arg) - throws java.io.IOException-
AbstractWriterwriteValue in class AbstractWriterjava.io.IOExceptionpublic class JsonAppender -extends AbstractJsonWriter-
The same instance can be - reused with the setOutput methods.
This class is not thread safe.
prettyPrintDBL_NAN, DBL_NEG_INF, DBL_POS_INF| Constructor and Description | -
|---|
JsonAppender()
-Be sure to call one of the setOutput methods.
- |
-
JsonAppender(java.lang.Appendable arg)
-Will write directly to the given appendable.
- |
-
JsonAppender(java.io.File arg)
-Creates an underlying FileWriter.
- |
-
JsonAppender(java.io.File file,
- java.lang.String zipFileName)
-Will create a zip file using the zipFileName as file name inside the zip.
- |
-
JsonAppender(java.io.OutputStream arg)
-Creates an underlying OutputStreamWriter.
- |
-
JsonAppender(java.io.OutputStream out,
- java.lang.String zipFileName)
-Will write a zip file to the given stream.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.Appendable |
-append(char ch)
-Append the char and return this.
- |
-
JsonAppender |
-append(char[] ch,
- int off,
- int len)
-Append the chars and return this.
- |
-
java.lang.Appendable |
-append(java.lang.CharSequence csq)
-Append the chars and return this.
- |
-
java.lang.Appendable |
-append(java.lang.CharSequence csq,
- int start,
- int end)
-Append the chars and return this.
- |
-
void |
-close()
-Close the stream.
- |
-
JsonAppender |
-flush()
-Flush the stream.
- |
-
boolean |
-isZip()
-Whether or not this is zipping the output.
- |
-
JsonAppender |
-reset()
-Clears the state of the writer.
- |
-
JsonAppender |
-setOutput(java.lang.Appendable arg)
-Sets the sink, resets the state and returns this.
- |
-
JsonAppender |
-setOutput(java.io.File arg)
-Sets the sink, resets the state and returns this.
- |
-
JsonAppender |
-setOutput(java.io.File file,
- java.lang.String zipFileName)
-Will create a zip file using the zipFileName as file name inside the zip.
- |
-
JsonAppender |
-setOutput(java.io.OutputStream arg)
-Sets the sink, resets the state and returns this.
- |
-
JsonAppender |
-setOutput(java.io.OutputStream out,
- java.lang.String zipFileName)
-Will write a zip file to the given stream.
- |
-
setPrettyPrint, value, write, write, write, write, writeKey, writeKeyValueSeparator, writeListEnd, writeListStart, writeMapEnd, writeMapStart, writeNewLineIndent, writeNull, writeSeparator, writeValuebeginList, beginList, beginMap, beginMap, endList, endMap, getDepth, key, length, value, value, value, value, value, valueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic JsonAppender()-
public JsonAppender(java.lang.Appendable arg)-
public JsonAppender(java.io.File arg)-
public JsonAppender(java.io.File file, - java.lang.String zipFileName)-
public JsonAppender(java.io.OutputStream arg)-
public JsonAppender(java.io.OutputStream out, - java.lang.String zipFileName)-
public java.lang.Appendable append(char ch)-
public JsonAppender append(char[] ch, - int off, - int len)-
append in class AbstractJsonWriterpublic java.lang.Appendable append(java.lang.CharSequence csq)-
public java.lang.Appendable append(java.lang.CharSequence csq, - int start, - int end)-
public void close()-
DSIWriterpublic JsonAppender flush()-
DSIWriterpublic boolean isZip()-
public JsonAppender reset()-
DSIWriterreset in interface DSIWriterreset in class AbstractWriterpublic JsonAppender setOutput(java.lang.Appendable arg)-
public JsonAppender setOutput(java.io.File arg)-
public JsonAppender setOutput(java.io.File file, - java.lang.String zipFileName)-
public JsonAppender setOutput(java.io.OutputStream arg)-
public JsonAppender setOutput(java.io.OutputStream out, - java.lang.String zipFileName)-
public interface JsonConstants
-| Modifier and Type | -Field and Description | -
|---|---|
static java.lang.String |
-DBL_NAN
-How Double.NaN is encoded: "\\u001BNaN"
- |
-
static java.lang.String |
-DBL_NEG_INF
-How Double.NEGATIVE_INFINITY is encoded: "\\u001B-Infinity"
- |
-
static java.lang.String |
-DBL_POS_INF
-How Double.POSITIVE_INFINITY is encoded: "\\u001BInfinity"
- |
-
static final java.lang.String DBL_NAN-
static final java.lang.String DBL_NEG_INF-
static final java.lang.String DBL_POS_INF-
public class JsonReader -extends AbstractReader -implements DSIReader, JsonConstants-
DSIReaderDSIReader.TokenvalBoolean, valBytes, valLong, valReal, valStringDBL_NAN, DBL_NEG_INF, DBL_POS_INF| Constructor and Description | -
|---|
JsonReader() |
-
JsonReader(java.lang.CharSequence in) |
-
JsonReader(java.io.File file) |
-
JsonReader(java.io.InputStream in,
- java.lang.String charset) |
-
JsonReader(java.io.Reader in) |
-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-close()
-Close the input.
- |
-
DSIReader.Token |
-next()
-Subclasses must override this, read the next item from the stream, then call one of the
- setXxx methods.
- |
-
JsonReader |
-reset()
-Sets last() == ROOT.
- |
-
JsonReader |
-setInput(java.lang.CharSequence in)
-Sets the input source, resets to ROOT, and returns this.
- |
-
JsonReader |
-setInput(java.io.File file)
-Sets the input source, resets to ROOT, and returns this.
- |
-
JsonReader |
-setInput(java.io.InputStream inputStream,
- java.lang.String charset)
-Sets the input source, resets to ROOT, and returns this.
- |
-
JsonReader |
-setInput(java.io.Reader reader)
-Sets the input source, resets to ROOT, and returns this.
- |
-
getBoolean, getBytes, getDouble, getElement, getList, getLong, getMap, getString, last, setBeginList, setBeginMap, setEndInput, setEndList, setEndMap, setNextValue, setNextValue, setNextValue, setNextValue, setNextValue, setNextValueNullclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic JsonReader()-
public JsonReader(java.lang.CharSequence in)-
public JsonReader(java.io.File file)-
public JsonReader(java.io.InputStream in, - java.lang.String charset)-
public JsonReader(java.io.Reader in)-
public void close()-
DSIReaderpublic DSIReader.Token next()-
AbstractReader- - Advances the reader to the next item and returns the token representing it's current state.
next in interface DSIReadernext in class AbstractReaderpublic JsonReader reset()-
DSIReaderreset in interface DSIReaderreset in class AbstractReaderpublic JsonReader setInput(java.lang.CharSequence in)-
public JsonReader setInput(java.io.File file)-
public JsonReader setInput(java.io.InputStream inputStream, - java.lang.String charset)-
public JsonReader setInput(java.io.Reader reader)-
public class JsonWriter -extends AbstractJsonWriter-
The same instance can be reused - with the setOutput methods.
This class is not thread safe.
DSIWriterprettyPrintDBL_NAN, DBL_NEG_INF, DBL_POS_INF| Constructor and Description | -
|---|
JsonWriter()
-Be sure to call one of the setOutput methods.
- |
-
JsonWriter(java.io.File arg)
-Creates an underlying FileWriter.
- |
-
JsonWriter(java.io.File file,
- java.lang.String zipFileName)
-Will create a zip file using the zipFileName as file name inside the zip.
- |
-
JsonWriter(java.io.OutputStream arg)
-Creates an underlying OutputStreamWriter.
- |
-
JsonWriter(java.io.OutputStream out,
- java.lang.String zipFileName)
-Will write a zip file to the given stream.
- |
-
JsonWriter(java.io.Writer out) |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.Appendable |
-append(char ch) |
-
AbstractJsonWriter |
-append(char[] ch,
- int off,
- int len)
-Append the chars and return this.
- |
-
java.lang.Appendable |
-append(java.lang.CharSequence csq) |
-
java.lang.Appendable |
-append(java.lang.CharSequence csq,
- int start,
- int end)
-Append the chars and return this.
- |
-
void |
-close()
-Close the stream.
- |
-
JsonWriter |
-flush()
-Flush the stream.
- |
-
JsonWriter |
-reset()
-Clears the state of the writer.
- |
-
JsonWriter |
-setOutput(java.io.File arg)
-Sets the sink, resets the state and returns this.
- |
-
JsonWriter |
-setOutput(java.io.File file,
- java.lang.String zipFileName)
-Will create a zip file using the zipFileName as file name inside the zip.
- |
-
JsonWriter |
-setOutput(java.io.OutputStream arg)
-Sets the sink, resets the state and returns this.
- |
-
JsonWriter |
-setOutput(java.io.OutputStream out,
- java.lang.String zipFileName)
-Will write a zip file to the given stream.
- |
-
JsonWriter |
-setOutput(java.io.Writer out)
-Sets the sink, resets the state and returns this.
- |
-
setPrettyPrint, value, write, write, write, write, writeKey, writeKeyValueSeparator, writeListEnd, writeListStart, writeMapEnd, writeMapStart, writeNewLineIndent, writeNull, writeSeparator, writeValuebeginList, beginList, beginMap, beginMap, endList, endMap, getDepth, key, length, value, value, value, value, value, valueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic JsonWriter()-
public JsonWriter(java.io.File arg)-
public JsonWriter(java.io.File file, - java.lang.String zipFileName)-
public JsonWriter(java.io.OutputStream arg)-
public JsonWriter(java.io.OutputStream out, - java.lang.String zipFileName)-
public JsonWriter(java.io.Writer out)-
public void close()-
DSIWriterpublic JsonWriter flush()-
DSIWriterpublic JsonWriter reset()-
DSIWriterreset in interface DSIWriterreset in class AbstractWriterpublic JsonWriter setOutput(java.io.File arg)-
public JsonWriter setOutput(java.io.File file, - java.lang.String zipFileName)-
public JsonWriter setOutput(java.io.OutputStream arg)-
public JsonWriter setOutput(java.io.OutputStream out, - java.lang.String zipFileName)-
public JsonWriter setOutput(java.io.Writer out)-
public java.lang.Appendable append(java.lang.CharSequence csq) - throws java.io.IOException-
java.io.IOExceptionpublic java.lang.Appendable append(char ch) - throws java.io.IOException-
java.io.IOExceptionpublic java.lang.Appendable append(java.lang.CharSequence csq, - int start, - int end) - throws java.io.IOException-
java.io.IOExceptionpublic AbstractJsonWriter append(char[] ch, - int off, - int len)-
append in class AbstractJsonWriter| Interface | -Description | -
|---|---|
| JsonConstants | -
- Useful constants.
- |
-
| Class | -Description | -
|---|---|
| AbstractJsonWriter | -- |
| JsonAppender | -
- Json implementation of DSWriter intended for Appendables such as StringBuilders.
- |
-
| JsonReader | -
- Json implementation of DSReader.
- |
-
| JsonWriter | -
- Json implementation of DSWriter intended for OutputStreams and Writers.
- |
-
See: Description
-| Interface | -Description | -
|---|---|
| DSIReader | -
- A decoder that can be used to get an entire graph in pieces, or one large group, or somewhere in
- between.
- |
-
| DSIWriter | -
- An encoder that can be used to encode large graphs with or without object instances.
- |
-
| Class | -Description | -
|---|---|
| AbstractReader | -
- Basic implementation of DSReader.
- |
-
| AbstractWriter | -
- Basic implementation of DSWriter.
- |
-
| DSBase64 | -
- Thread-safe Base64 encoder and decoder.
- |
-
| NodeDecoder | -
- Decodes a node (tree) that was encoded with NodeEncoder.
- |
-
| NodeEncoder | -
- Encodes a node tree using a compact JSON schema.
- |
-
| Enum | -Description | -
|---|---|
| DSIReader.Token | -
- Represents the state of the reader, and determines which getter should be called next.
- |
-
public abstract class AsyncLogHandler -extends java.util.logging.Handler -implements DSILevels-
| Constructor and Description | -
|---|
AsyncLogHandler() |
-
| Modifier and Type | -Method and Description | -
|---|---|
void |
-close()
-Closes the PrintStream, terminates the write thread and performs houseKeeping.
- |
-
void |
-flush() |
-
long |
-getHouseKeepingIntervalMillis()
-Ten seconds by default, this is a guideline more than anything else.
- |
-
protected java.io.PrintStream |
-getOut()
-The sink for formatted messages.
- |
-
protected abstract java.lang.String |
-getThreadName()
-Used to name the thread that processes logging records.
- |
-
protected void |
-houseKeeping()
-Subclass hook for activities such as rolling files and cleaning up old garbage.
- |
-
void |
-publish(java.util.logging.LogRecord record)
-Enqueues the record for the write thread.
- |
-
AsyncLogHandler |
-setMaxQueueSize(int maxQueueSize) |
-
protected AsyncLogHandler |
-setOut(java.io.PrintStream out)
-Sets the sink for formatted messages.
- |
-
protected void |
-start()
-This must be called for the handler to actually do anything.
- |
-
protected void |
-write(java.util.logging.LogRecord record)
-Formats and writes the logging record the underlying stream.
- |
-
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevelclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic void close()-
close in class java.util.logging.Handlerpublic void flush()-
flush in class java.util.logging.Handlerpublic long getHouseKeepingIntervalMillis()-
protected java.io.PrintStream getOut()-
protected abstract java.lang.String getThreadName()-
protected void houseKeeping()-
public void publish(java.util.logging.LogRecord record)-
publish in class java.util.logging.Handlerpublic AsyncLogHandler setMaxQueueSize(int maxQueueSize)-
protected AsyncLogHandler setOut(java.io.PrintStream out)-
protected void start()-
protected void write(java.util.logging.LogRecord record)-
public interface DSILevels
-| Modifier and Type | -Field and Description | -
|---|---|
static java.util.logging.Level |
-admin |
-
static int |
-ADMIN |
-
static java.util.logging.Level |
-all |
-
static int |
-CONFIG |
-
static java.util.logging.Level |
-debug |
-
static int |
-DEBUG |
-
static java.util.logging.Level |
-error |
-
static int |
-ERROR |
-
static java.util.logging.Level |
-fatal |
-
static int |
-FATAL |
-
static java.util.logging.Level |
-fine |
-
static int |
-FINE |
-
static java.util.logging.Level |
-info |
-
static int |
-INFO |
-
static java.util.logging.Level |
-off |
-
static java.util.logging.Level |
-trace |
-
static int |
-TRACE |
-
static java.util.logging.Level |
-warn |
-
static int |
-WARN |
-
static final int TRACE-
static final int DEBUG-
static final int FINE-
static final int CONFIG-
static final int WARN-
static final int INFO-
static final int ERROR-
static final int ADMIN-
static final int FATAL-
static final java.util.logging.Level all-
static final java.util.logging.Level trace-
static final java.util.logging.Level debug-
static final java.util.logging.Level fine-
static final java.util.logging.Level warn-
static final java.util.logging.Level info-
static final java.util.logging.Level error-
static final java.util.logging.Level admin-
static final java.util.logging.Level fatal-
static final java.util.logging.Level off-
public class DSLogger -extends java.lang.Object -implements DSILevels-
- - Without this class: - -
-
-
- if (myLogger.isLoggable(Level.INFO))
- myLogger.info(someMessage());
-
-
-
-
- With this class:
-
-
-
-
- info(info() ? someMessage() : null);
-
-
-
-
- - - DSA defines levels differently than JUL, however, all JUL levels will be mapped / formatted - for DSA. Level guidelines: - -
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-admin()
-True if the level is loggable.
- |
-
void |
-admin(java.lang.Object msg) |
-
void |
-admin(java.lang.Object msg,
- java.lang.Throwable x) |
-
boolean |
-debug()
-True if the level is loggable.
- |
-
void |
-debug(java.lang.Object msg)
-Log a debug event.
- |
-
void |
-debug(java.lang.Object msg,
- java.lang.Throwable x)
-Log a debug event.
- |
-
boolean |
-error()
-True if the level is loggable.
- |
-
void |
-error(java.lang.Object msg) |
-
void |
-error(java.lang.Object msg,
- java.lang.Throwable x) |
-
boolean |
-fatal()
-True if the level is loggable.
- |
-
void |
-fatal(java.lang.Object msg) |
-
void |
-fatal(java.lang.Object msg,
- java.lang.Throwable x) |
-
boolean |
-fine()
-True if the level is loggable.
- |
-
void |
-fine(java.lang.Object msg)
-Log a frequent event.
- |
-
void |
-fine(java.lang.Object msg,
- java.lang.Throwable x)
-Log a frequent event.
- |
-
protected java.lang.String |
-getLogName()
-Override point, returns the simple class name by default.
- |
-
boolean |
-info()
-True if the level is loggable.
- |
-
void |
-info(java.lang.Object msg)
-Log an infrequent major lifecycle event.
- |
-
void |
-info(java.lang.Object msg,
- java.lang.Throwable x)
-Log an infrequent major lifecycle event.
- |
-
boolean |
-trace()
-True if the level is loggable.
- |
-
void |
-trace(java.lang.Object msg)
-Log a trace or verbose event.
- |
-
void |
-trace(java.lang.Object msg,
- java.lang.Throwable x)
-Log a trace or verbose event.
- |
-
boolean |
-warn()
-True if the level is loggable.
- |
-
void |
-warn(java.lang.Object msg)
-Log an unusual but not critical event.
- |
-
void |
-warn(java.lang.Object msg,
- java.lang.Throwable x)
-Log an unusual but not critical event.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected java.lang.String getLogName()-
public boolean trace()-
public void trace(java.lang.Object msg)-
public void trace(java.lang.Object msg, - java.lang.Throwable x)-
public boolean debug()-
public void debug(java.lang.Object msg)-
public void debug(java.lang.Object msg, - java.lang.Throwable x)-
public boolean fine()-
public void fine(java.lang.Object msg)-
public void fine(java.lang.Object msg, - java.lang.Throwable x)-
public boolean warn()-
public void warn(java.lang.Object msg)-
public void warn(java.lang.Object msg, - java.lang.Throwable x)-
public boolean info()-
public void info(java.lang.Object msg)-
public void info(java.lang.Object msg, - java.lang.Throwable x)-
public boolean error()-
public void error(java.lang.Object msg)-
public void error(java.lang.Object msg, - java.lang.Throwable x)-
public boolean admin()-
public void admin(java.lang.Object msg)-
public void admin(java.lang.Object msg, - java.lang.Throwable x)-
public boolean fatal()-
public void fatal(java.lang.Object msg)-
public void fatal(java.lang.Object msg, - java.lang.Throwable x)-
public class DSLogging
-extends java.lang.Object
-| Modifier and Type | -Field and Description | -
|---|---|
static int |
-DEFAULT_BACKUP_THRESHOLD
-This is the threshold, not a hard limit: 10 megs by default.
- |
-
static int |
-DEFAULT_MAX_BACKUPS
-The default number of backups to retain: 10 by default.
- |
-
static int |
-DEFAULT_MAX_QUEUE
-Max async queue size: 2500 by default.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
static void |
-close()
-Closes all async log handlers.
- |
-
static java.util.logging.Logger |
-getDefaultLogger()
-The default logger.
- |
-
static java.util.logging.Logger |
-getLogger(java.lang.String name,
- java.io.File logFile)
-Adds a FileLogHandler to the named logger, if there isn't one already.
- |
-
static void |
-setDefaultLevel(java.util.logging.Level level) |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static int DEFAULT_BACKUP_THRESHOLD-
public static int DEFAULT_MAX_BACKUPS-
public static int DEFAULT_MAX_QUEUE-
public static void close()-
public static java.util.logging.Logger getDefaultLogger()-
public static java.util.logging.Logger getLogger(java.lang.String name, - java.io.File logFile)-
name - Log name.logFile - Where record the logging, may be null. Multiple logs can safely share the
- same file. If null, will route to System.out.public static void setDefaultLevel(java.util.logging.Level level)-
public class FileLogHandler -extends AsyncLogHandler-
| Modifier and Type | -Method and Description | -
|---|---|
java.io.File[] |
-getBackups()
-Backup files for this logging, found in the same directory as the active logging.
- |
-
static FileLogHandler |
-getHandler(java.io.File file)
-Will return an existing handler for the given file, or create a new one.
- |
-
int |
-getMaxBackups()
-The number of backup files to retain.
- |
-
java.lang.String |
-getThreadName()
-Used to name the thread that processes logging records.
- |
-
protected void |
-houseKeeping()
-Subclass hook for activities such as rolling files and cleaning up old garbage.
- |
-
void |
-makeBackup()
-Only public for testing, do not call.
- |
-
FileLogHandler |
-setBackupThreshold(int arg)
-The file size threshold after which a logging file will be backed up and cleared.
- |
-
FileLogHandler |
-setMaxBackups(int arg)
-The default is 10.
- |
-
void |
-trimBackups()
-Only public for testing, do not call.
- |
-
close, flush, getHouseKeepingIntervalMillis, getOut, publish, setMaxQueueSize, setOut, start, writegetEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevelclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static FileLogHandler getHandler(java.io.File file)-
public java.io.File[] getBackups()-
public int getMaxBackups()-
public java.lang.String getThreadName()-
AsyncLogHandlergetThreadName in class AsyncLogHandlerprotected void houseKeeping()-
AsyncLogHandlerhouseKeeping in class AsyncLogHandlerpublic void makeBackup()-
public FileLogHandler setBackupThreshold(int arg)-
public FileLogHandler setMaxBackups(int arg)-
public void trimBackups()-
public class PrintStreamLogHandler -extends AsyncLogHandler-
| Constructor and Description | -
|---|
PrintStreamLogHandler(java.lang.String name,
- java.io.PrintStream out) |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-getThreadName()
-Used to name the thread that processes logging records.
- |
-
close, flush, getHouseKeepingIntervalMillis, getOut, houseKeeping, publish, setMaxQueueSize, setOut, start, writegetEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevelclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic PrintStreamLogHandler(java.lang.String name, - java.io.PrintStream out)-
public java.lang.String getThreadName()-
AsyncLogHandlergetThreadName in class AsyncLogHandlerSee: Description
-| Interface | -Description | -
|---|---|
| DSILevels | -- |
| Class | -Description | -
|---|---|
| AsyncLogHandler | -
- Enqueues logging records which are then processed by separate thread.
- |
-
| DSLogger | -
- Adds an abstraction layer on Java Util Logging for two purposes:
-
-
-
- To use the DSA levels.
- |
-
| DSLogging | -
- Static utilities for configuring the logging subsystem.
- |
-
| FileLogHandler | -
- Logs records to a file.
- |
-
| PrintStreamLogHandler | -
- Async logging handler for writing to streams such as System.out.
- |
-
public class DSBool -extends DSElement -implements DSIBoolean-
| Modifier and Type | -Field and Description | -
|---|---|
static DSBool |
-FALSE |
-
static DSBool |
-NULL |
-
static DSBool |
-TRUE |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object arg) |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isBoolean()
-Whether or not the object represents a boolean.
- |
-
boolean |
-isNull()
-Whether or not the object represents null.
- |
-
boolean |
-toBoolean()
-Attempts to return a boolean value.
- |
-
double |
-toDouble()
-0 or 1.
- |
-
float |
-toFloat()
-0 or 1.
- |
-
int |
-toInt()
-0 or 1.
- |
-
long |
-toLong()
-0 or 1.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
static DSBool |
-valueOf(boolean arg)
-Will return either TRUE or FALSE.
- |
-
DSBool |
-valueOf(DSElement arg)
-Returns the argument.
- |
-
static DSBool |
-valueOf(java.lang.String arg)
-Will return NULL, TRUE or FALSE.
- |
-
copy, isBytes, isDouble, isEqual, isFloat, isGroup, isInt, isList, isLong, isMap, isNumber, isString, make, make, make, make, make, make, makeNull, toBytes, toElement, toGroup, toList, toMapclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSBool TRUE-
public static final DSBool FALSE-
public static final DSBool NULL-
public boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic boolean isBoolean()-
DSElementpublic boolean isNull()-
DSElementpublic DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean toBoolean()-
DSElementtoBoolean in interface DSIBooleantoBoolean in class DSElementpublic java.lang.String toString()-
DSValuepublic static DSBool valueOf(boolean arg)-
public DSBool valueOf(DSElement arg)-
DSElementpublic static DSBool valueOf(java.lang.String arg)-
java.lang.IllegalArgumentException - If the string cannot be decoded.| Modifier and Type | -Field and Description | -
|---|---|
static DSBytes |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
static byte[] |
-decode(java.lang.String encoded) |
-
static java.lang.String |
-encode(byte[] bytes) |
-
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSINumber and the values are equal or they are both isNull.
- |
-
static byte[] |
-fromHex(java.lang.CharSequence s)
-Converts a hex string into a byte array.
- |
-
byte[] |
-getBytes()
-The raw bytes, do not modify.
- |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isBytes()
-Whether or not the object represents a byte array.
- |
-
static boolean |
-isBytes(java.lang.String arg)
-True if the string starts with the DSA escape sequence for a base 64 encoded string.
- |
-
boolean |
-isNull()
-Whether or not the object represents null.
- |
-
int |
-length()
-The number of bytes in the array.
- |
-
static double |
-readDouble(byte[] buf,
- int off,
- boolean bigEndian)
-Reads the primitive from a byte array.
- |
-
static double |
-readDouble(java.io.InputStream in,
- boolean bigEndian)
-Reads the primitive from a stream.
- |
-
static float |
-readFloat(byte[] buf,
- int off,
- boolean bigEndian)
-Reads the primitive from a byte array.
- |
-
static float |
-readFloat(java.io.InputStream in,
- boolean bigEndian)
-Reads the primitive a stream
- |
-
static int |
-readInt(byte[] buf,
- int off,
- boolean bigEndian)
-Reads the primitive from a byte array.
- |
-
static int |
-readInt(java.io.InputStream in,
- boolean bigEndian)
-Reads the primitive from a stream.
- |
-
static long |
-readLong(byte[] buf,
- int off,
- boolean bigEndian)
-Reads the primitive from a byte array.
- |
-
static long |
-readLong(java.io.InputStream in,
- boolean bigEndian)
-Reads the primitive from a stream.
- |
-
static short |
-readShort(byte[] buf,
- int off,
- boolean bigEndian)
-Reads the primitive from a byte array.
- |
-
static short |
-readShort(java.io.InputStream in,
- boolean bigEndian)
-Reads the primitive from a stream.
- |
-
byte[] |
-toBytes()
-Returns the raw byte array for DSBytes only, which should not be modified.
- |
-
static java.lang.StringBuilder |
-toHex(byte[] bytes,
- java.lang.StringBuilder buf)
-Converts the bytes into a hex string.
- |
-
static java.lang.StringBuilder |
-toHex(byte val,
- java.lang.StringBuilder buf)
-Converts the bytes into a hex string.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
static DSBytes |
-valueOf(byte[] arg) |
-
DSBytes |
-valueOf(DSElement arg)
-Returns the argument.
- |
-
static DSBytes |
-valueOf(java.lang.String arg)
-Decodes a base64 encoded byte array.
- |
-
static void |
-writeDouble(double v,
- byte[] buf,
- int off,
- boolean bigEndian)
-Encodes the primitive into a byte array.
- |
-
static void |
-writeDouble(double v,
- java.io.OutputStream out,
- boolean bigEndian)
-Encodes the primitive into a stream.
- |
-
static void |
-writeFloat(float v,
- byte[] buf,
- int off,
- boolean bigEndian)
-Encodes the primitive into a byte array.
- |
-
static void |
-writeFloat(float v,
- java.io.OutputStream out,
- boolean bigEndian)
-Encodes the primitive into a stream
- |
-
static void |
-writeInt(int v,
- byte[] buf,
- int off,
- boolean bigEndian)
-Encodes the primitive into a byte array.
- |
-
static void |
-writeInt(int v,
- java.io.OutputStream out,
- boolean bigEndian)
-Encodes the primitive into a stream.
- |
-
static void |
-writeLong(long v,
- byte[] buf,
- int off,
- boolean bigEndian)
-Encodes the primitive into a byte array.
- |
-
static void |
-writeLong(long v,
- java.io.OutputStream out,
- boolean bigEndian)
-Encodes the primitive into a stream.
- |
-
static void |
-writeShort(short v,
- byte[] buf,
- int off,
- boolean bigEndian)
-Encodes the primitive into a byte array.
- |
-
static void |
-writeShort(short v,
- java.io.OutputStream out,
- boolean bigEndian)
-Encodes the primitive into a stream.
- |
-
copy, isBoolean, isDouble, isEqual, isFloat, isGroup, isInt, isList, isLong, isMap, isNumber, isString, make, make, make, make, make, make, makeNull, toBoolean, toDouble, toElement, toFloat, toGroup, toInt, toList, toLong, toMapclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static byte[] decode(java.lang.String encoded)-
public static java.lang.String encode(byte[] bytes)-
public boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic static byte[] fromHex(java.lang.CharSequence s)-
public byte[] getBytes()-
public DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isBytes()-
DSElementpublic static boolean isBytes(java.lang.String arg)-
public boolean isNull()-
DSElementpublic int length()-
public static double readDouble(byte[] buf, - int off, - boolean bigEndian)-
buf - Must be at least off + 8 in length.off - The offset into the buffer to start reading.bigEndian - Whether to decode in big or little endian byte ordering.public static double readDouble(java.io.InputStream in, - boolean bigEndian)-
in - Must have at 8 bytes to read.bigEndian - Whether to decode in big or little endian byte ordering.public static float readFloat(byte[] buf, - int off, - boolean bigEndian)-
buf - Must be at least off + 4 in length.off - The offset into the buffer to start reading.bigEndian - Whether to decode in big or little endian byte ordering.public static float readFloat(java.io.InputStream in, - boolean bigEndian)-
in - Must have at 4 bytes to read.bigEndian - Whether to decode in big or little endian byte ordering.public static int readInt(byte[] buf, - int off, - boolean bigEndian)-
buf - Must be at least off + 4 in length.off - The offset into the buffer to start reading.bigEndian - Whether to decode in big or little endian byte ordering.public static int readInt(java.io.InputStream in, - boolean bigEndian)-
in - Must have at least 4 bytes to read.bigEndian - Whether to decode in big or little endian byte ordering.public static long readLong(byte[] buf, - int off, - boolean bigEndian)-
buf - Must be at least off + 8 in length.off - The offset into the buffer to start reading.bigEndian - Whether to decode in big or little endian byte ordering.public static long readLong(java.io.InputStream in, - boolean bigEndian)-
in - Must have 8 bytes to read.bigEndian - Whether to decode in big or little endian byte ordering.public static short readShort(byte[] buf, - int off, - boolean bigEndian)-
buf - Must be at least off + 2 in length.off - The offset into the buffer to start reading.bigEndian - Whether to decode in big or little endian byte ordering.public static short readShort(java.io.InputStream in, - boolean bigEndian)-
in - Must have 2 bytes to read.bigEndian - Whether to decode in big or little endian byte ordering.public byte[] toBytes()-
DSElementpublic static java.lang.StringBuilder toHex(byte val, - java.lang.StringBuilder buf)-
val - What to convert.buf - Where to put the results, can be null.public static java.lang.StringBuilder toHex(byte[] bytes, - java.lang.StringBuilder buf)-
bytes - What to convert.buf - Where to put the results, can be null.public java.lang.String toString()-
DSValuepublic static DSBytes valueOf(byte[] arg)-
public DSBytes valueOf(DSElement arg)-
DSElementpublic static DSBytes valueOf(java.lang.String arg)-
public static void writeDouble(double v, - byte[] buf, - int off, - boolean bigEndian)-
v - The value to encode.buf - Where to encode the value. Must be at least off + 8 in length.off - The offset into the buffer to start encoding.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeDouble(double v, - java.io.OutputStream out, - boolean bigEndian)-
v - The value to encode.out - Where to encode the value.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeFloat(float v, - byte[] buf, - int off, - boolean bigEndian)-
v - The value to encode.buf - Where to encode the value. Must be at least off + 4 in length.off - The offset into the buffer to start encoding.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeFloat(float v, - java.io.OutputStream out, - boolean bigEndian)-
v - The value to encode.out - Where to encode the value.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeInt(int v, - byte[] buf, - int off, - boolean bigEndian)-
v - The value to encode.buf - Where to encode the value. Must be at least off + 4 in length.off - The offset into the buffer to start encoding.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeInt(int v, - java.io.OutputStream out, - boolean bigEndian)-
v - The value to encode.out - Where to encode the value.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeLong(long v, - byte[] buf, - int off, - boolean bigEndian)-
v - The value to encode.buf - Where to encode the value. Must be at least off + 8 in length;off - The offset into the buffer to start encoding.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeLong(long v, - java.io.OutputStream out, - boolean bigEndian)-
v - The value to encode.out - Where to encode the value.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeShort(short v, - byte[] buf, - int off, - boolean bigEndian)-
v - The value to encode.buf - Where to encode the value. Must be a least off + 2 in length.off - The offset into the buffer to start encoding.bigEndian - Whether to encode in big or little endian byte ordering.public static void writeShort(short v, - java.io.OutputStream out, - boolean bigEndian)-
v - The value to encode.out - Where to encode the value.bigEndian - Whether to encode in big or little endian byte ordering.| Modifier and Type | -Field and Description | -
|---|---|
static DSDouble |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSINumber and the values are equal or they are both isNull.
- |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isDouble()
-Whether or not the object represents a double.
- |
-
boolean |
-isInfinite() |
-
boolean |
-isNaN() |
-
boolean |
-isNull()
-Whether or not the object represents null.
- |
-
boolean |
-isNumber()
-Whether or not the object represents a number.
- |
-
boolean |
-toBoolean()
-Attempts to return a boolean value.
- |
-
double |
-toDouble()
-Attempts to return a double value.
- |
-
float |
-toFloat()
-Attempts to return a float value.
- |
-
int |
-toInt()
-Attempts to return an int value.
- |
-
long |
-toLong()
-Attempts to return a long value.
- |
-
java.lang.Number |
-toNumber()
-Returns the Java primitive wrapper.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
static DSDouble |
-valueOf(double arg)
-Attempts to reuse some common values before creating a new instance.
- |
-
DSDouble |
-valueOf(DSElement arg)
-Returns the argument.
- |
-
static DSDouble |
-valueOf(java.lang.String arg)
-Checks for null, then uses Double.parseDouble()
- |
-
copy, isBoolean, isBytes, isEqual, isFloat, isGroup, isInt, isList, isLong, isMap, isString, make, make, make, make, make, make, makeNull, toBytes, toElement, toGroup, toList, toMapclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isDouble()-
DSElementpublic boolean isInfinite()-
Double.isInfinite()public boolean isNaN()-
Double.isNaN()public boolean isNumber()-
DSElementpublic boolean isNull()-
DSElementpublic boolean toBoolean()-
DSElementpublic double toDouble()-
DSElementpublic float toFloat()-
DSElementpublic int toInt()-
DSElementpublic long toLong()-
DSElementpublic java.lang.Number toNumber()-
DSINumberpublic java.lang.String toString()-
DSValuepublic static DSDouble valueOf(double arg)-
public DSDouble valueOf(DSElement arg)-
DSElementpublic static DSDouble valueOf(java.lang.String arg)-
| Modifier and Type | -Method and Description | -
|---|---|
DSElement |
-copy()
-If an object is mutable (list or map) then this should clone it, immutable objects can simply
- return themselves.
- |
-
abstract DSElementType |
-getElementType()
-For switch statements.
- |
-
abstract DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
boolean |
-isBoolean()
-Whether or not the object represents a boolean.
- |
-
boolean |
-isBytes()
-Whether or not the object represents a byte array.
- |
-
boolean |
-isDouble()
-Whether or not the object represents a double.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isFloat()
-Whether or not the object represents a float.
- |
-
boolean |
-isGroup()
-Whether or not the object represents a list or map.
- |
-
boolean |
-isInt()
-Whether or not the object represents an int.
- |
-
boolean |
-isList()
-Whether or not the object represents a list.
- |
-
boolean |
-isLong()
-Whether or not the object represents a long.
- |
-
boolean |
-isMap()
-Whether or not the object represents a amp.
- |
-
boolean |
-isNull()
-Whether or not the object represents null.
- |
-
boolean |
-isNumber()
-Whether or not the object represents a number.
- |
-
boolean |
-isString()
-Whether or not the object represents a string.
- |
-
static DSElement |
-make(boolean arg)
-Creates an DSIObject representation of the primitive.
- |
-
static DSElement |
-make(byte[] arg)
-Creates an DSIObject representation of the primitive.
- |
-
static DSElement |
-make(double arg)
-Creates an DSIObject representation of the primitive.
- |
-
static DSElement |
-make(int arg)
-Creates an DSIObject representation of the primitive.
- |
-
static DSElement |
-make(long arg)
-Creates an DSIObject representation of the primitive.
- |
-
static DSElement |
-make(java.lang.String arg)
-Creates an DSIObject representation of the primitive.
- |
-
static DSElement |
-makeNull()
-Creates an DSIObject representation of null.
- |
-
boolean |
-toBoolean()
-Attempts to return a boolean value.
- |
-
byte[] |
-toBytes()
-Returns the raw byte array for DSBytes only, which should not be modified.
- |
-
double |
-toDouble()
-Attempts to return a double value.
- |
-
DSElement |
-toElement()
-Returns this.
- |
-
float |
-toFloat()
-Attempts to return a float value.
- |
-
DSGroup |
-toGroup()
-Lists and maps return themselves, everything else results in an exception.
- |
-
int |
-toInt()
-Attempts to return an int value.
- |
-
DSList |
-toList()
-Lists return themselves, everything else results in an exception.
- |
-
long |
-toLong()
-Attempts to return a long value.
- |
-
DSMap |
-toMap()
-Maps return themselves, everything else results in an exception.
- |
-
DSIValue |
-valueOf(DSElement arg)
-Returns the argument.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic DSElement copy()-
public abstract DSElementType getElementType()-
public abstract DSValueType getValueType()-
public boolean isBoolean()-
public boolean isBytes()-
public boolean isDouble()-
public boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isFloat()-
public boolean isInt()-
public boolean isGroup()-
public boolean isList()-
public boolean isLong()-
public boolean isMap()-
public boolean isNull()-
public boolean isNumber()-
public boolean isString()-
public static DSElement make(boolean arg)-
public static DSElement make(byte[] arg)-
public static DSElement make(double arg)-
public static DSElement make(int arg)-
public static DSElement make(long arg)-
public static DSElement make(java.lang.String arg)-
public static DSElement makeNull()-
public boolean toBoolean()-
java.lang.ClassCastException - If not convertible.public byte[] toBytes()-
java.lang.ClassCastException - If not DSBytes.public double toDouble()-
java.lang.ClassCastException - If not convertible.public DSElement toElement()-
public float toFloat()-
java.lang.ClassCastException - If not convertible.public DSGroup toGroup()-
java.lang.ClassCastException - If not convertible.public int toInt()-
java.lang.ClassCastException - If not convertible.public DSList toList()-
java.lang.ClassCastException - If not convertible.public long toLong()-
java.lang.ClassCastException - If not convertible.public DSMap toMap()-
java.lang.ClassCastException - If not convertible.public enum DSElementType -extends java.lang.Enum<DSElementType>-
| Enum Constant and Description | -
|---|
BOOLEAN |
-
BYTES |
-
DOUBLE |
-
LIST |
-
LONG |
-
MAP |
-
NULL |
-
STRING |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-toString() |
-
static DSElementType |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSElementType[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSElementType BOOLEAN-
public static final DSElementType BYTES-
public static final DSElementType DOUBLE-
public static final DSElementType LIST-
public static final DSElementType LONG-
public static final DSElementType MAP-
public static final DSElementType NULL-
public static final DSElementType STRING-
public static DSElementType[] values()-
-for (DSElementType c : DSElementType.values()) - System.out.println(c); -
public static DSElementType valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic java.lang.String toString()-
toString in class java.lang.Enum<DSElementType>public class DSFlexEnum -extends DSValue -implements DSIEnum, DSIMetadata, DSIStorable-
| Modifier and Type | -Field and Description | -
|---|---|
static DSFlexEnum |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSFlexEnum |
-copy()
-Returns this.
- |
-
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSFlexEnum and the values are equal or they are both isNull.
- |
-
DSList |
-getEnums(DSList bucket)
-Adds the range of possible values to the given bucket.
- |
-
void |
-getMetadata(DSMap bucket)
-The entity should add any metadata about itself to the given map.
- |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
DSFlexEnum |
-restore(DSElement arg)
-Deserialize a value from the configuration database, these will be values returned from the
- store() method.
- |
-
DSMap |
-store()
-Serialize the value for the configuration database.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSFlexEnum |
-valueOf(DSElement arg)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
DSFlexEnum |
-valueOf(java.lang.String value)
-Creates a new enum for the given value using the range from this instance.
- |
-
static DSFlexEnum |
-valueOf(java.lang.String value,
- DSList range)
-Creates a enum representing the given value and range.
- |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSFlexEnum NULL-
public DSFlexEnum copy()-
DSValuepublic boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSList getEnums(DSList bucket)-
DSIEnumpublic void getMetadata(DSMap bucket)-
DSIMetadatagetMetadata in interface DSIMetadatapublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isNull()-
DSIValuepublic DSFlexEnum restore(DSElement arg)-
DSIStorablerestore in interface DSIStorablepublic DSMap store()-
DSIStorablestore in interface DSIStorablepublic DSElement toElement()-
DSIValuepublic java.lang.String toString()-
DSValuepublic DSFlexEnum valueOf(DSElement arg)-
DSIValuepublic static DSFlexEnum valueOf(java.lang.String value, - DSList range)-
value - Must be in the given range.range - The all possible values in the range, must include the value param.public DSFlexEnum valueOf(java.lang.String value)-
value - Must be a member of the range in this enum.| Modifier and Type | -Field and Description | -
|---|---|
static DSFloat |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSINumber and the values are equal or they are both isNull.
- |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isDouble()
-Whether or not the object represents a double.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isFloat()
-Whether or not the object represents a double.
- |
-
boolean |
-isInt()
-Whether or not the object represents an int.
- |
-
boolean |
-isLong()
-Whether or not the object represents a long.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
double |
-toDouble()
-If not a double, will cast the underlying value.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
float |
-toFloat()
-If not a float, will cast the underlying value.
- |
-
int |
-toInt()
-If not an int, will cast the underlying value.
- |
-
long |
-toLong()
-If not a long, will cast the underlying value.
- |
-
java.lang.Number |
-toNumber()
-Returns the Java primitive wrapper.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSFloat |
-valueOf(DSElement arg)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
static DSFloat |
-valueOf(float arg)
-Attempts to reuse some common values before creating a new instance.
- |
-
static DSFloat |
-valueOf(java.lang.String arg)
-Checks for null, then uses Float.parseFloat()
- |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isDouble()-
DSINumberpublic boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isFloat()-
DSINumberpublic boolean isInt()-
DSINumberpublic boolean isLong()-
DSINumberpublic boolean isNull()-
DSIValuepublic double toDouble()-
DSINumberpublic DSElement toElement()-
DSIValuepublic float toFloat()-
DSINumberpublic int toInt()-
DSINumberpublic long toLong()-
DSINumberpublic java.lang.Number toNumber()-
DSINumberpublic java.lang.String toString()-
DSValuepublic DSFloat valueOf(DSElement arg)-
DSIValuepublic static DSFloat valueOf(float arg)-
public static DSFloat valueOf(java.lang.String arg)-
| Modifier and Type | -Method and Description | -
|---|---|
abstract DSGroup |
-clear()
-Removes all items.
- |
-
boolean |
-equals(java.lang.Object o) |
-
DSElement |
-first()
-Returns the item at index 0.
- |
-
abstract DSElement |
-get(int idx)
-Returns the value at the given index.
- |
-
boolean |
-get(int idx,
- boolean def)
-Optional getter.
- |
-
double |
-get(int idx,
- double def)
-Optional getter.
- |
-
int |
-get(int idx,
- int def)
-Optional getter.
- |
-
long |
-get(int idx,
- long def)
-Optional getter.
- |
-
java.lang.String |
-get(int idx,
- java.lang.String def)
-Optional getter.
- |
-
boolean |
-getBoolean(int idx)
-Primitive getter.
- |
-
double |
-getDouble(int idx)
-Primitive getter.
- |
-
double |
-getFloat(int idx)
-Primitive getter.
- |
-
int |
-getInt(int idx)
-Primitive getter.
- |
-
DSList |
-getList(int idx)
-Primitive getter.
- |
-
long |
-getLong(int idx)
-Primitive getter.
- |
-
DSMap |
-getMap(int idx)
-Primitive getter.
- |
-
java.lang.String |
-getString(int idx)
-Primitive getter.
- |
-
int |
-hashCode() |
-
boolean |
-hasParent() |
-
int |
-indexOf(DSElement obj)
-Scans the collection and returns the first index that equal the arg.
- |
-
boolean |
-isEmpty()
-Returns true when childCount() == 0.
- |
-
boolean |
-isGroup()
-Whether or not the object represents a list or map.
- |
-
boolean |
-isNull(int idx)
-Whether or not the object at the given index is null.
- |
-
DSElement |
-last()
-Returns the item at the highest index.
- |
-
int |
-lastIndexOf(DSElement obj)
-Scans the collection and returns the first index that equal the arg.
- |
-
abstract DSElement |
-remove(int idx)
-Removes the value at the given index and returns it.
- |
-
DSElement |
-removeFirst()
-Remove and return the item at index 0.
- |
-
DSElement |
-removeLast()
-Remove and return the item at the highest index.
- |
-
abstract int |
-size()
-The number of items is the group.
- |
-
DSGroup |
-toGroup()
-Lists and maps return themselves, everything else results in an exception.
- |
-
java.lang.String |
-toString()
-Json encodes the graph, be careful.
- |
-
copy, getElementType, getValueType, isBoolean, isBytes, isDouble, isEqual, isFloat, isInt, isList, isLong, isMap, isNull, isNumber, isString, make, make, make, make, make, make, makeNull, toBoolean, toBytes, toDouble, toElement, toFloat, toInt, toList, toLong, toMap, valueOfclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic abstract DSGroup clear()-
public boolean equals(java.lang.Object o)-
equals in class java.lang.Objectpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean hasParent()-
public DSElement first()-
public abstract DSElement get(int idx)-
public boolean get(int idx, - boolean def)-
public double get(int idx, - double def)-
public int get(int idx, - int def)-
public long get(int idx, - long def)-
public java.lang.String get(int idx, - java.lang.String def)-
public boolean getBoolean(int idx)-
public double getDouble(int idx)-
public double getFloat(int idx)-
public int getInt(int idx)-
public DSList getList(int idx)-
public long getLong(int idx)-
public DSMap getMap(int idx)-
public java.lang.String getString(int idx)-
public int indexOf(DSElement obj)-
public boolean isEmpty()-
public boolean isGroup()-
DSElementpublic boolean isNull(int idx)-
public DSElement last()-
public int lastIndexOf(DSElement obj)-
public abstract DSElement remove(int idx)-
public DSElement removeFirst()-
public DSElement removeLast()-
public DSGroup toGroup()-
DSElementpublic abstract int size()-
public interface DSIBoolean
-| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-toBoolean() |
-
public interface DSIEnum
-| Modifier and Type | -Method and Description | -
|---|---|
DSList |
-getEnums(DSList bucket)
-Adds the range of possible values to the given bucket.
- |
-
java.lang.String |
-toString()
-The string representation of the the enum value.
- |
-
DSList getEnums(DSList bucket)-
bucket - Also the return value, can be null, which will result in the creation of a new
- list.java.lang.String toString()-
toString in class java.lang.Objectpublic interface DSIMetadata
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-getMetadata(DSMap bucket)
-The entity should add any metadata about itself to the given map.
- |
-
void getMetadata(DSMap bucket)-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-isDouble()
-Whether or not the object represents a double.
- |
-
boolean |
-isFloat()
-Whether or not the object represents a double.
- |
-
boolean |
-isInt()
-Whether or not the object represents an int.
- |
-
boolean |
-isLong()
-Whether or not the object represents a long.
- |
-
double |
-toDouble()
-If not a double, will cast the underlying value.
- |
-
float |
-toFloat()
-If not a float, will cast the underlying value.
- |
-
int |
-toInt()
-If not an int, will cast the underlying value.
- |
-
long |
-toLong()
-If not a long, will cast the underlying value.
- |
-
java.lang.Number |
-toNumber()
-Returns the Java primitive wrapper.
- |
-
boolean isDouble()-
boolean isFloat()-
boolean isInt()-
boolean isLong()-
double toDouble()-
float toFloat()-
int toInt()-
long toLong()-
java.lang.Number toNumber()-
public interface DSIObject
-| Modifier and Type | -Method and Description | -
|---|---|
DSIObject |
-copy()
-Return a copy if it makes sense, but return this otherwise.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isNull() |
-
DSIObject copy()-
boolean isEqual(java.lang.Object obj)-
boolean isNull()-
public interface DSIStatus
-| Modifier and Type | -Method and Description | -
|---|---|
DSStatus |
-toStatus() |
-
public interface DSIStorable
-| Modifier and Type | -Method and Description | -
|---|---|
DSIValue |
-restore(DSElement element)
-Deserialize a value from the configuration database, these will be values returned from the
- store() method.
- |
-
DSElement |
-store()
-Serialize the value for the configuration database.
- |
-
DSIValue restore(DSElement element)-
DSElement store()-
public interface DSIValue -extends DSIObject-
- - Beyond the interface methods, custom implementations should: - -
- -
DSNode.onSet(DSIValue)| Modifier and Type | -Method and Description | -
|---|---|
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
DSIValue |
-valueOf(DSElement element)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
DSValueType getValueType()-
boolean isNull()-
DSElement toElement()-
public class DSInfo -extends java.lang.Object -implements ApiObject-
- -
- - Important things for developers to know about DSInfo are: - -
- -
| Modifier and Type | -Method and Description | -
|---|---|
DSInfo |
-copy() |
-
void |
-decodeState(DSElement state) |
-
DSElement |
-encodeState() |
-
boolean |
-equals(java.lang.Object arg) |
-
boolean |
-equalsDefault()
-True if this proxies a default and the state and value match the default.
- |
-
boolean |
-equalsDefaultState()
-True if the state matches the default state.
- |
-
boolean |
-equalsDefaultType()
-True if this proxies a default and the value type matches the default.
- |
-
boolean |
-equalsDefaultValue()
-True if this proxies a default and the value matches the default.
- |
-
DSAction |
-getAction()
-The action, should only be called if isAction() returns true.
- |
-
java.util.Iterator<ApiObject> |
-getChildren()
-Iterator of child objects, should only be called if hasChildren() returns true.
- |
-
DSIObject |
-getDefaultObject()
-If this represents a dynamic child, this just returns the current value.
- |
-
DSElement |
-getElement()
-A convenience that casts getObject().
- |
-
void |
-getMetadata(DSMap bucket) |
-
java.lang.String |
-getName()
-The display name.
- |
-
DSNode |
-getNode()
-A convenience that casts getObject().
- |
-
DSIObject |
-getObject() |
-
DSNode |
-getParent() |
-
DSIValue |
-getValue()
-A convenience that casts getObject().
- |
-
boolean |
-hasChildren()
-True if getChildren() can be called.
- |
-
int |
-hashCode() |
-
boolean |
-hasNext()
-True if there is another info after this one.
- |
-
boolean |
-isAction()
-True if the object is an action.
- |
-
boolean |
-isAdmin()
-Whether or not this object requires configuration permission to read/write.
- |
-
boolean |
-isDefaultOnCopy()
-Whether or not the current value, or the default value is copied.
- |
-
boolean |
-isDynamic()
-Whether or not this info represents a declared default.
- |
-
boolean |
-isEqual(DSInfo arg)
-True if the flags and target object are equal (not identical if the target is a node).
- |
-
boolean |
-isHidden()
-Whether or not an object is visible to clients.
- |
-
boolean |
-isIdentical(DSInfo arg)
-True if the flags and target object are identical.
- |
-
boolean |
-isNode()
-Whether or not the object is a DSNode.
- |
-
boolean |
-isReadOnly()
-Whether or not an object can be written by a client.
- |
-
boolean |
-isTransient()
-Whether or not an object is persistent.
- |
-
boolean |
-isValue()
-True if getValue() can be called.
- |
-
DSInfo |
-next()
-The next info in the parent node.
- |
-
DSInfo |
-nextAction()
-The next DSInfo in the parent that is an action, or null.
- |
-
DSInfo |
-nextNode()
-The next DSInfo in the parent that is a node, or null.
- |
-
DSInfo |
-nextValue()
-The next DSInfo in the parent that is a value, or null.
- |
-
DSInfo |
-setAdmin(boolean admin) |
-
DSInfo |
-setHidden(boolean hidden) |
-
DSInfo |
-setReadOnly(boolean readOnly) |
-
DSInfo |
-setTransient(boolean trans) |
-
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitpublic DSInfo copy()-
public void decodeState(DSElement state)-
public DSElement encodeState()-
public boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic boolean equalsDefault()-
public boolean equalsDefaultState()-
public boolean equalsDefaultType()-
public boolean equalsDefaultValue()-
public DSAction getAction()-
ApiObjectpublic java.util.Iterator<ApiObject> getChildren()-
ApiObjectgetChildren in interface ApiObjectpublic DSIObject getDefaultObject()-
public DSElement getElement()-
public java.lang.String getName()-
ApiObjectpublic void getMetadata(DSMap bucket)-
getMetadata in interface ApiObjectpublic DSNode getNode()-
public DSIObject getObject()-
public DSNode getParent()-
public DSIValue getValue()-
public boolean hasChildren()-
ApiObjecthasChildren in interface ApiObjectpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean hasNext()-
public boolean isAction()-
ApiObjectpublic boolean isAdmin()-
ApiObjectpublic boolean isDefaultOnCopy()-
public boolean isDynamic()-
public boolean isEqual(DSInfo arg)-
public boolean isHidden()-
public boolean isIdentical(DSInfo arg)-
public boolean isNode()-
public boolean isReadOnly()-
isReadOnly in interface ApiObjectpublic boolean isTransient()-
public boolean isValue()-
ApiObjectpublic DSInfo next()-
public DSInfo nextAction()-
public DSInfo nextNode()-
public DSInfo nextValue()-
public DSInfo setAdmin(boolean admin)-
public DSInfo setHidden(boolean hidden)-
public DSInfo setReadOnly(boolean readOnly)-
public DSInfo setTransient(boolean trans)-
| Modifier and Type | -Field and Description | -
|---|---|
static DSInt |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSINumber and the values are equal or they are both isNull.
- |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isDouble()
-Whether or not the object represents a double.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isFloat()
-Whether or not the object represents a double.
- |
-
boolean |
-isInt()
-Whether or not the object represents an int.
- |
-
boolean |
-isLong()
-Whether or not the object represents a long.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
double |
-toDouble()
-If not a double, will cast the underlying value.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
float |
-toFloat()
-If not a float, will cast the underlying value.
- |
-
int |
-toInt()
-If not an int, will cast the underlying value.
- |
-
long |
-toLong()
-If not a long, will cast the underlying value.
- |
-
java.lang.Number |
-toNumber()
-Returns the Java primitive wrapper.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSInt |
-valueOf(DSElement arg)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
static DSInt |
-valueOf(int arg)
-Attempts to reuse some common values before creating a new instance.
- |
-
static DSInt |
-valueOf(java.lang.String arg)
-Checks for null, then uses Float.parseFloat()
- |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isDouble()-
DSINumberpublic boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isFloat()-
DSINumberpublic boolean isInt()-
DSINumberpublic boolean isLong()-
DSINumberpublic boolean isNull()-
DSIValuepublic double toDouble()-
DSINumberpublic DSElement toElement()-
DSIValuepublic float toFloat()-
DSINumberpublic int toInt()-
DSINumberpublic long toLong()-
DSINumberpublic java.lang.Number toNumber()-
DSINumberpublic java.lang.String toString()-
DSValuepublic DSInt valueOf(DSElement arg)-
DSIValuepublic static DSInt valueOf(int arg)-
public static DSInt valueOf(java.lang.String arg)-
public class DSJavaEnum -extends DSValue -implements DSIEnum, DSIMetadata, DSIStorable-
| Modifier and Type | -Field and Description | -
|---|---|
static DSJavaEnum |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSDynamicEnum and the values are equal or they are both isNull.
- |
-
DSList |
-getEnums(DSList bucket)
-Adds the range of possible values to the given bucket.
- |
-
void |
-getMetadata(DSMap bucket)
-The entity should add any metadata about itself to the given map.
- |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
DSJavaEnum |
-restore(DSElement arg)
-Deserialize a value from the configuration database, these will be values returned from the
- store() method.
- |
-
DSElement |
-store()
-Serialize the value for the configuration database.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
java.lang.Enum |
-toEnum()
-The Java enum.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSJavaEnum |
-valueOf(DSElement arg)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
static DSJavaEnum |
-valueOf(java.lang.Enum value)
-Creates an enum for the given value (and it's range).
- |
-
DSJavaEnum |
-valueOf(java.lang.String arg) |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSJavaEnum NULL-
public boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSList getEnums(DSList bucket)-
DSIEnumpublic void getMetadata(DSMap bucket)-
DSIMetadatagetMetadata in interface DSIMetadatapublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isNull()-
DSIValuepublic DSJavaEnum restore(DSElement arg)-
DSIStorablerestore in interface DSIStorablepublic DSElement store()-
DSIStorablestore in interface DSIStorablepublic java.lang.Enum toEnum()-
public DSElement toElement()-
DSIValuepublic java.lang.String toString()-
DSValuepublic DSJavaEnum valueOf(DSElement arg)-
DSIValuepublic static DSJavaEnum valueOf(java.lang.Enum value)-
public DSJavaEnum valueOf(java.lang.String arg)-
public class DSList -extends DSGroup -implements java.lang.Iterable<DSElement>-
- - This can be mounted in the node tree. However, the parent node will not know when it has been - modified, so the modifier is responsible for calling DSNode.childChanged(DSInfo). - -
- - This is not thread safe.
| Modifier and Type | -Field and Description | -
|---|---|
protected java.util.ArrayList |
-list |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSList |
-add(boolean val)
-Appends the primitive and returns this.
- |
-
DSList |
-add(double val)
-Appends the primitive and returns this.
- |
-
DSList |
-add(DSElement val)
-Adds the value and returns this.
- |
-
DSList |
-add(int val)
-Appends the primitive and returns this.
- |
-
DSList |
-add(long val)
-Appends the primitive and returns this.
- |
-
DSList |
-add(java.lang.String val)
-Appends the primitive and returns this.
- |
-
DSList |
-addAll(DSList list)
-Add all elements of the argument to this list and returns this.
- |
-
DSList |
-addList()
-Appends a new list and returns it.
- |
-
DSMap |
-addMap()
-Appends a new map and returns it.
- |
-
DSList |
-addNull()
-Appends null and returns this.
- |
-
DSList |
-clear()
-Removes all items.
- |
-
boolean |
-contains(DSElement value) |
-
DSList |
-copy()
-If an object is mutable (list or map) then this should clone it, immutable objects can simply
- return themselves.
- |
-
DSElement |
-get(int idx)
-Returns the value at the given index.
- |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
boolean |
-isList()
-Returns true.
- |
-
boolean |
-isNull()
-Returns false.
- |
-
java.util.Iterator<DSElement> |
-iterator()
-Returns an iterator that does not implement remove.
- |
-
DSList |
-put(int idx,
- boolean val)
-Primitive setter, returns this.
- |
-
DSList |
-put(int idx,
- double val)
-Primitive setter, returns this.
- |
-
DSList |
-put(int idx,
- DSElement val)
-Replaces a value and returns this.
- |
-
DSList |
-put(int idx,
- int val)
-Primitive setter, returns this.
- |
-
DSList |
-put(int idx,
- long val)
-Primitive setter, returns this.
- |
-
DSList |
-put(int idx,
- java.lang.String val)
-Primitive setter, returns this.
- |
-
DSElement |
-remove(int idx)
-Removes the value at the given index and returns it.
- |
-
int |
-size()
-The number of items is the group.
- |
-
DSList |
-toElement()
-Returns this.
- |
-
DSList |
-toList()
-Lists return themselves, everything else results in an exception.
- |
-
static DSList |
-valueOf(java.lang.Double... values) |
-
static DSList |
-valueOf(DSElement... values) |
-
DSList |
-valueOf(DSElement element)
-Returns the argument.
- |
-
static DSList |
-valueOf(java.lang.Long... values) |
-
static DSList |
-valueOf(java.lang.String... values) |
-
equals, first, get, get, get, get, get, getBoolean, getDouble, getFloat, getInt, getList, getLong, getMap, getString, hashCode, hasParent, indexOf, isEmpty, isGroup, isNull, last, lastIndexOf, removeFirst, removeLast, toGroup, toStringisBoolean, isBytes, isDouble, isEqual, isFloat, isInt, isLong, isMap, isNumber, isString, make, make, make, make, make, make, makeNull, toBoolean, toBytes, toDouble, toFloat, toInt, toLong, toMapclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic DSList add(DSElement val)-
val - Can be null, and can not be an already parented group.public DSList add(boolean val)-
public DSList add(double val)-
public DSList add(long val)-
public DSList add(java.lang.String val)-
public DSList add(int val)-
public DSList addAll(DSList list)-
public DSList addList()-
public DSMap addMap()-
public DSList addNull()-
public boolean contains(DSElement value)-
public DSList copy()-
DSElementpublic DSList toElement()-
DSElementpublic DSElement get(int idx)-
DSGrouppublic DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic boolean isNull()-
public java.util.Iterator<DSElement> iterator()-
iterator in interface java.lang.Iterable<DSElement>public DSList put(int idx, - DSElement val)-
val - Can be null.public DSList put(int idx, - boolean val)-
public DSList put(int idx, - double val)-
public DSList put(int idx, - int val)-
public DSList put(int idx, - long val)-
public DSList put(int idx, - java.lang.String val)-
public DSElement remove(int idx)-
DSGrouppublic int size()-
DSGrouppublic DSList toList()-
DSElementpublic DSList valueOf(DSElement element)-
DSElementpublic static DSList valueOf(java.lang.Double... values)-
public static DSList valueOf(java.lang.Long... values)-
public static DSList valueOf(java.lang.String... values)-
| Modifier and Type | -Field and Description | -
|---|---|
static DSLong |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object arg)
-True if the argument is a DSINumber and the values are equal or they are both isNull.
- |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isLong()
-Whether or not the object represents a long.
- |
-
boolean |
-isNull()
-Whether or not the object represents null.
- |
-
boolean |
-isNumber()
-Whether or not the object represents a number.
- |
-
boolean |
-toBoolean()
-Attempts to return a boolean value.
- |
-
double |
-toDouble()
-Attempts to return a double value.
- |
-
float |
-toFloat()
-Attempts to return a float value.
- |
-
int |
-toInt()
-Attempts to return an int value.
- |
-
long |
-toLong()
-Attempts to return a long value.
- |
-
java.lang.Number |
-toNumber()
-Returns the Java primitive wrapper.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSLong |
-valueOf(DSElement arg)
-Returns this.
- |
-
static DSLong |
-valueOf(long arg)
-Attempts to reuse some common values before creating a new instance.
- |
-
static DSLong |
-valueOf(java.lang.String arg)
-Checks for null, then uses Float.parseFloat()
- |
-
copy, isBoolean, isBytes, isDouble, isEqual, isFloat, isGroup, isInt, isList, isMap, isString, make, make, make, make, make, make, makeNull, toBytes, toElement, toGroup, toList, toMapclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isLong()-
DSElementpublic boolean isNull()-
DSElementpublic boolean isNumber()-
DSElementpublic boolean toBoolean()-
DSElementpublic double toDouble()-
DSElementpublic float toFloat()-
DSElementpublic int toInt()-
DSElementpublic long toLong()-
DSElementpublic java.lang.Number toNumber()-
DSINumberpublic java.lang.String toString()-
DSValuepublic static DSLong valueOf(long arg)-
public static DSLong valueOf(java.lang.String arg)-
public static class DSMap.Entry
-extends java.lang.Object
-| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object obj) |
-
java.lang.String |
-getKey() |
-
DSElement |
-getValue() |
-
int |
-hashCode() |
-
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitpublic boolean equals(java.lang.Object obj)-
equals in class java.lang.Objectpublic java.lang.String getKey()-
public DSElement getValue()-
public int hashCode()-
hashCode in class java.lang.Objectpublic class DSMap -extends DSGroup-
- - This can be mounted in the node tree. However, the parent node will not know when it has been - modified, so the modifier is responsible for calling DSNode.childChanged(DSInfo). - -
- - This is not thread safe.
| Modifier and Type | -Class and Description | -
|---|---|
static class |
-DSMap.Entry
-Allows values to be accessed quickly by index in the list, rather than having to do a key
- lookup in the map.
- |
-
| Modifier and Type | -Field and Description | -
|---|---|
protected java.util.List<DSMap.Entry> |
-keys
-For preserving order.
- |
-
protected java.util.Map<java.lang.String,DSMap.Entry> |
-map |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSMap |
-clear()
-Removes all items.
- |
-
boolean |
-contains(java.lang.String key) |
-
DSMap |
-copy()
-If an object is mutable (list or map) then this should clone it, immutable objects can simply
- return themselves.
- |
-
boolean |
-equals(java.lang.Object arg) |
-
DSElement |
-get(int idx)
-Returns the value at the given index.
- |
-
DSElement |
-get(java.lang.String key)
-Returns the value for the given key.
- |
-
boolean |
-get(java.lang.String key,
- boolean def)
-Optional getter, returns the provided default if the value mapped to the key is null or not
- convertible.
- |
-
double |
-get(java.lang.String key,
- double def)
-Optional getter, returns the provided default if the value mapped to the key is null.
- |
-
int |
-get(java.lang.String key,
- int def)
-Optional getter, returns the provided default if the value mapped to the key is null or not
- convertible.
- |
-
long |
-get(java.lang.String key,
- long def)
-Optional getter, returns the provided default if the value mapped to the key is null or not
- convertible.
- |
-
java.lang.String |
-get(java.lang.String key,
- java.lang.String def)
-Optional getter, returns the provided default if the value mapped to the key is null.
- |
-
boolean |
-getBoolean(java.lang.String key)
-Primitive getter.
- |
-
double |
-getDouble(java.lang.String key)
-Primitive getter.
- |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSMap.Entry |
-getEntry(int index) |
-
DSMap.Entry |
-getEntry(java.lang.String key) |
-
int |
-getInt(java.lang.String key)
-Primitive getter.
- |
-
java.lang.String |
-getKey(int idx)
-Returns the key at the given index.
- |
-
DSList |
-getList(java.lang.String key)
-Return the list, or null.
- |
-
long |
-getLong(java.lang.String key)
-Primitive getter.
- |
-
DSMap |
-getMap(java.lang.String key)
-Returns the map value for the given key, or null.
- |
-
java.lang.String |
-getString(java.lang.String key)
-Returns the String value for the given key, or null.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
int |
-hashCode() |
-
int |
-indexOf(java.lang.String key)
-Index of the given key, or -1.
- |
-
boolean |
-isMap()
-Returns true.
- |
-
boolean |
-isNull()
-Returns false.
- |
-
boolean |
-isNull(java.lang.String key)
-Returns true if the key isn't in the map, or it's value is null.
- |
-
DSMap |
-put(java.lang.String key,
- boolean val)
-Primitive setter, returns this.
- |
-
DSMap |
-put(java.lang.String key,
- double val)
-Primitive setter, returns this.
- |
-
DSMap |
-put(java.lang.String key,
- DSElement val)
-Adds or replaces the value for the given key and returns this.
- |
-
DSMap |
-put(java.lang.String key,
- int val)
-Primitive setter, returns this.
- |
-
DSMap |
-put(java.lang.String key,
- long val)
-Primitive setter, returns this.
- |
-
DSMap |
-put(java.lang.String key,
- java.lang.String val)
-Primitive setter, returns this.
- |
-
DSMap |
-put(java.lang.String key,
- java.lang.Throwable val)
-Puts a String representing the stack trace into the map.
- |
-
DSMap |
-putAll(DSMap toAdd)
-Adds / overwrites entries in this map with those from the given.
- |
-
DSList |
-putList(java.lang.String key)
-Puts a new list for given key and returns it.
- |
-
DSMap |
-putMap(java.lang.String key)
-Puts a new map for given key and returns it.
- |
-
DSMap |
-putNull(java.lang.String key)
-Puts a null value for given key and returns this.
- |
-
DSElement |
-remove(int idx)
-Removes the value at the given index and returns it.
- |
-
DSElement |
-remove(java.lang.String key)
-Removes the key-value pair and returns the removed value.
- |
-
int |
-size()
-The number of items is the group.
- |
-
DSMap |
-toElement()
-Returns this.
- |
-
DSMap |
-toMap()
-Maps return themselves, everything else results in an exception.
- |
-
DSMap |
-valueOf(DSElement element)
-Returns the argument.
- |
-
first, get, get, get, get, get, getBoolean, getDouble, getFloat, getInt, getList, getLong, getMap, getString, hasParent, indexOf, isEmpty, isGroup, isNull, last, lastIndexOf, removeFirst, removeLast, toGroup, toStringisBoolean, isBytes, isDouble, isEqual, isFloat, isInt, isList, isLong, isNumber, isString, make, make, make, make, make, make, makeNull, toBoolean, toBytes, toDouble, toFloat, toInt, toList, toLongclone, finalize, getClass, notify, notifyAll, wait, wait, waitprotected java.util.List<DSMap.Entry> keys-
protected java.util.Map<java.lang.String,DSMap.Entry> map-
public boolean contains(java.lang.String key)-
public DSMap copy()-
DSElementpublic DSElement get(int idx)-
DSGrouppublic DSElement get(java.lang.String key)-
public boolean get(java.lang.String key, - boolean def)-
public double get(java.lang.String key, - double def)-
public int get(java.lang.String key, - int def)-
public long get(java.lang.String key, - long def)-
public java.lang.String get(java.lang.String key, - java.lang.String def)-
public boolean getBoolean(java.lang.String key)-
public double getDouble(java.lang.String key)-
public DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSMap.Entry getEntry(int index)-
public DSMap.Entry getEntry(java.lang.String key)-
public DSList getList(java.lang.String key)-
public long getLong(java.lang.String key)-
public int getInt(java.lang.String key)-
public java.lang.String getKey(int idx)-
public DSMap getMap(java.lang.String key)-
public java.lang.String getString(java.lang.String key)-
public DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic boolean isNull()-
public boolean isNull(java.lang.String key)-
public int indexOf(java.lang.String key)-
public DSMap put(java.lang.String key, - DSElement val)-
key - Must not be null.val - Can be null, and can not be an already parented group.public DSMap put(java.lang.String key, - boolean val)-
public DSMap put(java.lang.String key, - double val)-
public DSMap put(java.lang.String key, - int val)-
public DSMap put(java.lang.String key, - long val)-
public DSMap put(java.lang.String key, - java.lang.String val)-
public DSMap put(java.lang.String key, - java.lang.Throwable val)-
public DSMap putAll(DSMap toAdd)-
public DSList putList(java.lang.String key)-
public DSMap putMap(java.lang.String key)-
public DSMap putNull(java.lang.String key)-
public DSElement remove(int idx)-
DSGrouppublic DSElement remove(java.lang.String key)-
public int size()-
DSGrouppublic DSMap toElement()-
DSElementpublic DSMap toMap()-
DSElementpublic class DSMetadata
-extends java.lang.Object
-| Modifier and Type | -Field and Description | -
|---|---|
static java.lang.String |
-BOOLEAN_RANGE |
-
static java.lang.String |
-DECIMAL_PLACES |
-
static java.lang.String |
-DEFAULT |
-
static java.lang.String |
-DESCRIPTION |
-
static java.lang.String |
-DISPLAY_NAME |
-
static java.lang.String |
-EDITOR |
-
static java.lang.String |
-ENUM_RANGE |
-
static java.lang.String |
-MAX_VALUE |
-
static java.lang.String |
-MIN_VALUE |
-
static java.lang.String |
-NAME |
-
static java.lang.String |
-PLACEHOLDER |
-
static java.lang.String |
-TYPE |
-
static java.lang.String |
-UNIT |
-
| Constructor and Description | -
|---|
DSMetadata() |
-
DSMetadata(DSMap map) |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSMetadata |
-clear() |
-
DSMetadata |
-clear(java.lang.String key) |
-
DSList |
-getBooleanRange()
-The boolean range, or null.
- |
-
DSLong |
-getDecimalPlaces()
-The decimal precision or null.
- |
-
DSElement |
-getDefault()
-The default value for an action parameter, or null.
- |
-
java.lang.String |
-getDescription()
-The description, or null.
- |
-
java.lang.String |
-getDisplayName()
-The alternate display name, or null.
- |
-
java.lang.String |
-getEditor()
-The editor, or null.
- |
-
DSList |
-getEnumRange()
-The editor, or null.
- |
-
DSMap |
-getMap() |
-
DSElement |
-getMaxValue()
-The max value, or null.
- |
-
static DSMap |
-getMetadata(DSInfo info,
- DSMap bucket)
-Fully acquires metadata about the info.
- |
-
DSElement |
-getMinValue()
-The min value, or null.
- |
-
java.lang.String |
-getName()
-The name, or null.
- |
-
java.lang.String |
-getPlaceHolder()
-Placeholder text for text fields, or null.
- |
-
java.lang.String |
-getType()
-The type for action parameters, can be used to override types in the responder api.
- |
-
java.lang.String |
-getUnit()
-Value if defined, otherwise null.
- |
-
boolean |
-isEmpty() |
-
DSMetadata |
-set(java.lang.String key,
- DSElement value)
-Set arbitrary keys.
- |
-
DSMetadata |
-setBooleanRange(DSList range)
-The list must be size 2 and the entries must not be null.
- |
-
DSMetadata |
-setBooleanRange(java.lang.String falseText,
- java.lang.String trueText)
-The parameters can be null, which will result in the default text (false/true).
- |
-
DSMetadata |
-setDecimalPlaces(DSLong arg) |
-
DSMetadata |
-setDefault(DSIValue arg)
-Sets the default value only, does not set type information.
- |
-
DSMetadata |
-setDescription(java.lang.String arg) |
-
DSMetadata |
-setDisplayName(java.lang.String arg) |
-
DSMetadata |
-setEditor(java.lang.String arg)
-See the EDITOR_ constants.
- |
-
DSMetadata |
-setEnumRange(DSList arg)
-List of string values for an enum or string.
- |
-
DSMetadata |
-setEnumRange(java.lang.String... range)
-List of string values for an enum or string.
- |
-
DSMetadata |
-setMap(DSMap arg)
-Change the underlying map so the metadata instance can be reused.
- |
-
DSMetadata |
-setMaxValue(DSElement arg)
-The arg should be a number.
- |
-
DSMetadata |
-setMinValue(DSElement arg)
-The arg should be a number.
- |
-
DSMetadata |
-setName(java.lang.String arg) |
-
DSMetadata |
-setPlaceHolder(java.lang.String arg)
-Place holder text for text fields.
- |
-
DSMetadata |
-setType(DSIValue arg)
-Sets the type and if the given is an enum, sets the enum range as well.
- |
-
DSMetadata |
-setType(DSValueType arg)
-The type for action parameters, can be used to override types in the responder api.
- |
-
DSMetadata |
-setUnit(java.lang.String arg)
-The unit identifier.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final java.lang.String BOOLEAN_RANGE-
public static final java.lang.String DESCRIPTION-
public static final java.lang.String DECIMAL_PLACES-
public static final java.lang.String DEFAULT-
public static final java.lang.String DISPLAY_NAME-
public static final java.lang.String EDITOR-
public static final java.lang.String ENUM_RANGE-
public static final java.lang.String NAME-
public static final java.lang.String MAX_VALUE-
public static final java.lang.String MIN_VALUE-
public static final java.lang.String PLACEHOLDER-
public static final java.lang.String TYPE-
public static final java.lang.String UNIT-
public DSMetadata()-
public DSMetadata(DSMap map)-
public DSMetadata clear()-
public DSMetadata clear(java.lang.String key)-
public DSMap getMap()-
public DSList getBooleanRange()-
public DSLong getDecimalPlaces()-
public DSElement getDefault()-
public java.lang.String getDescription()-
public java.lang.String getDisplayName()-
public java.lang.String getEditor()-
public DSList getEnumRange()-
public DSElement getMaxValue()-
public static DSMap getMetadata(DSInfo info, - DSMap bucket)-
info - Who to get metadata for.bucket - Where to put the metadata, can be null in which case a new map will be
- instantiated.public DSElement getMinValue()-
public java.lang.String getName()-
public java.lang.String getPlaceHolder()-
public java.lang.String getType()-
public java.lang.String getUnit()-
public boolean isEmpty()-
public DSMetadata set(java.lang.String key, - DSElement value)-
public DSMetadata setBooleanRange(DSList range)-
public DSMetadata setBooleanRange(java.lang.String falseText, - java.lang.String trueText)-
public DSMetadata setDefault(DSIValue arg)-
public DSMetadata setDecimalPlaces(DSLong arg)-
public DSMetadata setDescription(java.lang.String arg)-
public DSMetadata setDisplayName(java.lang.String arg)-
public DSMetadata setEditor(java.lang.String arg)-
public DSMetadata setEnumRange(DSList arg)-
public DSMetadata setEnumRange(java.lang.String... range)-
public DSMetadata setMap(DSMap arg)-
public DSMetadata setMaxValue(DSElement arg)-
public DSMetadata setMinValue(DSElement arg)-
public DSMetadata setName(java.lang.String arg)-
public DSMetadata setPlaceHolder(java.lang.String arg)-
public DSMetadata setType(DSIValue arg)-
public DSMetadata setType(DSValueType arg)-
public DSMetadata setUnit(java.lang.String arg)-
public class DSNode -extends DSLogger -implements DSIObject, java.lang.Iterable<DSInfo>-
- To create a node subclass, you should understand the following concepts: -
-
-
- DSNode sub-classes must support the public no-arg constructor. This is how they will be - instantiated when deserializing the configuration database. -
-
- Every subtype of DSNode has a private default instance, all other instances of any particular - type are copies of the default instance. You should never perform application logic unless your - node is running (started or stable) because of this. -
- If a DSNode subtype needs to have specific child nodes or values (most will), it should override - the declareDefaults method. The method should: -
-
- During node serialization (configuration database, not DSA interop), children that match their - declared default are omitted. This has two benefits: -
-
-
- It is important to know the node lifecycle. Your nodes should not execute any application logic - unless they are running (started or stable). -
- Stopped -
- A node is instantiated in the stopped state. If a node tree has been persisted, will be be fully - restored in the stopped state. DSNode.onStopped will not be called, it is only called when nodes - transition from running to stopped. -
- When nodes are removed from a running parent node, they will be stopped. DSNode.onStopped will - be called after all child nodes have been stopped. -
- When a link is stopped, an attempt to stop the tree will be made, but it cannot be guaranteed. -
- Started -
- After the node tree is fully deserialized it will be started. A node's onStart method will be - called after all of its child nodes have been started. The only guarantee is that all child - nodes have been started. -
- Nodes will also started when they are added to an already running parent node. -
- Stable -
- Stable is called after the entire tree has been started. The first time the node tree is loaded, - there is a stable delay of 5 seconds. This is configurable as stableDelay in - slink.json. -
- Nodes added to an already stable parent will have onStart and onStable called immediately. -
- When in doubt of whether to use onStarted or onStable, use onStable. -
- Other Callbacks -
- When a node is stable, there are several other callbacks for various state changes. All - callbacks begin with **on** such as onChildAdded(). -
-
- Nodes should suspend, or minimize activity when nothing is interested in them. For example, if - nothing is interested in a point, it is best to not poll the point on the foreign system. -
- To do this you use the following APIs: -
-
-
- Values mostly represent leaf members of the node tree. There are two types of values: -
-
- Many values are singleton instances. This is for efficiency, the same value instance (e.g. - DSBoolean.TRUE) can be stored in many nodes. Singleton values must be immutable. -
- Whenever possible, values should also have NULL instance. Rather than storing a generic null, - this helps the system decode the proper type such as when a requester is attempting to set a - value. -
-
- Add actions to your node to allow requester invocation using org.iot.dsa.node.action.DSAction. -
- Override DSNode.onInvoke to handle invocations. The reason for this is complicated but it is - possible to subclass DSAction, just carefully read the javadoc if you do. Be sure to call - super.onInvoke() when overriding that method. -
-
- All node children have corresponding DSInfo instances. This type serves two purposes: -
-
- Important things for developers to know about DSInfo are: -
-
| Modifier and Type | -Field and Description | -
|---|---|
static DSTopic |
-INFO_TOPIC |
-
static DSTopic |
-VALUE_TOPIC |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSInfo |
-add(java.lang.String name,
- DSIObject object)
-Adds the named child only if the name is not already in use.
- |
-
int |
-childCount()
-The number of children.
- |
-
DSNode |
-clear()
-Removes non-permanent children.
- |
-
boolean |
-contains(java.lang.String key)
-Whether or not this node has a child with the given name.
- |
-
DSNode |
-copy()
-Returns a clone of this node and its subtree.
- |
-
protected DSInfo |
-declareDefault(java.lang.String name,
- DSIObject value)
-Use this in the declareDefaults method to create a non-removable child.
- |
-
protected void |
-declareDefaults()
-The is only called once for each class.
- |
-
protected void |
-fire(DSTopic topic,
- DSIEvent event,
- DSInfo child)
-Notifies subscribers of the event.
- |
-
protected void |
-fire(DSTopic topic,
- DSIEvent event,
- DSInfo child,
- java.lang.Object... params)
-Notifies subscribers of the event.
- |
-
DSIObject |
-get(java.lang.String name)
-Returns the child value with the given name, or null.
- |
-
DSElement |
-getElement(java.lang.String name)
-A convenience for (DSElement) get(name).
- |
-
DSIObject |
-getFirst()
-The first child, or null.
- |
-
DSInfo |
-getFirstInfo()
-The first child info, or null.
- |
-
DSInfo |
-getFirstNodeInfo()
-The info for the first child node, or null.
- |
-
DSInfo |
-getInfo()
-DSInfo for this node in its parent, or null if un-parented.
- |
-
DSInfo |
-getInfo(java.lang.String name)
-Returns the info for the child with the given name, or null.
- |
-
DSIObject |
-getLast()
-The last child, or null.
- |
-
DSInfo |
-getLastInfo()
-The last child info, or null.
- |
-
protected java.lang.String |
-getLogName()
-Override point, returns the simple class name by default.
- |
-
void |
-getMetadata(DSInfo info,
- DSMap bucket)
-Override point, add any meta data for the given info to the provided bucket.
- |
-
java.lang.String |
-getName()
-Returns the name of this node in its parent, or null if un-parented.
- |
-
DSNode |
-getNode(java.lang.String name)
-A convenience for (DSNode) get(name).
- |
-
DSNode |
-getParent()
-Returns the parent node, or null.
- |
-
java.lang.String |
-getPath()
-The DSA path, properly encoded.
- |
-
DSIValue |
-getValue(java.lang.String name)
-A convenience for (DSIValue) get(name).
- |
-
protected boolean |
-isDefaultInstance()
-True if this is the default instance for the type.
- |
-
boolean |
-isEqual(java.lang.Object arg)
-True if the argument is a node with the same children, although their order can be
- different.
- |
-
boolean |
-isIdentical(java.lang.Object arg)
-True if the argument is a node with the same children in the exact same order.
- |
-
protected static boolean |
-isNode(java.lang.Object obj)
-Convenience for instanceof DSNode.
- |
-
boolean |
-isNull()
-Returns false.
- |
-
boolean |
-isRunning()
-A convenience for !isStopped().
- |
-
boolean |
-isStable()
-True after stable is called, children are stable before their parents.
- |
-
boolean |
-isStarted()
-True after start is called, children are started before their parents.
- |
-
boolean |
-isStopped()
-True after stop is called, children are stopped before their parents.
- |
-
boolean |
-isSubscribed()
-True if there are any subscribers.
- |
-
boolean |
-isSubscribed(DSInfo child,
- DSTopic topic)
-True if there are any subscriptions with the matching child and topic.
- |
-
boolean |
-isSubscribed(DSTopic topic)
-True if there any subscriptions for the given topic.
- |
-
java.util.Iterator<DSInfo> |
-iterateNodes()
-Returns an info iterator of child DSNodes.
- |
-
java.util.Iterator<DSInfo> |
-iterateValues()
-Returns an info iterator of child DSIValues.
- |
-
java.util.Iterator<DSInfo> |
-iterator()
-Returns an info iterator of all children.
- |
-
protected void |
-onChildAdded(DSInfo info)
-Called when the given child is added and in the stable state.
- |
-
protected void |
-onChildChanged(DSInfo info)
-Called when the given child is changed and in the stable state.
- |
-
protected void |
-onChildRemoved(DSInfo info)
-Called when the given child is removed and in the stable state.
- |
-
protected void |
-onInfoChanged(DSInfo info)
-Called when the given info is modified and in the stable state.
- |
-
ActionResult |
-onInvoke(DSInfo actionInfo,
- ActionInvocation invocation)
-Override point, called by the default implementation of DSAction.invoke.
- |
-
void |
-onSet(DSInfo info,
- DSIValue value)
-Override point, called when a value being set.
- |
-
void |
-onSet(DSIValue value)
-Override point, called only when a DSNode subclass implements DSIValue is being set.
- |
-
protected void |
-onStable()
-Called once this node is stable, but before stable is called on children.
- |
-
protected void |
-onStarted()
-Called once this node and its entire subtree is started.
- |
-
protected void |
-onStopped()
-Called once this node and its entire subtree is stopped.
- |
-
protected void |
-onSubscribe(DSTopic topic,
- DSInfo child,
- DSISubscriber subscriber)
-Called for every subscription.
- |
-
protected void |
-onSubscribed()
-Called when this node transitions from having no subscriptions to having a subscription of
- any kind.
- |
-
protected void |
-onSubscribed(DSTopic topic,
- DSInfo child)
-Called when the child and topic pair transitions from having no subscriptions to have a
- subscription.
- |
-
protected void |
-onUnsubscribe(DSTopic topic,
- DSInfo child,
- DSISubscriber subscriber)
-Called for every unsubscribe.
- |
-
protected void |
-onUnsubscribed()
-Called when this node transitions to having no subscriptions of any kind.
- |
-
protected void |
-onUnsubscribed(DSTopic topic,
- DSInfo child)
-Called when the child and topic pair transitions to having no subscriptions.
- |
-
DSNode |
-put(DSInfo info,
- DSIObject object)
-Replaces the child.
- |
-
DSInfo |
-put(java.lang.String name,
- boolean arg)
-A convenience for put(String, DSIObject)
- |
-
DSInfo |
-put(java.lang.String name,
- double arg)
-A convenience for put(String, DSIObject)
- |
-
DSInfo |
-put(java.lang.String name,
- DSIObject object)
-Adds or replaces the named child.
- |
-
DSInfo |
-put(java.lang.String name,
- float arg)
-A convenience for put(String, DSIObject)
- |
-
DSInfo |
-put(java.lang.String name,
- int arg)
-A convenience for put(String, DSIObject)
- |
-
DSInfo |
-put(java.lang.String name,
- long arg)
-A convenience for put(String, DSIObject)
- |
-
DSInfo |
-put(java.lang.String name,
- java.lang.String arg)
-A convenience for put(String, DSIObject)
- |
-
DSNode |
-remove(DSInfo info)
-Removes the child.
- |
-
DSInfo |
-remove(java.lang.String name)
-Remove the named child if it is contained.
- |
-
void |
-stable()
-Called after the entire subtree is started.
- |
-
void |
-start()
-Sets the state to starting.
- |
-
void |
-stop()
-Sets the state to stopped.
- |
-
void |
-subscribe(DSTopic topic,
- DSInfo child,
- DSISubscriber subscriber)
-Subscribes the child and topic.
- |
-
protected static DSNode |
-toNode(java.lang.Object obj)
-A convenience that casts the argument to a node.
- |
-
void |
-unsubscribe(DSTopic topic,
- DSInfo child,
- DSISubscriber subscriber)
-Unsubscribes the tuple.
- |
-
protected void |
-validateChild(DSIObject obj)
-Override point, throw a meaningful IllegalArgumentException if the child is not allowed
- |
-
protected void |
-validateParent(DSNode node)
-Override point, throw a meaningful IllegalArgumentException if the parent is not allowed
- |
-
admin, admin, admin, debug, debug, debug, error, error, error, fatal, fatal, fatal, fine, fine, fine, info, info, info, trace, trace, trace, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic static final DSTopic INFO_TOPIC-
public static final DSTopic VALUE_TOPIC-
public DSInfo add(java.lang.String name, - DSIObject object)-
name - The name must not currently be in use.object - The object to add, nodes must not already be parented.java.lang.IllegalArgumentException - If the name is in use or the value is a node that is already
- parented.public int childCount()-
public DSNode clear()-
public boolean contains(java.lang.String key)-
public DSNode copy()-
protected DSInfo declareDefault(java.lang.String name, - DSIObject value)-
declareDefaults()protected void declareDefaults()-
To create non-removable children.protected void fire(DSTopic topic, - DSIEvent event, - DSInfo child)-
topic - Must not be null.event - Must not be null.child - Can be null.protected void fire(DSTopic topic, - DSIEvent event, - DSInfo child, - java.lang.Object... params)-
topic - Must not be null.event - Must not be null.child - Can be null.params - Optionalpublic DSIObject get(java.lang.String name)-
public DSElement getElement(java.lang.String name)-
public DSInfo getInfo()-
public DSInfo getInfo(java.lang.String name)-
public DSIObject getFirst()-
public DSInfo getFirstInfo()-
public DSInfo getFirstNodeInfo()-
public DSIObject getLast()-
public DSInfo getLastInfo()-
protected java.lang.String getLogName()-
DSLoggergetLogName in class DSLoggerpublic void getMetadata(DSInfo info, - DSMap bucket)-
public java.lang.String getName()-
public DSNode getNode(java.lang.String name)-
public DSNode getParent()-
public java.lang.String getPath()-
public DSIValue getValue(java.lang.String name)-
protected final boolean isDefaultInstance()-
public boolean isEqual(java.lang.Object arg)-
public boolean isIdentical(java.lang.Object arg)-
protected static final boolean isNode(java.lang.Object obj)-
public boolean isNull()-
public boolean isRunning()-
public boolean isStable()-
public boolean isStarted()-
public boolean isStopped()-
public boolean isSubscribed()-
public boolean isSubscribed(DSInfo child, - DSTopic topic)-
child - Can be null.topic - Can be null.public boolean isSubscribed(DSTopic topic)-
public java.util.Iterator<DSInfo> iterateNodes()-
public java.util.Iterator<DSInfo> iterateValues()-
public java.util.Iterator<DSInfo> iterator()-
iterator in interface java.lang.Iterable<DSInfo>protected void onChildAdded(DSInfo info)-
protected void onChildChanged(DSInfo info)-
protected void onChildRemoved(DSInfo info)-
protected void onInfoChanged(DSInfo info)-
public ActionResult onInvoke(DSInfo actionInfo, - ActionInvocation invocation)-
actionInfo - Child info for the action, you can declare a field for the action info for
- quick instance comparison.invocation - Details about the incoming invoke as well as the mechanism to send updates
- over an open stream.java.lang.IllegalStateException - If the nothing handles an incoming invocation.DSAction.invoke(DSInfo, ActionInvocation)public void onSet(DSInfo info, - DSIValue value)-
info - The child being changed.value - The new value.DSIResponder.onSet(InboundSetRequest)public void onSet(DSIValue value)-
value - The new value.DSIResponder.onSet(InboundSetRequest),
-DSValueNodeprotected void onSubscribe(DSTopic topic, - DSInfo child, - DSISubscriber subscriber)-
topic - Will not be null.child - Can be null.subscriber - Will not be null.protected void onSubscribed()-
protected void onSubscribed(DSTopic topic, - DSInfo child)-
child - Can be null, which indicates node subscriptions.protected void onStable()-
protected void onStarted()-
protected void onStopped()-
protected void onUnsubscribe(DSTopic topic, - DSInfo child, - DSISubscriber subscriber)-
topic - Will not be null.child - Can be null.subscriber - Will not be null.protected void onUnsubscribed()-
protected void onUnsubscribed(DSTopic topic, - DSInfo child)-
topic - Can not be null.child - Can be null.public DSInfo put(java.lang.String name, - DSIObject object)-
public DSInfo put(java.lang.String name, - boolean arg)-
public DSInfo put(java.lang.String name, - double arg)-
public DSInfo put(java.lang.String name, - float arg)-
public DSInfo put(java.lang.String name, - int arg)-
public DSInfo put(java.lang.String name, - long arg)-
public DSInfo put(java.lang.String name, - java.lang.String arg)-
public DSNode put(DSInfo info, - DSIObject object)-
public DSNode remove(DSInfo info)-
java.lang.IllegalStateException - If the info is permanent or not a child of this node.public DSInfo remove(java.lang.String name)-
java.lang.IllegalStateException - If the info says its not removable.public final void stable()-
public final void start()-
public final void stop()-
public void subscribe(DSTopic topic, - DSInfo child, - DSISubscriber subscriber)-
topic - Can not be null.child - Can be null, and cannot be a child node.subscriber - Can not be null.protected static DSNode toNode(java.lang.Object obj)-
public void unsubscribe(DSTopic topic, - DSInfo child, - DSISubscriber subscriber)-
topic - Can not be null.child - Can be null.subscriber - Can not be null.protected void validateChild(DSIObject obj)-
protected void validateParent(DSNode node)-
| Modifier and Type | -Field and Description | -
|---|---|
static DSNull |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSNull |
-copy()
-Returns this.
- |
-
boolean |
-equals(java.lang.Object arg)
-True of the arg == this.
- |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
boolean |
-isNull()
-True
- |
-
DSNull |
-toElement()
-Returns this.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSNull |
-valueOf(DSElement arg)
-Returns this.
- |
-
isBoolean, isBytes, isDouble, isEqual, isFloat, isGroup, isInt, isList, isLong, isMap, isNumber, isString, make, make, make, make, make, make, makeNull, toBoolean, toBytes, toDouble, toFloat, toGroup, toInt, toList, toLong, toMapclone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic DSNull copy()-
public DSNull toElement()-
public boolean equals(java.lang.Object arg)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic boolean isNull()-
public DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic class DSPath
-extends java.lang.Object
-| Constructor and Description | -
|---|
DSPath(java.lang.String path) |
-
| Modifier and Type | -Method and Description | -
|---|---|
static java.lang.StringBuilder |
-concat(java.lang.String leading,
- java.lang.String trailing,
- java.lang.StringBuilder bucket)
-Concatenates the two paths into the given bucket.
- |
-
static java.lang.String |
-decodeName(java.lang.String pathName)
-Un-escapes a name.
- |
-
static java.lang.String[] |
-decodePath(java.lang.String path)
-Splits the path and decodes each individual name.
- |
-
static java.lang.String |
-encodeName(java.lang.String name)
-Encodes a name for being in a path.
- |
-
static boolean |
-encodeName(java.lang.String name,
- java.lang.StringBuilder buf)
-Encodes a name for being in a path.
- |
-
static boolean |
-encodeNameV1(java.lang.String name,
- java.lang.StringBuilder buf)
-Encodes a DSA v1 name for use outside of a path.
- |
-
static java.lang.String |
-encodePath(boolean leadingSlash,
- java.lang.String... names)
-Creates a properly encoded path from the given names.
- |
-
static java.lang.String |
-encodePath(boolean leadingSlash,
- java.lang.String[] names,
- int len)
-Creates a properly encoded path from the given names.
- |
-
static java.lang.String |
-encodePath(DSNode node)
-Ascends the tree and encodes all the node names into a path.
- |
-
java.lang.String |
-getLastPathElement() |
-
java.lang.String |
-getPath()
-The raw fully encoded path.
- |
-
java.lang.String[] |
-getPathElements()
-The individual, decoded path elements.
- |
-
static java.lang.String[] |
-splitPath(java.lang.String path)
-Splits the path, but does not decode any names.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static java.lang.StringBuilder concat(java.lang.String leading, - java.lang.String trailing, - java.lang.StringBuilder bucket)-
bucket - Can be null, in which case a new buffer will be created.public static java.lang.String decodeName(java.lang.String pathName)-
public static java.lang.String[] decodePath(java.lang.String path)-
public static java.lang.String encodePath(boolean leadingSlash, - java.lang.String... names)-
leadingSlash - Whether or not to prepend a slash to the path.names - The names to encode in the given order.public static java.lang.String encodePath(boolean leadingSlash, - java.lang.String[] names, - int len)-
leadingSlash - Whether or not to prepend a slash to the path.names - The names to encode in the given order.len - The number of elements from the names array to use start at index 0.public static java.lang.String encodePath(DSNode node)-
public static java.lang.String encodeName(java.lang.String name)-
public static boolean encodeName(java.lang.String name, - java.lang.StringBuilder buf)-
name - The raw un-encoded name.buf - When to put the encoded name. Characters will be put into the buf no matter
- what.public static boolean encodeNameV1(java.lang.String name, - java.lang.StringBuilder buf)-
public java.lang.String getLastPathElement()-
public java.lang.String getPath()-
public java.lang.String[] getPathElements()-
public static java.lang.String[] splitPath(java.lang.String path)-
public class DSRegistry
-extends java.lang.Object
-| Constructor and Description | -
|---|
DSRegistry() |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSIValue |
-getDecoder(java.lang.Class clazz)
-The instance to use for decoding.
- |
-
static void |
-registerDecoder(java.lang.Class clazz,
- DSIValue instance)
-DSIValues must provide an instance for decoding.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static DSIValue getDecoder(java.lang.Class clazz)-
clazz - The class of a value type.public static void registerDecoder(java.lang.Class clazz, - DSIValue instance)-
clazz - The type the instance is for.instance - An instance to use for decoding.public class DSStatus -extends DSValue -implements DSIStatus, DSIStorable-
- - There are two categories of status, good and bad. Bad status means values can not be trusted and - should not be used in decision making / calculations. When performing aggregations / intervals, - bad values should be ignored if good values are present. - - -
- - Remote status means the status is being reported by a foreign system (outside of DSA). This - should greatly help with troubleshooting. - - -
- - Only the highest priority status should be assigned to an object. - - The status values in order from lowest to highest priority: - -
| Modifier and Type | -Field and Description | -
|---|---|
static int |
-CONFIG_FAULT
-Bad, a configuration error has been indentified within DSA.
- |
-
static java.lang.String |
-CONFIG_FAULT_STR |
-
static DSStatus |
-configFault |
-
static DSStatus |
-disabled |
-
static int |
-DISABLED
-Bad, the object has been disabled within DSA.
- |
-
static java.lang.String |
-DISABLED_STR |
-
static DSStatus |
-down |
-
static int |
-DOWN
-Bad, communications are down within DSA.
- |
-
static java.lang.String |
-DOWN_STR |
-
static DSStatus |
-fault |
-
static int |
-FAULT
-Bad, an operational error (exception) has occurred within DSA.
- |
-
static java.lang.String |
-FAULT_STR |
-
static DSStatus |
-NULL |
-
static DSStatus |
-ok |
-
static int |
-OK
-Good, no other status applies.
- |
-
static int |
-OK_OVERRIDE
-Good, the value is overridden within DSA.
- |
-
static java.lang.String |
-OK_OVERRIDE_STR |
-
static int |
-OK_REMOTE_OVERRIDE
-Good, the value is overridden outside of DSA.
- |
-
static java.lang.String |
-OK_REMOTE_OVERRIDE_STR |
-
static java.lang.String |
-OK_STR |
-
static DSStatus |
-okOverride |
-
static DSStatus |
-okRemoteOverride |
-
static int |
-REMOTE_CONFIG_FAULT
-Bad, a configuration error is being reported by the foreign system.
- |
-
static java.lang.String |
-REMOTE_CONFIG_FAULT_STR |
-
static int |
-REMOTE_DISABLED
-Bad, the foreign system is reporting the object is disabled.
- |
-
static java.lang.String |
-REMOTE_DISABLED_STR |
-
static int |
-REMOTE_DOWN
-Bad, down communications are being reported by the foreign system.
- |
-
static java.lang.String |
-REMOTE_DOWN_STR |
-
static int |
-REMOTE_FAULT
-Bad, an operational error is being reported by the foreign system.
- |
-
static java.lang.String |
-REMOTE_FAULT_STR |
-
static int |
-REMOTE_STALE
-Bad, a stale value is being reported by the foreign system.
- |
-
static java.lang.String |
-REMOTE_STALE_STR |
-
static int |
-REMOTE_UNKNOWN
-Bad, the foreign system is reporting the status is unknown.
- |
-
static java.lang.String |
-REMOTE_UNKNOWN_STR |
-
static DSStatus |
-remoteConfigFault |
-
static DSStatus |
-remoteDisabled |
-
static DSStatus |
-remoteDown |
-
static DSStatus |
-remoteFault |
-
static DSStatus |
-remoteStale |
-
static DSStatus |
-remoteUnknown |
-
static DSStatus |
-stale |
-
static int |
-STALE
-Bad, the value hasn't updated in a reasonable amount of time (user configurable on a per
- point basis) within DSA.
- |
-
static java.lang.String |
-STALE_STR |
-
static DSStatus |
-unknown |
-
static int |
-UNKNOWN
-Bad, the status is unknown within DSA, typically the initial state at boot.
- |
-
static java.lang.String |
-UNKNOWN_STR |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object obj) |
-
DSValueType |
-getValueType()
-String.
- |
-
int |
-hashCode() |
-
boolean |
-isBad()
-If any of the bad flags are set, or is null.
- |
-
boolean |
-isConfigFault()
-True if the associate bit is set.
- |
-
boolean |
-isDisabled()
-True if the associate bit is set.
- |
-
boolean |
-isDown()
-True if the associate bit is set.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isFault()
-True if the associate bit is set.
- |
-
boolean |
-isGood()
-If true, any associate object / value can be trusted.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
boolean |
-isOk() |
-
boolean |
-isOverride()
-True if the associate bit is set.
- |
-
boolean |
-isRemoteConfigFault() |
-
boolean |
-isRemoteDisabled() |
-
boolean |
-isRemoteDown() |
-
boolean |
-isRemoteFault() |
-
boolean |
-isRemoteOverride() |
-
boolean |
-isRemoteStale() |
-
boolean |
-isRemoteUnknown() |
-
boolean |
-isStale() |
-
boolean |
-isUnknown() |
-
DSStatus |
-restore(DSElement arg)
-Deserialize a value from the configuration database, these will be values returned from the
- store() method.
- |
-
DSLong |
-store()
-Serialize the value for the configuration database.
- |
-
DSString |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
DSStatus |
-toStatus() |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSStatus |
-valueOf(DSElement element)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
static DSStatus |
-valueOf(java.lang.String string) |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSStatus NULL-
public static final int OK-
public static final int OK_OVERRIDE-
public static final int OK_REMOTE_OVERRIDE-
public static final int STALE-
public static final int DOWN-
public static final int FAULT-
public static final int CONFIG_FAULT-
public static final int DISABLED-
public static final int UNKNOWN-
public static final int REMOTE_STALE-
public static final int REMOTE_DOWN-
public static final int REMOTE_FAULT-
public static final int REMOTE_CONFIG_FAULT-
public static final int REMOTE_DISABLED-
public static final int REMOTE_UNKNOWN-
public static final java.lang.String OK_STR-
public static final java.lang.String OK_OVERRIDE_STR-
public static final java.lang.String OK_REMOTE_OVERRIDE_STR-
public static final java.lang.String STALE_STR-
public static final java.lang.String DOWN_STR-
public static final java.lang.String CONFIG_FAULT_STR-
public static final java.lang.String FAULT_STR-
public static final java.lang.String DISABLED_STR-
public static final java.lang.String UNKNOWN_STR-
public static final java.lang.String REMOTE_STALE_STR-
public static final java.lang.String REMOTE_DOWN_STR-
public static final java.lang.String REMOTE_FAULT_STR-
public static final java.lang.String REMOTE_CONFIG_FAULT_STR-
public static final java.lang.String REMOTE_DISABLED_STR-
public static final java.lang.String REMOTE_UNKNOWN_STR-
public static final DSStatus ok-
public static final DSStatus okOverride-
public static final DSStatus okRemoteOverride-
public static final DSStatus stale-
public static final DSStatus down-
public static final DSStatus fault-
public static final DSStatus configFault-
public static final DSStatus disabled-
public static final DSStatus unknown-
public static final DSStatus remoteStale-
public static final DSStatus remoteDown-
public static final DSStatus remoteFault-
public static final DSStatus remoteConfigFault-
public static final DSStatus remoteDisabled-
public static final DSStatus remoteUnknown-
public boolean equals(java.lang.Object obj)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
getValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isBad()-
public boolean isConfigFault()-
public boolean isDisabled()-
public boolean isDown()-
public boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isFault()-
public boolean isGood()-
public boolean isNull()-
DSIValuepublic boolean isOk()-
public boolean isOverride()-
public boolean isRemoteConfigFault()-
public boolean isRemoteDisabled()-
public boolean isRemoteDown()-
public boolean isRemoteFault()-
public boolean isRemoteOverride()-
public boolean isRemoteStale()-
public boolean isRemoteUnknown()-
public boolean isStale()-
public boolean isUnknown()-
public DSLong store()-
DSIStorablestore in interface DSIStorablepublic DSStatus restore(DSElement arg)-
DSIStorablerestore in interface DSIStorablepublic DSString toElement()-
DSIValuepublic java.lang.String toString()-
DSValuepublic DSStatus valueOf(DSElement element)-
DSIValuepublic static DSStatus valueOf(java.lang.String string)-
| Modifier and Type | -Field and Description | -
|---|---|
static DSString |
-EMPTY
-The string of length 0.
- |
-
static DSString |
-NULL |
-
static java.nio.charset.Charset |
-UTF8
-The standard UTF8 charset, can be used with string.getBytes(Charset).
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-equals(java.lang.Object o) |
-
DSElementType |
-getElementType()
-For switch statements.
- |
-
DSValueType |
-getValueType()
-The DSA value type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isString()
-Whether or not the object represents a string.
- |
-
boolean |
-toBoolean()
-Attempts to return a boolean value.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSString |
-valueOf(DSElement arg)
-Returns the argument.
- |
-
static DSString |
-valueOf(java.lang.Object arg) |
-
copy, isBoolean, isBytes, isDouble, isEqual, isFloat, isGroup, isInt, isList, isLong, isMap, isNull, isNumber, make, make, make, make, make, make, makeNull, toBytes, toDouble, toElement, toFloat, toGroup, toInt, toList, toLong, toMapclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSString EMPTY-
public static final DSString NULL-
public static final java.nio.charset.Charset UTF8-
public boolean equals(java.lang.Object o)-
equals in class java.lang.Objectpublic DSElementType getElementType()-
DSElementgetElementType in class DSElementpublic DSValueType getValueType()-
DSElementgetValueType in interface DSIValuegetValueType in class DSElementpublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isString()-
DSElementpublic boolean toBoolean()-
DSElementpublic java.lang.String toString()-
DSValuepublic DSString valueOf(DSElement arg)-
DSElementpublic static DSString valueOf(java.lang.Object arg)-
public abstract class DSValue -extends java.lang.Object -implements DSIValue-
| Modifier and Type | -Method and Description | -
|---|---|
DSIValue |
-copy()
-Returns this.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic abstract class DSValueNode -extends DSNode -implements DSIValue-
getValueChild()INFO_TOPIC, VALUE_TOPIC| Constructor and Description | -
|---|
DSValueNode() |
-
| Modifier and Type | -Method and Description | -
|---|---|
abstract DSInfo |
-getValueChild()
-Subclasses must store the node value in a child value and provide the info for that child
- here.
- |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
void |
-onChildChanged(DSInfo child)
-This fires the NODE_CHANGED topic when the value child changes.
- |
-
void |
-onSet(DSIValue value)
-Override point, called only when a DSNode subclass implements DSIValue is being set.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
DSIValue |
-valueOf(DSElement element)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
add, childCount, clear, contains, copy, declareDefault, declareDefaults, fire, fire, get, getElement, getFirst, getFirstInfo, getFirstNodeInfo, getInfo, getInfo, getLast, getLastInfo, getLogName, getMetadata, getName, getNode, getParent, getPath, getValue, isDefaultInstance, isEqual, isIdentical, isNode, isNull, isRunning, isStable, isStarted, isStopped, isSubscribed, isSubscribed, isSubscribed, iterateNodes, iterateValues, iterator, onChildAdded, onChildRemoved, onInfoChanged, onInvoke, onSet, onStable, onStarted, onStopped, onSubscribe, onSubscribed, onSubscribed, onUnsubscribe, onUnsubscribed, onUnsubscribed, put, put, put, put, put, put, put, put, remove, remove, stable, start, stop, subscribe, toNode, unsubscribe, validateChild, validateParentadmin, admin, admin, debug, debug, debug, error, error, error, fatal, fatal, fatal, fine, fine, fine, info, info, info, trace, trace, trace, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic void onChildChanged(DSInfo child)-
onChildChanged in class DSNodepublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic abstract DSInfo getValueChild()-
public DSElement toElement()-
DSIValuepublic void onSet(DSIValue value)-
DSNodeonSet in class DSNodevalue - The new value.DSIResponder.onSet(InboundSetRequest),
-DSValueNodepublic enum DSValueType -extends java.lang.Enum<DSValueType>-
| Enum Constant and Description | -
|---|
BINARY |
-
BOOL |
-
DYNAMIC |
-
ENUM |
-
LIST |
-
MAP |
-
NUMBER |
-
STRING |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-toString() |
-
static DSValueType |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSValueType[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSValueType BINARY-
public static final DSValueType BOOL-
public static final DSValueType DYNAMIC-
public static final DSValueType ENUM-
public static final DSValueType LIST-
public static final DSValueType MAP-
public static final DSValueType NUMBER-
public static final DSValueType STRING-
public static DSValueType[] values()-
-for (DSValueType c : DSValueType.values()) - System.out.println(c); -
public static DSValueType valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic java.lang.String toString()-
toString in class java.lang.Enum<DSValueType>public interface ActionInvocation
-| Modifier and Type | -Method and Description | -
|---|---|
void |
-clearAllRows()
-Only use with stream and open tables, instructs the requester to clear all existing rows.
- |
-
void |
-close()
-For use with streams and open tables, will have no effect if the stream is already closed.
- |
-
void |
-close(java.lang.Exception reason)
-Close and send and error.
- |
-
DSMap |
-getParameters()
-The parameters supplied by the requester, or null.
- |
-
DSPermission |
-getPermission()
-The permission level of the invoker, should be verified against the permission level required
- by the action.
- |
-
void |
-insert(int index,
- DSList... rows)
-Only use with open tables, insert the rows at the given index.
- |
-
boolean |
-isOpen()
-Whether or not response is still open.
- |
-
void |
-replace(int idx,
- int len,
- DSList... rows)
-Only use with open tables, deletes len rows starting at the given index, then inserts the
- given rows in their place.
- |
-
void |
-send(DSList row)
-Only use with stream and open tables.
- |
-
void clearAllRows()-
void close()-
void close(java.lang.Exception reason)-
DSMap getParameters()-
DSPermission getPermission()-
void insert(int index, - DSList... rows)-
boolean isOpen()-
void send(DSList row)-
void replace(int idx, - int len, - DSList... rows)-
idx - Delete len rows starting at this index and replace with the given rows.len - Does not have to match the number of rows.rows - Does not have to match the len.public interface ActionResult
-ActionTable,
-ActionValues| Modifier and Type | -Method and Description | -
|---|---|
ActionSpec |
-getAction()
-The action that was invoked.
- |
-
void |
-onClose()
-Always called, whether or not the result is a stream, and no matter who closes it.
- |
-
ActionSpec getAction()-
void onClose()-
public static enum ActionSpec.ResultType -extends java.lang.Enum<ActionSpec.ResultType>-
| Enum Constant and Description | -
|---|
CLOSED_TABLE
-A finite sized table whose stream is closed when the row iterator is complete.
- |
-
OPEN_TABLE
-A finite sized table whose stream is left open after the row iterator is complete because
- it can change over time.
- |
-
STREAM_TABLE
-A stream of rows.
- |
-
VALUES
-One or more return values.
- |
-
VOID
-No return value.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-isClosed()
-True if CLOSED_TABLE, VOID, or VALUES.
- |
-
boolean |
-isOpen()
-True if OPEN_TABLE or STREAM_TABLE
- |
-
boolean |
-isStream()
-True if this is the STREAM_TABLE.
- |
-
boolean |
-isValues() |
-
boolean |
-isVoid() |
-
java.lang.String |
-toString() |
-
static ActionSpec.ResultType |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static ActionSpec.ResultType[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final ActionSpec.ResultType CLOSED_TABLE-
public static final ActionSpec.ResultType OPEN_TABLE-
public static final ActionSpec.ResultType STREAM_TABLE-
public static final ActionSpec.ResultType VOID-
public static final ActionSpec.ResultType VALUES-
public static ActionSpec.ResultType[] values()-
-for (ActionSpec.ResultType c : ActionSpec.ResultType.values()) - System.out.println(c); -
public static ActionSpec.ResultType valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic boolean isClosed()-
public boolean isOpen()-
public boolean isStream()-
public boolean isVoid()-
public boolean isValues()-
public java.lang.String toString()-
toString in class java.lang.Enum<ActionSpec.ResultType>public interface ActionSpec
-| Modifier and Type | -Interface and Description | -
|---|---|
static class |
-ActionSpec.ResultType
-Defines what the action returns.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.util.Iterator<DSMap> |
-getParameters()
-Returns an iterator for each parameter.
- |
-
DSPermission |
-getPermission()
-Minimum permission level required to invoke.
- |
-
ActionSpec.ResultType |
-getResultType()
-What the action returns.
- |
-
java.util.Iterator<DSMap> |
-getValueResults()
-This is only called for the VALUES result type.
- |
-
java.util.Iterator<DSMap> getParameters()-
DSPermission getPermission()-
ActionSpec.ResultType getResultType()-
java.util.Iterator<DSMap> getValueResults()-
public interface ActionTable -extends ActionResult-
| Modifier and Type | -Method and Description | -
|---|---|
java.util.Iterator<DSMap> |
-getColumns()
-Column definitions, optional but highly recommended.
- |
-
java.util.Iterator<DSList> |
-getRows()
-This should return an iterator for the initial set of rows, or null if there aren't any.
- |
-
getAction, onClosejava.util.Iterator<DSMap> getColumns()-
DSMetadatajava.util.Iterator<DSList> getRows()-
public interface ActionValues -extends ActionResult-
| Modifier and Type | -Method and Description | -
|---|---|
java.util.Iterator<DSIValue> |
-getValues() |
-
getAction, onClosepublic class DSAction -extends java.lang.Object -implements ActionSpec, DSIObject-
DSNode.onInvoke(DSInfo, ActionInvocation)ActionSpec.ResultType| Modifier and Type | -Field and Description | -
|---|---|
static DSAction |
-DEFAULT
-Use this when you have no-arg, no-return actions.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSMetadata |
-addDefaultParameter(java.lang.String name,
- DSIValue value,
- java.lang.String description)
-A convenience which calls addParameter with the same arguments, and also sets the metadata
- for the default value.
- |
-
DSAction |
-addParameter(DSMap metadata)
-Fully describes a parameter for method invocation.
- |
-
DSMetadata |
-addParameter(java.lang.String name,
- DSIValue value,
- java.lang.String description)
-Creates a DSMetadata, calls setName and setType on it, adds the internal map to the parameter
- list and returns the metadata instance for further configuration.
- |
-
DSMetadata |
-addParameter(java.lang.String name,
- DSValueType type,
- java.lang.String description)
-Creates a DSMetadata, calls setName and setType on it, adds the internal map to the parameter
- list and returns the metadata instance for further configuration.
- |
-
DSAction |
-addValueResult(DSMap metadata)
-Fully describes a return value when the result type is VALUES.
- |
-
DSMetadata |
-addValueResult(java.lang.String name,
- DSIValue value)
-Creates a DSMetadata, calls setName and setType on it, adds the internal map to the results
- list and returns the metadata instance for further configuration.
- |
-
DSMetadata |
-addValueResult(java.lang.String name,
- DSValueType type)
-Creates a DSMetadata, calls setName and setType on it, adds the internal map to the results
- list and returns the metadata instance for further configuration.
- |
-
DSAction |
-copy()
-Return a copy if it makes sense, but return this otherwise.
- |
-
java.util.Iterator<DSMap> |
-getParameters()
-Returns an iterator for each parameter.
- |
-
DSPermission |
-getPermission()
-Not used.
- |
-
ActionSpec.ResultType |
-getResultType()
-What the action returns.
- |
-
java.util.Iterator<DSMap> |
-getValueResults()
-This is only called for the VALUES result type.
- |
-
ActionResult |
-invoke(DSInfo info,
- ActionInvocation invocation)
-Calls onInvoke on the proper node.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Defaults to the equals method.
- |
-
boolean |
-isNull()
-False
- |
-
void |
-prepareParameter(DSInfo info,
- DSMap parameter)
-Override point, called for each parameter as it is being sent to the requester.
-<<<<<<< HEAD
- |
-
DSAction |
-setPermission(DSPermission permission)
-Returns this, it is not necessary to set the permission to read.
-=======
->>>>>>> 22064982f1faddb35f2da7c8a183dbbc8602cbe9
- |
-
DSAction |
-setResultType(ActionSpec.ResultType result)
-Returns this, it is not necessary to set the result to void.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final DSAction DEFAULT-
public DSAction copy()-
DSIObjectpublic DSMetadata addDefaultParameter(java.lang.String name, - DSIValue value, - java.lang.String description)-
name - Must not be null.value - Must not be null.description - Can be null.public DSAction addParameter(DSMap metadata)-
DSMetadatapublic DSMetadata addParameter(java.lang.String name, - DSIValue value, - java.lang.String description)-
name - Must not be null.value - Must not be null.description - Can be null.public DSMetadata addParameter(java.lang.String name, - DSValueType type, - java.lang.String description)-
name - Must not be null.type - Must not be null.description - Can be null.public DSAction addValueResult(DSMap metadata)-
DSMetadatapublic DSMetadata addValueResult(java.lang.String name, - DSIValue value)-
name - Must not be null.value - Must not be null.public DSMetadata addValueResult(java.lang.String name, - DSValueType type)-
name - Must not be null.type - Must not be null.public java.util.Iterator<DSMap> getParameters()-
ActionSpecgetParameters in interface ActionSpecpublic DSPermission getPermission()-
getPermission in interface ActionSpecpublic ActionSpec.ResultType getResultType()-
ActionSpecgetResultType in interface ActionSpecpublic java.util.Iterator<DSMap> getValueResults()-
ActionSpecgetValueResults in interface ActionSpecpublic ActionResult invoke(DSInfo info, - ActionInvocation invocation)-
info - The info about the action in it's parent container. Never use the outer
- 'this' of anonymous instances.invocation - Details about the incoming invoke as well as the mechanism to send updates
- over an open stream.java.lang.IllegalStateException - If the target node has not overridden onInvoke.public boolean isEqual(java.lang.Object obj)-
public void prepareParameter(DSInfo info, - DSMap parameter)-
info - The info about the action in it's parent container. Never use the outer
- 'this' of anonymous instances.parameter - Map representing a single parameter.public void prepareParameter(DSInfo info, - DSMap parameter)-
info - The info about the action in it's parent container. Never use the outer
- 'this' of anonymous instances.parameter - Map representing a single parameter.public DSAction setResultType(ActionSpec.ResultType result)-
public class DSActionValues -extends java.lang.Object -implements ActionValues-
| Constructor and Description | -
|---|
DSActionValues(DSAction action) |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSActionValues |
-addResult(DSIValue value)
-Values must be added in the same order they were defined in the action.
- |
-
DSAction |
-getAction()
-The action that was invoked.
- |
-
java.util.Iterator<DSIValue> |
-getValues() |
-
void |
-onClose()
-Does nothing.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic DSActionValues addResult(DSIValue value)-
public DSAction getAction()-
ActionResultgetAction in interface ActionResultpublic java.util.Iterator<DSIValue> getValues()-
getValues in interface ActionValuespublic void onClose()-
onClose in interface ActionResult| Interface | -Description | -
|---|---|
| ActionInvocation | -
- Encapsulates the details of an action invocation and provides the mechanism for updating and open
- stream.
- |
-
| ActionResult | -
- Super interface for possible results of an action.
- |
-
| ActionSpec | -
- Defines an invokable node in the DSA model.
- |
-
| ActionTable | -
- Provides access to the columns and rows of a table.
- |
-
| ActionValues | -
- Simple set of return values from an action.
- |
-
| Class | -Description | -
|---|---|
| DSAction | -
- Fully describes an action and routes invocations to DSNode.onInvoke.
- |
-
| DSActionValues | -
- This is a convenience implementation of ActionValues.
- |
-
| Enum | -Description | -
|---|---|
| ActionSpec.ResultType | -
- Defines what the action returns.
- |
-
public interface DSIEvent
-public interface DSISubscriber
-- A single topic can emanate multiple types of events. The event object is an empty interface, - each topic will define it's own events. -
- Events can also supply parameters. The parameters specific to each kind of event. -
- See the class documentation of a specific topic to understand the possible events and their - parameters. -
- The two most important topics are built into every node, they are: DSValueTopic and DSInfoTopic.
DSIEvent,
-DSTopic,
-DSNode.subscribe(DSTopic, DSInfo, DSISubscriber)| Modifier and Type | -Method and Description | -
|---|---|
void |
-onEvent(DSTopic topic,
- DSIEvent event,
- DSNode node,
- DSInfo child,
- java.lang.Object... params)
-Subscription callback.
- |
-
void |
-onUnsubscribed(DSTopic topic,
- DSNode node,
- DSInfo child)
-Called no matter how the unsubscribe happens, whether explicitly or if the node
- unsubscribes itself.
- |
-
void onEvent(DSTopic topic, - DSIEvent event, - DSNode node, - DSInfo child, - java.lang.Object... params)-
topic - Required, the topic emanating the event.event - Required, the actual event.node - Required, node subscribed to.child - Optional, if the event concerns a child.params - Can be null, only used if the event defines it.void onUnsubscribed(DSTopic topic, - DSNode node, - DSInfo child)-
topic - The topic that was passed to DSNode.subscribe.node - Node that was passed to DSNode.subscribe, never null.child - The child that was passed to DSNode.subscribe, may be null.public static enum DSInfoTopic.Event -extends java.lang.Enum<DSInfoTopic.Event> -implements DSIEvent-
| Enum Constant and Description | -
|---|
CHILD_ADDED
-Events will have a single parameter, the info of the new child.
- |
-
CHILD_REMOVED
-Events will have a single parameter, the unparented info of the child.
- |
-
METADATA_CHANGED
-TBD.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSInfoTopic.Event |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSInfoTopic.Event[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSInfoTopic.Event CHILD_ADDED-
public static final DSInfoTopic.Event CHILD_REMOVED-
public static final DSInfoTopic.Event METADATA_CHANGED-
public static DSInfoTopic.Event[] values()-
-for (DSInfoTopic.Event c : DSInfoTopic.Event.values()) - System.out.println(c); -
public static DSInfoTopic.Event valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is null| Modifier and Type | -Class and Description | -
|---|---|
static class |
-DSInfoTopic.Event
-The possible events for this topic.
- |
-
| Modifier and Type | -Field and Description | -
|---|---|
static DSInfoTopic |
-INSTANCE
-The only instance of this topic.
- |
-
public static final DSInfoTopic INSTANCE-
DSNode.INFO_TOPICpublic class DSTopic -extends java.lang.Object -implements DSIObject-
- A single topic can emanate multiple types of events. The event object is an empty interface, - each topic will define it's own events. -
- Events can also supply parameters. The parameters specific to each kind of event. -
- See the class documentation of a specific topic to understand the possible events and their - parameters. -
- The two most important topics are built into every node, they are: DSValueTopic and DSInfoTopic.
DSIEvent,
-DSISubscriber,
-DSInfoTopic,
-DSValueTopic,
-DSNode.subscribe(DSTopic, DSInfo, DSISubscriber)| Modifier and Type | -Method and Description | -
|---|---|
DSTopic |
-copy()
-Returns this.
- |
-
boolean |
-isEqual(java.lang.Object obj)
-Only test instance equality.
- |
-
boolean |
-isNull()
-False
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static enum DSValueTopic.Event -extends java.lang.Enum<DSValueTopic.Event> -implements DSIEvent-
| Enum Constant and Description | -
|---|
CHILD_CHANGED
-For node value children (who are not also nodes).
- |
-
NODE_CHANGED
-For DSNodes that implement DSIValue.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSValueTopic.Event |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSValueTopic.Event[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSValueTopic.Event NODE_CHANGED-
public static final DSValueTopic.Event CHILD_CHANGED-
public static DSValueTopic.Event[] values()-
-for (DSValueTopic.Event c : DSValueTopic.Event.values()) - System.out.println(c); -
public static DSValueTopic.Event valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic class DSValueTopic -extends DSTopic -implements DSIEvent-
- Events will be one of the enums defined in the Event inner class.
| Modifier and Type | -Class and Description | -
|---|---|
static class |
-DSValueTopic.Event
-The possible events from this topic.
- |
-
| Modifier and Type | -Field and Description | -
|---|---|
static DSValueTopic |
-INSTANCE
-The only instance of this topic.
- |
-
public static final DSValueTopic INSTANCE-
DSNode.VALUE_TOPIC| Interface | -Description | -
|---|---|
| DSIEvent | -
- This is an empty interface, DSTopics are allowed to define events however they wish.
- |
-
| DSISubscriber | -
- DSISubscribers subscribe to DSTopics on DSNodes.
- |
-
| Class | -Description | -
|---|---|
| DSInfoTopic | -
- This topic is for info related events on DSNodes.
- |
-
| DSTopic | -
- DSISubscribers subscribe to DSTopics on DSNodes.
- |
-
| DSValueTopic | -
- This topic is for change of value events on DSNodes.
- |
-
| Enum | -Description | -
|---|---|
| DSInfoTopic.Event | -
- The possible events for this topic.
- |
-
| DSValueTopic.Event | -
- The possible events from this topic.
- |
-
See: Description
-| Interface | -Description | -
|---|---|
| DSIBoolean | -
- Indicates something that is/has a boolean value.
- |
-
| DSIEnum | -
- DSA Enum mapping.
- |
-
| DSIMetadata | -
- Nodes and values can implement this to provide meta-data about themselves.
- |
-
| DSINumber | -
- Indicates something that is/has a numeric value.
- |
-
| DSIObject | -
- Super class of anything found in the node tree.
- |
-
| DSIStatus | -
- Indicates something that is/has a quality.
- |
-
| DSIStorable | -
- Enables custom serialization for non-node values in the configuration database.
- |
-
| DSIValue | -
- How data values are represented in the node tree.
- |
-
| Class | -Description | -
|---|---|
| DSBool | -
- Represents a boolean value.
- |
-
| DSBytes | -
- Byte array that gets encoded as a base64 string.
- |
-
| DSDouble | -
- A 64 bit floating point (Java double).
- |
-
| DSElement | -
- The primitives of the node model.
- |
-
| DSFlexEnum | -
- An enum where the value and range can be created at runtime, primarily intended for defining
- action parameters.
- |
-
| DSFloat | -
- A Java float.
- |
-
| DSGroup | -
- An index accessible collection of primitives.
- |
-
| DSInfo | -
- All node children have corresponding DSInfo instances.
- |
-
| DSInt | -
- A Java int.
- |
-
| DSJavaEnum | -
- Wrapper for Java enums.
- |
-
| DSList | -
- Indexed collection of elements.
- |
-
| DSLong | -
- A 64 bit integer (a Java long).
- |
-
| DSMap | -
- String keyed collection of elements that preserves the order of addition.
- |
-
| DSMap.Entry | -
- Allows values to be accessed quickly by index in the list, rather than having to do a key
- lookup in the map.
- |
-
| DSMetadata | -
- Utility fon constructing metadata maps.
- |
-
| DSNode | -
- The organizational unit of the node tree.
- |
-
| DSNull | -
- Try not to use, it is for decoding raw json.
- |
-
| DSPath | -
- Represents a path in the node tree.
- |
-
| DSRegistry | -
- Static type related meta-data.
- |
-
| DSStatus | -
- Represent the health, quality or condition of an object.
- |
-
| DSString | -
- String wrapper.
- |
-
| DSValue | -
- A convenience that provides some common default behavior.
- |
-
| DSValueNode | -
- A convenience implementation of a node that is also a value.
- |
-
| Enum | -Description | -
|---|---|
| DSElementType | -
- The core set of elements that translate directly to a JSON type.
- |
-
| DSValueType | -
- These are the primitive types in the DSA protocol.
- |
-
| Class | -Description | -
|---|---|
| DSRuntime | -
- DSA thread pool and timers.
- |
-
| DSRuntime.Timer | -
- Can be used to inspect and cancel tasks passed to the run methods in DSRuntime.
- |
-
public interface DSIPassword -extends DSIValue-
| Modifier and Type | -Method and Description | -
|---|---|
boolean |
-isValid(DSElement arg)
-Returns true if the give element is valid according to the backing implementation.
- |
-
public class DSKeys.Signer
-extends java.lang.Object
-| Constructor and Description | -
|---|
Signer(java.security.PrivateKey privateKey) |
-
| Modifier and Type | -Method and Description | -
|---|---|
byte[] |
-getSignature()
-The signature for all bytes passed to the update method.
- |
-
java.lang.String |
-getSignatureBase64()
-The base 64 encoding of the signature for all bytes passed to the update method.
- |
-
DSKeys.Signer |
-reset()
-Call to begin a new signature.
- |
-
DSKeys.Signer |
-update(byte[] buf)
-Update the signature with the given bytes.
- |
-
DSKeys.Signer |
-update(byte[] buf,
- int off,
- int len)
-Update the signature with the given bytes.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Signer(java.security.PrivateKey privateKey)-
public byte[] getSignature()-
public java.lang.String getSignatureBase64()-
public DSKeys.Signer reset()-
public DSKeys.Signer update(byte[] buf)-
buf - The source of the bytes.public DSKeys.Signer update(byte[] buf, - int off, - int len)-
buf - The source of the bytes.off - The offset of the first byte.len - The number of bytes to sign.public static class DSKeys.Verifier
-extends java.lang.Object
-| Constructor and Description | -
|---|
Verifier(java.security.PublicKey publicKey) |
-
| Modifier and Type | -Method and Description | -
|---|---|
DSKeys.Verifier |
-reset()
-Call to begin a new signature.
- |
-
DSKeys.Verifier |
-update(byte[] buf)
-Update the signature with the given bytes.
- |
-
DSKeys.Verifier |
-update(byte[] buf,
- int off,
- int len)
-Update the signature with the given bytes.
- |
-
boolean |
-validate(byte[] signature)
-Returns true if the given signature is valid for the bytes passed to update.
- |
-
boolean |
-validate(java.lang.String base64signature)
-Returns true if the given base 64 encoded signature is valid for the bytes passed to
- update.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic Verifier(java.security.PublicKey publicKey)-
public DSKeys.Verifier reset()-
public DSKeys.Verifier update(byte[] buf)-
buf - The source of the bytes.public DSKeys.Verifier update(byte[] buf, - int off, - int len)-
buf - The source of the bytes.off - The offset of the first byte.len - The number of bytes to sign.public boolean validate(byte[] signature)-
public boolean validate(java.lang.String base64signature)-
public class DSKeys
-extends java.lang.Object
-| Modifier and Type | -Class and Description | -
|---|---|
class |
-DSKeys.Signer
-Signs bytes.
- |
-
static class |
-DSKeys.Verifier
-Verifies signatures.
- |
-
| Constructor and Description | -
|---|
DSKeys(java.io.File keyFile)
-Creates a DSKeys object by decoding existing keys from the given file.
- |
-
DSKeys(java.security.KeyPair keyPair)
-Creates a DSKeys object for an existing key pair.
- |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSKeys |
-decodeKeys(java.lang.String arg)
-Decodes an instance that was encoded with encodeKeys().
- |
-
static java.security.interfaces.ECPrivateKey |
-decodePrivate(byte[] bytes)
-Decodes the X9.63 encoding of a public key.
- |
-
static java.security.interfaces.ECPublicKey |
-decodePublic(byte[] bytes)
-Decodes the X9.63 encoding of a public key.
- |
-
java.lang.String |
-encodeKeys()
-Encodes the key pair which can be then decoded with decodeKeys().
- |
-
byte[] |
-encodePublic()
-X9.63 encoding of the public key.
- |
-
java.lang.String |
-encodePublicHashDsId()
-Base64 encoding (no padding and url safe) of the SHA256 hash of the public key.
- |
-
static byte[] |
-generateHmacSHA256Signature(byte[] data,
- byte[] secretKeyBytes) |
-
byte[] |
-generateSharedSecret(byte[] publicKeyBytes)
-Uses the given public key to generate an ECDH shared secret.
- |
-
byte[] |
-generateSharedSecret(java.lang.String base64key)
-Uses the given public key to generate an ECDH shared secret.
- |
-
java.security.KeyPair |
-getKeys()
-The public and private keys.
- |
-
static java.security.spec.ECParameterSpec |
-getParameters()
-The AlgorithmParameterSpec for the predefined elliptic curve secp256r1.
- |
-
java.security.interfaces.ECPrivateKey |
-getPrivateKey()
-A convenience that casts the private key.
- |
-
java.security.interfaces.ECPublicKey |
-getPublicKey()
-A convenience that casts the public key.
- |
-
static java.security.KeyPair |
-newKeyPair()
-Creates a key pair for the predefined elliptic curve secp256r1.
- |
-
static java.security.Signature |
-newSignature()
-Returns a SHA256withECDSA signature.
- |
-
DSKeys.Signer |
-newSigner()
-Creates a signer for this private key.
- |
-
DSKeys.Verifier |
-newVerifier()
-Creates a verifier for this public key.
- |
-
static DSKeys |
-restore(java.io.File file)
-Decodes a key pair that was encoded by the store method.
- |
-
static DSKeys |
-restore(java.io.InputStream in)
-Decodes a key pair that was encoded by the store method, does not onClose the given stream.
- |
-
java.lang.String |
-sign(byte[] buf,
- int off,
- int len)
-A convenience that creates a signer and signs the given bytes.
- |
-
void |
-store(java.io.File file)
-Write the bytes from the string encoding to the given file.
- |
-
void |
-store(java.io.OutputStream out)
-Writes the bytes from the string encoding to the given stream, does not onClose the stream.
- |
-
boolean |
-verify(byte[] buf,
- int off,
- int len,
- java.lang.String signature)
-A convenience that creates a verifier and validates the signature for the given bytes.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic DSKeys(java.io.File keyFile)-
keyFile - The file to decodeKeys existing keys, or to store newly generated keys.DSException - Wrapping underlying IOExceptions.public DSKeys(java.security.KeyPair keyPair)-
keyPair - Must represent the EC curve secp256r1.public static DSKeys decodeKeys(java.lang.String arg)-
arg - String produced by encodeKeys().public static java.security.interfaces.ECPrivateKey decodePrivate(byte[] bytes)-
public static java.security.interfaces.ECPublicKey decodePublic(byte[] bytes)-
public static byte[] generateHmacSHA256Signature(byte[] data, - byte[] secretKeyBytes)-
public byte[] generateSharedSecret(byte[] publicKeyBytes)-
publicKeyBytes - Public key of the other party.public byte[] generateSharedSecret(java.lang.String base64key)-
base64key - Base64 encoded public key of the other party.public java.lang.String encodeKeys()-
public java.lang.String encodePublicHashDsId()-
DSException - wrapping any security related exceptions.public byte[] encodePublic()-
public static java.security.spec.ECParameterSpec getParameters()-
public java.security.KeyPair getKeys()-
public java.security.interfaces.ECPrivateKey getPrivateKey()-
public java.security.interfaces.ECPublicKey getPublicKey()-
public static java.security.KeyPair newKeyPair()-
DSException - Wrapping underlying security exceptions.public static java.security.Signature newSignature()-
DSException - Wrapping underlying security exceptions.public DSKeys.Signer newSigner()-
public DSKeys.Verifier newVerifier()-
public java.lang.String sign(byte[] buf, - int off, - int len)-
public static DSKeys restore(java.io.File file)-
file - File containing the serialized keys.DSException - Wrapping underlying IOExceptions.public static DSKeys restore(java.io.InputStream in)-
in - Stream containing the serialized keys, will not be closed.DSException - Wrapping underlying IOExceptions.public void store(java.io.File file)-
file - Will be created or overwritten.DSException - Wrapping underlying IOExceptions.public void store(java.io.OutputStream out)-
out - Where write the serialized keys, will not be closed.DSException - Wrapping underlying IOExceptions.public boolean verify(byte[] buf, - int off, - int len, - java.lang.String signature)-
public class DSPasswordAes -extends DSValue -implements DSIPassword, DSIStorable-
| Modifier and Type | -Field and Description | -
|---|---|
static DSPasswordAes |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.String |
-decode()
-Returns the decrypted password.
- |
-
static java.lang.String |
-encode(byte[] arg)
-Encrypts the given bytes.
- |
-
static java.lang.String |
-encode(java.lang.String arg)
-Encrypts the given text.
- |
-
boolean |
-equals(java.lang.Object obj) |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
boolean |
-isValid(DSElement clearText)
-Encrypts the string value of the given element and compares against the value stored in this
- object.
- |
-
boolean |
-isValid(java.lang.String clearText)
-Encrypts the given string and compares against the value stored in this object.
- |
-
DSPasswordAes |
-restore(DSElement element)
-Deserialize a value from the configuration database, these will be values returned from the
- store() method.
- |
-
DSString |
-store()
-Serialize the value for the configuration database.
- |
-
DSString |
-toElement()
-Returns a string representing the url safe base64 encoding of the hash.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSPasswordAes |
-valueOf(DSElement arg)
-Creates a encrypted password for the given clear text.
- |
-
static DSPasswordAes |
-valueOf(java.lang.String arg)
-Creates a encrypted password for the given clear text.
- |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSPasswordAes NULL-
public java.lang.String decode()-
DSException - If there is a problem.public static java.lang.String encode(byte[] arg)-
public static java.lang.String encode(java.lang.String arg)-
public boolean equals(java.lang.Object obj)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isNull()-
DSIValuepublic boolean isValid(DSElement clearText)-
isValid in interface DSIPasswordclearText - If null, isNull, or is the empty string, this will on return true if this is
- the NULL instance.public boolean isValid(java.lang.String clearText)-
clearText - If null, isNull, or is the empty string, this will on return true if this is
- the NULL instance.public DSString store()-
DSIStorablestore in interface DSIStorablepublic DSPasswordAes restore(DSElement element)-
DSIStorablerestore in interface DSIStorablepublic DSString toElement()-
public java.lang.String toString()-
DSValuepublic DSPasswordAes valueOf(DSElement arg)-
public static DSPasswordAes valueOf(java.lang.String arg)-
arg - The text to hash.public class DSPasswordSha256 -extends DSValue -implements DSIPassword, DSIStorable-
| Modifier and Type | -Field and Description | -
|---|---|
static DSPasswordSha256 |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
static java.lang.String |
-encode(byte[] arg)
-SHA-256 hash of the bytes encoded as url safe base 64..
- |
-
static java.lang.String |
-encode(java.lang.String arg)
-SHA-256 hash of the UTF-8 bytes, encoded as url safe base 64..
- |
-
boolean |
-equals(java.lang.Object obj) |
-
DSValueType |
-getValueType()
-The DSA type mapping.
- |
-
int |
-hashCode() |
-
boolean |
-isEqual(java.lang.Object obj)
-Equals implementation that doesn't require hashCodes to equal, primarily intended
- so for comparing nodes.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
boolean |
-isValid(DSElement clearText)
-Hashes the string value of the given element and compares against the hash stored in this
- object.
- |
-
boolean |
-isValid(java.lang.String clearText)
-Hashes the given string and compares against the value stored in this object.
- |
-
DSPasswordSha256 |
-restore(DSElement element)
-Deserialize a value from the configuration database, these will be values returned from the
- store() method.
- |
-
DSString |
-store()
-Serialize the value for the configuration database.
- |
-
DSString |
-toElement()
-Returns a string representing the url safe base64 encoding of the hash.
- |
-
java.lang.String |
-toString()
-If isNull(), returns "null", otherwise returns toElement().toString()
- |
-
DSPasswordSha256 |
-valueOf(DSElement arg)
-Creates a digest password for the given clear text.
- |
-
static DSPasswordSha256 |
-valueOf(java.lang.String arg)
-Creates a digest password for the given clear text.
- |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSPasswordSha256 NULL-
public static java.lang.String encode(byte[] arg)-
public static java.lang.String encode(java.lang.String arg)-
public boolean equals(java.lang.Object obj)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
DSIValuegetValueType in interface DSIValuepublic int hashCode()-
hashCode in class java.lang.Objectpublic boolean isEqual(java.lang.Object obj)-
DSIObjectpublic boolean isNull()-
DSIValuepublic boolean isValid(DSElement clearText)-
isValid in interface DSIPasswordclearText - If null, isNull, or is the empty string, this will on return true if this is
- the NULL instance.public boolean isValid(java.lang.String clearText)-
clearText - If null, or the empty string, this will on return true if this is the NULL
- instance.public DSString store()-
DSIStorablestore in interface DSIStorablepublic DSPasswordSha256 restore(DSElement element)-
DSIStorablerestore in interface DSIStorablepublic DSString toElement()-
public java.lang.String toString()-
DSValuepublic DSPasswordSha256 valueOf(DSElement arg)-
public static DSPasswordSha256 valueOf(java.lang.String arg)-
arg - The text to hash.public enum DSPermission -extends java.lang.Enum<DSPermission>-
| Enum Constant and Description | -
|---|
CONFIG |
-
LIST |
-
READ |
-
WRITE |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSPermission |
-forString(java.lang.String str) |
-
int |
-getLevel() |
-
boolean |
-isConfig() |
-
boolean |
-isGreaterThan(DSPermission arg)
-True if this level is higher than the given.
- |
-
boolean |
-isList() |
-
boolean |
-isRead() |
-
boolean |
-isWrite() |
-
java.lang.String |
-toString() |
-
static DSPermission |
-valueOf(int v2byte) |
-
static DSPermission |
-valueOf(int v2byte) |
-
static DSPermission |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSPermission[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSPermission LIST-
public static final DSPermission READ-
public static final DSPermission WRITE-
public static final DSPermission CONFIG-
public static DSPermission[] values()-
-for (DSPermission c : DSPermission.values()) - System.out.println(c); -
public static DSPermission valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic int getLevel()-
public boolean isConfig()-
public boolean isGreaterThan(DSPermission arg)-
public boolean isRead()-
public boolean isWrite()-
public boolean isList()-
public static DSPermission forString(java.lang.String str)-
public java.lang.String toString()-
toString in class java.lang.Enum<DSPermission>public static DSPermission valueOf(int v2byte)-
| Interface | -Description | -
|---|---|
| DSIPassword | -
- Defines the api for verifying passwords.
- |
-
| Class | -Description | -
|---|---|
| DSKeys | -
- DSA public private key pair.
- |
-
| DSKeys.Verifier | -
- Verifies signatures.
- |
-
| DSPasswordAes | -
- Stores an encrypted password which can be decrypted.
- |
-
| DSPasswordSha256 | -
- Stores and verifies passwords using a SHA-256 hash of the text.
- |
-
| Enum | -Description | -
|---|---|
| DSPermission | -
- Used to define the required permissions for various objects.
- |
-
| Modifier and Type | -Field and Description | -
|---|---|
static DSDateTime |
-NULL |
-
| Modifier and Type | -Method and Description | -
|---|---|
static DSDateTime |
-currentTime()
-The current time.
- |
-
boolean |
-equals(java.lang.Object obj) |
-
DSValueType |
-getValueType()
-String.
- |
-
int |
-hashCode() |
-
boolean |
-isEqual(java.lang.Object obj)
-Defaults to the equals method.
- |
-
boolean |
-isNull()
-Values should have an instance representing null.
- |
-
long |
-timeInMillis()
-The Java time represented by this object.
- |
-
DSElement |
-toElement()
-The current value should convert itself to an element for DSA interop such as subscription
- updates, and setting requests.
- |
-
java.lang.String |
-toString()
-ISO 8601 standard format of "yyyy-mm-ddThh:mm:ss.mmm[+/-]hh:mm".
- |
-
DSDateTime |
-valueOf(DSElement element)
-This should convert an element transmitted over DSA, such as subscription updates or set
- requests.
- |
-
static DSDateTime |
-valueOf(long millis) |
-
static DSDateTime |
-valueOf(java.lang.String string)
-Decodes an ISO 8601 standard format of "yyyy-mm-ddThh:mm:ss.mmm[+/-]hh:mm".
- |
-
clone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final DSDateTime NULL-
public static DSDateTime currentTime()-
public boolean equals(java.lang.Object obj)-
equals in class java.lang.Objectpublic DSValueType getValueType()-
public int hashCode()-
hashCode in class java.lang.Objectpublic boolean isEqual(java.lang.Object obj)-
public boolean isNull()-
DSIValuepublic long timeInMillis()-
public DSElement toElement()-
DSIValuepublic java.lang.String toString()-
public DSDateTime valueOf(DSElement element)-
DSIValuepublic static DSDateTime valueOf(long millis)-
public static DSDateTime valueOf(java.lang.String string)-
public enum DSInterval -extends java.lang.Enum<DSInterval>-
| Enum Constant and Description | -
|---|
day |
-
fifteenMinutes |
-
fifteenSeconds |
-
fiveMinutes |
-
fiveSeconds |
-
fourHours |
-
hour |
-
minute |
-
month |
-
none |
-
quarter |
-
second |
-
sixHours |
-
tenMinutes |
-
tenSeconds |
-
thirtyMinutes |
-
thirtySeconds |
-
threeHours |
-
twelveHours |
-
twentyMinutes |
-
twoHours |
-
week |
-
year |
-
| Modifier and Type | -Method and Description | -
|---|---|
int |
-count(long start,
- long end)
-Returns the number of intervals for the given time range, or -1 if indeterminate.
- |
-
long |
-millis()
-The approximate number of ms in the interval.
- |
-
long |
-next(long timestamp)
-Returns the nextRun interval for the previously aligned timestamp.
- |
-
static DSInterval |
-valueOf(java.lang.String name)
-Returns the enum constant of this type with the specified name.
- |
-
static DSInterval[] |
-values()
-Returns an array containing the constants of this enum type, in
-the order they are declared.
- |
-
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfgetClass, notify, notifyAll, wait, wait, waitpublic static final DSInterval none-
public static final DSInterval second-
public static final DSInterval fiveSeconds-
public static final DSInterval tenSeconds-
public static final DSInterval fifteenSeconds-
public static final DSInterval thirtySeconds-
public static final DSInterval minute-
public static final DSInterval fiveMinutes-
public static final DSInterval tenMinutes-
public static final DSInterval fifteenMinutes-
public static final DSInterval twentyMinutes-
public static final DSInterval thirtyMinutes-
public static final DSInterval hour-
public static final DSInterval twoHours-
public static final DSInterval threeHours-
public static final DSInterval fourHours-
public static final DSInterval sixHours-
public static final DSInterval twelveHours-
public static final DSInterval day-
public static final DSInterval week-
public static final DSInterval month-
public static final DSInterval quarter-
public static final DSInterval year-
public static DSInterval[] values()-
-for (DSInterval c : DSInterval.values()) - System.out.println(c); -
public static DSInterval valueOf(java.lang.String name)-
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic int count(long start, - long end)-
public long millis()-
public long next(long timestamp)-
public class DSTime
-extends java.lang.Object
-| Modifier and Type | -Field and Description | -
|---|---|
static int |
-MILLIS_DAY |
-
static int |
-MILLIS_FIFTEEN_MINUTES |
-
static int |
-MILLIS_FIFTEEN_SECONDS |
-
static int |
-MILLIS_FIVE_MINUTES |
-
static int |
-MILLIS_FIVE_SECONDS |
-
static int |
-MILLIS_FOUR_HOURS |
-
static int |
-MILLIS_HOUR |
-
static int |
-MILLIS_MINUTE |
-
static long |
-MILLIS_MONTH |
-
static long |
-MILLIS_QUARTER |
-
static int |
-MILLIS_SECOND |
-
static int |
-MILLIS_SIX_HOURS |
-
static int |
-MILLIS_TEN_MINUTES |
-
static int |
-MILLIS_TEN_SECONDS |
-
static int |
-MILLIS_THIRTY_MINUTES |
-
static int |
-MILLIS_THIRTY_SECONDS |
-
static int |
-MILLIS_THREE_HOURS |
-
static int |
-MILLIS_TWELVE_HOURS |
-
static int |
-MILLIS_TWENTY_MINUTES |
-
static int |
-MILLIS_TWO_HOURS |
-
static int |
-MILLIS_WEEK |
-
static long |
-MILLIS_YEAR |
-
static long |
-NANOS_IN_MS |
-
static long |
-NANOS_IN_SEC |
-
| Modifier and Type | -Method and Description | -
|---|---|
static java.util.Calendar |
-addDays(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addDays(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-addHours(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addHours(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-addMinutes(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addMinutes(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-addMonths(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addMonths(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-addSeconds(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addSeconds(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-addWeeks(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addWeeks(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-addYears(int count,
- java.util.Calendar timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static long |
-addYears(int count,
- long timestamp)
-Adds or subtracts the corresponding time field, does not perform any alignment.
- |
-
static java.util.Calendar |
-alignDay(java.util.Calendar timestamp)
-Aligns the time fields to the start of the day.
- |
-
static java.util.Calendar |
-alignDays(int interval,
- java.util.Calendar timestamp)
-Aligns the time fields to the start of given interval.
- |
-
static java.util.Calendar |
-alignHour(java.util.Calendar timestamp)
-Aligns the time fields to the start of the hour.
- |
-
static java.util.Calendar |
-alignHours(int interval,
- java.util.Calendar timestamp)
-Aligns the time fields to the start of given interval.
- |
-
static java.util.Calendar |
-alignMinute(java.util.Calendar timestamp)
-Aligns the time fields to the start of the minute.
- |
-
static java.util.Calendar |
-alignMinutes(int interval,
- java.util.Calendar timestamp)
-Aligns the time fields to the start of given interval.
- |
-
static java.util.Calendar |
-alignMonth(java.util.Calendar timestamp)
-Aligns the time fields to the start of the month.
- |
-
static java.util.Calendar |
-alignSecond(java.util.Calendar timestamp)
-Aligns the time fields to the start of the second.
- |
-
static java.util.Calendar |
-alignSeconds(int interval,
- java.util.Calendar timestamp)
-Aligns the time fields to the start of given interval.
- |
-
static java.util.Calendar |
-alignWeek(java.util.Calendar timestamp)
-Aligns the time fields to the start of the week.
- |
-
static java.util.Calendar |
-alignYear(java.util.Calendar timestamp)
-Aligns the time fields to the start of the year.
- |
-
static long |
-decode(java.lang.String timestamp)
-This is a convenience that uses reuses and recycles a calendar instance to get the time in
- millis.
- |
-
static java.util.Calendar |
-decode(java.lang.String timestamp,
- java.util.Calendar calendar)
-Converts a DSA encoded timestamp into a Java Calendar.
- |
-
static java.lang.StringBuilder |
-encode(java.util.Calendar calendar,
- boolean encodeTzOffset,
- java.lang.StringBuilder buf)
-Converts a Java Calendar into a DSA encoded timestamp.
- |
-
static java.lang.StringBuilder |
-encode(long timestamp,
- boolean encodeTzOffset)
-Converts a Java Calendar into a DSA encoded timestamp.
- |
-
static java.lang.StringBuilder |
-encode(long timestamp,
- boolean encodeTzOffset,
- java.lang.StringBuilder buf)
-Converts a Java Calendar into a DSA encoded timestamp.
- |
-
static java.lang.StringBuilder |
-encodeForFiles(java.util.Calendar calendar,
- java.lang.StringBuilder buf)
-Converts a Java Calendar into a number safe for file names: YYMMDDHHMMSS.
- |
-
static java.lang.StringBuilder |
-encodeForLogs(java.util.Calendar calendar,
- java.lang.StringBuilder buf)
-Converts a Java Calendar into a shorter human readable timestamp for use in logging files.
- |
-
static java.util.Calendar |
-getCalendar()
-Attempts to reuse a calendar instance, the timezone will be set to TimeZone.getDefault().
- |
-
static java.util.Calendar |
-getCalendar(long timestamp)
-Attempts to reuse a calendar instance and sets the time in millis to the argument and the
- timezone to TimeZone.getDefault().
- |
-
static long |
-millisToNanos(long millis) |
-
static long |
-nanosToMillis(long nanos) |
-
static void |
-recycle(java.util.Calendar cal)
-Return a calendar instance for reuse.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static final long NANOS_IN_MS-
public static final long NANOS_IN_SEC-
public static final int MILLIS_SECOND-
public static final int MILLIS_FIVE_SECONDS-
public static final int MILLIS_TEN_SECONDS-
public static final int MILLIS_FIFTEEN_SECONDS-
public static final int MILLIS_THIRTY_SECONDS-
public static final int MILLIS_MINUTE-
public static final int MILLIS_FIVE_MINUTES-
public static final int MILLIS_TEN_MINUTES-
public static final int MILLIS_FIFTEEN_MINUTES-
public static final int MILLIS_TWENTY_MINUTES-
public static final int MILLIS_THIRTY_MINUTES-
public static final int MILLIS_HOUR-
public static final int MILLIS_TWO_HOURS-
public static final int MILLIS_THREE_HOURS-
public static final int MILLIS_FOUR_HOURS-
public static final int MILLIS_SIX_HOURS-
public static final int MILLIS_TWELVE_HOURS-
public static final int MILLIS_DAY-
public static final int MILLIS_WEEK-
public static final long MILLIS_MONTH-
public static final long MILLIS_QUARTER-
public static final long MILLIS_YEAR-
public static java.util.Calendar addDays(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addDays(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar addHours(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addHours(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar addMinutes(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addMinutes(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar addMonths(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addMonths(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar addSeconds(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addSeconds(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar addWeeks(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addWeeks(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar addYears(int count, - java.util.Calendar timestamp)-
count - The quantity to change, can be negative.timestamp - The calendar to modify.public static long addYears(int count, - long timestamp)-
count - The quantity to change, can be negative.timestamp - The time to modify.public static java.util.Calendar alignDay(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static java.util.Calendar alignDays(int interval, - java.util.Calendar timestamp)-
interval - The number of days in the interval to align to.timestamp - The calendar to align.public static java.util.Calendar alignHour(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static java.util.Calendar alignHours(int interval, - java.util.Calendar timestamp)-
interval - The number of hours in the interval to align to.timestamp - The calendar to align.public static java.util.Calendar alignMinute(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static java.util.Calendar alignMinutes(int interval, - java.util.Calendar timestamp)-
interval - The number of minutes in the interval to align to.timestamp - The calendar to align.public static java.util.Calendar alignMonth(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static java.util.Calendar alignSecond(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static java.util.Calendar alignSeconds(int interval, - java.util.Calendar timestamp)-
interval - The number of seconds in the interval to align to.timestamp - The calendar to align.public static java.util.Calendar alignWeek(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static java.util.Calendar alignYear(java.util.Calendar timestamp)-
timestamp - The calendar to align.public static long decode(java.lang.String timestamp)-
public static java.util.Calendar decode(java.lang.String timestamp, - java.util.Calendar calendar)-
timestamp - The encoded timestamp.calendar - The instance to decodeKeys into and returnt, may be null. If the timestamp
- does not specify a timezone, the zone in this instance will be used.public static java.lang.StringBuilder encode(long timestamp, - boolean encodeTzOffset)-
timestamp - What to encode.encodeTzOffset - Whether or not to encode the timezone offset.public static java.lang.StringBuilder encode(long timestamp, - boolean encodeTzOffset, - java.lang.StringBuilder buf)-
timestamp - What to encode.encodeTzOffset - Whether or not to encode the timezone offset.buf - The buffer to append the encoded timestamp and return value, can be
- null.public static java.lang.StringBuilder encode(java.util.Calendar calendar, - boolean encodeTzOffset, - java.lang.StringBuilder buf)-
calendar - The calendar representing the timestamp to encode.encodeTzOffset - Whether or not to encode the timezone offset.buf - The buffer to append the encoded timestamp and return value, can be
- null.public static java.lang.StringBuilder encodeForFiles(java.util.Calendar calendar, - java.lang.StringBuilder buf)-
calendar - The calendar representing the timestamp to encode.buf - The buffer to append the encoded timestamp and return, can be null.public static java.lang.StringBuilder encodeForLogs(java.util.Calendar calendar, - java.lang.StringBuilder buf)-
calendar - The calendar representing the timestamp to encode.buf - The buffer to append the encoded timestamp and return, can be null.public static java.util.Calendar getCalendar()-
public static java.util.Calendar getCalendar(long timestamp)-
public static long millisToNanos(long millis)-
public static long nanosToMillis(long nanos)-
public static void recycle(java.util.Calendar cal)-
| Class | -Description | -
|---|---|
| DSDateTime | -
- Wrapper for Java time.
- |
-
| DSTime | -
- Misc time utility functions.
- |
-
| Enum | -Description | -
|---|---|
| DSInterval | -
- Enum representing periods of time.
- |
-
public class DSException
-extends java.lang.RuntimeException
-The throwRuntime method is a - convenience for converting checked exceptions into runtime exceptions.
| Constructor and Description | -
|---|
DSException(java.lang.Throwable inner) |
-
| Modifier and Type | -Method and Description | -
|---|---|
java.lang.Throwable |
-getCause() |
-
java.lang.String |
-getLocalizedMessage() |
-
java.lang.String |
-getMessage() |
-
java.lang.StackTraceElement[] |
-getStackTrace() |
-
java.lang.Throwable |
-initCause(java.lang.Throwable cause) |
-
static java.lang.String |
-makeMessage(java.lang.Throwable t)
-Attempts come up with the best description of the argument.
- |
-
static java.lang.RuntimeException |
-makeRuntime(java.lang.Throwable x)
-If the given exception is already a runtime exception, it is cast and returned,
- otherwise it will be returned wrapped by an instance of this class.
- |
-
void |
-printStackTrace() |
-
void |
-printStackTrace(java.io.PrintStream out) |
-
void |
-printStackTrace(java.io.PrintWriter out) |
-
static void |
-throwRuntime(java.lang.Throwable x)
-If the given exception is already a runtime exception, it is rethrown, otherwise
- it will be thrown wrapped by an instance of this class.
- |
-
java.lang.String |
-toString() |
-
addSuppressed, fillInStackTrace, getSuppressed, setStackTraceclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic DSException(java.lang.Throwable inner)-
public java.lang.Throwable getCause()-
getCause in class java.lang.Throwablepublic java.lang.String getMessage()-
getMessage in class java.lang.Throwablepublic java.lang.String getLocalizedMessage()-
getLocalizedMessage in class java.lang.Throwablepublic java.lang.StackTraceElement[] getStackTrace()-
getStackTrace in class java.lang.Throwablepublic static java.lang.String makeMessage(java.lang.Throwable t)-
public static java.lang.RuntimeException makeRuntime(java.lang.Throwable x)-
public void printStackTrace()-
printStackTrace in class java.lang.Throwablepublic void printStackTrace(java.io.PrintStream out)-
printStackTrace in class java.lang.Throwablepublic void printStackTrace(java.io.PrintWriter out)-
printStackTrace in class java.lang.Throwablepublic java.lang.Throwable initCause(java.lang.Throwable cause)-
initCause in class java.lang.Throwablepublic static void throwRuntime(java.lang.Throwable x)-
public java.lang.String toString()-
toString in class java.lang.Throwablepublic class DSUtil
-extends java.lang.Object
-| Modifier and Type | -Method and Description | -
|---|---|
static boolean |
-equal(java.lang.Object o1,
- java.lang.Object o2)
-Comparison that takes null into account; null == null.
- |
-
static boolean |
-getBit(int bits,
- int index)
-Returns true if the bit at the given index is set.
- |
-
static int |
-setBit(int bits,
- int index,
- boolean set)
-Set or unset a bit at the given index.
- |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpublic static boolean equal(java.lang.Object o1, - java.lang.Object o2)-
public static boolean getBit(int bits, - int index)-
bits - The bitset the check.index - The bit position in the bits argument; 0 is the lowest order bit and 31 is the
- highest order.public static int setBit(int bits, - int index, - boolean set)-
bits - The bitset to modify.index - Which bit to set/unset; 0 is the lowest order bit and 31 is the highest.set - True to set, false to unset.| Class | -Description | -
|---|---|
| DSUtil | -
- Common utilities.
- |
-
| Exception | -Description | -
|---|---|
| DSException | -
- An runtime exception that forwards most calls to the inner exception.
- |
-
- - diff --git a/docs/javadoc/overview-summary.html b/docs/javadoc/overview-summary.html deleted file mode 100644 index fe932ade..00000000 --- a/docs/javadoc/overview-summary.html +++ /dev/null @@ -1,212 +0,0 @@ - - - - -<<<<<<< HEAD - -
| Package | -Description | -
|---|---|
| org.iot.dsa | -
- Use the DSRuntime thread pool and timers.
- |
-
| org.iot.dsa.dslink | -
- DSLink is the main entry point for an application.
- |
-
| org.iot.dsa.dslink.requester | -
- API for implementing requesters without having to modeling everything in the node tree.
- |
-
| org.iot.dsa.dslink.responder | -
- API for implementing responders without having modeling everything in the node tree.
- |
-
| org.iot.dsa.io | -
- Node serialization and streaming abstraction for JSON and MsgPack.
- |
-
| org.iot.dsa.io.json | -- |
| org.iot.dsa.logging | -
- Async handler for Java Util Logging that also manages log backups.
- |
-
| org.iot.dsa.node | -
- Persistent data model used to build the node tree of a link.
- |
-
| org.iot.dsa.node.action | -- |
| org.iot.dsa.node.event | -- |
| org.iot.dsa.security | -- |
| org.iot.dsa.time | -- |
| org.iot.dsa.util | -- |
java.lang.String detail-
java.lang.Throwable inner-