Class DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator
java.lang.Object
de.iip_ecosphere.platform.connectors.DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator
- All Implemented Interfaces:
ConnectorFactoryDescriptor.ConnectorFactoryCreator
- Enclosing class:
DefaultConnectorFactoryDescriptor
public static class DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator
extends Object
implements ConnectorFactoryDescriptor.ConnectorFactoryCreator
Default (type-safe) creator implementation.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Supplier<ConnectorParameter> private Map<Class<?>, DefaultConnectorFactoryDescriptor.SerializerSupplier<?>> private Map<Class<?>, DefaultConnectorFactoryDescriptor.SerializerSupplier<?>> private DefaultConnectorFactoryDescriptor.ProtocolAdapterSupplier<?, ?, ?, ?> private String -
Constructor Summary
ConstructorsConstructorDescriptionDefaultConnectorFactoryCreator(String serviceId) Creates a factory creator instance for a givenservuceId. -
Method Summary
Modifier and TypeMethodDescriptioncreateChanneledInputSerializer(Class<T> cls) Creates a channeled input serializer for the givenserviceIdand the given typecls.createChanneledOutputSerializer(Class<T> cls) Creates a channeled output serializer for the givenserviceIdand the given typecls.Creates the default connector parameter instance.<O,I, CO, CI>
ProtocolAdapter<O,I, CO, CI>[] createProtocolAdapter(de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates the default connector protocol adapter.Returns the associated plugin id.supply(DefaultConnectorFactoryDescriptor.PathSupplier<ProtocolAdapter<O, I, CO, CI>> protoSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Adds a protocol adapter supplier.supply(Supplier<ConnectorParameter> connSupplier) Adds a connector parameter supplier.supplyForInput(Supplier<ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T>> supplier, Class<T> cls) Adds an input serializer supplier.supplyForOutput(Supplier<ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T>> supplier, Class<T> cls) Adds an output serializer supplier.supplyMulti(DefaultConnectorFactoryDescriptor.PathSupplier<ProtocolAdapter<O, I, CO, CI>[]> protoSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Adds a protocol adapter supplier.
-
Field Details
-
serviceId
-
connSupplier
-
protoSupplier
-
inputSerializerSupplier
private Map<Class<?>,DefaultConnectorFactoryDescriptor.SerializerSupplier<?>> inputSerializerSupplier -
outputSerializerSupplier
private Map<Class<?>,DefaultConnectorFactoryDescriptor.SerializerSupplier<?>> outputSerializerSupplier
-
-
Constructor Details
-
DefaultConnectorFactoryCreator
Creates a factory creator instance for a givenservuceId. Requires calls to the supplier-methods after instance creation.- Parameters:
serviceId- the service id
-
-
Method Details
-
supply
public DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator supply(Supplier<ConnectorParameter> connSupplier) Adds a connector parameter supplier.- Parameters:
connSupplier- the supplier to be called, may be null but thencreateConnectorParameter()will return null- Returns:
- this for chaining
-
supply
public <O,I, DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator supplyCO, CI> (DefaultConnectorFactoryDescriptor.PathSupplier<ProtocolAdapter<O, I, CO, CI>> protoSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Adds a protocol adapter supplier.- 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:
protoSupplier- the supplier to be called, may be null, will return nulloClass- the type forOiClass- the type forIcoClass- the type forCOciClass- the type forCI- Returns:
- this for chaining
-
supplyMulti
public <O,I, DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator supplyMultiCO, CI> (DefaultConnectorFactoryDescriptor.PathSupplier<ProtocolAdapter<O, I, CO, CI>[]> protoSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Adds a protocol adapter supplier.- 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:
protoSupplier- the supplier to be called, may be null, will return nulloClass- the type forOiClass- the type forIcoClass- the type forCOciClass- the type forCI- Returns:
- this for chaining
-
supplyForInput
public <T> DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator supplyForInput(Supplier<ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T>> supplier, Class<T> cls) Adds an input serializer supplier.- Type Parameters:
T- the data type- Parameters:
supplier- the suppliercls- the data type class- Returns:
- this for chaining
-
supplyForOutput
public <T> DefaultConnectorFactoryDescriptor.DefaultConnectorFactoryCreator supplyForOutput(Supplier<ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T>> supplier, Class<T> cls) Adds an output serializer supplier.- Type Parameters:
T- the data type- Parameters:
supplier- the suppliercls- the data type class- Returns:
- this for chaining
-
getPluginId
Description copied from interface:ConnectorFactoryDescriptor.ConnectorFactoryCreatorReturns the associated plugin id.- Specified by:
getPluginIdin interfaceConnectorFactoryDescriptor.ConnectorFactoryCreator- Returns:
- the plugin id
-
createConnectorParameter
Description copied from interface:ConnectorFactoryDescriptor.ConnectorFactoryCreatorCreates the default connector parameter instance.- Specified by:
createConnectorParameterin interfaceConnectorFactoryDescriptor.ConnectorFactoryCreator- Returns:
- the connector parameter
-
createProtocolAdapter
public <O,I, ProtocolAdapter<O,CO, CI> I, createProtocolAdapterCO, CI>[] (de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Description copied from interface:ConnectorFactoryDescriptor.ConnectorFactoryCreatorCreates the default connector protocol adapter.- Specified by:
createProtocolAdapterin interfaceConnectorFactoryDescriptor.ConnectorFactoryCreator- 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:
metrics- the metrics provider to use, null for no metric measurementslog- the log file to use to record individual measurements in experiments, null for no logging. Only becomes active ifmetricsis not nullinPathSupplier- function returning the actual input base path to use for data accesses, may be nulloutPathSupplier- function returning the actual output base path to use for data accesses, may be nulloClass- the actual type ofOiClass- the actual type ofIcoClass- the actual type ofCOciClass- the actual type ofCI- Returns:
- the connector protocol adapter
-
createChanneledInputSerializer
public <T> ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T> createChanneledInputSerializer(Class<T> cls) Description copied from interface:ConnectorFactoryDescriptor.ConnectorFactoryCreatorCreates a channeled input serializer for the givenserviceIdand the given typecls.- Specified by:
createChanneledInputSerializerin interfaceConnectorFactoryDescriptor.ConnectorFactoryCreator- Type Parameters:
T- the data type- Parameters:
cls- the data type- Returns:
- the serializer or null if unknown
-
createChanneledOutputSerializer
public <T> ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T> createChanneledOutputSerializer(Class<T> cls) Description copied from interface:ConnectorFactoryDescriptor.ConnectorFactoryCreatorCreates a channeled output serializer for the givenserviceIdand the given typecls.- Specified by:
createChanneledOutputSerializerin interfaceConnectorFactoryDescriptor.ConnectorFactoryCreator- Type Parameters:
T- the data type- Parameters:
cls- the data type- Returns:
- the serializer or null if unknown
-