You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@edgent.apache.org by dj...@apache.org on 2016/03/17 18:13:23 UTC

[08/10] incubator-quarks git commit: Add javadoc to IotProvider

Add javadoc to IotProvider


Project: http://git-wip-us.apache.org/repos/asf/incubator-quarks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quarks/commit/b97b0a4f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quarks/tree/b97b0a4f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quarks/diff/b97b0a4f

Branch: refs/heads/master
Commit: b97b0a4f601eb9b4edec8ad2ac531d6b0ba32291
Parents: 6fc3322
Author: Dan Debrunner <dj...@debrunners.com>
Authored: Wed Mar 16 16:26:05 2016 -0700
Committer: Dan Debrunner <dj...@debrunners.com>
Committed: Wed Mar 16 16:26:05 2016 -0700

----------------------------------------------------------------------
 .../java/quarks/apps/iot/IotDevicePubSub.java   |  2 +-
 .../java/quarks/providers/iot/IotProvider.java  | 50 ++++++++++++++++++--
 .../quarks/test/fvt/iot/IotProviderTest.java    |  2 +-
 3 files changed, 48 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/b97b0a4f/apps/iot/src/main/java/quarks/apps/iot/IotDevicePubSub.java
----------------------------------------------------------------------
diff --git a/apps/iot/src/main/java/quarks/apps/iot/IotDevicePubSub.java b/apps/iot/src/main/java/quarks/apps/iot/IotDevicePubSub.java
index 2514a98..4dc34d9 100644
--- a/apps/iot/src/main/java/quarks/apps/iot/IotDevicePubSub.java
+++ b/apps/iot/src/main/java/quarks/apps/iot/IotDevicePubSub.java
@@ -28,7 +28,7 @@ import quarks.topology.TopologyElement;
 
 /**
  * Application sharing an {@code IotDevice} through publish-subscribe. <BR>
- * This application allows sharing an {@link IotDevice} across multiple running
+ * This application shares an {@link IotDevice} across multiple running
  * jobs. This allows a single connection to a back-end message hub to be shared
  * across multiple independent applications, without having to build a single
  * topology.

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/b97b0a4f/providers/iot/src/main/java/quarks/providers/iot/IotProvider.java
----------------------------------------------------------------------
diff --git a/providers/iot/src/main/java/quarks/providers/iot/IotProvider.java b/providers/iot/src/main/java/quarks/providers/iot/IotProvider.java
index 89d1604..3440f90 100644
--- a/providers/iot/src/main/java/quarks/providers/iot/IotProvider.java
+++ b/providers/iot/src/main/java/quarks/providers/iot/IotProvider.java
@@ -44,13 +44,37 @@ import quarks.topology.TopologyProvider;
 import quarks.topology.services.ApplicationService;
 
 /**
- * IoT provider supporting multiple topologies with a single connection to a
+ * Abstract IoT provider supporting multiple topologies with a single connection to a
  * message hub. A provider that uses a single {@link IotDevice} to communicate
  * with an IoT scale message hub.
  * {@link quarks.connectors.pubsub.PublishSubscribe Publish-subscribe} is
  * used to allow multiple topologies to communicate through the single
  * connection.
+ * <P>
+ * This provider registers these services:
+ * <UL>
+ * <LI>{@link ControlService control} - An instance of {@link JsonControlService}.</LI>
+ * <LI>{@link ApplicationService application} - An instance of {@link AppService}.</LI>
+ * <LI>{@link PublishSubscribeService publish-subscribe} - An instance of {@link ProviderPubSub}</LI>
+ * </UL>
+ * System applications provide this functionality:
+ * <UL>
+ * <LI>
+ * </LI>
+ * </UL>
+ * <UL>
+ * <LI>Single connection to the message hub using an {@code IotDevice}
+ * using {@link IotDevicePubSub}.
+ * Applications using this provider that want to connect
+ * to the message hub for device events and commands must create an instance of
+ * {@code IotDevice} using {@link IotDevicePubSub#addIotDevice(quarks.topology.TopologyElement)}</LI>
+ * <LI>Access to the control service through device commands from the message hub using command
+ * identifier {@link Commands#CONTROL_SERVICE quarksControl}.
+ * </UL>
+ * </P>
  * 
+ * @see IotDevice
+ * @see IotDevicePubSub
  */
 public abstract class IotProvider implements TopologyProvider,
  DirectSubmitter<Topology, Job> {
@@ -129,12 +153,12 @@ public abstract class IotProvider implements TopologyProvider,
      * Subscribes to device events and sends them to the messages hub.
      * Publishes device commands from the message hub.
      * @see IotDevicePubSub
-     * @see #getMessageHubDevice(Topology)
+     * @see #createMessageHubDevice(Topology)
      */
     protected void createIotDeviceApp() {
         Topology topology = newTopology("QuarksIotDevice");
              
-        IotDevice msgHub = getMessageHubDevice(topology);
+        IotDevice msgHub = createMessageHubDevice(topology);
         IotDevicePubSub.createApplication(msgHub);
         systemApps.add(topology);
     }
@@ -173,5 +197,23 @@ public abstract class IotProvider implements TopologyProvider,
         }
     }
 
-    protected abstract IotDevice getMessageHubDevice(Topology topology);
+    /**
+     * Create the connection to the message hub.
+     * 
+     * A sub-class creates an instance of {@link IotDevice}
+     * used to communicate with the message hub. This
+     * provider creates and submits an application
+     * that subscribes to published events to send
+     * as device events and publishes device commands.
+     * <BR>
+     * The application is created using
+     * {@link IotDevicePubSub#createApplication(IotDevice)}.
+     * 
+     * @param topology Topology the {@code IotDevice} will be contained in.
+     * @return IotDevice device used to communicate with the message hub.
+     * 
+     * @see IotDevice
+     * @see IotDevicePubSub
+     */
+    protected abstract IotDevice createMessageHubDevice(Topology topology);
 }

http://git-wip-us.apache.org/repos/asf/incubator-quarks/blob/b97b0a4f/test/fvtiot/src/test/java/quarks/test/fvt/iot/IotProviderTest.java
----------------------------------------------------------------------
diff --git a/test/fvtiot/src/test/java/quarks/test/fvt/iot/IotProviderTest.java b/test/fvtiot/src/test/java/quarks/test/fvt/iot/IotProviderTest.java
index e13d845..17d8cab 100644
--- a/test/fvtiot/src/test/java/quarks/test/fvt/iot/IotProviderTest.java
+++ b/test/fvtiot/src/test/java/quarks/test/fvt/iot/IotProviderTest.java
@@ -57,7 +57,7 @@ public class IotProviderTest {
         IotProvider provider = new IotProvider() {
 
             @Override
-            protected IotDevice getMessageHubDevice(Topology topology) {
+            protected IotDevice createMessageHubDevice(Topology topology) {
                 return new EchoIotDevice(topology);
             }
         };