Interface ProtocolAdapter<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 Known Subinterfaces:
ChannelProtocolAdapter<O,I,CO,CI>
- All Known Implementing Classes:
AbstractProtocolAdapter,ChannelTranslatingProtocolAdapter,TranslatingProtocolAdapter
public interface ProtocolAdapter<O,I,CO,CI>Adapts a protocol from/to an underlying machine/platform.- Author:
- Holger Eichelberger, SSE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IadaptInput(CI data)Adapts the input from the IIP-Ecosphere platform to the underlying machine/platform.COadaptOutput(java.lang.String channel, O data)Adapts the output from the underlying machine/platform to the IIP-Ecosphere platform.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.ModelAccessgetModelAccess()Returns the instance abstracting the access to the underlying model.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.voidinitializeModelAccess()Called to initialize the model access, e.g., to setup notifications.voidsetModelAccess(ModelAccess modelAccess)Defines the model access.
-
-
-
Method Detail
-
adaptInput
I adaptInput(CI data) throws java.io.IOException
Adapts the input from the IIP-Ecosphere platform to the underlying machine/platform.- Parameters:
data- the data to be adapted- Returns:
- the adapted data
- Throws:
java.io.IOException- in case that the adaptation fails
-
adaptOutput
CO adaptOutput(java.lang.String channel, O data) throws java.io.IOException
Adapts the output from the underlying machine/platform to the IIP-Ecosphere platform.- Parameters:
channel- the channel the data was receiveddata- the data to be adapted- Returns:
- the adapted data
- Throws:
java.io.IOException- in case that the adaptation fails
-
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)
-
getModelAccess
ModelAccess getModelAccess()
Returns the instance abstracting the access to the underlying model.- Returns:
- the instance, may be null if
MachineConnector.hasModel()isfalse
-
setModelAccess
void setModelAccess(ModelAccess modelAccess)
Defines the model access. Handle with care, shall be called by connector only.- Parameters:
modelAccess- the model access
-
initializeModelAccess
void initializeModelAccess() throws java.io.IOExceptionCalled to initialize the model access, e.g., to setup notifications. Called only, when the connector is connected.- Throws:
java.io.IOException- in case the initialization fails, e.g., monitors cannot be set up
-
-