Class TransportConverterFactory
java.lang.Object
de.iip_ecosphere.platform.services.environment.services.TransportConverterFactory
- Direct Known Subclasses:
WsTransportConverterFactory
Creates instances for the transport converter service support.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNetwork manager key for transport gateway.private static TransportConverterFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal <T> TransportConverter<T> createConverter(de.iip_ecosphere.platform.support.Endpoint endpoint, String transportStream, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter instance.final <T> TransportConverter<T> createConverter(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String transportStream, String path, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter instance.abstract <T> TransportConverter<T> createConverterImpl(de.iip_ecosphere.platform.support.Endpoint endpoint, String transportStream, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter instance.final <T> Sender<T> createSender(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter sender instance.final <T> Sender<T> createSender(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter sender instance.protected abstract <T> Sender<T> createSenderImpl(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter sender instance.final de.iip_ecosphere.platform.support.ServercreateServer(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport) Creates a converter server instance.abstract de.iip_ecosphere.platform.support.ServercreateServer(de.iip_ecosphere.platform.support.ServerAddress address) Creates a converter server instance.final <T> TransportConverter.Watcher<T> createWatcher(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls, int period) Creates a watcher instance.final <T> TransportConverter.Watcher<T> createWatcher(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls, int period) Creates a watcher instance.protected abstract <T> TransportConverter.Watcher<T> createWatcherImpl(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls, int period) Creates a watcher instance.protected static <R> RcreateWithUri(de.iip_ecosphere.platform.support.Endpoint endpoint, Function<URI, R> creator) Creates some instance with a URI.protected <R> RcreateWithUri(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path, Function<URI, R> creator) Creates some instance with a URI.static <T> de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> ensureTranslator(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Ensures the existence of a translator instance.abstract de.iip_ecosphere.platform.support.EndpointgetGatewayEndpoint(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path) Returns an endpoint for the given path.static TransportConverterFactoryReturns the actual factory instance.de.iip_ecosphere.platform.support.EndpointvalidateGatewayEndpoint(de.iip_ecosphere.platform.support.Endpoint endpoint) Validates a gateway endpoint with respect to a modified ephemeral port.
-
Field Details
-
GATEWAY_PORT_KEY
Network manager key for transport gateway.- See Also:
-
instance
-
-
Constructor Details
-
TransportConverterFactory
public TransportConverterFactory()
-
-
Method Details
-
getInstance
Returns the actual factory instance.- Returns:
- the factor instance
-
createSender
public final <T> Sender<T> createSender(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter sender instance. The implementing factory is free to choose which information to take and may fail if required information is not given.- Type Parameters:
T- the type of data to be sent- Parameters:
aas- the AAS setup for AAS-based senderstransport- the transport setup for transport-based senderspath- within the mechanism to identify the data, may be an id short, an URI sub-path etc.translator- the type-to-sender format translator, may be nullcls- the data type class- Returns:
- the sender instance, may be null
- See Also:
-
createSender
public final <T> Sender<T> createSender(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter sender instance.- Type Parameters:
T- the type of data to be sent- Parameters:
endpoint- the server endpointtranslator- the type-to-sender format translator, may be nullcls- the data type class- Returns:
- the sender instance, may be null
- See Also:
-
createSenderImpl
protected abstract <T> Sender<T> createSenderImpl(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter sender instance.- Type Parameters:
T- the type of data to be sent- Parameters:
endpoint- the server endpointtranslator- the type-to-sender format translatorcls- the data type class- Returns:
- the sender instance, may be null
-
createWatcher
public final <T> TransportConverter.Watcher<T> createWatcher(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls, int period) Creates a watcher instance. The implementing factory is free to choose which information to take and may fail if required information is not given.- Type Parameters:
T- the type of data to be watched- Parameters:
aas- the AAS setup for AAS-based watcherstransport- the transport setup for transport-based watcherspath- within the mechanism to identify the data, may be an id short, an URI sub-path etc.translator- the receiver-to-type format translator (may be null)cls- the data type classperiod- the watching period in ms- Returns:
- the watcher instance, may be null
- See Also:
-
createWatcher
public final <T> TransportConverter.Watcher<T> createWatcher(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls, int period) Creates a watcher instance.- Type Parameters:
T- the type of data to be watched- Parameters:
endpoint- the server endpointtranslator- the receiver-to-type format translatorcls- the data type classperiod- the watching period in ms- Returns:
- the watcher instance, may be null
- See Also:
-
createWatcherImpl
protected abstract <T> TransportConverter.Watcher<T> createWatcherImpl(de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls, int period) Creates a watcher instance.- Type Parameters:
T- the type of data to be watched- Parameters:
endpoint- the server endpointtranslator- the receiver-to-type format translatorcls- the data type classperiod- the watching period in ms- Returns:
- the watcher instance, may be null
-
createConverter
public final <T> TransportConverter<T> createConverter(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String transportStream, String path, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter instance. The implementing factory is free to choose which information to take and may fail if required information is not given.- Type Parameters:
T- the type of data to be watched- Parameters:
aas- the AAS setup for AAS-based watcherstransport- the transport setup for transport-based watcherstransportStream- the stream to listen topath- within the mechanism to stream the data to, may be an id short, an URI sub-path etc.translator- the receiver-to-type format translator (may be null)cls- the data type class- Returns:
- the converter instance, may be null
- See Also:
-
createConverter
public final <T> TransportConverter<T> createConverter(de.iip_ecosphere.platform.support.Endpoint endpoint, String transportStream, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter instance. The implementing factory is free to choose which information to take and may fail if required information is not given.- Type Parameters:
T- the type of data to be watched- Parameters:
endpoint- the server endpointtransportStream- the stream to listen totranslator- the receiver-to-type format translator (may be null)cls- the data type class- Returns:
- the converter instance, may be null
- See Also:
-
createConverterImpl
public abstract <T> TransportConverter<T> createConverterImpl(de.iip_ecosphere.platform.support.Endpoint endpoint, String transportStream, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Creates a converter instance. The implementing factory is free to choose which information to take and may fail if required information is not given.- Type Parameters:
T- the type of data to be watched- Parameters:
endpoint- the server endpointtransportStream- the stream to listen totranslator- the receiver-to-type format translatorcls- the data type class- Returns:
- the converter instance, may be null
-
ensureTranslator
public static <T> de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T,String> ensureTranslator(de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator, Class<T> cls) Ensures the existence of a translator instance. [public for testing]- Type Parameters:
T- the data type- Parameters:
translator- the type translator; if null,GenericJsonToStringTranslatoris usedcls- the data type class- Returns:
- the type translator, either
tanslatoror a default instance
-
createWithUri
protected <R> R createWithUri(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path, Function<URI, R> creator) Creates some instance with a URI.- Type Parameters:
R- the resulting instance type- Parameters:
aas- the AAS setuptransport- the transport setup to takeTransportSetup.getGatewayServerEndpoint(Schema, String)frompath- the path for determining the gateway server endpointcreator- the creator function- Returns:
- created instance, may be null
- See Also:
-
createWithUri
protected static <R> R createWithUri(de.iip_ecosphere.platform.support.Endpoint endpoint, Function<URI, R> creator) Creates some instance with a URI.- Type Parameters:
R- the resulting instance type- Parameters:
endpoint- the endpoint to take the URI fromcreator- the creator function- Returns:
- created instance, may be null
-
createServer
public final de.iip_ecosphere.platform.support.Server createServer(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport) Creates a converter server instance. The implementing factory is free to choose which information to take and may fail if required information is not given. If the configured port is not positive, an ephemeral port will be used for creating the server.- Parameters:
aas- the AAS setup for AAS-based senderstransport- the transport setup for transport-based senders, may be modified for emphemeral ports- Returns:
- the server instance, may be null if none is required for the actual factory
- See Also:
-
createServer
public abstract de.iip_ecosphere.platform.support.Server createServer(de.iip_ecosphere.platform.support.ServerAddress address) Creates a converter server instance.- Parameters:
address- the server address- Returns:
- the server instance, may be null if none is required for the actual factory
-
getGatewayEndpoint
public abstract de.iip_ecosphere.platform.support.Endpoint getGatewayEndpoint(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aas, de.iip_ecosphere.platform.transport.connectors.TransportSetup transport, String path) Returns an endpoint for the given path. The implementing factory is free to choose which information to take and may fail if required information is not given.- Parameters:
aas- the AAS setup for AAS-based senderstransport- the transport setup for transport-based senderspath- the path within the resulting endpoint- Returns:
- the endpoint
-
validateGatewayEndpoint
public de.iip_ecosphere.platform.support.Endpoint validateGatewayEndpoint(de.iip_ecosphere.platform.support.Endpoint endpoint) Validates a gateway endpoint with respect to a modified ephemeral port.- Parameters:
endpoint- the endpoint to validate- Returns:
endpointor the validated/modified endpoint
-