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

Difference between revisions of "BaSyx / Scenarios / Static Dynamic Extension"

(Created page with "This example shows the enrichment of AAS data loaded from an aasx file with a static Submodel. The following components are used: * BaSyx_/_Documentation_/_Components_/_...")
 
m (Adds GitHub link)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
This example shows the enrichment of AAS data loaded from an aasx file with a static Submodel.
+
This example shows the enrichment of AAS data loaded from an aasx file with a dynamically created Submodel. Its code is available on [https://github.com/eclipse-basyx/basyx-java-examples/tree/main/basyx.examples/src/main/java/org/eclipse/basyx/examples/scenarios/staticdynamic GitHub]
  
  
Line 7: Line 7:
  
 
* [[BaSyx_/_Documentation_/_Components_/_AAS_Server | AAS Server Component]]
 
* [[BaSyx_/_Documentation_/_Components_/_AAS_Server | AAS Server Component]]
 +
 +
 +
 +
 +
[[File:StaticDynamicScenario.png|600px|thumb]]
  
  
Line 12: Line 17:
 
In the first step an AAS-Server and a Registry-Server is started by the methodes <code>startAASServer()</code> and <code>startRegistry()</code>.
 
In the first step an AAS-Server and a Registry-Server is started by the methodes <code>startAASServer()</code> and <code>startRegistry()</code>.
  
Then the AASXPackageManager is used to load example AASs/SMs form an .aasx file into a Set of AASBundle objects.
+
Then the AASXPackageManager is used to load example AASs/SMs from an .aasx file into a Set of AASBundle objects.
  
 
<syntaxhighlight lang="java" style="margin-left: 4em">
 
<syntaxhighlight lang="java" style="margin-left: 4em">
Line 28: Line 33:
 
<syntaxhighlight lang="java" style="margin-left: 4em">
 
<syntaxhighlight lang="java" style="margin-left: 4em">
  
// Get the correct Bundle form the Set
+
// Get the correct Bundle from the Set
 
AASBundle bundle = findBundle(bundles, AAS_ID_SHORT);
 
AASBundle bundle = findBundle(bundles, AAS_ID_SHORT);
  
Line 43: Line 48:
  
 
// Load the new Bundles to the Server
 
// Load the new Bundles to the Server
AASBundleIntegrator.integrate(new AASAggregatorProxy(SERVER_URL), bundles);
+
AASBundleHelper.integrate(new AASAggregatorProxy(SERVER_URL), bundles);
  
 
</syntaxhighlight>
 
</syntaxhighlight>

Latest revision as of 05:59, 27 October 2022

This example shows the enrichment of AAS data loaded from an aasx file with a dynamically created Submodel. Its code is available on GitHub


The following components are used:



StaticDynamicScenario.png


In the first step an AAS-Server and a Registry-Server is started by the methodes startAASServer() and startRegistry().

Then the AASXPackageManager is used to load example AASs/SMs from an .aasx file into a Set of AASBundle objects.

// Load Bundles from .aasx file
AASXPackageManager packageManager = new AASXPackageManager("aasx/01_Festo.aasx");
Set<AASBundle> bundles = packageManager.retrieveAASBundles();


A new Submodel is added to one of the bundles. The correct bundle is found by the idShort of its AAS.

// Get the correct Bundle from the Set
AASBundle bundle = findBundle(bundles, AAS_ID_SHORT);
 
// Add the new SubModel to the Bundle
bundle.getSubmodels().add(sm);


These bundles are then uploaded to the server using the AASBundleIntegrator.

// Load the new Bundles to the Server
AASBundleHelper.integrate(new AASAggregatorProxy(SERVER_URL), bundles);


The last step is to register the newly uploaded AAS/SM objects. This is done by a separate method registerBundles(). It iterates over a given Set of bundles and registers all contained AASs/SMs.

// Get a RegistryProxy and register all Objects contained in the Bundles
AASRegistryProxy proxy = new AASRegistryProxy(REGISTRY_URL);
registerBundles(bundles, proxy, SERVER_URL);



An example of how to execute and use the scenario can be found in TestStaticDynamicScenario.

Back to the top