Class SdcRemoteDevicesConnectorImpl
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,SdcRemoteDevicesConnector,WatchdogObserver
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture<SdcRemoteDevice>connect(HostingServiceProxy hostingServiceProxy, ConnectConfiguration connectConfiguration) Tries to establish an SDC client connection to the given hosting service proxy (i.e., remote SDC device).com.google.common.util.concurrent.ListenableFuture<SdcRemoteDevice>connect(HostingServiceProxy hostingServiceProxy, ConnectConfiguration connectConfiguration, MdibAccessObserver mdibAccessObserver) Tries to establish an SDC client connection to the given hosting service proxy (i.e., remote SDC device).com.google.common.util.concurrent.ListenableFuture<?>disconnect(String eprAddress) Disconnects a device.getConnectedDevice(String eprAddress) Gets a connected device.Gets a copy of all connected devices at a certain point in time.voidregisterObserver(SdcRemoteDevicesObserver observer) protected voidshutDown()protected voidstartUp()voidunregisterObserver(SdcRemoteDevicesObserver observer) Methods inherited from class com.google.common.util.concurrent.AbstractIdleService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, executor, failureCause, isRunning, serviceName, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.common.util.concurrent.Service
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
Method Details
-
connect
public com.google.common.util.concurrent.ListenableFuture<SdcRemoteDevice> connect(HostingServiceProxy hostingServiceProxy, ConnectConfiguration connectConfiguration) throws PrerequisitesException Description copied from interface:SdcRemoteDevicesConnectorTries 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:
- If there is at least one action in the set of available actions, then the connector subscribes to those actions.
- 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.
- The connector collects and buffers all incoming reports.
- The MDIB is requested from the remote node.
- Reports are applied on the MDIB.
- An
SdcRemoteDeviceis 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:
connectin interfaceSdcRemoteDevicesConnector- Parameters:
hostingServiceProxy- the hosted service to connect toconnectConfiguration- options for the connection process.- Returns:
- a future that contains the
SdcRemoteDeviceif 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:SdcRemoteDevicesConnectorTries 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:
- If there is at least one action in the set of available actions, then the connector subscribes to those actions.
- 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.
- The connector collects and buffers all incoming reports.
- The MDIB is requested from the remote node.
- Reports are applied on the MDIB.
- An
SdcRemoteDeviceis 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:
connectin interfaceSdcRemoteDevicesConnector- Parameters:
hostingServiceProxy- the hosted service to connect toconnectConfiguration- 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
SdcRemoteDeviceif connection succeeds. It will immediately return if there is an existing connection already. - Throws:
PrerequisitesException- if verification of premises for connection establishment fails.
-
disconnect
Description copied from interface:SdcRemoteDevicesConnectorDisconnects 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:
disconnectin interfaceSdcRemoteDevicesConnector- 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.
-
getConnectedDevices
Description copied from interface:SdcRemoteDevicesConnectorGets a copy of all connected devices at a certain point in time.- Specified by:
getConnectedDevicesin interfaceSdcRemoteDevicesConnector- Returns:
- a collection of all connected devices. Please note that this creates a copy on every call.
-
getConnectedDevice
Description copied from interface:SdcRemoteDevicesConnectorGets a connected device.- Specified by:
getConnectedDevicein interfaceSdcRemoteDevicesConnector- Parameters:
eprAddress- the endpoint reference address of the remote device to get.- Returns:
- an
SdcRemoteDeviceinstance if connected, otherwiseOptional.empty().
-
registerObserver
- Specified by:
registerObserverin interfaceSdcRemoteDevicesConnector
-
unregisterObserver
- Specified by:
unregisterObserverin interfaceSdcRemoteDevicesConnector
-
startUp
- Specified by:
startUpin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-
shutDown
- Specified by:
shutDownin classcom.google.common.util.concurrent.AbstractIdleService- Throws:
Exception
-