Class TraceToAasService
- java.lang.Object
-
- de.iip_ecosphere.platform.services.environment.AbstractService
-
- de.iip_ecosphere.platform.services.environment.services.TraceToAasService
-
- All Implemented Interfaces:
ParameterConfigurerProvider,Service,ServiceBase
public class TraceToAasService extends AbstractService
Implements a generic service that mapsTraceRecordto an (application) AAS. This service is in development/preliminary. The service does not take any data or produce data, it is just meant to create up the trace record AAS entries. It can be used as a sink. Currently, the service builds up the AAS of an application. However, this functionality shall be moved that the platform is providing the AAS and the service just hooks the traces submodel into.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTraceToAasService.ConverterA configured transport to AAS converter forTraceRecord.private static classTraceToAasService.YamlConstructionInfoRepresents construction information.
-
Field Summary
Fields Modifier and Type Field Description private de.iip_ecosphere.platform.support.iip_aas.ApplicationSetupappSetupprivate YamlArtifactartifactprivate TraceToAasService.Converterconverterprivate java.util.Map<java.lang.String,ParameterConfigurer<?>>paramConfigurersstatic java.lang.StringPROPERTY_ACTIONstatic java.lang.StringPROPERTY_PAYLOADstatic java.lang.StringPROPERTY_PAYLOAD_TYPEstatic java.lang.StringPROPERTY_SOURCEstatic java.lang.StringPROPERTY_TIMESTAMPstatic java.lang.StringSUBMODEL_COMMANDSstatic java.lang.StringSUBMODEL_SERVICESstatic java.lang.StringSUBMODEL_TRACESstatic java.lang.StringVERSION-
Fields inherited from interface de.iip_ecosphere.platform.services.environment.switching.ServiceBase
APPLICATION_SEPARATOR, DEFAULT_APPLICATION_INSTANCE_ID
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTraceToAasService(TraceToAasService.YamlConstructionInfo info)Intermediary constructor based onTraceToAasService.YamlConstructionInfo.TraceToAasService(YamlArtifact artifact, java.lang.String serviceId)Creates a service instance.TraceToAasService(de.iip_ecosphere.platform.support.iip_aas.ApplicationSetup app, YamlService yaml)Creates a service instance.TraceToAasService(java.lang.String serviceId, java.io.InputStream ymlFile)Creates a service instance from a service id and a YAML artifact.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddConverter(java.lang.Class<?> cls, TransportToAasConverter.TypeConverter converter)Adds/overwrites a converter.protected <T> voidaddParameterConfigurer(ParameterConfigurer<T> configurer)Adds a parameter configurer.protected voidaugmentCommandsSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder)Allows adding application-specific elements to the command submodel, e.g., operations.private voidaugmentServicesSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder)Adds elements to the services submodel if available.protected TraceToAasService.ConvertercreateConverter()Creates the actual converter instance.java.lang.StringgetAasId()Returns the AAS idShort of the AAS represented by this service/application.java.lang.StringgetAasUrn()Returns the AAS URN of the AAS represented by this service/application.de.iip_ecosphere.platform.support.iip_aas.ApplicationSetupgetApplicationSetup()Returns the application setup.ParameterConfigurer<?>getParameterConfigurer(java.lang.String paramName)Returns the parameter configurer for a given parameter.protected java.lang.StringmapPayloadType(java.lang.Class<?> cls)Allows for application specific payload type names.voidmigrate(java.lang.String resourceId)Migrates a service.protected voidsetTimeout(long timeout)Changes the timeout until trace events are deleted.protected ServiceStatestart()Starts the service and the background process.protected ServiceStatestop()Stops the service and the background process.voidswitchTo(java.lang.String targetId)Switches to an interface-compatible service.voidupdate(java.net.URI location)Updates the service by the service in the givenlocation.-
Methods inherited from class de.iip_ecosphere.platform.services.environment.AbstractService
activate, addConfigurer, addConfigurer, addConfigurer, createInstance, createInstance, createInstance, getDescription, getId, getKind, getName, getNetMgtKeyAddress, getResourceAsStream, getState, getVersion, initializeFrom, isDeployable, isTopLevel, notifyReconfigured, passivate, reconf, reconfigure, reconfigure, rollbackReconfigurationOnFailure, setLibJars, setState
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.iip_ecosphere.platform.services.environment.Service
getParameterNames
-
-
-
-
Field Detail
-
VERSION
public static final java.lang.String VERSION
- See Also:
- Constant Field Values
-
SUBMODEL_TRACES
public static final java.lang.String SUBMODEL_TRACES
- See Also:
- Constant Field Values
-
SUBMODEL_COMMANDS
public static final java.lang.String SUBMODEL_COMMANDS
- See Also:
- Constant Field Values
-
SUBMODEL_SERVICES
public static final java.lang.String SUBMODEL_SERVICES
- See Also:
- Constant Field Values
-
PROPERTY_SOURCE
public static final java.lang.String PROPERTY_SOURCE
- See Also:
- Constant Field Values
-
PROPERTY_ACTION
public static final java.lang.String PROPERTY_ACTION
- See Also:
- Constant Field Values
-
PROPERTY_TIMESTAMP
public static final java.lang.String PROPERTY_TIMESTAMP
- See Also:
- Constant Field Values
-
PROPERTY_PAYLOAD_TYPE
public static final java.lang.String PROPERTY_PAYLOAD_TYPE
- See Also:
- Constant Field Values
-
PROPERTY_PAYLOAD
public static final java.lang.String PROPERTY_PAYLOAD
- See Also:
- Constant Field Values
-
paramConfigurers
private java.util.Map<java.lang.String,ParameterConfigurer<?>> paramConfigurers
-
appSetup
private de.iip_ecosphere.platform.support.iip_aas.ApplicationSetup appSetup
-
artifact
private YamlArtifact artifact
-
converter
private TraceToAasService.Converter converter
-
-
Constructor Detail
-
TraceToAasService
public TraceToAasService(de.iip_ecosphere.platform.support.iip_aas.ApplicationSetup app, YamlService yaml)Creates a service instance.- Parameters:
app- static information about the applicationyaml- the service description
-
TraceToAasService
public TraceToAasService(java.lang.String serviceId, java.io.InputStream ymlFile)Creates a service instance from a service id and a YAML artifact.- Parameters:
serviceId- the service idymlFile- the YML file containing the YAML artifact with the service descriptor
-
TraceToAasService
private TraceToAasService(TraceToAasService.YamlConstructionInfo info)
Intermediary constructor based onTraceToAasService.YamlConstructionInfo.- Parameters:
info- the information instance
-
TraceToAasService
public TraceToAasService(YamlArtifact artifact, java.lang.String serviceId)
Creates a service instance.- Parameters:
artifact- static information about the artifact this service is member ofserviceId- the id of the service
-
-
Method Detail
-
createConverter
protected TraceToAasService.Converter createConverter()
Creates the actual converter instance.- Returns:
- the converter
-
setTimeout
protected void setTimeout(long timeout)
Changes the timeout until trace events are deleted.- Parameters:
timeout- the timeout in ms
-
getApplicationSetup
public de.iip_ecosphere.platform.support.iip_aas.ApplicationSetup getApplicationSetup()
Returns the application setup.- Returns:
- the application setup
-
addParameterConfigurer
protected <T> void addParameterConfigurer(ParameterConfigurer<T> configurer)
Adds a parameter configurer.- Type Parameters:
T- the type of the parameter- Parameters:
configurer- the configurer instance, ignored if null
-
addConverter
protected void addConverter(java.lang.Class<?> cls, TransportToAasConverter.TypeConverter converter)Adds/overwrites a converter.- Parameters:
cls- the class the converter applies toconverter- the converter instance
-
getAasId
public java.lang.String getAasId()
Returns the AAS idShort of the AAS represented by this service/application.- Returns:
- the idShort
-
getAasUrn
public java.lang.String getAasUrn()
Returns the AAS URN of the AAS represented by this service/application.- Returns:
- the URN
-
mapPayloadType
protected java.lang.String mapPayloadType(java.lang.Class<?> cls)
Allows for application specific payload type names.- Parameters:
cls- the type- Returns:
- the mapped name
-
start
protected ServiceState start() throws java.util.concurrent.ExecutionException
Description copied from class:AbstractServiceStarts the service and the background process.- Overrides:
startin classAbstractService- Returns:
- the state to transition to, may be null for none
- Throws:
java.util.concurrent.ExecutionException- if starting the process fails
-
stop
protected ServiceState stop()
Description copied from class:AbstractServiceStops the service and the background process.- Overrides:
stopin classAbstractService- Returns:
- the state to transition to, may be null for none
-
augmentServicesSubmodel
private void augmentServicesSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder)
Adds elements to the services submodel if available.- Parameters:
smBuilder- the submodel builder
-
augmentCommandsSubmodel
protected void augmentCommandsSubmodel(de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder smBuilder)
Allows adding application-specific elements to the command submodel, e.g., operations.- Parameters:
smBuilder- the builder, do not callBuilder.build()in here!
-
migrate
public void migrate(java.lang.String resourceId) throws java.util.concurrent.ExecutionExceptionDescription copied from interface:ServiceMigrates a service. However, it may be required to migrate/move the containing artifact. [adaptation]- Parameters:
resourceId- the target resource id, e.g., a device- Throws:
java.util.concurrent.ExecutionException- if migration fails
-
update
public void update(java.net.URI location) throws java.util.concurrent.ExecutionExceptionDescription copied from interface:ServiceUpdates the service by the service in the givenlocation. This operation is responsible for stopping the running service (if needed), replacing it, starting the new service.- Parameters:
location- the location of the new service, e.g., an URL- Throws:
java.util.concurrent.ExecutionException- if the given service cannot be updated for some reason, e.g., because the replacement service is not an evolved version of the running service
-
switchTo
public void switchTo(java.lang.String targetId) throws java.util.concurrent.ExecutionExceptionDescription copied from interface:ServiceSwitches to an interface-compatible service. This method cares for stopping the old service, performing a handover if adequate, starting thetargetservice. [adaptation]- Parameters:
targetId- the id of the target service- Throws:
java.util.concurrent.ExecutionException- if switching the service cannot be performed for some reason
-
getParameterConfigurer
public ParameterConfigurer<?> getParameterConfigurer(java.lang.String paramName)
Description copied from interface:ParameterConfigurerProviderReturns the parameter configurer for a given parameter. We need this generic approach to ease code generation and initial setting of parameter values.- Parameters:
paramName- the name of the parameter- Returns:
- the associated parameter configurer or null if there is none
-
-