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
public interface Connector<O,I,CO,CI> extends EventHandlingConnector
The interface of a platform/machine connector. A connector shall define aConnectorDescriptoras 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 explicitlyenable/disablepolling.- Author:
- Holger Eichelberger, SSE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidconnect(ConnectorParameter params)Connects the connector to the underlying machine/platform.voiddisconnect()Disconnects the connector from the underlying machine/platform.voiddispose()Final cleanup when platform shuts down, e.g., for shared resources.java.lang.StringenabledEncryption()Returns the actually enabled encryption mechanisms on this instance.voidenableNotifications(boolean enableNotifications)Enables/disables notifications/polling at all.default java.lang.Class<? extends CachingStrategy>getCachingStrategyCls()Returns the actual caching strategy class.java.lang.Class<? extends CI>getConnectorInputType()Returns the input type from the IIP-Ecosphere platform.java.lang.Class<? extends CO>getConnectorOutputType()Returns the output type to the IIP-Ecosphere platform.java.lang.Class<? extends I>getProtocolInputType()Returns the input type to the protocol.java.lang.Class<? extends O>getProtocolOutputType()Returns the output type of the protocol.default voidnotifyReconfigured(java.lang.String parameterName, java.lang.String value)Called when parameters of the containing service are changed.COrequest(boolean sendToCallback)Explicitly requests reading data from the source.voidsetReceptionCallback(de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<CO> callback)Attaches a receptioncallbackto this connector.java.lang.StringsupportedEncryption()Returns the supported encryption mechanisms.voidwrite(CI data)Writes the givendatato the underlying machine/platform.-
Methods inherited from interface de.iip_ecosphere.platform.connectors.events.EventHandlingConnector
enablePolling, getName, trigger, trigger
-
-
-
-
Method Detail
-
connect
void connect(ConnectorParameter params) throws java.io.IOException
Connects the connector to the underlying machine/platform.- Parameters:
params- connection parameter- Throws:
java.io.IOException- in case that connecting fails
-
request
CO request(boolean sendToCallback) throws java.io.IOException
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:
java.io.IOException- in case that reading fails
-
write
void write(CI data) throws java.io.IOException
Writes the givendatato the underlying machine/platform.- Parameters:
data- the data to send tostream- Throws:
java.io.IOException- in case that problems during the connection happens
-
setReceptionCallback
void setReceptionCallback(de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<CO> callback) throws java.io.IOException
Attaches a receptioncallbackto this connector. Thecallbackis called upon a reception.- Parameters:
callback- the callback to attach- Throws:
java.io.IOException- in case that problems during registering the callback (e.g., during subscription) happens
-
disconnect
void disconnect() throws java.io.IOExceptionDisconnects the connector from the underlying machine/platform.- Throws:
java.io.IOException- in case that connecting fails
-
dispose
void dispose()
Final cleanup when platform shuts down, e.g., for shared resources.
-
getProtocolInputType
java.lang.Class<? extends I> 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
java.lang.Class<? extends CI> 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
java.lang.Class<? extends O> 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
java.lang.Class<? extends CO> 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
java.lang.String supportedEncryption()
Returns the supported encryption mechanisms.- Returns:
- the supported encryption mechanisms (comma-separated), may be null or empty
-
enabledEncryption
java.lang.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
default java.lang.Class<? extends CachingStrategy> getCachingStrategyCls()
Returns the actual caching strategy class.- Returns:
- the strategy class
-
notifyReconfigured
default void notifyReconfigured(java.lang.String parameterName, java.lang.String value)Called when parameters of the containing service are changed.- Parameters:
parameterName- the parameter namevalue- the new value
-
-