Class TransportToWsConverter<T>
java.lang.Object
de.iip_ecosphere.platform.services.environment.services.TransportConverter<T>
de.iip_ecosphere.platform.services.environment.services.TransportToWsConverter<T>
- Type Parameters:
T- the data type
Transport converter for websockets. Use
createServer(ServerAddress) to create a server.- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested classes/interfaces inherited from class de.iip_ecosphere.platform.services.environment.services.TransportConverter
TransportConverter.ConverterInstances<T>, TransportConverter.Watcher<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate de.iip_ecosphere.platform.support.Endpointprivate booleanstatic final de.iip_ecosphere.platform.support.SchemaFields inherited from class de.iip_ecosphere.platform.services.environment.services.TransportConverter
NAME_COLL_ENDPOINTS, NAME_PROP_HOST, NAME_PROP_PATH, NAME_PROP_PORT, NAME_PROP_SCHEMA, NAME_PROP_URI, PREFIX_GETTER -
Constructor Summary
ConstructorsConstructorDescriptionTransportToWsConverter(String transportStream, Class<T> dataType, de.iip_ecosphere.platform.support.Endpoint endpoint) Creates a transport to web socket converter running the server in this instance.TransportToWsConverter(String transportStream, Class<T> dataType, de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator) Creates a transport to web socket converter running the server in this instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TransportConverter.ConverterInstances<T> createInstances(String transportStream, Class<T> cls, de.iip_ecosphere.platform.support.Server server, de.iip_ecosphere.platform.transport.connectors.TransportSetup setup, Service service) Creates a combined set of server/converter instances.static de.iip_ecosphere.platform.support.ServercreateServer(de.iip_ecosphere.platform.support.ServerAddress address) Creates a server instance for the given address.createWatcher(int period) Creates a watcher instance.de.iip_ecosphere.platform.support.EndpointReturns the server endpoint to connect to.protected static de.iip_ecosphere.platform.support.logging.LoggerReturns the logger.Returns the type translator.protected voidHandles a new trace record.voidinitializeSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder) Initializes the submodel.voidsetExcludedFields(Set<String> excludedFields) Sets the excluded fields forTransportConverter.handleNew(Object).voidstart(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aasSetup) Starts the transport tracer.voidstop()Stops the transport, deletes the AAS.Methods inherited from class de.iip_ecosphere.platform.services.environment.services.TransportConverter
addEndpointToAas, addNotifier, cleanup, getEndpoint, getEndpoint, getExcludedFieldsArray, getType, getValue, isAasEnabled, isAasStarted, isExcludedField, isGetter, isTraceInAas, mapPayloadType, setAasEnabledSupplier, setCleanupTimeout, setHandleNewFilter, setTimeout, toAasEndpointId
-
Field Details
-
SCHEMA
public static final de.iip_ecosphere.platform.support.Schema SCHEMA -
endpoint
private de.iip_ecosphere.platform.support.Endpoint endpoint -
sender
-
notConnectedError
private boolean notConnectedError -
typeTranslator
-
-
Constructor Details
-
TransportToWsConverter
public TransportToWsConverter(String transportStream, Class<T> dataType, de.iip_ecosphere.platform.support.Endpoint endpoint) Creates a transport to web socket converter running the server in this instance. The type translator will be the default one fromTransportToWsConverter(String, Class, Endpoint, TypeTranslator).- Parameters:
transportStream- the transport stream to listen ondataType- the data type to listen forendpoint- the server endpoint
-
TransportToWsConverter
public TransportToWsConverter(String transportStream, Class<T> dataType, de.iip_ecosphere.platform.support.Endpoint endpoint, de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T, String> translator) Creates a transport to web socket converter running the server in this instance.- Parameters:
transportStream- the transport stream to listen ondataType- the data type to listen forendpoint- the server endpointtranslator- the optional type translator- See Also:
-
-
Method Details
-
createInstances
public static <T> TransportConverter.ConverterInstances<T> createInstances(String transportStream, Class<T> cls, de.iip_ecosphere.platform.support.Server server, de.iip_ecosphere.platform.transport.connectors.TransportSetup setup, Service service) Creates a combined set of server/converter instances.- Type Parameters:
T- the data type- Parameters:
transportStream- the transport stream to create the converter forcls- the data classserver- the server, may be existing or nullsetup- the transport setupservice- the service to create the instances for- Returns:
- the instances object for server/converter
-
createServer
public static de.iip_ecosphere.platform.support.Server createServer(de.iip_ecosphere.platform.support.ServerAddress address) Creates a server instance for the given address.- Parameters:
address- the address- Returns:
- the server instance
-
setExcludedFields
Description copied from class:TransportConverterSets the excluded fields forTransportConverter.handleNew(Object).- Overrides:
setExcludedFieldsin classTransportConverter<T>- Parameters:
excludedFields- the excluded fields, may be null or empty for none
-
initializeSubmodel
public void initializeSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder) Description copied from class:TransportConverterInitializes the submodel.- Overrides:
initializeSubmodelin classTransportConverter<T>- Parameters:
smBuilder- the submodel builder
-
start
public void start(de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup aasSetup) Description copied from class:TransportConverterStarts the transport tracer.- Overrides:
startin classTransportConverter<T>- Parameters:
aasSetup- the AAS setup to use
-
stop
public void stop()Stops the transport, deletes the AAS.- Overrides:
stopin classTransportConverter<T>
-
handleNew
Description copied from class:TransportConverterHandles a new trace record. Called upon arrival. [protected for mocking]- Specified by:
handleNewin classTransportConverter<T>- Parameters:
data- the trace record data
-
getLogger
protected static de.iip_ecosphere.platform.support.logging.Logger getLogger()Returns the logger.- Returns:
- the logger
-
getEndpoint
public de.iip_ecosphere.platform.support.Endpoint getEndpoint()Description copied from class:TransportConverterReturns the server endpoint to connect to.- Overrides:
getEndpointin classTransportConverter<T>- Returns:
- the server endpoint, may be null for none, in particular if this connector is hosted by an AAS
-
createWatcher
Description copied from class:TransportConverterCreates a watcher instance.- Specified by:
createWatcherin classTransportConverter<T>- Parameters:
period- the watching period in ms- Returns:
- the watcher
-
getTypeTranslator
public de.iip_ecosphere.platform.transport.serialization.TypeTranslator<T,String> getTypeTranslator()Returns the type translator.- Returns:
- the type translator
-