Class SdcRemoteDevicesConnectorImpl

    • Method Detail

      • connect

        public com.google.common.util.concurrent.ListenableFuture<SdcRemoteDevice> connect​(HostingServiceProxy hostingServiceProxy,
                                                                                           ConnectConfiguration connectConfiguration)
                                                                                    throws PrerequisitesException
        Description copied from interface: SdcRemoteDevicesConnector
        Tries to establish an SDC client connection to the given hosting service proxy (i.e., remote SDC device).

        The client connection will pass only if the host is reachable and provides the mandatory BICEPS Get service. After this function is triggered, the following process is conducted:

        1. If there is at least one action in the set of available actions, then the connector subscribes to those actions.
        2. The connector starts a watchdog and either uses WS-Eventing Renew requests in case of an existing subscription or DirectedProbe requests in case of no existing subscriptions in order to keep track of the connection to the remote node.
        3. The connector collects and buffers all incoming reports.
        4. The MDIB is requested from the remote node.
        5. Reports are applied on the MDIB.
        6. An SdcRemoteDevice is supplied.

        Connections can be triggered only once per device per time. As reports are applied on the received MDIB there are no gaps as long as every subscription has been subscribed during connection.

        Specified by:
        connect in interface SdcRemoteDevicesConnector
        Parameters:
        hostingServiceProxy - the hosted service to connect to
        connectConfiguration - options for the connection process.
        Returns:
        a future that contains the SdcRemoteDevice if connection succeeds. It will immediately return if there is an existing connection already.
        Throws:
        PrerequisitesException - if verification of premises for connection establishment fails.
      • connect

        public com.google.common.util.concurrent.ListenableFuture<SdcRemoteDevice> connect​(HostingServiceProxy hostingServiceProxy,
                                                                                           ConnectConfiguration connectConfiguration,
                                                                                           @Nullable
                                                                                           MdibAccessObserver mdibAccessObserver)
                                                                                    throws PrerequisitesException
        Description copied from interface: SdcRemoteDevicesConnector
        Tries to establish an SDC client connection to the given hosting service proxy (i.e., remote SDC device).

        The client connection will pass only if the host is reachable and provides the mandatory BICEPS Get service. After this function is triggered, the following process is conducted:

        1. If there is at least one action in the set of available actions, then the connector subscribes to those actions.
        2. The connector starts a watchdog and either uses WS-Eventing Renew requests in case of an existing subscription or DirectedProbe requests in case of no existing subscriptions in order to keep track of the connection to the remote node.
        3. The connector collects and buffers all incoming reports.
        4. The MDIB is requested from the remote node.
        5. Reports are applied on the MDIB.
        6. An SdcRemoteDevice is supplied.

        Connections can be triggered only once per device per time. As reports are applied on the received MDIB there are no gaps as long as every subscription has been subscribed during connection.

        Specified by:
        connect in interface SdcRemoteDevicesConnector
        Parameters:
        hostingServiceProxy - the hosted service to connect to
        connectConfiguration - options for the connection process.
        mdibAccessObserver - observer that is registered before the initial MDIB is fetched from the device
        Returns:
        a future that contains the SdcRemoteDevice if connection succeeds. It will immediately return if there is an existing connection already.
        Throws:
        PrerequisitesException - if verification of premises for connection establishment fails.
      • disconnect

        public com.google.common.util.concurrent.ListenableFuture<?> disconnect​(String eprAddress)
        Description copied from interface: SdcRemoteDevicesConnector
        Disconnects a device.

        This function is non-blocking. Right after it returns the disconnected device can be re-connected (while the former device is still disconnecting).

        Specified by:
        disconnect in interface SdcRemoteDevicesConnector
        Parameters:
        eprAddress - the endpoint reference address of the remote device to disconnect.
        Returns:
        a listenable future that finishes once the remote device is disconnected (i.e., subscriptions are unsubscribed). If there is no device to disconnect, an immediate cancelled future is returned.
      • startUp

        protected void startUp()
                        throws Exception
        Specified by:
        startUp in class com.google.common.util.concurrent.AbstractIdleService
        Throws:
        Exception
      • shutDown

        protected void shutDown()
                         throws Exception
        Specified by:
        shutDown in class com.google.common.util.concurrent.AbstractIdleService
        Throws:
        Exception