Class AasPartRegistry
java.lang.Object
de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry
A registry for
AasContributor instances to be loaded via the Java Service loader.- Author:
- Holger Eichelberger, SSE
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the result of building the platform AAS.static enumAas installation/setup modes.static classThe technical setup of the AAS/VAB endpoints as data class to be used with a usual configuration format/YAML parser. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static intstatic final Stringstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final intstatic final de.iip_ecosphere.platform.support.Schemastatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringThe name of the top-level AAS created by this registry inbuild().static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate static AasPartRegistry.AasSetupstatic final StringThe URN of the top-level AAS created by this registry inbuild().static final StringThe URN of the asset of the top-level AAS created by this registry inbuild(). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static de.iip_ecosphere.platform.support.aas.PropertyaddAasEndpointProperty(de.iip_ecosphere.platform.support.aas.Registry reg, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, String property, String aasId) Adds a property tobuilderpointing to an AAS endpoint for an AAS with idserviceIdin registryreg.static de.iip_ecosphere.platform.support.aas.PropertyaddDeviceAasEndpointProperty(de.iip_ecosphere.platform.support.aas.Registry reg, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, String property, String deviceId) Adds a property tobuilderpointing to an AAS endpoint for a device with iddeviceIdin registryreg.static de.iip_ecosphere.platform.support.aas.PropertyaddServiceAasEndpointProperty(de.iip_ecosphere.platform.support.aas.Registry reg, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, String property, String serviceId) Adds a property tobuilderpointing to an AAS endpoint for a service with idserviceIdin registryreg.static <T extends de.iip_ecosphere.platform.support.aas.CorsEnabledRecipe>
TapplyCorsOrigin(T rcp, AasPartRegistry.AasSetup setup) build()Build up all AAS of the currently running platform part including all contributors.build(boolean startImplServer) Build up all AAS of the currently running platform part including all contributors.build(Predicate<AasContributor> filter) Build up all AAS of the currently running platform part.build(Predicate<AasContributor> filter, boolean startImplServer) Build up all AAS of the currently running platform part.build(Predicate<AasContributor> filter, boolean startImplServer, de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder) Build up all AAS of the currently running platform part.static StringcomposeIdentifier(String specificId) Composes an identifier based onURN_AASand the given specific identifier.static Set<Class<? extends AasContributor>> Returns the contributor classes.static Iterator<AasContributor> Returns the contributors.private static EndpointHolderCreates an AAS endpoint holder.private static EndpointHoldercreateAasEndpointHolder(de.iip_ecosphere.platform.support.Schema schema, String host, int port, String path) Creates an instance.static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuildercreateSubmodelBuilder(de.iip_ecosphere.platform.support.aas.Aas.AasBuilder aasBuilder, String idShort) Creates a submodel builder for the givenaasBuilderandidShortderiving the submodel identification viagetSubmodelIdentification(String).static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuildercreateSubmodelBuilder(de.iip_ecosphere.platform.support.aas.Aas aas, String idShort) Creates a submodel builder for the givenaasandidShortderiving the submodel identification viagetSubmodelIdentification(String).static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuildercreateSubmodelBuilderRbac(de.iip_ecosphere.platform.support.aas.Aas.AasBuilder aasBuilder, String idShort) Creates a submodel builder for the givenaasBuilderandidShortderiving the submodel identification viagetSubmodelIdentification(String)with default authentication, i.e.static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuildercreateSubmodelBuilderRbac(de.iip_ecosphere.platform.support.aas.Aas aas, String idShort) Creates a submodel builder for the givenaasandidShortderiving the submodel identification viagetSubmodelIdentification(String)with default authentication, i.e.static de.iip_ecosphere.platform.support.ServerDeploy the given AAS to a local server.static de.iip_ecosphere.platform.support.aas.AasReturns the first AAS inlistmatching the given name.static de.iip_ecosphere.platform.support.aas.AuthenticationDescriptorReturns the AAS authentication descriptor.private static ServiceLoader<AasContributor> Returns the contributor loader.static List<de.iip_ecosphere.platform.support.aas.Aas> Returns the real AAS server instance based on the instances it was initially built.static de.iip_ecosphere.platform.support.aas.RegistryReturns the AAS registry for the endpoint in the setup ofAasPartRegistry.static AasPartRegistry.AasSetupgetSetup()Returns the AAS setup.static de.iip_ecosphere.platform.support.aas.AuthenticationDescriptorReturns the submodel authentication descriptor.static StringgetSubmodelIdentification(String idShort) Returns the platform identification.private static booleanReturns whether AAS URL paths shall be ignored.static de.iip_ecosphere.platform.support.Serverregister(List<de.iip_ecosphere.platform.support.aas.Aas> aas, de.iip_ecosphere.platform.support.Endpoint registry, String... options) Registers the given AAS to a remote registry and creates a local server for the AAS.static voidremoteDeploy(AasPartRegistry.AasSetup setup, List<de.iip_ecosphere.platform.support.aas.Aas> aas) Performs a remote deployment of the givenaas.static voidremoteDeploy(List<de.iip_ecosphere.platform.support.aas.Aas> aas) Performs a remote deployment of the givenaas.static de.iip_ecosphere.platform.support.aas.AasretrieveAas(AasPartRegistry.AasSetup setup, String identifier) Obtains an AAS instance.static de.iip_ecosphere.platform.support.aas.AasretrieveAas(AasPartRegistry.AasSetup setup, String identifier, boolean populate) Obtains an AAS instance.static de.iip_ecosphere.platform.support.aas.AasretrieveAas(String identifier) Obtains an AAS instance via the setup in this class.static de.iip_ecosphere.platform.support.aas.AasObtains the IIP-Ecosphere platform AAS.static AasPartRegistry.AasSetupsetAasSetup(AasPartRegistry.AasSetup aasSetup) Defines the AAS setup without resetting the AAS device/component implementation port.static AasPartRegistry.AasSetupsetAasSetup(AasPartRegistry.AasSetup aasSetup, boolean resetImplPort) Defines the AAS setup.static voidsetAasSupplier(Supplier<List<de.iip_ecosphere.platform.support.aas.Aas>> supplier) Sets a supplier to provide instance to the real AAS server instance (rather than remote/connected instances viaretrieveIipAas().
-
Field Details
-
NAME_AAS
The name of the top-level AAS created by this registry inbuild().- See Also:
-
NAME_SUBMODEL_SERVICES
- See Also:
-
NAME_COLLECTION_SERVICES
- See Also:
-
NAME_SUBMODEL_RESOURCES
- See Also:
-
NAME_PROP_DEVICE_AAS
- See Also:
-
NAME_SUBMODEL_TRANSPORT
- See Also:
-
NAME_SUBMODEL_PLATFORM
- See Also:
-
NAME_SUBMODEL_NETWORK_MGT
- See Also:
-
NAME_SUBMODEL_TYPES
- See Also:
-
NAME_SUBMODEL_CONN_INSTALLED
- See Also:
-
NAME_SUBMODEL_CONN_ACTIVE
- See Also:
-
NAME_SUBMODEL_MONITORING
- See Also:
-
NAME_SUBMODEL_CONFIGURATION
- See Also:
-
NAME_SUBMODEL_ARTIFACTS
- See Also:
-
NAME_SUBMODEL_STATUS
- See Also:
-
NAME_SUBMODEL_APPINSTANCES
- See Also:
-
ID_PART_SERVICES
- See Also:
-
ID_PART_RESOURCES
- See Also:
-
ID_PART_DEVICES
- See Also:
-
ID_PART_TRANSPORT
- See Also:
-
ID_PART_PLATFORM
- See Also:
-
ID_PART_NETWORK
- See Also:
-
ID_PART_TECHNICAL_DATA
- See Also:
-
ID_PART_SW_NAMEPLATE
- See Also:
-
ID_PART_TYPES
- See Also:
-
ID_PART_CONN_INSTALLED
- See Also:
-
ID_PART_CONN_ACTIVE
- See Also:
-
ID_PART_MONITORING
- See Also:
-
ID_PART_CONFIGURATION
- See Also:
-
ID_PART_ARTIFACTS
- See Also:
-
ID_PART_STATUS
- See Also:
-
ID_PART_APPINSTANCES
- See Also:
-
URN_AAS
The URN of the top-level AAS created by this registry inbuild().- See Also:
-
URN_AAS_ASSET
The URN of the asset of the top-level AAS created by this registry inbuild().- See Also:
-
DEFAULT_SCHEMA
public static final de.iip_ecosphere.platform.support.Schema DEFAULT_SCHEMA -
DEFAULT_HOST
- See Also:
-
NO_SPECIFIC_SERVER_HOST
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
DEFAULT_SM_PORT
public static final int DEFAULT_SM_PORT- See Also:
-
DEFAULT_REGISTRY_PORT
public static final int DEFAULT_REGISTRY_PORT- See Also:
-
DEFAULT_SM_REGISTRY_PORT
public static final int DEFAULT_SM_REGISTRY_PORT- See Also:
-
DEFAULT_PROTOCOL_PORT
public static final int DEFAULT_PROTOCOL_PORT- See Also:
-
DEFAULT_AAS_ENDPOINT
- See Also:
-
DEFAULT_REGISTRY_ENDPOINT
- See Also:
-
DEFAULT_PROTOCOL
- See Also:
-
setup
-
aasSupplier
-
aasImplPort
private static int aasImplPort -
idShortIdentificationMapping
-
-
Constructor Details
-
AasPartRegistry
public AasPartRegistry()
-
-
Method Details
-
ignoreAasUrlPaths
private static boolean ignoreAasUrlPaths()Returns whether AAS URL paths shall be ignored.- Returns:
truefor ignoring,falsefor considering- See Also:
-
createAasEndpointHolder
private static EndpointHolder createAasEndpointHolder(de.iip_ecosphere.platform.support.Schema schema, String host, int port, String path) Creates an instance. Dependent on the AAS factory, may disable URL paths. [factory]- Parameters:
schema- the schemahost- the host nameport- the portpath- the path denoting the endpoint
-
createAasEndpointHolder
Creates an AAS endpoint holder. Dependent on the AAS factory, may disable URL paths. [factory]- Parameters:
holder- the holder to take the information from- See Also:
-
getSubmodelIdentification
Returns the platform identification.- Parameters:
idShort- the idShort of the submodel- Returns:
- the submodel identification, may be null usually leading to an identification through
idShort
-
createSubmodelBuilder
public static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder createSubmodelBuilder(de.iip_ecosphere.platform.support.aas.Aas.AasBuilder aasBuilder, String idShort) Creates a submodel builder for the givenaasBuilderandidShortderiving the submodel identification viagetSubmodelIdentification(String).- Parameters:
aasBuilder- the "parent" AAS builderidShort- the idShort of the submodel- Returns:
- the submodel builder
-
createSubmodelBuilder
public static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder createSubmodelBuilder(de.iip_ecosphere.platform.support.aas.Aas aas, String idShort) Creates a submodel builder for the givenaasandidShortderiving the submodel identification viagetSubmodelIdentification(String).- Parameters:
aas- the "parent" AASidShort- the idShort of the submodel- Returns:
- the submodel builder
-
createSubmodelBuilderRbac
public static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder createSubmodelBuilderRbac(de.iip_ecosphere.platform.support.aas.Aas.AasBuilder aasBuilder, String idShort) Creates a submodel builder for the givenaasBuilderandidShortderiving the submodel identification viagetSubmodelIdentification(String)with default authentication, i.e. appliesRbacReceiver.rbacPlatform(AuthenticationDescriptor)withgetSubmodelAuthentication().- Parameters:
aasBuilder- the "parent" AAS builderidShort- the idShort of the submodel- Returns:
- the submodel builder
-
createSubmodelBuilderRbac
public static de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder createSubmodelBuilderRbac(de.iip_ecosphere.platform.support.aas.Aas aas, String idShort) Creates a submodel builder for the givenaasandidShortderiving the submodel identification viagetSubmodelIdentification(String)with default authentication, i.e. appliesRbacReceiver.rbacPlatform(AuthenticationDescriptor)withgetSubmodelAuthentication().- Parameters:
aas- the "parent" AASidShort- the idShort of the submodel- Returns:
- the submodel builder
-
setAasSupplier
public static void setAasSupplier(Supplier<List<de.iip_ecosphere.platform.support.aas.Aas>> supplier) Sets a supplier to provide instance to the real AAS server instance (rather than remote/connected instances viaretrieveIipAas(). The real instance is e.g., needed to persist/store an AAS. Handle with care.- Parameters:
supplier- the supplier, may be null for none
-
getSetup
Returns the AAS setup.- Returns:
- the setup
-
setAasSetup
Defines the AAS setup without resetting the AAS device/component implementation port.- Parameters:
aasSetup- the setup information- Returns:
- the setup information before this call
- See Also:
-
setAasSetup
public static AasPartRegistry.AasSetup setAasSetup(AasPartRegistry.AasSetup aasSetup, boolean resetImplPort) Defines the AAS setup.- Parameters:
aasSetup- the setup informationresetImplPort- reset or keep the AAS device/component implementation port- Returns:
- the setup information before this call
-
getContributorLoader
Returns the contributor loader.- Returns:
- the loader instance
-
contributors
Returns the contributors.- Returns:
- the contributors
-
contributorClasses
Returns the contributor classes.- Returns:
- the contributor classes
-
build
Build up all AAS of the currently running platform part including all contributors. No implementation server is started. [public for testing]- Returns:
- the list of AAS
-
build
Build up all AAS of the currently running platform part including all contributors. [public for testing]- Parameters:
startImplServer- whether the implementation server shall be started before creating the AAS, this may be required for incremental deployment- Returns:
- the list of AAS
-
build
Build up all AAS of the currently running platform part. No implementation server is started. [public for testing]- Parameters:
filter- filter out contributors, in particular for testing, e.g., active AAS that require an implementation server- Returns:
- the list of AAS
-
build
public static AasPartRegistry.AasBuildResult build(Predicate<AasContributor> filter, boolean startImplServer) Build up all AAS of the currently running platform part. [public for testing]- Parameters:
filter- filter out contributors, in particular for testing, e.g., active AAS that require an implementation serverstartImplServer- whether the implementation server shall be started before creating the AAS, this may be required for incremental deployment- Returns:
- the list of AAS
-
build
public static AasPartRegistry.AasBuildResult build(Predicate<AasContributor> filter, boolean startImplServer, de.iip_ecosphere.platform.support.aas.ProtocolServerBuilder sBuilder) Build up all AAS of the currently running platform part. [public for testing]- Parameters:
filter- filter out contributors, in particular for testing, e.g., active AAS that require an implementation serverstartImplServer- whether the implementation server shall be started before creating the AAS, this may be required for incremental deploymentsBuilder- the protocol server builder. May be null then the method creates a new one, may be an instance that must then match the settings inAasPartRegistry.AasSetup.getImplementation().- Returns:
- the list of AAS
-
retrieveIipAas
Obtains the IIP-Ecosphere platform AAS. Be careful with the returned instance, as if the AAS is modified in the mean time, you may hold an outdated instance.- Returns:
- the platform AAS (may be null for none)
- Throws:
IOException- if the AAS cannot be read due to connection errors
-
retrieveAas
public static de.iip_ecosphere.platform.support.aas.Aas retrieveAas(String identifier) throws IOException Obtains an AAS instance via the setup in this class. Be careful with the returned instance, as if the AAS is modified in the mean time, you may hold an outdated instance.- Parameters:
identifier- the identifier of the AAS (may be null or empty for an identification based onidShort, interpreted as an URN if this starts withurn)- Returns:
- the platform AAS (may be null for none)
- Throws:
IOException- if the AAS cannot be read due to connection errors
-
retrieveAas
public static de.iip_ecosphere.platform.support.aas.Aas retrieveAas(AasPartRegistry.AasSetup setup, String identifier) throws IOException Obtains an AAS instance. Be careful with the returned instance, as if the AAS is modified in the mean time, you may hold an outdated instance. Populates the submodels initially with elements.- Parameters:
setup- the AAS setupidentifier- the identifier of the AAS (may be null or empty for an identification based onidShort, interpreted as an URN if this starts withurn)- Returns:
- the platform AAS (may be null for none)
- Throws:
IOException- if the AAS cannot be read due to connection errors
-
retrieveAas
public static de.iip_ecosphere.platform.support.aas.Aas retrieveAas(AasPartRegistry.AasSetup setup, String identifier, boolean populate) throws IOException Obtains an AAS instance. Be careful with the returned instance, as if the AAS is modified in the mean time, you may hold an outdated instance.- Parameters:
setup- the AAS setupidentifier- the identifier of the AAS (may be null or empty for an identification based onidShort, interpreted as an URN if this starts withurn)populate- populates the submodels initially with elements (performance!)- Returns:
- the platform AAS (may be null for none)
- Throws:
IOException- if the AAS cannot be read due to connection errors
-
getIipAasInstance
Returns the real AAS server instance based on the instances it was initially built. This instance is only available on server side and shall be used only in cases where a potentially remote/connected AAS (as it is typically returned byretrieveIipAas()) is not sufficient, e.g., for storing/persisting the AAS. It shall not be used for parallel accesses or for modifying the AAS.- Returns:
- the AAS instance, may be null
-
deploy
public static de.iip_ecosphere.platform.support.Server deploy(List<de.iip_ecosphere.platform.support.aas.Aas> aas, String... options) Deploy the given AAS to a local server. However, server and registry are created within the same tomcat instance and cannot be executed with different TLS settings.[testing]- Parameters:
aas- the list of aas, e.g., frombuild()options- optional server creation options- Returns:
- the server instance
-
applyCorsOrigin
public static <T extends de.iip_ecosphere.platform.support.aas.CorsEnabledRecipe> T applyCorsOrigin(T rcp, AasPartRegistry.AasSetup setup) - Type Parameters:
T- the receipt type- Parameters:
rcp- the recipesetup- the setup to take the information from- Returns:
- the rcp
-
register
public static de.iip_ecosphere.platform.support.Server register(List<de.iip_ecosphere.platform.support.aas.Aas> aas, de.iip_ecosphere.platform.support.Endpoint registry, String... options) throws IOException Registers the given AAS to a remote registry and creates a local server for the AAS.- Parameters:
aas- the list of aas, e.g., frombuild()registry- optional registry endpoint for remote registration, assuming a local in-memory registry if nulloptions- optional server creation options- Returns:
- the server instance
- Throws:
IOException- if access to the AAS registry fails
-
remoteDeploy
public static void remoteDeploy(List<de.iip_ecosphere.platform.support.aas.Aas> aas) throws IOException Performs a remote deployment of the givenaas. Assumes that server and registry are up and running.- Parameters:
aas- the list of AAS, e.g., frombuild()- Throws:
IOException- if the deployment of an AAS fails or access to the AAS registry fails
-
remoteDeploy
public static void remoteDeploy(AasPartRegistry.AasSetup setup, List<de.iip_ecosphere.platform.support.aas.Aas> aas) throws IOException Performs a remote deployment of the givenaas. Assumes that server and registry are up and running.- Parameters:
setup- the AAS setup to useaas- the list of AAS, e.g., frombuild()- Throws:
IOException- if the deployment of an AAS fails or access to the AAS registry fails
-
getAas
public static de.iip_ecosphere.platform.support.aas.Aas getAas(List<de.iip_ecosphere.platform.support.aas.Aas> list, String idShort) Returns the first AAS inlistmatching the given name. [utility]- Parameters:
list- the list to consideridShort- the short name to filter for- Returns:
- the first AAS or null for none
-
getIipAasRegistry
public static de.iip_ecosphere.platform.support.aas.Registry getIipAasRegistry()Returns the AAS registry for the endpoint in the setup ofAasPartRegistry.- Returns:
- the registry, may be null if there is none
-
addAasEndpointProperty
private static de.iip_ecosphere.platform.support.aas.Property addAasEndpointProperty(de.iip_ecosphere.platform.support.aas.Registry reg, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, String property, String aasId) Adds a property tobuilderpointing to an AAS endpoint for an AAS with idserviceIdin registryreg.- Parameters:
reg- the registry, may be null then the property will have an empty value.builder- the builder to add the property toproperty- the shortId of the property to createaasId- the id of the AAS- Returns:
- the created AAS property
-
addServiceAasEndpointProperty
public static de.iip_ecosphere.platform.support.aas.Property addServiceAasEndpointProperty(de.iip_ecosphere.platform.support.aas.Registry reg, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, String property, String serviceId) Adds a property tobuilderpointing to an AAS endpoint for a service with idserviceIdin registryreg.- Parameters:
reg- the registry, may be null then the property will have an empty value.builder- the builder to add the property toproperty- the idShort of the property to createserviceId- the id of the service, may be empty leading to an empty property value- Returns:
- the created AAS property
-
addDeviceAasEndpointProperty
public static de.iip_ecosphere.platform.support.aas.Property addDeviceAasEndpointProperty(de.iip_ecosphere.platform.support.aas.Registry reg, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, String property, String deviceId) Adds a property tobuilderpointing to an AAS endpoint for a device with iddeviceIdin registryreg.- Parameters:
reg- the registry, may be null then the property will have an empty value.builder- the builder to add the property toproperty- the idShort of the property to createdeviceId- the id of the device, may be empty leading to an empty property value- Returns:
- the created AAS property
-
getAasAuthentication
public static de.iip_ecosphere.platform.support.aas.AuthenticationDescriptor getAasAuthentication()Returns the AAS authentication descriptor.- Returns:
- the AAS authentication descriptor, may be null for none
- See Also:
-
getSubmodelAuthentication
public static de.iip_ecosphere.platform.support.aas.AuthenticationDescriptor getSubmodelAuthentication()Returns the submodel authentication descriptor.- Returns:
- the submodel authentication descriptor, may be null for none
- See Also:
-
composeIdentifier
Composes an identifier based onURN_AASand the given specific identifier.- Parameters:
specificId- the specific identifier- Returns:
- the composed identifier
- See Also:
-