You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by dlaboss <gi...@git.apache.org> on 2017/02/01 20:42:32 UTC

[GitHub] incubator-edgent pull request #280: [Edgent-374] [COMMENTS?] IotGateway [ci-...

GitHub user dlaboss opened a pull request:

    https://github.com/apache/incubator-edgent/pull/280

    [Edgent-374] [COMMENTS?] IotGateway [ci-skip]

    Add IotGateway
    Add IotDevice.{getDeviceType(),getDeviceId(),CMD_DEVICE}
    
    These IotDevice changes break existing IotDevice implementations but in
    practice this won't be a problem - its highly unlikely any IotDevice
    implementations exist outside of this repository (and adapting is
    trivial).  "default" can't be used due to support for Java7/Android.  
    
    Other schemes are possible that avoid this but they don't model things
    as well (an IotDevice really does have an Id), introduce even more types
    (e.g., a IotGatewayConnectedDevice), and/or are less convenient to use.
    e.g., those new IotDevice methods could be migrated to IotGateway -
    IotGateway.getDeviceId(IotDevice).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dlaboss/incubator-edgent edgent377-iotGateway

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-edgent/pull/280.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #280
    
----
commit ca0ee386e2596448b036b6fb66a53fac4ef2aa9d
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-01T20:39:48Z

    [Edgent-374] [COMMENTS?] IotGateway [ci-skip]
    
    Add IotGateway
    Add IotDevice.{getDeviceType(),getDeviceId(),CMD_DEVICE}
    
    These IotDevice changes break existing IotDevice implementations but in
    practice this won't be a problem - its highly unlikely any IotDevice
    implementations exist outside of this repository (and adapting is
    trivial).  "default" can't be used due to support for Java7/Android.  
    
    Other schemes are possible that avoid this but they don't model things
    as well (an IotDevice really does have an Id), introduce even more types
    (e.g., a IotGatewayConnectedDevice), and/or are less convenient to use.
    e.g., those new IotDevice methods could be migrated to IotGateway -
    IotGateway.getDeviceId(IotDevice).

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-377] IotGateway

Posted by dlaboss <gi...@git.apache.org>.
Github user dlaboss closed the pull request at:

    https://github.com/apache/incubator-edgent/pull/280


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-377] [COMMENTS?] IotGatewa...

