Interface ConnectorFactory<O,I,CO,CI,A extends 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 connectorA- the protocol adapter type
public interface ConnectorFactory<O,I,CO,CI,A extends ProtocolAdapter<O,I,CO,CI>>
Creates a single connector instance or allows to dynamically choose among multiple connector
types of the same kind. Implementations must have a publicly accessible no-arg constructor.
- Author:
- Holger Eichelberger, SSE
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T> createChanneledSerializer(String serviceId, boolean input, Class<T> cls) Creates a channeled input/output serializer for the givenserviceIdand the given typecls.createConnector(ConnectorParameter params, A... adapter) Creates a connector based on the given connector parameters.static <O,I, CO, CI, A extends ProtocolAdapter<O, I, CO, CI>>
Connector<O, I, CO, CI> createConnector(String cls, ConnectorParameter params, A... adapter) Creates a connector instance.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, ConnectorParameter params, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, ConnectorParameter params, 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 a connector for a givenserviceId.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, ConnectorParameter params, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, ConnectorParameter params, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId.static <O,I, CO, CI, A extends ProtocolAdapter<O, I, CO, CI>>
Connector<O, I, CO, CI> createConnector(String cls, Supplier<ConnectorParameter> params, A... adapter) Creates a connector instance.static <O,I, CO, CI>
Connector<O, I, CO, CI> createConnector(String serviceId, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId.static <O,I, CO, CI, S extends AdapterSelector<O, I, CO, CI>, A extends ProtocolAdapter<O, I, CO, CI>>
Connector<O, I, CO, CI> createConnectorByPlugin(String pluginId, boolean log, Supplier<ConnectorParameter> params, S selector, A... adapter) Creates a connector instance from a plugin of typeConnectorDescriptor, see alsoAbstractPluginConnectorDescriptor.static <O,I, CO, CI, A extends ProtocolAdapter<O, I, CO, CI>>
Connector<O, I, CO, CI> createConnectorByPlugin(String pluginId, Supplier<ConnectorParameter> params, A... adapter) Creates a connector instance from a plugin of typeConnectorDescriptor, see alsoAbstractPluginConnectorDescriptor.static ConnectorParametercreateConnectorParameter(String serviceId) Creates the default connector parameter for a givenserviceId.static booleanhasService(ConnectorParameter params) Returns whether connector parameter is given and has a service.static booleanhasVersion(ConnectorParameter params) Returns whether connector parameter is given and has service containing a version with version number.
-
Method Details
-
createConnector
Creates a connector based on the given connector parameters.- Parameters:
params- the parametersadapter- the protocol adapters to create the connector for- Returns:
- the connector
-
hasService
Returns whether connector parameter is given and has a service.- Parameters:
params- the parameters- Returns:
truefor service,false else
-
hasVersion
Returns whether connector parameter is given and has service containing a version with version number.- Parameters:
params- the parameters- Returns:
truefor version,false else
-
createConnector
@SafeVarargs static <O,I, Connector<O,CO, CI, A extends ProtocolAdapter<O, I, CO, CI>> I, createConnectorCO, CI> (String cls, ConnectorParameter params, A... adapter) Creates a connector instance.- 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 connectorA- the adapter type- Parameters:
cls- the class or plugin id of the connector or of the connector factory indirectly creating the connector. Connectors must have at least a one-arg public constructor takingadaptersparams- the connector parameters supplieradapter- the protocol adapters to create the connector for- Returns:
- the connector instance or null if none can be created
- See Also:
-
createConnector
@SafeVarargs static <O,I, Connector<O,CO, CI, A extends ProtocolAdapter<O, I, CO, CI>> I, createConnectorCO, CI> (String cls, Supplier<ConnectorParameter> params, A... adapter) Creates a connector instance.- 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 connectorA- the adapter type- Parameters:
cls- the class or plugin id of the connector or of the connector factory indirectly creating the connector. Connectors must have at least a one-arg public constructor takingadaptersparams- the connector parameters supplieradapter- the protocol adapters to create the connector for- Returns:
- the connector instance or null if none can be created
-
createConnectorByPlugin
static <O,I, Connector<O,CO, CI, A extends ProtocolAdapter<O, I, CO, CI>> I, createConnectorByPluginCO, CI> (String pluginId, Supplier<ConnectorParameter> params, A... adapter) Creates a connector instance from a plugin of typeConnectorDescriptor, see alsoAbstractPluginConnectorDescriptor. Logs errors.- 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 connectorA- the adapter type- Parameters:
pluginId- the plugin idparams- the connector parameters supplieradapter- the protocol adapters to create the connector for- Returns:
- the connector instance or null if none can be created
-
createConnectorByPlugin
static <O,I, Connector<O,CO, CI, S extends AdapterSelector<O, I, CO, CI>, A extends ProtocolAdapter<O, I, CO, CI>> I, createConnectorByPluginCO, CI> (String pluginId, boolean log, Supplier<ConnectorParameter> params, S selector, A... adapter) Creates a connector instance from a plugin of typeConnectorDescriptor, see alsoAbstractPluginConnectorDescriptor.- 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 connectorS- the selector typeA- the adapter type- Parameters:
pluginId- the plugin idlog- shall plugin errors be loggedparams- the connector parameters supplierselector- the adapter selector, may be null for noneadapter- the protocol adapters to create the connector for- Returns:
- the connector instance or null if none can be created
-
createConnectorParameter
Creates the default connector parameter for a givenserviceId.- Returns:
- the connector parameter instance or null if no instance can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!)oClass- the actual type ofOiClass- the actual type ofIcoClass- the actual type ofCOciClass- the actual type ofCI- Returns:
- the connector or null if no connector can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, ConnectorParameter params, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!)params- connector params to use, may be null for implicitly obtaining the default connector paramsoClass- the actual type ofOiClass- the actual type ofIcoClass- the actual type ofCOciClass- the actual type ofCI- Returns:
- the connector or null if no connector can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, ConnectorParameter params, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!)params- connector params to use, may be null for implicitly obtaining the default connector paramsinPathSupplier- 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 or null if no connector can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, Supplier<String> inPathSupplier, Supplier<String> outPathSupplier, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!)inPathSupplier- 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 or null if no connector can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!) becomes active ifmetricsis not nullmetrics- 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. OnlyoClass- the actual type ofOiClass- the actual type ofIcoClass- the actual type ofCOciClass- the actual type ofCI- Returns:
- the connector or null if no connector can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, ConnectorParameter params, de.iip_ecosphere.platform.support.metrics.MetricsProvider metrics, File log, Class<O> oClass, Class<I> iClass, Class<CO> coClass, Class<CI> ciClass) Creates a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!)params- connector params to use, may be null for implicitly obtaining the default connector params becomes active ifmetricsis not nullmetrics- 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. OnlyoClass- the actual type ofOiClass- the actual type ofIcoClass- the actual type ofCOciClass- the actual type ofCI- Returns:
- the connector or null if no connector can be created
-
createConnector
static <O,I, Connector<O,CO, CI> I, createConnectorCO, CI> (String serviceId, ConnectorParameter params, 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 a connector for a givenserviceId. Connector instances may only be available after the app build process has been completed once.- 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:
serviceId- the id of the service to create the connector for (not the plugin id!)params- connector params to use, may be null for implicitly obtaining the default connector paramsmetrics- 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 or null if no connector can be created
-
createChanneledSerializer
static <T> ChanneledConnectorOutputTypeAdapter.ChanneledSerializer<T> createChanneledSerializer(String serviceId, boolean input, Class<T> cls) Creates a channeled input/output serializer for the givenserviceIdand the given typecls. If serializers are registered, they shall be available already in early app build stages so that service unit test can rely on the instances.- Type Parameters:
T- the data type- Parameters:
serviceId- the service idinput- input (parser) or output formattercls- the data type- Returns:
- the serializer or null if unknown
-