public class ApplicationUtilities
extends java.lang.Object
Utilities include:
Constructor and Description |
---|
ApplicationUtilities(java.util.Properties props) |
Modifier and Type | Method and Description |
---|---|
Range<java.lang.Byte> |
getRangeByte(java.lang.String sensorId,
java.lang.String label)
Get the Range for a sensor range configuration item.
|
Range<java.lang.Double> |
getRangeDouble(java.lang.String sensorId,
java.lang.String label)
Get the Range for a sensor range configuration item.
|
Range<java.lang.Float> |
getRangeFloat(java.lang.String sensorId,
java.lang.String label)
Get the Range for a sensor range configuration item.
|
Range<java.lang.Integer> |
getRangeInteger(java.lang.String sensorId,
java.lang.String label)
Get the Range for a sensor range configuration item.
|
Range<java.lang.Short> |
getRangeShort(java.lang.String sensorId,
java.lang.String label)
Get the Range for a sensor range configuration item.
|
java.lang.String |
getSensorPropertyName(java.lang.String sensorId,
java.lang.String label,
java.lang.String kind)
Get the property name for a sensor's configuration item.
|
<T> TStream<T> |
logStream(TStream<T> stream,
java.lang.String eventTag,
java.lang.String baseName)
Log every tuple on the stream using the
FileStreams connector. |
<T> TStream<T> |
traceStream(TStream<T> stream,
java.lang.String sensorId,
Supplier<java.lang.String> label)
Trace a stream to System.out if the sensor id's "label" has been configured
to enable tracing.
|
<T> TStream<T> |
traceStream(TStream<T> stream,
Supplier<java.lang.String> label)
Trace a stream to System.out if the "label" has been configured
to enable tracing.
|
public <T> TStream<T> traceStream(TStream<T> stream, java.lang.String sensorId, Supplier<java.lang.String> label)
If tracing has not been enabled in the config, the topology will not be augmented to trace the stream.
T
- Tuple typestream
- the stream to tracesensorId
- the sensor idlabel
- some unique labelpublic <T> TStream<T> traceStream(TStream<T> stream, Supplier<java.lang.String> label)
If tracing has not been enabled in the config, the topology will not be augmented to trace the stream.
T
- Tuple typestream
- the stream to tracelabel
- some unique labelpublic java.lang.String getSensorPropertyName(java.lang.String sensorId, java.lang.String label, java.lang.String kind)
sensorId
- the sensor's idlabel
- the label for an instance of "kind" (e.g., "tempThreshold")kind
- the kind of configuration item (e.g., "range")public Range<java.lang.Integer> getRangeInteger(java.lang.String sensorId, java.lang.String label)
sensorId
- the sensor's idlabel
- the range's labelpublic Range<java.lang.Byte> getRangeByte(java.lang.String sensorId, java.lang.String label)
sensorId
- the sensor's idlabel
- the range's labelpublic Range<java.lang.Short> getRangeShort(java.lang.String sensorId, java.lang.String label)
sensorId
- the sensor's idlabel
- the range's labelpublic Range<java.lang.Float> getRangeFloat(java.lang.String sensorId, java.lang.String label)
sensorId
- the sensor's idlabel
- the range's labelpublic Range<java.lang.Double> getRangeDouble(java.lang.String sensorId, java.lang.String label)
sensorId
- the sensor's idlabel
- the range's labelpublic <T> TStream<T> logStream(TStream<T> stream, java.lang.String eventTag, java.lang.String baseName)
FileStreams
connector.
The logs are added to the directory as specified by the "application.log.dir" property. The directory will be created as needed.
The "active" (open / being written) log file name is .<baseName>
.
Completed stable logs have a name of <baseName>_YYYYMMDD_HHMMSS
.
The log entry format being used is:
[<date>] [<eventTag>] <tuple>.toString()
T
- Tuple typestream
- the TStreambaseName
- the base log nameeventTag
- a tag that gets added to the log entryCopyright © 2016 The Apache Software Foundation. All Rights Reserved - bbe71fa-20161201-1641