Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "BaSyx.Examples.Snippets.AASCreation.Java"

(Created page with "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: {|style="text-ali...")
 
m
Line 2: Line 2:
  
 
{|style="text-align: center; width: 100%"
 
{|style="text-align: center; width: 100%"
|[[File:BaSyx.Snippet.AASConnectorConnection.Java.png|center|512px]]
+
|[[File:BaSyx.Snippet.AASConnectorConnectionAAS.Java.png|center|512px]]
 
|}
 
|}
  

Revision as of 19:43, 12 June 2019

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 {
 
	/**
	 * Version number of serialized instance
	 */
	private static final long serialVersionUID = 1L;
 
	/**
	 * Constructor
	 */
	public ExampleAssetAdministrationShell() {
		// Set Asset Administration Shell ID
		setId("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.

/**
 * Instantiate and start context elements for this example. 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(
			// Servlets for example snippet
			new BaSyxExamplesContext_Empty().
				// Deploy example specific servlets to Tomcat server in this context
				addServletMapping("/Testsuite/components/BaSys/1.0/SampleAAS/*",         new AASServlet(new ExampleAssetAdministrationShell()))
 
		);



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