| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_112) on Sun Feb 26 17:08:10 EST 2017 --> |
| <title>ConsoleWaterDetector (Edgent v1.1.0)</title> |
| <meta name="date" content="2017-02-26"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="ConsoleWaterDetector (Edgent v1.1.0)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ConsoleWaterDetector.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../org/apache/edgent/samples/console/HttpServerSample.html" title="class in org.apache.edgent.samples.console"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/edgent/samples/console/ConsoleWaterDetector.html" target="_top">Frames</a></li> |
| <li><a href="ConsoleWaterDetector.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.edgent.samples.console</div> |
| <h2 title="Class ConsoleWaterDetector" class="title">Class ConsoleWaterDetector</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li>java.lang.Object</li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.edgent.samples.console.ConsoleWaterDetector</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">ConsoleWaterDetector</span> |
| extends java.lang.Object</pre> |
| <div class="block">Demonstrates some of the features of the console. |
| <P> |
| The topology graph in the console currently allows for 3 distinct "views" of the topology: |
| <ul> |
| <li>Static flow</li> |
| <li>Tuple count</li> |
| <li>Oplet kind</li> |
| </ul> |
| <P> |
| Selecting any of these, with the exception of "Static flow", adds a legend to the topology which |
| allows the user to identify elements of the view. |
| </P> |
| <P> The "Static flow" view shows the toology in an unchanging state - that is if tuple counts are available the |
| lines (connections) representing the edges of the topology are not updated, nor are the circles (representing the vertices) dimensions updated. |
| The purpose of this view is to give the user an indication of the topology map of the application. |
| </P> |
| <P> |
| The "Oplet kind" view colors the oplets or vertices displayed in the topology graph (the circles) by their |
| corresponding Oplet kind. |
| </P> |
| <P> |
| If "Tuple count" is selected the legend reflects ranges of tuple counts measured since the application was started. |
| </P> |
| <P> |
| Note: The DevelopmentProvider class overrides the submit method of the DirectProvider class |
| and adds a Metrics counter to the submitted topology. |
| If a counter is not added to the topology (or to an individual oplet), the "Tuple count" view selection is not enabled. |
| </P> |
| |
| <P> |
| In the lower half of the edgent console is a chart displaying metrics, if available. In this example metrics |
| are available since the DevelopmentProvider class is being used. Note that the DevelopmentProvider class adds a Metrics counter |
| to all oplets in the topology, with the exception of certain oplet types. For further information |
| about how metrics are added to a topology, see the details in the org.apache.edgent.metrics.Metrics class and the counter method. |
| <br> |
| A counter can be added to an individual oplet, and not the entire topology. For an example of this |
| see the org.apache.edgent.samples.utils.metrics.DevelopmentMetricsSample. |
| </P> |
| <P> |
| The org.apache.edgent.metric.Metrics class also provides a rate meter. Rate meters must be added to individual oplets and are not currently |
| available for the entire topology. |
| </P> |
| |
| <P> |
| The metrics chart displayed is a bar chart by default. If a rate meter is added to an oplet it will be displayed |
| as a line chart over the last 20 measures (the interval to refresh the line chart is every 2 1/2 seconds). |
| If a counter is added to a single oplet, the tuple count can also be displayed as a line chart. |
| </P> |
| |
| <P> |
| ConsoleWaterDetector scenario: |
| A county agency is responsible for ensuring the safety of residents well water. Each well they monitor has four different |
| sensor types: |
| <ul> |
| <li>Temperature</li> |
| <li>Acidity</li> |
| <li>Ecoli</li> |
| <li>Lead</li> |
| </ul> |
| <P> |
| This application topology monitors 3 wells: |
| <ul> |
| <li> |
| Each well that is to be measured is added to the topology. The topology polls each sensor for each well as a unit. |
| All the sensor readings for a single well are 'unioned' into a single TStream<JsonObject>. |
| </li> |
| <li> |
| Now, each well has a single stream with each of the sensors readings as a property with a name and value in the JsonObject. |
| Each well's sensors are then checked to see if their values are in an acceptable range. The filter oplet is used to check each sensor's range. |
| If any of the sensor's readings are out of the acceptable range the tuple is passed along. Those that are within an acceptable range |
| are discarded. |
| </li> |
| <li> |
| If the tuples in the stream for the well are out of range they are then passed to the split oplet. The split oplet breaks the single |
| TStream<JsonObject> into individual streams for each sensor type for the well. |
| </li> |
| <li> |
| Well1 and Well3's temperature sensor streams have rate meters placed on them. This will be used to compare the rate of tuples flowing through these |
| streams that are a result of out of range readings for Well1 and Well3 respectively. |
| </li> |
| <li> |
| Each stream that is produced from the split prints out the value for the sensor reading that it is monitoring along with the wellId. |
| </li> |
| </ul></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colOne" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/samples/console/ConsoleWaterDetector.html#ConsoleWaterDetector--">ConsoleWaterDetector</a></span>()</code> </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/samples/console/ConsoleWaterDetector.html#alertFilter-org.apache.edgent.topology.TStream-int-boolean-">alertFilter</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject> readingsDetector, |
| int wellId, |
| boolean simulateNormal)</code> |
| <div class="block">Look through the stream and check to see if any of the measurements cause concern.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>static java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/samples/console/ConsoleWaterDetector.html#formatAlertOutput-com.google.gson.JsonObject-java.lang.String-java.lang.String-">formatAlertOutput</a></span>(com.google.gson.JsonObject alertObj, |
| java.lang.String wellId, |
| java.lang.String alertType)</code> |
| <div class="block">Formats the output of the alert, containing the well id, sensor type and value of the sensor</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/samples/console/ConsoleWaterDetector.html#main-java.lang.String:A-">main</a></span>(java.lang.String[] args)</code> </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>static java.util.List<<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/samples/console/ConsoleWaterDetector.html#splitAlert-org.apache.edgent.topology.TStream-int-">splitAlert</a></span>(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject> alertStream, |
| int wellId)</code> |
| <div class="block">Splits the incoming TStream<JsonObject> into individual TStreams based on the sensor type</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/edgent/samples/console/ConsoleWaterDetector.html#waterDetector-org.apache.edgent.topology.Topology-int-">waterDetector</a></span>(<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a> topology, |
| int wellId)</code> |
| <div class="block">Creates a TStream<JsonObject> for each sensor reading for each well.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.Object</h3> |
| <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="ConsoleWaterDetector--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>ConsoleWaterDetector</h4> |
| <pre>public ConsoleWaterDetector()</pre> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="main-java.lang.String:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>main</h4> |
| <pre>public static void main(java.lang.String[] args) |
| throws java.lang.Exception</pre> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code>java.lang.Exception</code></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="waterDetector-org.apache.edgent.topology.Topology-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>waterDetector</h4> |
| <pre>public static <a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject> waterDetector(<a href="../../../../../org/apache/edgent/topology/Topology.html" title="interface in org.apache.edgent.topology">Topology</a> topology, |
| int wellId)</pre> |
| <div class="block">Creates a TStream<JsonObject> for each sensor reading for each well. Unions all the TStream<JsonObject> into a |
| single one representing all readings on the well.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>topology</code> - Topology providing the tuples for the sensors</dd> |
| <dd><code>wellId</code> - Id of the well sending the measurements</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>TStream<JsonObject> containing a measurement from each sensor type. |
| Creates a single TStream<JsonObject> from polling the four sensor types as TStream<Integer></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="alertFilter-org.apache.edgent.topology.TStream-int-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>alertFilter</h4> |
| <pre>public static <a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject> alertFilter(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject> readingsDetector, |
| int wellId, |
| boolean simulateNormal)</pre> |
| <div class="block">Look through the stream and check to see if any of the measurements cause concern. |
| Only a TStream that has one or more of the readings at "alert" level are passed through</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>readingsDetector</code> - The TStream<JsonObject> that represents all of the different sensor readings for the well</dd> |
| <dd><code>wellId</code> - The id of the well</dd> |
| <dd><code>simulateNormal</code> - Make this stream simulate all readings within the normal range, and therefore will not pass through the filter</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>TStream<JsonObject> that contain readings that could cause concern. Note: if any reading is out of range the tuple |
| will be returned</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="splitAlert-org.apache.edgent.topology.TStream-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>splitAlert</h4> |
| <pre>public static java.util.List<<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject>> splitAlert(<a href="../../../../../org/apache/edgent/topology/TStream.html" title="interface in org.apache.edgent.topology">TStream</a><com.google.gson.JsonObject> alertStream, |
| int wellId)</pre> |
| <div class="block">Splits the incoming TStream<JsonObject> into individual TStreams based on the sensor type</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>alertStream</code> - The TStream<JsonObject> that we know has some out of range condition - it could be temp, acidity, ecoli or lead |
| - or all of them</dd> |
| <dd><code>wellId</code> - The id of the well that has the out of range readings</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>List<TStream<JsonObject>> - one for each sensor.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="formatAlertOutput-com.google.gson.JsonObject-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>formatAlertOutput</h4> |
| <pre>public static java.lang.String formatAlertOutput(com.google.gson.JsonObject alertObj, |
| java.lang.String wellId, |
| java.lang.String alertType)</pre> |
| <div class="block">Formats the output of the alert, containing the well id, sensor type and value of the sensor</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>alertObj</code> - The tuple that contains out of range readings</dd> |
| <dd><code>wellId</code> - The id of the well</dd> |
| <dd><code>alertType</code> - The type of sensor that has the possible alert on it</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>String containing the wellId, sensor type and sensor value</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/ConsoleWaterDetector.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><a href="http://edgent.incubator.apache.org">Apache Edgent (incubating)</a></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../../../org/apache/edgent/samples/console/HttpServerSample.html" title="class in org.apache.edgent.samples.console"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/edgent/samples/console/ConsoleWaterDetector.html" target="_top">Frames</a></li> |
| <li><a href="ConsoleWaterDetector.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2017 The Apache Software Foundation. All Rights Reserved - 4744f56-20170226-1707</small></p> |
| </body> |
| </html> |