Updates CloudEdgeDeploymentScenario to use BaSyxAASServerConfiguration
Change-Id: I66fb77700217979677ab0b0781463ca39ef59b13
Signed-off-by: Frank Schnicke <frank.schnicke@iese.fraunhofer.de>
diff --git a/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/AASServerComponent.java b/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/AASServerComponent.java
index 68979fa..52ec917 100644
--- a/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/AASServerComponent.java
+++ b/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/AASServerComponent.java
@@ -97,12 +97,14 @@
public void startComponent() {
logger.info("Create the server...");
// Load the aggregator servlet
+ createRegistryFromUrl();
AASAggregatorServlet aggregatorServlet = loadAggregatorServlet();
// Init HTTP context and add an XMLAASServlet according to the configuration
BaSyxContext context = contextConfig.createBaSyxContext();
context.addServletMapping("/*", aggregatorServlet);
+
// An initial AAS has been loaded from the drive?
if (aasBundles != null) {
// 1. Also provide the files
@@ -111,8 +113,7 @@
// 2. Fix the file paths according to the servlet configuration
modifyFilePaths(contextConfig.getHostname(), contextConfig.getPort(), contextConfig.getContextPath());
- // 3. Create registry & register the initial AAS
- createRegistryFromUrl();
+ // 3. Register the initial AAS
registerAAS();
}
diff --git a/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/configuration/BaSyxAASServerConfiguration.java b/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/configuration/BaSyxAASServerConfiguration.java
index f0a29ca..0f507a1 100644
--- a/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/configuration/BaSyxAASServerConfiguration.java
+++ b/components/basys.components/basyx.components.docker/basyx.components.AASServer/src/main/java/org/eclipse/basyx/components/aas/configuration/BaSyxAASServerConfiguration.java
@@ -45,10 +45,12 @@
}
/**
- * Constructor with initial configuration - docBasePath and hostname are default values
+ * Constructor with initial configuration
*
- * @param backend The backend for the AASServer
- * @param source The file source for the AASServer (e.g. an .aasx file)
+ * @param backend
+ * The backend for the AASServer
+ * @param source
+ * The file source for the AASServer (e.g. an .aasx file)
*/
public BaSyxAASServerConfiguration(AASServerBackend backend, String source) {
super(getDefaultProperties());
@@ -57,6 +59,23 @@
}
/**
+ * Constructor with initial configuration values
+ *
+ * @param backend
+ * The backend for the AASServer
+ * @param source
+ * The file source for the AASServer (e.g. an .aasx file)
+ * @param registryUrl
+ * The url to the registry
+ */
+ public BaSyxAASServerConfiguration(AASServerBackend backend, String source, String registryUrl) {
+ super(getDefaultProperties());
+ setAASBackend(backend);
+ setAASSource(source);
+ setRegistry(registryUrl);
+ }
+
+ /**
* Constructor with predefined value map
*/
public BaSyxAASServerConfiguration(Map<String, String> values) {
diff --git a/examples/basys.examples/src/main/java/org/eclipse/basyx/examples/scenarios/cloudedgedeployment/CloudEdgeDeploymentScenario.java b/examples/basys.examples/src/main/java/org/eclipse/basyx/examples/scenarios/cloudedgedeployment/CloudEdgeDeploymentScenario.java
index b4b68eb..c0ea604 100644
--- a/examples/basys.examples/src/main/java/org/eclipse/basyx/examples/scenarios/cloudedgedeployment/CloudEdgeDeploymentScenario.java
+++ b/examples/basys.examples/src/main/java/org/eclipse/basyx/examples/scenarios/cloudedgedeployment/CloudEdgeDeploymentScenario.java
@@ -9,6 +9,8 @@
import org.eclipse.basyx.aas.registration.proxy.AASRegistryProxy;
import org.eclipse.basyx.components.IComponent;
import org.eclipse.basyx.components.aas.AASServerComponent;
+import org.eclipse.basyx.components.aas.configuration.AASServerBackend;
+import org.eclipse.basyx.components.aas.configuration.BaSyxAASServerConfiguration;
import org.eclipse.basyx.components.configuration.BaSyxContextConfiguration;
import org.eclipse.basyx.components.registry.RegistryComponent;
import org.eclipse.basyx.components.registry.configuration.BaSyxRegistryConfiguration;
@@ -159,13 +161,15 @@
*
*/
private void startupCloudServer() {
- // Load the AAS context from a .properties file resource
+ // Load the server context from a .properties file resource
BaSyxContextConfiguration contextConfig = new BaSyxContextConfiguration();
contextConfig.loadFromResource("CloudEdgeDeploymentScenarioAASContext.properties");
+ // Create the AAS - Can alternatively also be loaded from a .property file
+ BaSyxAASServerConfiguration aasServerConfig = new BaSyxAASServerConfiguration(AASServerBackend.INMEMORY, "", registryPath);
+
// Create a server according to this configuration
- AASServerComponent cloudServer = new AASServerComponent(contextConfig);
- cloudServer.setRegistry(registry);
+ AASServerComponent cloudServer = new AASServerComponent(contextConfig, aasServerConfig);
// Start the created server
cloudServer.startComponent();