Class AbstractChannelConnector<O,I,CO,CI>
java.lang.Object
de.iip_ecosphere.platform.connectors.AbstractConnector<O,I,CO,CI>
de.iip_ecosphere.platform.connectors.AbstractChannelConnector<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 Implemented Interfaces:
Connector<O,,I, CO, CI> EventHandlingConnector,AbstractModelAccess.NotificationChangedListener
Defines a basic channeled connector.
- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classRefines the parent'sAbstractConnector<O,to comply with/providerI, CO, CI>.BasicAdapterProvider ChannelProtocolAdapter.Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
AbstractConnector.BasicAdapterProvider -
Field Summary
FieldsFields inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
DEFAULT_CHANNEL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractChannelConnector(ChannelAdapterSelector<O, I, CO, CI> selector, ChannelProtocolAdapter<O, I, CO, CI>... adapter) Creates an instance and installs the protocol adapter.protectedAbstractChannelConnector(ChannelProtocolAdapter<O, I, CO, CI>... adapter) Creates an instance and installs the protocol adapter. -
Method Summary
Modifier and TypeMethodDescriptionprivate static <O,I, CO, CI>
ChannelAdapterSelector<O, I, CO, CI> ensureAdapterSelector(ChannelAdapterSelector<O, I, CO, CI> selector) Ensures that there is at least a default first-adapter selector of the right type.protected String[]Returns the output channel names.protected ChannelAdapterSelector<O, I, CO, CI> Returns the adapter selector.protected voidinitSelector(AdapterSelector<O, I, CO, CI> selector) CallsAdapterSelector.init(de.iip_ecosphere.platform.connectors.AdapterSelector.AdapterProvider)with a provider instance pointing to the adapters in this instance.Explicitly requests reading data from the source.voidWrites the givendatato the underlying machine/platform.protected final voidDoes the actual writing to the underlying machine/platform.protected abstract voidDoes the actual writing to the underlying machine/platform.Methods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
checkCache, configureAdapter, configureModelAccess, connect, connectImpl, createTlsContext, disconnect, disconnectImpl, dispose, doPolling, enableNotifications, enablePolling, error, getCachingStrategy, getCachingStrategyCls, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getInitCachingStrategyCls, getInstanceIdentification, getProtocolInputType, getProtocolOutputType, getStorageValue, initializeModelAccess, installPollTask, isPolling, notificationsChanged, notifyDataTimeDifference, notifyReconfigured, read, received, received, request, setDataTimeDifference, setDataTimeDifferenceProvider, setInstanceIdentification, setReceptionCallback, setStorageValue, trigger, trigger, uninstallPollTask, useTlsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.connectors.Connector
createSharedSpace, disconnectSafe, enabledEncryption, enableSharedSpace, setReceptionCallbackSafe, supportedEncryptionMethods inherited from interface de.iip_ecosphere.platform.connectors.events.EventHandlingConnector
getName
-
Field Details
-
outputChannels
-
selector
-
-
Constructor Details
-
AbstractChannelConnector
Creates an instance and installs the protocol adapter.- Parameters:
adapter- the protocol adapter- Throws:
IllegalArgumentException- ifadapteris null or empty or adapters are null
-
AbstractChannelConnector
@SafeVarargs protected AbstractChannelConnector(ChannelAdapterSelector<O, I, CO, CI> selector, ChannelProtocolAdapter<O, I, CO, CI>... adapter) Creates an instance and installs the protocol adapter.- Parameters:
selector- the adapter selector (null leads to a default selector for the first adapter)adapter- the protocol adapter- Throws:
IllegalArgumentException- ifadapteris null or empty or adapters are null
-
-
Method Details
-
ensureAdapterSelector
private static <O,I, ChannelAdapterSelector<O,CO, CI> I, ensureAdapterSelectorCO, CI> (ChannelAdapterSelector<O, I, CO, CI> selector) Ensures that there is at least a default first-adapter selector of the right type.- 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- Parameters:
selector- the adapter selector (null leads to a default selector for the first adapter)- Returns:
selectoror a default selector instance
-
initSelector
Description copied from class:AbstractConnectorCallsAdapterSelector.init(de.iip_ecosphere.platform.connectors.AdapterSelector.AdapterProvider)with a provider instance pointing to the adapters in this instance.- Overrides:
initSelectorin classAbstractConnector<O,I, CO, CI> - Parameters:
selector- the selector to initialize
-
getSelector
Returns the adapter selector.- Overrides:
getSelectorin classAbstractConnector<O,I, CO, CI> - Returns:
- the selector
-
request
Explicitly requests reading data from the source. This is typically done by polling or events, but, in seldom cases, may be needed manually.- Overrides:
requestin classAbstractConnector<O,I, CO, CI> - Parameters:
channel- the channel to assign the received data to, may beAbstractConnector.DEFAULT_CHANNEL.notifyCallback- 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
Description copied from interface:ConnectorWrites the givendatato the underlying machine/platform. -
writeImpl
Description copied from class:AbstractConnectorDoes the actual writing to the underlying machine/platform. Can be left empty ifMachineConnector.hasModel().- Specified by:
writeImplin classAbstractConnector<O,I, CO, CI> - Parameters:
data- the data to be send- Throws:
IOException- if sending fails
-
writeImpl
Does the actual writing to the underlying machine/platform. Can be left empty ifMachineConnector.hasModel().- Parameters:
data- the data to be sendchannel- the channel name to use- Throws:
IOException- if sending fails
-
getOutputChannels
Returns the output channel names.- Returns:
- the output channel names
-