Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

BaSyx.Examples.Snippets.AASCreation.Java

Revision as of 09:31, 18 August 2020 by Unnamed Poltroon (Talk)

This code snippet illustrates the creation of an Asset Administration Shell (AAS) with the Java SDK. The BaSys setup for this code snippet is the following:

BaSyx.Snippet.AASConnectorConnectionAAS.Java.png


The BaSys setup consists of a Apache Tomcat server that runs BaSyx Servlets. It contains an Asset Administration Shell provider servlet that exports the created example Asset Administration Shell. The snippet code runs in context of a servlet in the tomcat server and creates, and exports the AAS. It is created as following:

/**
* Example Asset Administration Shell
*/
static class ExampleAssetAdministrationShell extends AssetAdministrationShell {
	/**
	 * Constructor
	 */
	public ExampleAssetAdministrationShell() {
		// Set Asset Administration Shell ID
		setIdShort("aas-001");
	}
}


The AAS sets its short Id meta property to "aas-001". The following code illustrates the deployment of the AAS to the Apache Tomcat server. It maps the path on the HTTP server "/Testsuite/components/BaSys/1.0/SampleAAS/*" to an instance of class AASServlet. This class exports an Asset Administration Shell as HTTP accessible servlet using the BaSys API for Asset Administration Shells.

/**
 * The BaSyx Deployment instantiates and starts context elements for this example. 
 * 
 * This example instantiates the BaSyxExamplesContext_1MemoryAASServer_1SQLDirectory
 * example context that creates one AAS server, and one SQL based AAS registry.
 * 
 * BaSyxDeployment contexts instantiate all components on the IP address of the host. 
 * Therefore, all components use the same IP address. 
 */
public static BaSyxDeployment context = new BaSyxDeployment(
	// Simulated servlets
	// - BaSys topology with one AAS Server and one SQL directory
	TestContext.sqlContext.
		// Deploy example specific servlets to Tomcat server in this context
		addServletMapping("/Components/BaSys/1.0/aasServer/*", new AASServerServlet())
	);



The complete, executable code is available in the basyx.examples project in package <<<>>>.


BaSyx project links: Project BaSyx main wiki page | What is BaSyx? | BaSyx Developer Documentation

Back to the top