Interface Connector<O,I,CO,CI>
- Type Parameters:
O- the output type from the underlying machine/platformI- the input type to the underlying machine/platformCO- the output type of the connectorCI- the input type of the connector
- All Superinterfaces:
EventHandlingConnector
- All Known Implementing Classes:
AbstractChannelConnector,AbstractConnector,AbstractThreadedConnector
The interface of a platform/machine connector. A connector shall define a
ConnectorDescriptor as top-level
inner class and register the descriptor as service. By default, polling shall be enabled but in certain cases this
may not fit into the lifecycle of services in a service environment. Then it is possible to explicitly
enable/disable polling.- Author:
- Holger Eichelberger, SSE
-
Method Summary
Modifier and TypeMethodDescriptionvoidconnect(ConnectorParameter params) Connects the connector to the underlying machine/platform.default SharedSpaceCreates a shared space among connector instances of the same type.voidDisconnects the connector from the underlying machine/platform.default voidDisconnects the connector from the underlying machine/platform.voiddispose()Final cleanup when platform shuts down, e.g., for shared resources.Returns the actually enabled encryption mechanisms on this instance.voidenableNotifications(boolean enableNotifications) Enables/disables notifications/polling at all.default booleanenableSharedSpace(SharedSpace space) Enables a shared space among connector instances of the same type (created by the first MIMO connector).default Class<? extends CachingStrategy> Returns the actual caching strategy class.Returns the input type from the IIP-Ecosphere platform.Returns the output type to the IIP-Ecosphere platform.Returns the instance identification forconnector extensions.Returns the input type to the protocol.Returns the output type of the protocol.default voidnotifyReconfigured(String parameterName, String value) Called when parameters of the containing service are changed.request(boolean sendToCallback) Explicitly requests reading data from the source.default voidDefines the time difference provider.voidsetInstanceIdentification(String identification) Sets an instance identification forconnector extensions.voidsetReceptionCallback(de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<CO> callback) Attaches a receptioncallbackto this connector.default voidsetReceptionCallbackSafe(de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<CO> callback) Attaches a receptioncallbackto this connector.Returns the supported encryption mechanisms.voidWrites the givendatato the underlying machine/platform.Methods inherited from interface de.iip_ecosphere.platform.connectors.events.EventHandlingConnector
enablePolling, getName, getStorageValue, setDataTimeDifference, setStorageValue, trigger, trigger
-
Method Details
-
connect
Connects the connector to the underlying machine/platform.- Parameters:
params- connection parameter- Throws:
IOException- in case that connecting fails
-
request
Explicitly requests reading data from the source. This is typically done by polling or events, but, in seldom cases, may be needed manually.- Parameters:
sendToCallback- whetherthe reception callbackshall be informed about new data- Returns:
- the data from the machine, null for none, i.e., also no call to
the reception callback - Throws:
IOException- in case that reading fails
-
write
Writes the givendatato the underlying machine/platform.- Parameters:
data- the data to send tostream- Throws:
IOException- in case that problems during the connection happens
-
setReceptionCallback
void setReceptionCallback(de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<CO> callback) throws IOException Attaches a receptioncallbackto this connector. Thecallbackis called upon a reception.- Parameters:
callback- the callback to attach- Throws:
IOException- in case that problems during registering the callback (e.g., during subscription) happens
-
setReceptionCallbackSafe
default void setReceptionCallbackSafe(de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<CO> callback) Attaches a receptioncallbackto this connector. Thecallbackis called upon a reception. Exceptions are not thrown rather than logged.- Parameters:
callback- the callback to attach
-
disconnect
Disconnects the connector from the underlying machine/platform.- Throws:
IOException- in case that connecting fails
-
disconnectSafe
default void disconnectSafe()Disconnects the connector from the underlying machine/platform. Logs exceptions was warning. -
dispose
void dispose()Final cleanup when platform shuts down, e.g., for shared resources. -
getProtocolInputType
Returns the input type to the protocol.- Returns:
- the input type (may be null in case of generic types, but shall not be null)
-
getConnectorInputType
Returns the input type from the IIP-Ecosphere platform.- Returns:
- the input type (may be null in case of generic types, but shall not be null)
-
getProtocolOutputType
Returns the output type of the protocol.- Returns:
- the output type (may be null in case of generic types, but shall not be null)
-
getConnectorOutputType
Returns the output type to the IIP-Ecosphere platform.- Returns:
- the output type (may be null in case of generic types, but shall not be null)
-
supportedEncryption
String supportedEncryption()Returns the supported encryption mechanisms.- Returns:
- the supported encryption mechanisms (comma-separated), may be null or empty
-
enabledEncryption
String enabledEncryption()Returns the actually enabled encryption mechanisms on this instance. The result may change when connecting the connector.- Returns:
- the enabled encryption mechanisms (comma-separated), may be null or empty
-
enableNotifications
void enableNotifications(boolean enableNotifications) Enables/disables notifications/polling at all.- Parameters:
enableNotifications- enable or disable notifications
-
getCachingStrategyCls
Returns the actual caching strategy class.- Returns:
- the strategy class
-
notifyReconfigured
Called when parameters of the containing service are changed.- Parameters:
parameterName- the parameter namevalue- the new value
-
setDataTimeDifferenceProvider
Defines the time difference provider. Depends on the connector implementation.- Parameters:
provider- the provider, may be null for none
-
setInstanceIdentification
Sets an instance identification forconnector extensions.- Parameters:
identification- the identification
-
getInstanceIdentification
String getInstanceIdentification()Returns the instance identification forconnector extensions.- Returns:
- the identification, set before by
setInstanceIdentification(String)
-