Posted by dlaboss <gi...@git.apache.org>.
Github user dlaboss closed the pull request at:

    https://github.com/apache/incubator-edgent/pull/280


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-374] [COMMENTS?] IotGatewa...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-edgent/pull/280#discussion_r99167183
  
    --- Diff: connectors/iot/src/main/java/org/apache/edgent/connectors/iot/IotDevice.java ---
    @@ -29,13 +29,43 @@ Licensed to the Apache Software Foundation (ASF) under one
     
     /**
      * Generic Internet of Things device connector.
    + * <p>
    + * IotDevice characteristics:
    + * <ul>
    + * <li>{@code IotDevice.getDeviceTypeId()} returns an opaque value whose form
    + *      is the domain of an IoT connector implementation.</li>
    + * <li>{@code IotDevice.getDeviceId()} returns an opaque value whose form
    + *      is the domain of an IoT connector implementation.
    + *      The value is unique for a particular a logical device.
    + * <li>{@code IotDevice.equals()} returns true if two IotDevice instances are
    + *     for the same logical device, false otherwise.</li>
    + * <li>{@code IotDevice.hashCode()} returns the same value for all IotDevice instances
    + *     for the same logical device.</li>
    + * <li>{@code IotDevice} may be used as a {@link org.apache.edgent.topology.TWindow TWindow} partition key.</li> 
    --- End diff --
    
    Curious why this is here. If IoTDevice holds a connection to send/receive messages and it doesn't seem like that should be partition key.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-377] [COMMENTS?] IotGatewa...

Posted by dlaboss <gi...@git.apache.org>.
Github user dlaboss commented on a diff in the pull request:

    https://github.com/apache/incubator-edgent/pull/280#discussion_r99207767
  
    --- Diff: connectors/iot/src/main/java/org/apache/edgent/connectors/iot/IotDevice.java ---
    @@ -29,13 +29,43 @@ Licensed to the Apache Software Foundation (ASF) under one
     
     /**
      * Generic Internet of Things device connector.
    + * <p>
    + * IotDevice characteristics:
    + * <ul>
    + * <li>{@code IotDevice.getDeviceTypeId()} returns an opaque value whose form
    + *      is the domain of an IoT connector implementation.</li>
    + * <li>{@code IotDevice.getDeviceId()} returns an opaque value whose form
    + *      is the domain of an IoT connector implementation.
    + *      The value is unique for a particular a logical device.
    + * <li>{@code IotDevice.equals()} returns true if two IotDevice instances are
    + *     for the same logical device, false otherwise.</li>
    + * <li>{@code IotDevice.hashCode()} returns the same value for all IotDevice instances
    + *     for the same logical device.</li>
    + * <li>{@code IotDevice} may be used as a {@link org.apache.edgent.topology.TWindow TWindow} partition key.</li> 
    --- End diff --
    
    Relates to the use of an IotDevice instance as an API object representing an IoT device.  More on that in the response to your other usage model question.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [Edgent-377] IotGateway

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-edgent/pull/280


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-377] [COMMENTS?] IotGatewa...

Posted by dlaboss <gi...@git.apache.org>.
GitHub user dlaboss reopened a pull request:

    https://github.com/apache/incubator-edgent/pull/280

    [WIP] [Edgent-377] [COMMENTS?] IotGateway [ci-skip]

    Add IotGateway
    Add IotDevice.{getDeviceType(),getDeviceId(),CMD_DEVICE}
    
    These IotDevice changes break existing IotDevice implementations but in
    practice this won't be a problem - its highly unlikely any IotDevice
    implementations exist outside of this repository (and adapting is
    trivial).  "default" can't be used due to support for Java7/Android.  
    
    Other schemes are possible that avoid this but they don't model things
    as well (an IotDevice really does have an Id), introduce even more types
    (e.g., a IotGatewayConnectedDevice), and/or are less convenient to use.
    e.g., those new IotDevice methods could be migrated to IotGateway -
    IotGateway.getDeviceId(IotDevice).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dlaboss/incubator-edgent edgent377-iotGateway

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-edgent/pull/280.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #280
    
----
commit ca0ee386e2596448b036b6fb66a53fac4ef2aa9d
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-01T20:39:48Z

    [Edgent-374] [COMMENTS?] IotGateway [ci-skip]
    
    Add IotGateway
    Add IotDevice.{getDeviceType(),getDeviceId(),CMD_DEVICE}
    
    These IotDevice changes break existing IotDevice implementations but in
    practice this won't be a problem - its highly unlikely any IotDevice
    implementations exist outside of this repository (and adapting is
    trivial).  "default" can't be used due to support for Java7/Android.  
    
    Other schemes are possible that avoid this but they don't model things
    as well (an IotDevice really does have an Id), introduce even more types
    (e.g., a IotGatewayConnectedDevice), and/or are less convenient to use.
    e.g., those new IotDevice methods could be migrated to IotGateway -
    IotGateway.getDeviceId(IotDevice).

commit 295eb450b1f5eb90d92eed9b7490ca9b521f8478
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-01T21:40:36Z

    update package-info

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-377] IotGateway

Posted by dlaboss <gi...@git.apache.org>.
GitHub user dlaboss reopened a pull request:

    https://github.com/apache/incubator-edgent/pull/280

    [WIP] [Edgent-377] IotGateway

    Add IotGateway
    Add IotDevice.{getDeviceType(),getDeviceId(),CMD_DEVICE}
    
    These IotDevice changes break existing IotDevice implementations but in
    practice this won't be a problem - its highly unlikely any IotDevice
    implementations exist outside of this repository (and adapting is
    trivial).  "default" can't be used due to support for Java7/Android.  
    
    Other schemes are possible that avoid this but they don't model things
    as well (an IotDevice really does have an Id), introduce even more types
    (e.g., a IotGatewayConnectedDevice), and/or are less convenient to use.
    e.g., those new IotDevice methods could be migrated to IotGateway -
    IotGateway.getDeviceId(IotDevice).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dlaboss/incubator-edgent edgent377-iotGateway

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-edgent/pull/280.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #280
    
----
commit 3d66a15305f45463405f8defce2f3ae9fe432609
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-01T20:39:48Z

    [Edgent-374] [COMMENTS?] IotGateway [ci-skip]
    
    Add IotGateway
    Add IotDevice.{getDeviceType(),getDeviceId(),CMD_DEVICE}
    
    These IotDevice changes break existing IotDevice implementations but in
    practice this won't be a problem - its highly unlikely any IotDevice
    implementations exist outside of this repository (and adapting is
    trivial).  "default" can't be used due to support for Java7/Android.  
    
    Other schemes are possible that avoid this but they don't model things
    as well (an IotDevice really does have an Id), introduce even more types
    (e.g., a IotGatewayConnectedDevice), and/or are less convenient to use.
    e.g., those new IotDevice methods could be migrated to IotGateway -
    IotGateway.getDeviceId(IotDevice).

commit b5841855a034aa8bc65356521126965554df3f50
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-01T21:40:36Z

    update package-info

commit d52591b2a90493518f347c3e8fc380f067d6ff6c
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-03T21:16:34Z

    updates / cleanup
    
    - add the ability to avoid use of IotDevice from a gateway context

commit aed7224a9dee2f61d276a4bf0f1f2844615e7fdd
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-23T22:10:13Z

    Initial IotpGateway implementation
    
    - some updates to the initial IotGateway interface
    - add IotpGateway and its runtime classes
    - add sample clients - it all seems to be working
    - TODO flesh out the new IotDevice methods in EchoIotDevice, MqttDevice
    and PubSubIotDevice

commit 66ad5f264bf589e9addaaaccce5e446d183ed7cd
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-23T22:34:57Z

    fix javadoc warnings

commit 13447fcaa7eff7c9423e3b987f9671eecb263650
Author: Dale LaBossiere <dl...@us.ibm.com>
Date:   2017-02-24T13:23:15Z

    flesh out new methods in EchoIotDevice and MqttDevice

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-edgent pull request #280: [WIP] [Edgent-377] [COMMENTS?] IotGatewa...

Posted by ddebrunner <gi...@git.apache.org>.
Github user ddebrunner commented on a diff in the pull request:

    https://github.com/apache/incubator-edgent/pull/280#discussion_r99176181
  
    --- Diff: connectors/iot/src/main/java/org/apache/edgent/connectors/iot/IotGateway.java ---
    @@ -0,0 +1,122 @@
    +/*
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright ownership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +
    +  http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +*/
    +
    +package org.apache.edgent.connectors.iot;
    +
    +import java.util.Collection;
    +import java.util.Map;
    +
    +import org.apache.edgent.topology.TStream;
    +
    +import com.google.gson.JsonObject;
    +
    +/**
    + * A generic IoT Gateway device connector.
    + * <p>
    + * An IoT Gateway device is a conduit for a collection of IoT devices 
    + * that lack direct connection to the enterprise IoT hub.
    + * <p>
    + * The IoT Gateway device is an {@link IotDevice}.  Events can be published
    + * that are from the gateway device and commands can be received that are targeted for it
    + * using the IotGateway's {@code events()} and {@code commands()}.
    + * <p>
    + * Use {@link #getIotDevice(Map)} to get an IotDevice for a connected device.
    + * The name/value pairs in the map are IotGateway implementation defined values.
    + * Refer to the IotGateway implementation for details.
    + * Events can be published that are from that device and commands can be 
    + * received for that are targeted for that device using the connected device's IotDevice
    + * {@code events()} and {@code commands()).
    + * 
    + * @see IotDevice
    + */
    +public interface IotGateway extends IotDevice {
    +  
    +  /**
    +   * Get an {@link IotDevice} for a connected device.
    +   * @param deviceIdAttrs IotGateway implementation specific attributes
    +   *                    that identify a connected device.
    +   * @return
    +   */
    +  public IotDevice getIotDevice(Map<String,String> deviceIdAttrs);
    +  
    +  /**
    +   * Get an {@link IotDevice} for a connected device.
    +   * @param deviceId a value from {@link IotDevice#getDeviceId()}.
    +   * @return
    +   */
    +  public IotDevice getIotDevice(String deviceId);
    +
    +  /**
    +   * Create a stream of device commands as JSON objects.
    +   * Each command sent to one of the specified devices matching {@code commands} will
    +   * result in a tuple on the stream. The JSON object has these keys:
    +   * <UL>
    +   * <LI>{@link IotDevice#CMD_DEVICE device} - Command's target device's opaque id String.
    +   * <LI>{@link IotDevice#CMD_ID command} - Command identifier as a String</LI>
    +   * <LI>{@link IotDevice#CMD_TS tsms} - Timestamp of the command in milliseconds since the 1970/1/1 epoch.</LI>
    +   * <LI>{@link IotDevice#CMD_FORMAT format} - Format of the command as a String</LI>
    +   * <LI>{@link IotDevice#CMD_PAYLOAD payload} - Payload of the command
    +   * <UL>
    +   * <LI>If {@code format} is {@code json} then {@code payload} is JSON</LI>
    +   * <LI>Otherwise {@code payload} is String</LI>
    +   * </UL>
    +   * </LI>
    +   * </UL>
    +   * <P>
    +   * This is logically equivalent to a union of a collection of individual IotDevice specific
    +   * command streams but enables an IotGateway implementation to implement it more efficiently. 
    +   * 
    +   * @param devices
    +   *            Only return commands for the specified connected devices
    +   * @param commands Command identifiers to include. If no command identifiers are provided then the
    +   * stream will contain all device commands for the specified devices.
    +   * @return Stream containing device commands.
    +   */
    +  TStream<JsonObject> commands(Collection<IotDevice> devices, String... commands);
    --- End diff --
    
    I think this should be `Set<String> deviceIds` not a collection of `IotDevice`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---