Updated example project with contexts.
This update illustrates the creation of new contexts, and introduces a
new context for the basys.examples project. Web service configurations
are now independent from basys.components project.
diff --git a/examples/basys.examples/.classpath b/examples/basys.examples/.classpath
index 3bf06c0..dd47eaf 100644
--- a/examples/basys.examples/.classpath
+++ b/examples/basys.examples/.classpath
@@ -8,13 +8,13 @@
</classpathentry>
<classpathentry kind="src" path="examples"/>
<classpathentry kind="src" path="servlets"/>
- <classpathentry kind="src" path="directory"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <classpathentry kind="src" path="support"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0">
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.5">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
diff --git a/examples/basys.examples/.settings/org.eclipse.wst.common.component b/examples/basys.examples/.settings/org.eclipse.wst.common.component
index 8757062..e9654ef 100644
--- a/examples/basys.examples/.settings/org.eclipse.wst.common.component
+++ b/examples/basys.examples/.settings/org.eclipse.wst.common.component
@@ -5,10 +5,13 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/examples"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/servlets"/>
- <wb-resource deploy-path="/WEB-INF/classes" source-path="/directory"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/support"/>
<dependent-module archiveName="basys.sdk-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/basys.sdk/basys.sdk">
<dependency-type>uses</dependency-type>
</dependent-module>
+ <dependent-module archiveName="basys.components-0.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/basys.components/basys.components">
+ <dependency-type>uses</dependency-type>
+ </dependent-module>
<property name="context-root" value="basys.examples"/>
<property name="java-output-path" value="/basys.examples/build/classes"/>
</wb-module>
diff --git a/examples/basys.examples/WebContent/WEB-INF/config/directory/sqldirectory/directory.properties b/examples/basys.examples/WebContent/WEB-INF/config/directory/sqldirectory/directory.properties
new file mode 100644
index 0000000..4c8746e
--- /dev/null
+++ b/examples/basys.examples/WebContent/WEB-INF/config/directory/sqldirectory/directory.properties
@@ -0,0 +1,43 @@
+# ##############################################################
+# Directory configuration file
+# ##############################################################
+
+
+
+
+# ##############################################################
+# Directory server configuration
+
+
+# URL and type of uplink server. Forward all requests that we cannot satisfy here to uplink
+# - URL of uplink directory server
+# - Type of uplink server. Currently supported is BASYS (BaSys registry API) or DNS (DNS server processing legalBody tag)
+cfg.uplink =
+cfg.uplink.type = DNS
+
+
+# Downlink servers, forward matching URI patterns to downlink servers
+# - Match all subunits that end with "is.iese", including "is.iese"
+cfg.downlink.is.pattern = is.iese
+cfg.downlink.is.directory = http://wherever1
+
+# - Match all subunits that end with "pm.iese", including "pm.iese"
+cfg.downlink.pm.pattern = pm.iese
+cfg.downlink.pm.directory = http://wherever2
+
+# - Match all subunits that end with ".es.iese", but not "es.iese"
+cfg.downlink.es.pattern = .es.iese
+cfg.downlink.es.directory = http://wherever3
+
+
+
+
+# ##############################################################
+# SQL database configuration
+
+dbuser = postgres
+dbpass = admin
+dburl = //localhost/basyx-directory?
+
+sqlDriver = org.postgresql.Driver
+sqlPrefix = jdbc:postgresql:
diff --git a/examples/basys.examples/WebContent/WEB-INF/web.xml b/examples/basys.examples/WebContent/WEB-INF/web.xml
index 40853bc..4cdd818 100644
--- a/examples/basys.examples/WebContent/WEB-INF/web.xml
+++ b/examples/basys.examples/WebContent/WEB-INF/web.xml
@@ -4,47 +4,6 @@
- <servlet>
- <servlet-name>AAS_Server</servlet-name>
- <servlet-class> org.eclipse.basyx.components.servlets.RawCFGSubModelProviderServlet </servlet-class>
-
- <init-param>
- <param-name>config</param-name>
- <param-value>/WEB-INF/config/aasServer/aasServer.properties</param-value>
- </init-param>
-
- <load-on-startup>5</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>AAS_Server</servlet-name>
- <url-pattern>/Testsuite/components/BaSys/1.0/aasserver/*</url-pattern>
- </servlet-mapping>
-
-
-
- <servlet>
- <servlet-name>DeviceStatusVABObject</servlet-name>
- <servlet-class> examples.controllingdevice.vab.object.SimpleVABElementServlet </servlet-class>
-
- <load-on-startup>5</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>DeviceStatusVABObject</servlet-name>
- <url-pattern>/Testsuite/components/BaSys/1.0/devicestatusVAB/*</url-pattern>
- </servlet-mapping>
-
-
- <servlet>
- <servlet-name>DeviceStatusSubmodel</servlet-name>
- <servlet-class> examples.controllingdevice.vab.object.SimpleSubmodelServlet </servlet-class>
-
- <load-on-startup>5</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>DeviceStatusSubmodel</servlet-name>
- <url-pattern>/Testsuite/components/BaSys/1.0/devicestatusSM/*</url-pattern>
- </servlet-mapping>
-
<welcome-file-list>
diff --git a/examples/basys.examples/examples/examples/contexts/DefaultBaSyxExamplesContext.java b/examples/basys.examples/examples/examples/contexts/DefaultBaSyxExamplesContext.java
new file mode 100644
index 0000000..8e095b1
--- /dev/null
+++ b/examples/basys.examples/examples/examples/contexts/DefaultBaSyxExamplesContext.java
@@ -0,0 +1,35 @@
+package examples.contexts;
+
+import org.eclipse.basyx.components.servlets.RawCFGSubModelProviderServlet;
+import org.eclipse.basyx.components.servlets.SQLDirectoryServlet;
+import org.eclipse.basyx.regression.support.server.BaSyxContext;
+
+/**
+ * BaSyx context that contains an Industrie 4.0 Servlet infrastructure for regression testing of basys.components package
+ *
+ * @author kuhn
+ *
+ */
+public class DefaultBaSyxExamplesContext extends BaSyxContext {
+
+
+ /**
+ * Version of serialized instance
+ */
+ private static final long serialVersionUID = 1L;
+
+
+
+ /**
+ * Constructor
+ */
+ public DefaultBaSyxExamplesContext() {
+ // Invoke base constructor to set up Tomcat server in basys.components context
+ super("/basys.examples", "");
+
+ // Define Servlet infrastucture
+ addServletMapping("/Components/Directory/SQL/*", new SQLDirectoryServlet().withParameter("config", "/WebContent/WEB-INF/config/directory/sqldirectory/directory.properties"));
+ addServletMapping("/Components/BaSys/1.0/aasServer/*", new RawCFGSubModelProviderServlet().withParameter("config", "/WebContent/WEB-INF/config/aasServer/aasServer.properties"));
+ }
+}
+
diff --git a/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceStatusSubmodel.java b/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceStatusSubmodel.java
index e8bfba4..b883b41 100644
--- a/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceStatusSubmodel.java
+++ b/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceStatusSubmodel.java
@@ -4,8 +4,8 @@
import org.eclipse.basyx.aas.api.resources.IAssetAdministrationShell;
import org.eclipse.basyx.aas.metamodel.factory.MetaModelElementFactory;
import org.eclipse.basyx.aas.metamodel.hashmap.aas.SubModel;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.property.atomicdataproperty.PropertySingleValued;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identification;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.IdentifierType;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.property.Property;
@@ -36,13 +36,13 @@
// Initialize this sub model
((Map<String, Object>) this.get("identification")).put("id", "urn:de.FHG:devices.es.iese:statusSM:1.0:3:x-509#002");
- ((Map<String, Object>) this.get("identification")).put("idType", Identification.URI);
+ ((Map<String, Object>) this.get("identification")).put("idType", IdentifierType.URI);
// This sub model only defines two property named "device status" and "mode"
- PropertySingleValued deviceStatusProperty = factory.create(new PropertySingleValued(), "offline");
+ Property deviceStatusProperty = factory.create(new Property(), "offline");
deviceStatusProperty.setId("deviceStatus");
- PropertySingleValued deviceModeProperty = factory.create(new PropertySingleValued(), "idle");
+ Property deviceModeProperty = factory.create(new Property(), "idle");
deviceModeProperty.setId("mode");
// Add properties to sub model properties
diff --git a/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceTCPServer.java b/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceTCPServer.java
index c0f8735..abc85f4 100644
--- a/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceTCPServer.java
+++ b/examples/basys.examples/examples/examples/controllingdevice/submodel/object/DeviceTCPServer.java
@@ -13,22 +13,51 @@
*/
public class DeviceTCPServer {
+
+ /**
+ * Create IModelProvider that provides a VAB element
+ */
+ protected VABHashmapProvider modelProvider = new VABHashmapProvider(new DeviceStatusSubmodel());
+
+ /**
+ * Create native BaSyx TCP server using default port
+ */
+ protected BaSyxTCPServer<VABHashmapProvider> tcpServer = new BaSyxTCPServer<VABHashmapProvider>(modelProvider, 6998);
+
+
+
+
+ /**
+ * Start TCP server
+ */
+ public void startTCPServer() {
+ // Start TCP server
+ tcpServer.start();
+ }
+
+
+ /**
+ * Stop TCP server
+ */
+ public void stopTCPServer() {
+ // Shutdown TCP server
+ tcpServer.shutdown();
+ }
+
+
+
/**
* Main method
*/
public static void main(String[] args) {
-
- // Create IModelProvider that provides a VAB element
- VABHashmapProvider modelProvider = new VABHashmapProvider(new DeviceStatusSubmodel());
-
- // Create native BaSyx TCP server using default port
- BaSyxTCPServer<VABHashmapProvider> tcpServer = new BaSyxTCPServer<VABHashmapProvider>(modelProvider, 6998);
-
- // Start TCP server
- tcpServer.start();
+ // Create device TCP server
+ DeviceTCPServer deviceServer = new DeviceTCPServer();
+
+ // Start device TCP server
+ deviceServer.startTCPServer();
// Wait until TCP server completes (which will never happen) or do something else meaningful
- try {tcpServer.join();} catch (InterruptedException e) {e.printStackTrace();}
+ try {deviceServer.tcpServer.join();} catch (InterruptedException e) {e.printStackTrace();}
}
}
diff --git a/examples/basys.examples/examples/examples/controllingdevice/submodel/object/RunExample.java b/examples/basys.examples/examples/examples/controllingdevice/submodel/object/RunExample.java
index 021f76f..11d98b0 100644
--- a/examples/basys.examples/examples/examples/controllingdevice/submodel/object/RunExample.java
+++ b/examples/basys.examples/examples/examples/controllingdevice/submodel/object/RunExample.java
@@ -1,8 +1,12 @@
package examples.controllingdevice.submodel.object;
+import static org.junit.Assert.assertTrue;
+
import org.eclipse.basyx.aas.backend.connector.basyx.BaSyxConnectorProvider;
import org.eclipse.basyx.vab.core.VABConnectionManager;
import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
@@ -22,6 +26,33 @@
protected VABConnectionManager connManager = new VABConnectionManager(new ExampleDirectory(), new BaSyxConnectorProvider());
+ /**
+ * Device TCP server for this example
+ */
+ protected DeviceTCPServer deviceTCPServer = null;
+
+
+ /**
+ * Creates the manager to be used in the test cases
+ */
+ @Before
+ public void before() {
+ // Create and start device TCP server
+ deviceTCPServer = new DeviceTCPServer();
+ // - Start server
+ deviceTCPServer.startTCPServer();
+ }
+
+
+ /**
+ * Creates the manager to be used in the test cases
+ */
+ @After
+ public void after() {
+ // Stop TCP server
+ deviceTCPServer.stopTCPServer();
+ }
+
/**
* Test basic queries
@@ -36,7 +67,10 @@
// Device updates status to ready
Object devState = connSubModel.readElementValue("properties/deviceStatus/value");
- // Output device status
+ // Compare and output device status
+ // - Automated result check
+ assertTrue(devState.equals("offline"));
+ // - Output result to console
System.out.println("Status:"+devState);
}
}
diff --git a/examples/basys.examples/examples/examples/controllingdevice/vab/object/ControllingDeviceVABObjectContext.java b/examples/basys.examples/examples/examples/controllingdevice/vab/object/ControllingDeviceVABObjectContext.java
new file mode 100644
index 0000000..cf72978
--- /dev/null
+++ b/examples/basys.examples/examples/examples/controllingdevice/vab/object/ControllingDeviceVABObjectContext.java
@@ -0,0 +1,61 @@
+package examples.controllingdevice.vab.object;
+
+import org.eclipse.basyx.components.servlets.RawCFGSubModelProviderServlet;
+import org.eclipse.basyx.components.servlets.SQLDirectoryServlet;
+
+import examples.contexts.DefaultBaSyxExamplesContext;
+
+/*
+<servlet>
+<servlet-name>DeviceStatusVABObject</servlet-name>
+<servlet-class> examples.controllingdevice.vab.object.SimpleVABElementServlet </servlet-class>
+
+<load-on-startup>5</load-on-startup>
+</servlet>
+<servlet-mapping>
+<servlet-name>DeviceStatusVABObject</servlet-name>
+<url-pattern>/Testsuite/components/BaSys/1.0/devicestatusVAB/*</url-pattern>
+</servlet-mapping>
+
+
+<servlet>
+<servlet-name>DeviceStatusSubmodel</servlet-name>
+<servlet-class> examples.controllingdevice.vab.object.SimpleSubmodelServlet </servlet-class>
+
+<load-on-startup>5</load-on-startup>
+</servlet>
+<servlet-mapping>
+<servlet-name>DeviceStatusSubmodel</servlet-name>
+<url-pattern>/Testsuite/components/BaSys/1.0/devicestatusSM/*</url-pattern>
+</servlet-mapping>
+
+ */
+
+/**
+ * Tailored context for examples.controllingdevice.vab.object test cases
+ *
+ * @author kuhn
+ *
+ */
+public class ControllingDeviceVABObjectContext extends DefaultBaSyxExamplesContext {
+
+
+ /**
+ * Version of serialized instance
+ */
+ private static final long serialVersionUID = 1L;
+
+
+
+ /**
+ * Constructor
+ */
+ public ControllingDeviceVABObjectContext() {
+ // Invoke base constructor to set up Tomcat server
+ super();
+
+ // Define test case specific Servlet infrastucture
+ addServletMapping("/Testsuite/components/BaSys/1.0/devicestatusVAB/*", new SimpleVABElementServlet());
+ addServletMapping("/Testsuite/components/BaSys/1.0/devicestatusSM/*", new SimpleSubmodelServlet());
+ }
+}
diff --git a/examples/basys.examples/examples/examples/controllingdevice/vab/object/ExampleDirectory.java b/examples/basys.examples/examples/examples/controllingdevice/vab/object/ExampleDirectory.java
index 6695f14..31363a9 100644
--- a/examples/basys.examples/examples/examples/controllingdevice/vab/object/ExampleDirectory.java
+++ b/examples/basys.examples/examples/examples/controllingdevice/vab/object/ExampleDirectory.java
@@ -25,3 +25,4 @@
addMapping("urn:de.FHG:devices.es.iese:statusSM:1.0:3:x-509#004", "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/devicestatusSM/");
}
}
+
diff --git a/examples/basys.examples/examples/examples/controllingdevice/vab/object/RunExample.java b/examples/basys.examples/examples/examples/controllingdevice/vab/object/RunExample.java
index f12ce07..77fc747 100644
--- a/examples/basys.examples/examples/examples/controllingdevice/vab/object/RunExample.java
+++ b/examples/basys.examples/examples/examples/controllingdevice/vab/object/RunExample.java
@@ -1,10 +1,14 @@
package examples.controllingdevice.vab.object;
import org.eclipse.basyx.aas.backend.connector.http.HTTPConnectorProvider;
+import org.eclipse.basyx.regression.support.server.AASHTTPServerResource;
import org.eclipse.basyx.vab.core.VABConnectionManager;
import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
+import org.junit.ClassRule;
import org.junit.Test;
+import examples.contexts.DefaultBaSyxExamplesContext;
+
/**
@@ -22,6 +26,14 @@
protected VABConnectionManager connManager = new VABConnectionManager(new ExampleDirectory(), new HTTPConnectorProvider());
+ /**
+ * Makes sure Tomcat Server with basic BaSys topology is started
+ */
+ @ClassRule
+ public static AASHTTPServerResource res = AASHTTPServerResource.getTestResource(new ControllingDeviceVABObjectContext());
+
+
+
/**
* Test basic queries
diff --git a/examples/basys.examples/examples/examples/deviceaas/RunExample.java b/examples/basys.examples/examples/examples/deviceaas/RunExample.java
index 38f1b23..b75ab7d 100644
--- a/examples/basys.examples/examples/examples/deviceaas/RunExample.java
+++ b/examples/basys.examples/examples/examples/deviceaas/RunExample.java
@@ -1,22 +1,25 @@
package examples.deviceaas;
+import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.basyx.aas.backend.connector.http.HTTPConnectorProvider;
-import org.eclipse.basyx.aas.backend.http.tools.JSONTools;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell_;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.SubModel_;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identification;
+import org.eclipse.basyx.aas.backend.http.tools.GSONTools;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.SubModel;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.IdentifierType;
+import org.eclipse.basyx.regression.support.server.AASHTTPServerResource;
import org.eclipse.basyx.tools.webserviceclient.WebServiceRawClient;
import org.eclipse.basyx.vab.core.VABConnectionManager;
import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
+import org.junit.ClassRule;
import org.junit.Test;
import basys.examples.aasdescriptor.AASDescriptor;
import basys.examples.aasdescriptor.SubmodelDescriptor;
import basys.examples.urntools.ModelUrn;
-import org.json.JSONObject;
+import examples.contexts.DefaultBaSyxExamplesContext;
import examples.directory.ExamplesDirectory;
@@ -36,31 +39,35 @@
protected VABConnectionManager connManager = new VABConnectionManager(new ExamplesDirectory(), new HTTPConnectorProvider());
+ /**
+ * Makes sure Tomcat Server with basic BaSys topology is started
+ */
+ @ClassRule
+ public static AASHTTPServerResource res = AASHTTPServerResource.getTestResource(new DefaultBaSyxExamplesContext());
+
+
/**
* Test basic queries
*/
- @SuppressWarnings("unchecked")
- @Test
+ @Test @SuppressWarnings("unchecked")
public void test() throws Exception {
-
// Server connections
// - Connect to AAS server
VABElementProxy connSubModel = this.connManager.connectToVABElement("AASServer");
// - Invoke BaSyx service calls via web services
WebServiceRawClient client = new WebServiceRawClient();
// - Directory web service URL
- String wsURL = "http://localhost:8080/basys.components/Testsuite/Directory/SQL";
+ String wsURL = "http://localhost:8080/basys.examples/Components/Directory/SQL";
// - AAS repository server URL
- String aasSrvURL = "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver";
+ String aasSrvURL = "http://localhost:8080/basys.examples/Components/BaSys/1.0/aasServer";
-
// Create device AAS
// - Product ID (urn:<legalEntity>:<subUnit>:<subModel>:<version>:<revision>:<elementID>#<elementInstance>)
ModelUrn deviceAASID = new ModelUrn("de.FHG", "devices.es.iese", "aas", "1.0", "3", "x-509", "001");
// - Create device AAS
- AssetAdministrationShell_ aas = new AssetAdministrationShell_();
+ AssetAdministrationShell aas = new AssetAdministrationShell();
aas.put("idShort", "DeviceIDShort");
// - AAS URL on server
String aasURLOnServer = "/aas/submodels/aasRepository/"+deviceAASID.getEncodedURN();
@@ -71,18 +78,18 @@
// The device also brings a sub model structure with an own ID that is being pushed on the server
ModelUrn deviceStatusSMID = new ModelUrn("de.FHG", "devices.es.iese", "statusSM", "1.0", "3", "x-509", "001");
// - Create generic sub model
- SubModel_ statusSM = new SubModel_();
+ SubModel statusSM = new SubModel();
((Map<String, Object>) statusSM.get("properties")).put("status", "offline");
// - Sub model URL on server
String statusSubmodelURLOnServer = "/aas/submodels/aasRepository/"+deviceStatusSMID.getEncodedURN();
// - Transfer device sub model to server
connSubModel.createElement(statusSubmodelURLOnServer, statusSM);
-
+
// The device also brings a sub model structure with an own ID that is being pushed on the server
- ModelUrn deviceControllerSMID = new ModelUrn("jp.orin", "devices.orin", "controllerSM", "1.0", "3", "x-509", "001");
+ ModelUrn deviceControllerSMID = new ModelUrn("de.FHG", "devices.es.iese", "controllerSM", "1.0", "3", "x-509", "001");
// - Create generic sub model
- SubModel_ controllerSM = new SubModel_();
+ SubModel controllerSM = new SubModel();
// - Create sub model contents
Map<String, Object> listOfControllers = new HashMap<>();
((Map<String, Object>) controllerSM.get("properties")).put("controllers", listOfControllers);
@@ -91,35 +98,41 @@
// - Transfer device sub model to server
connSubModel.createElement(controllerSubmodelURLOnServer, controllerSM);
-
-
+
+ // Delete AAS registration for a fresh start - ignore if URL was not found. In this case, there was no previsous registration and the registry was clean
+ client.delete(wsURL+"/api/v1/registry/"+URLEncoder.encode(deviceAASID.getURN()));
+
+
// Register AAS and sub models in directory (push AAS descriptor to server)
// - Create an AAS descriptor
- AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), Identification.URI, aasSrvURL+aasURLOnServer);
+ AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), IdentifierType.URI, aasSrvURL+aasURLOnServer);
// - Add a sub model descriptor for device
- SubmodelDescriptor deviceStatusSubmodelDescriptor = new SubmodelDescriptor(deviceStatusSMID.getURN(), Identification.URI, aasSrvURL+statusSubmodelURLOnServer);
+ SubmodelDescriptor deviceStatusSubmodelDescriptor = new SubmodelDescriptor(deviceStatusSMID.getURN(), IdentifierType.URI, aasSrvURL+statusSubmodelURLOnServer);
deviceAASDescriptor.addSubmodelDescriptor(deviceStatusSubmodelDescriptor);
- SubmodelDescriptor deviceControllerSubmodelDescriptor = new SubmodelDescriptor(deviceControllerSMID.getURN(), Identification.URI, aasSrvURL+controllerSubmodelURLOnServer);
+ SubmodelDescriptor deviceControllerSubmodelDescriptor = new SubmodelDescriptor(deviceControllerSMID.getURN(), IdentifierType.URI, aasSrvURL+controllerSubmodelURLOnServer);
deviceAASDescriptor.addSubmodelDescriptor(deviceControllerSubmodelDescriptor);
// - Push AAS descriptor to server
- client.post(wsURL+"/api/v1/registry", JSONTools.Instance.serialize(deviceAASDescriptor).toString());
+ client.post(wsURL+"/api/v1/registry", GSONTools.Instance.getJsonString(GSONTools.Instance.serialize(deviceAASDescriptor)));
// Device updates status to ready
connSubModel.updateElementValue(statusSubmodelURLOnServer+"/properties/status", "ready");
-
+
// Lookup device AAS
// - Lookup AAS from AAS directory, get AAS descriptor
String jsonData = client.get(wsURL+"/api/v1/registry/"+deviceAASID.getEncodedURN());
// - Read AAS end point from AAS descriptor
- AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) JSONTools.Instance.deserialize(new JSONObject(jsonData)));
+ AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) GSONTools.Instance.deserialize(GSONTools.Instance.getMap(GSONTools.Instance.getObjFromJsonStr(jsonData))));
+
+
// - Get information about status sub model
SubmodelDescriptor smDescriptor = aasDescriptor.getSubModelDescriptor(deviceStatusSMID.getURN());
-
+
// Connect to status sub model end point
VABElementProxy connSM = connManager.connectToVABElementByURL(smDescriptor.getFirstEndpoint());
+ // - Read elements
Map<String, Object> deviceSM = (Map<String, Object>) connSM.readElementValue("/");
// - Output status information
System.out.println("ReadBack:"+((Map<String, Object>) deviceSM.get("properties")).get("status"));
diff --git a/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistry.java b/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistry.java
index c295d9a..ef8c588 100644
--- a/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistry.java
+++ b/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistry.java
@@ -2,10 +2,12 @@
import org.eclipse.basyx.aas.backend.connector.http.HTTPConnectorProvider;
import org.eclipse.basyx.aas.metamodel.hashmap.VABModelMap;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell_;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.SubModel_;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identification;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.SubModel;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.IdentifierType;
+import org.eclipse.basyx.regression.support.server.AASHTTPServerResource;
import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
+import org.junit.ClassRule;
import org.junit.Test;
import basys.examples.aasdescriptor.AASDescriptor;
@@ -14,6 +16,7 @@
import basys.examples.frontend.client.connmanager.ModelServerProxy;
import basys.examples.frontend.client.proxies.AASRegistryProxy;
import basys.examples.urntools.ModelUrn;
+import examples.contexts.DefaultBaSyxExamplesContext;
import examples.directory.ExamplesDirectory;
@@ -33,6 +36,13 @@
protected BaSysConnectionManager connManager = new BaSysConnectionManager(new ExamplesDirectory(), new HTTPConnectorProvider());
+ /**
+ * Makes sure Tomcat Server with basic BaSys topology is started
+ */
+ @ClassRule
+ public static AASHTTPServerResource res = AASHTTPServerResource.getTestResource(new DefaultBaSyxExamplesContext());
+
+
/**
* Test basic queries
@@ -52,7 +62,7 @@
//String aasSrvURL = "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver";
- // Instantiate AAS registry proxy
+ // Instantiate AAS registry proxy that connects to registry
AASRegistryProxy registry = new AASRegistryProxy("http://localhost:8080/basys.components/Testsuite/Directory/SQL");
@@ -60,7 +70,7 @@
// - Product ID (urn:<legalEntity>:<subUnit>:<subModel>:<version>:<revision>:<elementID>#<elementInstance>)
ModelUrn deviceAASID = new ModelUrn("de.FHG", "devices.es.iese", "aas", "1.0", "3", "x-509", "001");
// - Create device AAS
- AssetAdministrationShell_ aas = new AssetAdministrationShell_();
+ AssetAdministrationShell aas = new AssetAdministrationShell();
aas.put("idShort", "DeviceIDShort");
// - Push AAS to model repository
modelServer.pushToServer(deviceAASID, aas);
@@ -73,7 +83,7 @@
// The device also brings a sub model structure with an own ID that is being pushed on the server
ModelUrn deviceStatusSMID = new ModelUrn("de.FHG", "devices.es.iese", "statusSM", "1.0", "3", "x-509", "001");
// - Create generic sub model
- SubModel_ statusSM = new SubModel_();
+ SubModel statusSM = new SubModel();
statusSM.putPath("properties/status", "offline");
//((Map<String, Object>) statusSM.get("properties")).put("status", "offline");
// - Push static sub model to model repository
@@ -87,9 +97,9 @@
// Register AAS and sub models in directory (push AAS descriptor to server)
// - Create an AAS descriptor
//AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), Identification.URI, aasSrvURL+aasURLOnServer);
- AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), Identification.URI, modelServer.getURLToModel(deviceAASID));
+ AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), IdentifierType.URI, modelServer.getURLToModel(deviceAASID));
// - Add a sub model descriptor for device
- SubmodelDescriptor deviceStatusSubmodelDescriptor = new SubmodelDescriptor(deviceStatusSMID.getURN(), Identification.URI, modelServer.getURLToModel(deviceStatusSMID));
+ SubmodelDescriptor deviceStatusSubmodelDescriptor = new SubmodelDescriptor(deviceStatusSMID.getURN(), IdentifierType.URI, modelServer.getURLToModel(deviceStatusSMID));
deviceAASDescriptor.addSubmodelDescriptor(deviceStatusSubmodelDescriptor);
// - Push AAS descriptor to server
//client.post(wsURL+"/api/v1/registry", JSONTools.Instance.serialize(deviceAASDescriptor).toString());
diff --git a/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistryURL.java b/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistryURL.java
new file mode 100644
index 0000000..46184e5
--- /dev/null
+++ b/examples/basys.examples/examples/examples/deviceaas/RunExampleSimpleAPIManualRegistryURL.java
@@ -0,0 +1,126 @@
+package examples.deviceaas;
+
+import org.eclipse.basyx.aas.backend.connector.http.HTTPConnectorProvider;
+import org.eclipse.basyx.aas.metamodel.hashmap.VABModelMap;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.SubModel;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.IdentifierType;
+import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
+import org.junit.Test;
+
+import basys.examples.aasdescriptor.AASDescriptor;
+import basys.examples.aasdescriptor.SubmodelDescriptor;
+import basys.examples.frontend.client.connmanager.BaSysConnectionManager;
+import basys.examples.frontend.client.connmanager.ModelServerProxy;
+import basys.examples.frontend.client.proxies.AASRegistryProxy;
+import basys.examples.urntools.ModelUrn;
+import examples.directory.ExamplesDirectory;
+
+
+
+/**
+ * Run example for device AAS
+ *
+ * @author kuhn
+ *
+ */
+public class RunExampleSimpleAPIManualRegistryURL {
+
+
+ /**
+ * BaSys connection manager backend
+ */
+ protected BaSysConnectionManager connManager = new BaSysConnectionManager(new ExamplesDirectory(), new HTTPConnectorProvider());
+
+
+
+ /**
+ * Test basic queries
+ */
+ @Test @SuppressWarnings("unchecked")
+ public void test() throws Exception {
+
+ // Server connections
+ // - Connect to AAS server
+ //VABElementProxy connSubModel = this.connManager.connectToVABElement("AASServer");
+ ModelServerProxy modelServer = this.connManager.connectToModelServerURL("http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver/");
+ // - Invoke BaSyx service calls via web services
+ //WebServiceRawClient client = new WebServiceRawClient();
+ // - Directory web service URL
+ //String wsURL = "http://localhost:8080/basys.components/Testsuite/Directory/SQL";
+ // - AAS repository server URL
+ //String aasSrvURL = "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver";
+
+
+ // Instantiate AAS registry proxy that connects to registry
+ AASRegistryProxy registry = new AASRegistryProxy("http://localhost:8080/basys.components/Testsuite/Directory/SQL");
+
+
+ // Create device AAS
+ // - Product ID (urn:<legalEntity>:<subUnit>:<subModel>:<version>:<revision>:<elementID>#<elementInstance>)
+ ModelUrn deviceAASID = new ModelUrn("de.FHG", "devices.es.iese", "aas", "1.0", "3", "x-509", "001");
+ // - Create device AAS
+ AssetAdministrationShell aas = new AssetAdministrationShell();
+ aas.put("idShort", "DeviceIDShort");
+ // - Push AAS to model repository
+ modelServer.pushToServer(deviceAASID, aas);
+ // - AAS URL on server
+ //String aasURLOnServer = "/aas/submodels/aasRepository/"+deviceAASID.getEncodedURN();
+ // - Transfer device AAS to server
+ //connSubModel.createElement(aasURLOnServer, aas);
+
+
+ // The device also brings a sub model structure with an own ID that is being pushed on the server
+ ModelUrn deviceStatusSMID = new ModelUrn("de.FHG", "devices.es.iese", "statusSM", "1.0", "3", "x-509", "001");
+ // - Create generic sub model
+ SubModel statusSM = new SubModel();
+ statusSM.putPath("properties/status", "offline");
+ //((Map<String, Object>) statusSM.get("properties")).put("status", "offline");
+ // - Push static sub model to model repository
+ modelServer.pushToServer(deviceStatusSMID, statusSM);
+ // - Sub model URL on server
+ //String statusSubmodelURLOnServer = "/aas/submodels/aasRepository/"+deviceStatusSMID.getEncodedURN();
+ // - Transfer device sub model to server
+ //connSubModel.createElement(statusSubmodelURLOnServer, statusSM);
+
+
+ // Register AAS and sub models in directory (push AAS descriptor to server)
+ // - Create an AAS descriptor
+ //AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), Identification.URI, aasSrvURL+aasURLOnServer);
+ AASDescriptor deviceAASDescriptor = new AASDescriptor(deviceAASID.getURN(), IdentifierType.URI, modelServer.getURLToModel(deviceAASID));
+ // - Add a sub model descriptor for device
+ SubmodelDescriptor deviceStatusSubmodelDescriptor = new SubmodelDescriptor(deviceStatusSMID.getURN(), IdentifierType.URI, modelServer.getURLToModel(deviceStatusSMID));
+ deviceAASDescriptor.addSubmodelDescriptor(deviceStatusSubmodelDescriptor);
+ // - Push AAS descriptor to server
+ //client.post(wsURL+"/api/v1/registry", JSONTools.Instance.serialize(deviceAASDescriptor).toString());
+ registry.register(deviceAASDescriptor);
+
+
+ // Device updates status to ready
+ //connSubModel.updateElementValue(statusSubmodelURLOnServer+"/properties/status", "ready");
+ modelServer.updateElementValue(deviceStatusSMID, "/properties/status", "ready");
+ // - Read updated status back
+ modelServer.readElementValue(deviceStatusSMID, "/properties/status");
+
+
+ // Lookup device AAS
+ // - Lookup AAS from AAS directory, get AAS descriptor
+ //String jsonData = client.get(wsURL+"/api/v1/registry/"+deviceAASID.getEncodedURN());
+ // - Read AAS end point from AAS descriptor
+ //AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) JSONTools.Instance.deserialize(new JSONObject(jsonData)));
+ AASDescriptor aasDescriptor = registry.lookup(deviceAASID);
+ // - Get information about status sub model
+ SubmodelDescriptor smDescriptor = aasDescriptor.getSubModelDescriptor(deviceStatusSMID.getURN());
+
+
+ // Connect to status sub model end point
+ // - FIXME - we need the ability to connect to an absolute URL here
+ //Map<String, Object> deviceSM = (Map<String, Object>) connSubModel.readElementValue(statusSubmodelURLOnServer);
+ //Map<String, Object> deviceSM = (Map<String, Object>) connSubModel.readElementValue(smDescriptor.getFirstEndpoint());
+ VABElementProxy connSubModel = connManager.connectToVABElementByURL(smDescriptor.getFirstEndpoint());
+ VABModelMap<Object> deviceSM = (VABModelMap<Object>) connSubModel.readElementValue("/");
+ // - Output status information
+ //System.out.println("ReadBack:"+((Map<String, Object>) deviceSM.get("properties")).get("status"));
+ System.out.println("ReadBack:"+deviceSM.getPath("properties/status"));
+ }
+}
diff --git a/examples/basys.examples/examples/examples/productaas/RunExample.java b/examples/basys.examples/examples/examples/productaas/RunExample.java
index 2f9300d..da7e30b 100644
--- a/examples/basys.examples/examples/examples/productaas/RunExample.java
+++ b/examples/basys.examples/examples/examples/productaas/RunExample.java
@@ -1,19 +1,22 @@
package examples.productaas;
+import java.net.URLEncoder;
import java.util.Map;
import org.eclipse.basyx.aas.backend.connector.http.HTTPConnectorProvider;
-import org.eclipse.basyx.aas.backend.http.tools.JSONTools;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell_;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identification;
+import org.eclipse.basyx.aas.backend.http.tools.GSONTools;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.IdentifierType;
+import org.eclipse.basyx.regression.support.server.AASHTTPServerResource;
import org.eclipse.basyx.tools.webserviceclient.WebServiceRawClient;
import org.eclipse.basyx.vab.core.VABConnectionManager;
import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
-import org.json.JSONObject;
+import org.junit.ClassRule;
import org.junit.Test;
import basys.examples.aasdescriptor.AASDescriptor;
import basys.examples.urntools.ModelUrn;
+import examples.contexts.DefaultBaSyxExamplesContext;
import examples.directory.ExamplesDirectory;
@@ -33,6 +36,13 @@
protected VABConnectionManager connManager = new VABConnectionManager(new ExamplesDirectory(), new HTTPConnectorProvider());
+ /**
+ * Makes sure Tomcat Server with basic BaSys topology is started
+ */
+ @ClassRule
+ public static AASHTTPServerResource res = AASHTTPServerResource.getTestResource(new DefaultBaSyxExamplesContext());
+
+
/**
* Test basic queries
@@ -47,36 +57,40 @@
// - Invoke BaSyx service calls via web services
WebServiceRawClient client = new WebServiceRawClient();
// - Directory web service URL
- String wsURL = "http://localhost:8080/basys.components/Testsuite/Directory/SQL";
+ String wsURL = "http://localhost:8080/basys.examples/Components/Directory/SQL";
// - AAS repository server URL
- String aasSrvURL = "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver";
-
+ String aasSrvURL = "http://localhost:8080/basys.examples/Components/BaSys/1.0/aasServer";
// Create product AAS
// - Product ID (urn:<legalEntity>:<subUnit>:<subModel>:<version>:<revision>:<elementID>#<elementInstance>)
ModelUrn productID = new ModelUrn("de.FHG", "products.es.iese", "aas", "1.0", "3", "product1", null);
// - Create map with complex type
- AssetAdministrationShell_ aas = new AssetAdministrationShell_();
+ AssetAdministrationShell aas = new AssetAdministrationShell();
aas.put("idShort", "ProductIDShort");
// - AAS URL on server
+ //String aasURLOnServer = "/aas/submodels/rawSampleCFG/"+productID.getEncodedURN();
String aasURLOnServer = "/aas/submodels/aasRepository/"+productID.getEncodedURN();
// - Create AAS structure on server
connSubModel.createElement(aasURLOnServer, aas);
+
+ // Delete AAS registration for a fresh start - ignore if URL was not found. In this case, there was no previous registration and the registry was clean
+ client.delete(wsURL+"/api/v1/registry/"+URLEncoder.encode(productID.getURN()));
+
// Register AAS in directory (push AAS descriptor to server)
// - Create an AAS descriptor
- AASDescriptor productAASDescriptor = new AASDescriptor(productID.getURN(), Identification.URI, aasSrvURL+aasURLOnServer);
+ AASDescriptor productAASDescriptor = new AASDescriptor(productID.getURN(), IdentifierType.URI, aasSrvURL+aasURLOnServer);
// - Push AAS descriptor to server
- client.post(wsURL+"/api/v1/registry", JSONTools.Instance.serialize(productAASDescriptor).toString());
+ client.post(wsURL+"/api/v1/registry", GSONTools.Instance.getJsonString(GSONTools.Instance.serialize(productAASDescriptor)));
// Lookup AAS
// - Lookup AAS from AAS directory, get AAS descriptor
String jsonData = client.get(wsURL+"/api/v1/registry/"+productID.getEncodedURN());
// - Read AAS end point from AAS descriptor
- AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) JSONTools.Instance.deserialize(new JSONObject(jsonData)));
+ AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) GSONTools.Instance.deserialize(GSONTools.Instance.getMap(GSONTools.Instance.getObjFromJsonStr(jsonData))));
System.out.println("Endpoint:"+aasDescriptor.getFirstEndpoint());
diff --git a/examples/basys.examples/examples/examples/productaas/RunExampleSimpleAPI.java b/examples/basys.examples/examples/examples/productaas/RunExampleSimpleAPI.java
index fef42bf..df6b65c 100644
--- a/examples/basys.examples/examples/examples/productaas/RunExampleSimpleAPI.java
+++ b/examples/basys.examples/examples/examples/productaas/RunExampleSimpleAPI.java
@@ -2,8 +2,8 @@
import org.eclipse.basyx.aas.backend.connector.http.HTTPConnectorProvider;
import org.eclipse.basyx.aas.metamodel.hashmap.VABModelMap;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell_;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identification;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.IdentifierType;
import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
import org.junit.Test;
@@ -52,7 +52,7 @@
// - Product ID (urn:<legalEntity>:<subUnit>:<subModel>:<version>:<revision>:<elementID>#<elementInstance>)
ModelUrn productID = new ModelUrn("de.FHG", "products.es.iese", "aas", "1.0", "3", "product1", null);
// - Create map with complex type
- AssetAdministrationShell_ aas = new AssetAdministrationShell_();
+ AssetAdministrationShell aas = new AssetAdministrationShell();
aas.put("idShort", "ProductIDShort");
// - Push AAS to model repository
modelServer.pushToServer(productID, aas);
@@ -60,7 +60,7 @@
// Register AAS in directory (push AAS descriptor to server)
// - Create an AAS descriptor
- AASDescriptor productAASDescriptor = new AASDescriptor(productID.getURN(), Identification.URI, modelServer.getURLToModel(productID));
+ AASDescriptor productAASDescriptor = new AASDescriptor(productID.getURN(), IdentifierType.URI, modelServer.getURLToModel(productID));
// - Push AAS descriptor to server
registry.register(productAASDescriptor);
diff --git a/examples/basys.examples/pom.xml b/examples/basys.examples/pom.xml
index 4070d6f..2f05b53 100644
--- a/examples/basys.examples/pom.xml
+++ b/examples/basys.examples/pom.xml
@@ -3,7 +3,9 @@
<groupId>basys.examples</groupId>
<artifactId>basys.examples</artifactId>
<version>0.0.1-SNAPSHOT</version>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
+ <name>BaSys Examples</name>
+
<repositories>
<repository>
<id>data-local</id>
@@ -97,6 +99,18 @@
</execution>
</executions>
</plugin>
+
+
+ <!-- Export Jar file to /examples package -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <outputDirectory>../../examples/basys.examples/repo/basys/examples/basys.examples/0.0.1-SNAPSHOT</outputDirectory>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
@@ -253,6 +267,13 @@
<artifactId>Saxon-HE</artifactId>
<version>9.5.1-5</version>
</dependency>
+
+
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.8.5</version>
+ </dependency>
<!-- Add BaSys SDK from local repository. Maven build of SDK must generate a jar and place it into the repository to update -->
diff --git a/examples/basys.examples/src/basys/examples/frontend/client/connmanager/BaSysConnectionManager.java b/examples/basys.examples/src/basys/examples/frontend/client/connmanager/BaSysConnectionManager.java
index e56500e..d43e064 100644
--- a/examples/basys.examples/src/basys/examples/frontend/client/connmanager/BaSysConnectionManager.java
+++ b/examples/basys.examples/src/basys/examples/frontend/client/connmanager/BaSysConnectionManager.java
@@ -47,5 +47,16 @@
// Return a new ModelServerProxy
return new ModelServerProxy(addr, providerProvider.getConnector(addr));
}
+
+
+ /**
+ * Connect to an model provider server through a provided URL
+ *
+ * @param url to model provider server
+ */
+ public ModelServerProxy connectToModelServerURL(String url) {
+ // Return a new ModelServerProxy
+ return new ModelServerProxy(url, providerProvider.getConnector(url));
+ }
}
diff --git a/examples/basys.examples/src/basys/examples/frontend/client/proxies/AASRegistryProxy.java b/examples/basys.examples/src/basys/examples/frontend/client/proxies/AASRegistryProxy.java
index a6635c9..9da4c52 100644
--- a/examples/basys.examples/src/basys/examples/frontend/client/proxies/AASRegistryProxy.java
+++ b/examples/basys.examples/src/basys/examples/frontend/client/proxies/AASRegistryProxy.java
@@ -2,10 +2,8 @@
import java.util.Map;
-import org.eclipse.basyx.aas.backend.http.tools.JSONTools;
+import org.eclipse.basyx.aas.backend.http.tools.GSONTools;
import org.eclipse.basyx.tools.webserviceclient.WebServiceRawClient;
-import org.json.JSONObject;
-
import basys.examples.aasdescriptor.AASDescriptor;
import basys.examples.urntools.ModelUrn;
@@ -53,7 +51,7 @@
*/
public void register(AASDescriptor deviceAASDescriptor) {
// Perform web service call to registry
- client.post(aasRegistryURL+"/api/v1/registry", JSONTools.Instance.serialize(deviceAASDescriptor).toString());
+ client.post(aasRegistryURL+"/api/v1/registry", GSONTools.Instance.getJsonString(GSONTools.Instance.serialize(deviceAASDescriptor)));
}
@@ -66,7 +64,7 @@
String jsonData = client.get(aasRegistryURL+"/api/v1/registry/"+aasID.getEncodedURN());
// Deserialize AAS descriptor
- AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) JSONTools.Instance.deserialize(new JSONObject(jsonData)));
+ AASDescriptor aasDescriptor = new AASDescriptor((Map<String, Object>) GSONTools.Instance.deserialize(GSONTools.Instance.getMap(jsonData)));
// Return AAS descriptor
return aasDescriptor;
diff --git a/examples/basys.examples/support/examples/directory/ExamplesDirectory.java b/examples/basys.examples/support/examples/directory/ExamplesDirectory.java
index bb06a65..9462c87 100644
--- a/examples/basys.examples/support/examples/directory/ExamplesDirectory.java
+++ b/examples/basys.examples/support/examples/directory/ExamplesDirectory.java
@@ -23,6 +23,7 @@
// Define mappings
// - AAS server mapping
- addMapping("AASServer", "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver/");
+ //addMapping("AASServer", "http://localhost:8080/basys.examples/Testsuite/components/BaSys/1.0/aasserver/");
+ addMapping("AASServer", "http://localhost:8080/basys.examples/Components/BaSys/1.0/aasServer/");
}
}