Aligns Registry connection with c#
Signed-off-by: Patrick Pschorn <patrick.pschorn@iese.fraunhofer.de>
diff --git a/components/basys.components/regression/org/eclipse/basyx/regression/support/server/BaSyxContext.java b/components/basys.components/regression/org/eclipse/basyx/regression/support/server/BaSyxContext.java
index 590d7e5..f3a183a 100644
--- a/components/basys.components/regression/org/eclipse/basyx/regression/support/server/BaSyxContext.java
+++ b/components/basys.components/regression/org/eclipse/basyx/regression/support/server/BaSyxContext.java
@@ -1,10 +1,14 @@
package org.eclipse.basyx.regression.support.server;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServlet;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+
/**
@@ -49,7 +53,7 @@
public Object AASHTTPServerResource;
-
+ protected List<AssetAdministrationShell> aasList;
/**
* Constructor with default port
@@ -57,6 +61,8 @@
public BaSyxContext(String reqContextPath, String reqDocBasePath) {
// Invoke constructor
this(reqContextPath, reqDocBasePath, 8080);
+
+ this.aasList = new ArrayList<AssetAdministrationShell>();
}
@@ -83,6 +89,18 @@
return this;
}
+ /**
+ * Store AAS provided in this context
+ * @param fs01
+ */
+ public void addAAS(AssetAdministrationShell aas) {
+ this.aasList.add(aas);
+ }
+
+ public List<AssetAdministrationShell> getAASList() {
+ return this.aasList;
+ }
+
/**
* Add a servlet mapping with parameter
@@ -130,5 +148,9 @@
public int getPort() {
return port;
}
+
+
+
+
}
diff --git a/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASHTTPRegistryProxy.java b/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASHTTPRegistryProxy.java
index 7b9c076..1136d1a 100644
--- a/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASHTTPRegistryProxy.java
+++ b/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASHTTPRegistryProxy.java
@@ -168,5 +168,20 @@
// Currently not implemented
return null;
}
+
+
+ /**
+ * Register hacked aas descriptor
+ */
+ @Override
+ public void register(ModelUrn aasID,
+ org.eclipse.basyx.aas.metamodel.hashmap.aas.descriptor.AASDescriptor deviceAASDescriptor) {
+ // Invoke delete operation of AAS registry
+ try {client.delete(aasRegistryURL+"/api/v1/registry/"+URLEncoder.encode(aasID.getURN(), "UTF-8"));} catch (Exception e) {e.printStackTrace();}
+
+ // Perform web service call to registry
+ client.post(aasRegistryURL+"/api/v1/registry", serializer.serialize(deviceAASDescriptor));
+
+ }
}
diff --git a/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASRegistryProxyIF.java b/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASRegistryProxyIF.java
index 04304cc..63169cf 100644
--- a/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASRegistryProxyIF.java
+++ b/components/basys.components/src/org/eclipse/basyx/components/proxy/registry/AASRegistryProxyIF.java
@@ -17,10 +17,16 @@
/**
- * Register AAS descriptor in registry, delete old registration
+ * Register AAS descriptor in registry, delete old registration
*/
public void register(ModelUrn aasID, AASDescriptor deviceAASDescriptor);
+ /**
+ * Register AAS descriptor in registry, delete old registration (hacked)
+ * @param aasId
+ */
+ public void register(ModelUrn aasId, org.eclipse.basyx.aas.metamodel.hashmap.aas.descriptor.AASDescriptor desc);
+
/**
* Only register AAS descriptor in registry
diff --git a/components/basys.components/src/org/eclipse/basyx/tools/aasdescriptor/AASDescriptor.java b/components/basys.components/src/org/eclipse/basyx/tools/aasdescriptor/AASDescriptor.java
index 07c5394..9d561b9 100644
--- a/components/basys.components/src/org/eclipse/basyx/tools/aasdescriptor/AASDescriptor.java
+++ b/components/basys.components/src/org/eclipse/basyx/tools/aasdescriptor/AASDescriptor.java
@@ -91,6 +91,10 @@
put("endpoints", Arrays.asList(endpointWrapper));
}
+ public String getAASId() {
+ return (String) get("idShort");
+ }
+
/**
diff --git a/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnection.java b/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnection.java
index 09ccfd7..980e87b 100644
--- a/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnection.java
+++ b/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnection.java
@@ -71,7 +71,7 @@
getProperties().put(fac.createContainer(new SubmodelElementCollection(), containerProperties, fac.emptyList(), "prop2"));
// Add another property manually to sub model container "properties"
- {((Map<String, Object>) this.get("properties")).put("prop3", fac.create(new Property(), 17, "prop3"));}
+ {((Map<String, Object>) this.get("dataElements")).put("prop3", fac.create(new Property(), 17, "prop3"));}
}
}
diff --git a/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnectionFull.java b/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnectionFull.java
index e6b73da..8e8e2a7 100644
--- a/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnectionFull.java
+++ b/examples/basys.examples/examples/org/eclipse/basyx/examples/snippets/undoc/aas/connection/servlet/AASServletConnectionFull.java
@@ -71,7 +71,7 @@
getProperties().put(fac.createContainer(new SubmodelElementCollection(), containerProperties, fac.emptyList(), "prop2"));
// Add another property manually to sub model container "properties"
- {((Map<String, Object>) this.get("properties")).put("prop3", fac.create(new Property(), 17, "prop3"));}
+ {((Map<String, Object>) this.get("dataElements")).put("prop3", fac.create(new Property(), 17, "prop3"));}
}
}
diff --git a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/backend/connected/aas/submodelelement/property/ConnectedContainerProperty.java b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/backend/connected/aas/submodelelement/property/ConnectedContainerProperty.java
index d9863cb..5eaa28a 100644
--- a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/backend/connected/aas/submodelelement/property/ConnectedContainerProperty.java
+++ b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/backend/connected/aas/submodelelement/property/ConnectedContainerProperty.java
@@ -1,78 +1,78 @@
-package org.eclipse.basyx.aas.backend.connected.aas.submodelelement.property;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.basyx.aas.api.resources.IContainerProperty;
-import org.eclipse.basyx.aas.api.resources.IOperation;
-import org.eclipse.basyx.aas.api.resources.IProperty;
-import org.eclipse.basyx.aas.api.resources.PropertyType;
-import org.eclipse.basyx.aas.backend.connected.aas.submodelelement.operation.ConnectedOperation;
-import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
-
-/**
- * Connects to a ComplexDataProperty as specified by meta model. <br />
- * Not contained in DAAS meta model
- *
- * @author schnicke
- *
- */
-public class ConnectedContainerProperty extends ConnectedProperty implements IContainerProperty {
-
- ConnectedPropertyFactory factory = new ConnectedPropertyFactory();
-
- public ConnectedContainerProperty(String path, VABElementProxy proxy) {
- super(PropertyType.Container, path, proxy);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, IProperty> getProperties() {
- Map<String, Object> props = (Map<String, Object>) getProxy().readElementValue(constructPath("properties"));
- Map<String, IProperty> ret = new HashMap<>();
-
- for (String s : props.keySet()) {
- ret.put(s, factory.createProperty(constructPath("properties/" + s), getProxy()));
- }
- return ret;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, IOperation> getOperations() {
- Map<String, Object> ops = (Map<String, Object>) getProxy().readElementValue(constructPath("operations"));
-
- Map<String, IOperation> ret = new HashMap<>();
- for (String s : ops.keySet()) {
- ret.put(s, new ConnectedOperation(constructPath("operations/" + s), getProxy()));
- }
- return ret;
- }
-
- @Override
- public void setValue(Object obj) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Object getValue() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setValueId(Object obj) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Object getValueId() {
- // TODO Auto-generated method stub
- return null;
- }
-
-
-
-}
+package org.eclipse.basyx.aas.backend.connected.aas.submodelelement.property;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.basyx.aas.api.resources.IContainerProperty;
+import org.eclipse.basyx.aas.api.resources.IOperation;
+import org.eclipse.basyx.aas.api.resources.IProperty;
+import org.eclipse.basyx.aas.api.resources.PropertyType;
+import org.eclipse.basyx.aas.backend.connected.aas.submodelelement.operation.ConnectedOperation;
+import org.eclipse.basyx.vab.core.proxy.VABElementProxy;
+
+/**
+ * Connects to a ComplexDataProperty as specified by meta model. <br />
+ * Not contained in DAAS meta model
+ *
+ * @author schnicke
+ *
+ */
+public class ConnectedContainerProperty extends ConnectedProperty implements IContainerProperty {
+
+ ConnectedPropertyFactory factory = new ConnectedPropertyFactory();
+
+ public ConnectedContainerProperty(String path, VABElementProxy proxy) {
+ super(PropertyType.Container, path, proxy);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map<String, IProperty> getProperties() {
+ Map<String, Object> props = (Map<String, Object>) getProxy().readElementValue(constructPath("dataElements"));
+ Map<String, IProperty> ret = new HashMap<>();
+
+ for (String s : props.keySet()) {
+ ret.put(s, factory.createProperty(constructPath("dataElements/" + s), getProxy()));
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map<String, IOperation> getOperations() {
+ Map<String, Object> ops = (Map<String, Object>) getProxy().readElementValue(constructPath("operations"));
+
+ Map<String, IOperation> ret = new HashMap<>();
+ for (String s : ops.keySet()) {
+ ret.put(s, new ConnectedOperation(constructPath("operations/" + s), getProxy()));
+ }
+ return ret;
+ }
+
+ @Override
+ public void setValue(Object obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Object getValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void setValueId(Object obj) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Object getValueId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+
+}
diff --git a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/facades/AssetAdministrationShellFacade.java b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/facades/AssetAdministrationShellFacade.java
index dcfe569..944a69a 100644
--- a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/facades/AssetAdministrationShellFacade.java
+++ b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/facades/AssetAdministrationShellFacade.java
@@ -1,155 +1,160 @@
-package org.eclipse.basyx.aas.metamodel.facades;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.basyx.aas.api.metamodel.aas.parts.IConceptDictionary;
-import org.eclipse.basyx.aas.api.metamodel.aas.parts.IView;
-import org.eclipse.basyx.aas.api.metamodel.aas.reference.IReference;
-import org.eclipse.basyx.aas.api.metamodel.aas.security.ISecurity;
-import org.eclipse.basyx.aas.api.resources.IAssetAdministrationShell;
-import org.eclipse.basyx.aas.api.resources.ISubModel;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.Identifier;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.AdministrativeInformation;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.HasDataSpecification;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identifiable;
-/**
- * Facade providing access to a map containing the AssetAdministrationShell structure
- * @author rajashek
- *
- */
-public class AssetAdministrationShellFacade implements IAssetAdministrationShell {
-
- private Map<String, Object> map;
- public AssetAdministrationShellFacade(Map<String, Object> map) {
- super();
- this.map = map;
- }
-
- @Override
- public void setSecurity(ISecurity security) {
- map.put(AssetAdministrationShell.SECURITY,security );
-
- }
-
- @Override
- public ISecurity getSecurity() {
- return (ISecurity)map.get(AssetAdministrationShell.SECURITY);
- }
-
- @Override
- public void setDerivedFrom(IReference derivedFrom) {
- map.put(AssetAdministrationShell.DERIVEDFROM,derivedFrom );
-
- }
-
- @Override
- public IReference getDerivedFrom() {
- return (IReference)map.get(AssetAdministrationShell.DERIVEDFROM);
- }
-
- @Override
- public void setAsset(IReference asset) {
- map.put(AssetAdministrationShell.ASSET,asset );
-
- }
-
- @Override
- public IReference getAsset() {
- return (IReference)map.get(AssetAdministrationShell.ASSET);
- }
-
- @Override
- public void setSubModel(Set<IReference> submodels) {
- map.put(AssetAdministrationShell.SUBMODEL,submodels );
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Set<IReference> getSubModel() {
- return (Set<IReference>)map.get(AssetAdministrationShell.SUBMODEL);
- }
-
- @Override
- public void setViews(Set<IView> views) {
- map.put(AssetAdministrationShell.VIEWS,views);
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Set<IView> getViews() {
- return (Set<IView>)map.get(AssetAdministrationShell.VIEWS);
- }
-
- @Override
- public void setConceptDictionary(Set<IConceptDictionary> dictionaries) {
- map.put(AssetAdministrationShell.CONCEPTDICTIONARY, dictionaries);
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Set<IConceptDictionary> getConceptDictionary() {
- return (Set<IConceptDictionary>)map.get(AssetAdministrationShell.CONCEPTDICTIONARY);
- }
-
- @Override
- public AdministrativeInformation getAdministration() {
- return (AdministrativeInformation)map.get(Identifiable.ADMINISTRATION);
- }
-
- @Override
- public Identifier getIdentification() {
- return (Identifier)map.get(Identifiable.IDENTIFICATION);
- }
-
- @Override
- public void setAdministration(String version, String revision) {
- map.put(Identifiable.ADMINISTRATION, new AdministrativeInformation(version, revision));
-
- }
-
- @Override
- public void setIdentification(String idType, String id) {
- map.put(Identifiable.IDENTIFICATION, new Identifier(idType, id));
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public HashSet<IReference> getDataSpecificationReferences() {
- return (HashSet<IReference>) map.get(HasDataSpecification.HASDATASPECIFICATION);
- }
-
- @Override
- public void setDataSpecificationReferences(HashSet<IReference> ref) {
- map.put(HasDataSpecification.HASDATASPECIFICATION, ref);
-
- }
-
- @Override
- public String getId() {
- return (String)map.get(AssetAdministrationShell.IDSHORT);
- }
-
- @Override
- public void setId(String id) {
- map.put(AssetAdministrationShell.IDSHORT, id);
-
- }
-
- @Override
- public Map<String, ISubModel> getSubModels() {
- throw new RuntimeException("getSubModels on local copy is not supported");
- }
-
- @Override
- public void addSubModel(ISubModel subModel) {
- throw new RuntimeException("addSubModel on local copy is not supported");
- }
-
-}
+package org.eclipse.basyx.aas.metamodel.facades;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.basyx.aas.api.metamodel.aas.parts.IConceptDictionary;
+import org.eclipse.basyx.aas.api.metamodel.aas.parts.IView;
+import org.eclipse.basyx.aas.api.metamodel.aas.reference.IReference;
+import org.eclipse.basyx.aas.api.metamodel.aas.security.ISecurity;
+import org.eclipse.basyx.aas.api.resources.IAssetAdministrationShell;
+import org.eclipse.basyx.aas.api.resources.ISubModel;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.AssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.identifier.Identifier;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.AdministrativeInformation;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.HasDataSpecification;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.qualifier.Identifiable;
+/**
+ * Facade providing access to a map containing the AssetAdministrationShell structure
+ * @author rajashek
+ *
+ */
+public class AssetAdministrationShellFacade implements IAssetAdministrationShell {
+
+ private Map<String, Object> map;
+ public AssetAdministrationShellFacade(Map<String, Object> map) {
+ super();
+ this.map = map;
+ }
+
+ @Override
+ public void setSecurity(ISecurity security) {
+ map.put(AssetAdministrationShell.SECURITY,security );
+
+ }
+
+ @Override
+ public ISecurity getSecurity() {
+ return (ISecurity)map.get(AssetAdministrationShell.SECURITY);
+ }
+
+ @Override
+ public void setDerivedFrom(IReference derivedFrom) {
+ map.put(AssetAdministrationShell.DERIVEDFROM,derivedFrom );
+
+ }
+
+ @Override
+ public IReference getDerivedFrom() {
+ return (IReference)map.get(AssetAdministrationShell.DERIVEDFROM);
+ }
+
+ @Override
+ public void setAsset(IReference asset) {
+ map.put(AssetAdministrationShell.ASSET,asset );
+
+ }
+
+ @Override
+ public IReference getAsset() {
+ return (IReference)map.get(AssetAdministrationShell.ASSET);
+ }
+
+ @Override
+ public void setSubModel(Set<IReference> submodels) {
+ map.put(AssetAdministrationShell.SUBMODEL,submodels );
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<IReference> getSubModel() {
+ return (Set<IReference>)map.get(AssetAdministrationShell.SUBMODEL);
+ }
+
+ @Override
+ public void setViews(Set<IView> views) {
+ map.put(AssetAdministrationShell.VIEWS,views);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<IView> getViews() {
+ return (Set<IView>)map.get(AssetAdministrationShell.VIEWS);
+ }
+
+ @Override
+ public void setConceptDictionary(Set<IConceptDictionary> dictionaries) {
+ map.put(AssetAdministrationShell.CONCEPTDICTIONARY, dictionaries);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Set<IConceptDictionary> getConceptDictionary() {
+ return (Set<IConceptDictionary>)map.get(AssetAdministrationShell.CONCEPTDICTIONARY);
+ }
+
+ @Override
+ public AdministrativeInformation getAdministration() {
+ return (AdministrativeInformation)map.get(Identifiable.ADMINISTRATION);
+ }
+
+ @Override
+ public Identifier getIdentification() {
+ return (Identifier)map.get(Identifiable.IDENTIFICATION);
+ }
+
+ @Override
+ public void setAdministration(String version, String revision) {
+ map.put(Identifiable.ADMINISTRATION, new AdministrativeInformation(version, revision));
+
+ }
+
+ @Override
+ public void setIdentification(String idType, String id) {
+ map.put(Identifiable.IDENTIFICATION, new Identifier(idType, id));
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public HashSet<IReference> getDataSpecificationReferences() {
+ return (HashSet<IReference>) map.get(HasDataSpecification.HASDATASPECIFICATION);
+ }
+
+ @Override
+ public void setDataSpecificationReferences(HashSet<IReference> ref) {
+ map.put(HasDataSpecification.HASDATASPECIFICATION, ref);
+
+ }
+
+ @Override
+ public String getId() {
+ return (String)map.get(AssetAdministrationShell.IDSHORT);
+ }
+
+ @Override
+ public void setId(String id) {
+ map.put(AssetAdministrationShell.IDSHORT, id);
+
+ }
+
+ @Override
+ public Map<String, ISubModel> getSubModels() {
+ throw new RuntimeException("getSubModels on local copy is not supported");
+ }
+
+
+ public Set<ISubModel> getSubModelsHack() {
+ return (Set<ISubModel>) map.get("submodels");
+ }
+
+ @Override
+ public void addSubModel(ISubModel subModel) {
+ throw new RuntimeException("addSubModel on local copy is not supported");
+ }
+
+}
diff --git a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/AssetAdministrationShell.java b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/AssetAdministrationShell.java
index 6637a61..4a5169f 100644
--- a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/AssetAdministrationShell.java
+++ b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/AssetAdministrationShell.java
@@ -4,6 +4,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -100,6 +101,10 @@
put("endpoints", Arrays.asList(endpointWrapper));
}
+ public List<HashMap<String, String>> getEndpoints(){
+ return (List<HashMap<String, String>>) get("endpoints");
+ }
+
/**
* Add a submodel as reference
*/
@@ -112,10 +117,14 @@
@SuppressWarnings("unchecked")
public void addSubModelHack(SubModel subModel, String endpoint, String endpointType) {
System.out.println("adding Submodel " + subModel.getId());
- SubmodelDescriptor desc = new SubmodelDescriptor(subModel, endpoint, endpointType);
+ SubmodelDescriptor desc = new SubmodelDescriptor(subModel, endpoint + "/aas/submodel", endpointType);
((Set<SubmodelDescriptor>) get(SUBMODELS)).add(desc);
}
+
+ public Set<SubmodelDescriptor> getSubmodelDescriptors(){
+ return ((Set<SubmodelDescriptor>) get(SUBMODELS));
+ }
@SuppressWarnings("unchecked")
public void addSubModel(String id) {
diff --git a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/AASDescriptor.java b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/AASDescriptor.java
index ca3528c..931b084 100644
--- a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/AASDescriptor.java
+++ b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/AASDescriptor.java
@@ -54,6 +54,27 @@
put("endpoints", Arrays.asList(endpointWrapper));
}
+ /**
+ * Create a new sub model descriptor with minimal information
+ */
+ @SuppressWarnings("unchecked")
+ public AASDescriptor(AssetAdministrationShell aas) {
+ // Invoke default constructor
+
+
+ put("idShort", aas.getId());
+ put("submodels", new LinkedList<SubmodelDescriptor>());
+
+ // Add identification and end point information
+ Identifier identifier = new Identifier();
+
+ identifier.setIdType(aas.getIdentification().getIdType());
+ identifier.setId(aas.getIdentification().getId());
+ put("identification", identifier);
+
+ put("endpoints", aas.getEndpoints());
+ }
+
/**
@@ -150,5 +171,11 @@
// No Descritor found
return null;
}
+
+
+
+ public String getAASId() {
+ return (String) get("idShort");
+ }
}
diff --git a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/SubmodelDescriptor.java b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/SubmodelDescriptor.java
index d4094ca..02e03fb 100644
--- a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/SubmodelDescriptor.java
+++ b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/descriptor/SubmodelDescriptor.java
@@ -62,12 +62,18 @@
this.putAll(map);
}
-
/**
* Return sub model ID
*/
- @SuppressWarnings("unchecked")
public String getId() {
+ return (String) get("idShort");
+ }
+
+ /**
+ * Return sub model identification ID
+ */
+ @SuppressWarnings("unchecked")
+ public String getIdentificationId() {
return new Identifier((Map<String, Object>) get("identification")).getId();
}
diff --git a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/submodelelement/SubmodelElementCollection.java b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/submodelelement/SubmodelElementCollection.java
index 0b46d5c..21d91ac 100644
--- a/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/submodelelement/SubmodelElementCollection.java
+++ b/sdks/java/basys.sdk/src/org/eclipse/basyx/aas/metamodel/hashmap/aas/submodelelement/SubmodelElementCollection.java
@@ -1,335 +1,335 @@
-package org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.basyx.aas.api.exception.FeatureNotImplementedException;
-import org.eclipse.basyx.aas.api.metamodel.aas.qualifier.qualifiable.IConstraint;
-import org.eclipse.basyx.aas.api.metamodel.aas.reference.IReference;
-import org.eclipse.basyx.aas.api.metamodel.aas.submodelelement.ISubmodelElement;
-import org.eclipse.basyx.aas.api.metamodel.aas.submodelelement.ISubmodelElementCollection;
-import org.eclipse.basyx.aas.api.resources.IContainerProperty;
-import org.eclipse.basyx.aas.api.resources.IOperation;
-import org.eclipse.basyx.aas.api.resources.IProperty;
-import org.eclipse.basyx.aas.api.resources.PropertyType;
-import org.eclipse.basyx.aas.metamodel.facades.HasDataSpecificationFacade;
-import org.eclipse.basyx.aas.metamodel.facades.HasKindFacade;
-import org.eclipse.basyx.aas.metamodel.facades.HasSemanticsFacade;
-import org.eclipse.basyx.aas.metamodel.facades.OperationFacade;
-import org.eclipse.basyx.aas.metamodel.facades.PropertyFacade;
-import org.eclipse.basyx.aas.metamodel.facades.QualifiableFacade;
-import org.eclipse.basyx.aas.metamodel.facades.ReferableFacade;
-import org.eclipse.basyx.aas.metamodel.facades.SubmodelElementCollectionFacade;
-import org.eclipse.basyx.aas.metamodel.hashmap.VABElementContainer;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.operation.Operation;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.property.Property;
-import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.property.valuetypedef.PropertyValueTypeDefHelper;
-
-/**
- * SubmodelElementCollection as defined by DAAS document <br/>
- * A submodel element collection is a set or list of submodel elements
- *
- * @author schnicke
- *
- */
-public class SubmodelElementCollection extends SubmodelElement implements IContainerProperty, VABElementContainer,ISubmodelElementCollection {
- private static final long serialVersionUID = 1L;
-
- public static final String VALUE="value";
- public static final String ORDERED="ordered";
- public static final String ALLOWDUPLICATES= "allowDuplicates";
- public static final String ELEMENTS="elements";
- public static final String PROPERTIES="properties";
- public static final String OPERATIONS= "operations";
-
- /**
- * Constructor
- */
- public SubmodelElementCollection() {
- // Put attributes
- put(VALUE, new ArrayList<>());
- put(ORDERED, true);
- put(ALLOWDUPLICATES, true);
-
- put(ELEMENTS, new HashMap<>());
-
- // Helper for operations and properties
- put(PROPERTIES, new HashMap<>());
- put(OPERATIONS, new HashMap<>());
- }
-
- /**
- *
- * @param value
- * Submodel element contained in the collection
- * @param ordered
- * If ordered=false then the elements in the property collection are
- * not ordered. If ordered=true then the elements in the collection
- * are ordered.
- * @param allowDuplicates
- * If allowDuplicates=true then it is allowed that the collection
- * contains the same element several times
- */
- public SubmodelElementCollection(Collection<SubmodelElement> value, boolean ordered, boolean allowDuplicates) {
- // Put attributes
- put(VALUE, value);
- put(ORDERED, ordered);
- put(ALLOWDUPLICATES, allowDuplicates);
-
- put(ELEMENTS, new HashMap<>());
-
- // Helper for operations and properties
- put(PROPERTIES, new HashMap<>());
- put(OPERATIONS, new HashMap<>());
-
- for (SubmodelElement elem : value) {
- if (elem instanceof IProperty) {
- getProperties().put(elem.getId(), (IProperty) elem);
- } else if (elem instanceof IOperation) {
- getOperations().put(elem.getId(), (IOperation) elem);
- }
- }
- }
-
- public void addSubmodelElement(SubmodelElement elem) {
- if (elem instanceof IProperty) {
- addProperty((IProperty) elem);
- } else if (elem instanceof IOperation) {
- addOperation((IOperation) elem);
- }
- getElements().put(elem.getId(), elem);
- }
-
- public void addProperty(IProperty property) {
- getElements().put(property.getId(), (SubmodelElement) property);
- getProperties().put(property.getId(), property);
- }
-
- public void addOperation(IOperation operation) {
- getElements().put(operation.getId(), (SubmodelElement) operation);
- getOperations().put(operation.getId(), operation);
- }
-
- @Override
- public PropertyType getPropertyType() {
- return PropertyType.Container;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, IProperty> getProperties() {
- return (Map<String, IProperty>) get(PROPERTIES);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, IOperation> getOperations() {
- return (Map<String, IOperation>) get(OPERATIONS);
- }
-
- @Override
- public void addDataElement(DataElement element) {
- if (element instanceof IProperty) {
- addProperty((IProperty) element);
- } else {
- throw new RuntimeException("Tried to add DataElement with id " + element.getId() + " which is does not implement IProperty");
- }
- }
-
- @Override
- public void addOperation(Operation operation) {
- if (operation instanceof IOperation) {
- addOperation((IOperation) operation);
- } else {
- throw new RuntimeException("Tried to add Operation with id " + operation.getId() + " which is does not implement IOperation");
- }
- }
-
- @Override
- public void addEvent(Object event) {
- // TODO Auto-generated method stub
- throw new FeatureNotImplementedException();
- }
-
- @Override
- public void addElementCollection(SubmodelElementCollection collection) {
- getElements().put(collection.getId(), collection);
- if (collection instanceof IProperty) {
- getProperties().put(collection.getId(), collection);
- }
- }
-
-
-
-
-
- @Override
- public HashSet<IReference> getDataSpecificationReferences() {
- return new HasDataSpecificationFacade(this).getDataSpecificationReferences();
- }
-
- @Override
- public void setDataSpecificationReferences(HashSet<IReference> ref) {
- new HasDataSpecificationFacade(this).setDataSpecificationReferences(ref);
-
- }
-
- @Override
- public String getIdshort() {
- return new ReferableFacade(this).getIdshort();
- }
-
- @Override
- public String getCategory() {
- return new ReferableFacade(this).getCategory();
- }
-
- @Override
- public String getDescription() {
- return new ReferableFacade(this).getDescription();
- }
-
- @Override
- public IReference getParent() {
- return new ReferableFacade(this).getParent();
- }
-
- @Override
- public void setIdshort(String idShort) {
- new ReferableFacade(this).setIdshort(idShort);
-
- }
-
- @Override
- public void setCategory(String category) {
- new ReferableFacade(this).setCategory(category);
-
- }
-
- @Override
- public void setDescription(String description) {
- new ReferableFacade(this).setDescription(description);
-
- }
-
- @Override
- public void setParent(IReference obj) {
- new ReferableFacade(this).setParent(obj);
-
- }
-
- @Override
- public void setQualifier(Set<IConstraint> qualifiers) {
- new QualifiableFacade(this).setQualifier(qualifiers);
-
- }
-
- @Override
- public Set<IConstraint> getQualifier() {
- return new QualifiableFacade(this).getQualifier();
- }
-
- @Override
- public IReference getSemanticId() {
- return new HasSemanticsFacade(this).getSemanticId();
- }
-
- @Override
- public void setSemanticID(IReference ref) {
- new HasSemanticsFacade(this).setSemanticID(ref);
-
- }
-
- @Override
- public String getHasKindReference() {
- return new HasKindFacade(this).getHasKindReference();
- }
-
- @Override
- public void setHasKindReference(String kind) {
- new HasKindFacade(this).setHasKindReference(kind);
-
- }
-
- @Override
- public String getId() {
- return new OperationFacade(this).getId();
- }
-
- @Override
- public void setId(String id) {
- new OperationFacade(this).setId(id);
-
- }
-
- @Override
- public void setValue(ArrayList<?> value) {
- new SubmodelElementCollectionFacade(this).setValue(value);
-
- }
-
- @Override
- public ArrayList<?> getValue() {
- return new SubmodelElementCollectionFacade(this).getValue();
- }
-
- @Override
- public void setOrdered(boolean value) {
- new SubmodelElementCollectionFacade(this).setOrdered(value);
-
- }
-
- @Override
- public boolean isOrdered() {
- return new SubmodelElementCollectionFacade(this).isOrdered();
- }
-
- @Override
- public void setAllowDuplicates(boolean value) {
- new SubmodelElementCollectionFacade(this).setAllowDuplicates(value);
-
- }
-
- @Override
- public boolean isAllowDuplicates() {
- return new SubmodelElementCollectionFacade(this).isAllowDuplicates();
- }
-
- @Override
- public void setElements(HashMap<String, ISubmodelElement> value) {
- new SubmodelElementCollectionFacade(this).setElements(value);
-
- }
-
- @Override
- public HashMap<String, ISubmodelElement> getElements() {
- return new SubmodelElementCollectionFacade(this).getElements();
- }
-
- @Override
- public void setValue(Object obj) {
- put(Property.VALUE, obj);
- put(Property.VALUETYPE, PropertyValueTypeDefHelper.fromObject(obj).toString());
-
- }
-
- @Override
- public void setValueId(Object obj) {
- new PropertyFacade(this).setValueId(obj);
-
- }
-
- @Override
- public Object getValueId() {
- return new PropertyFacade(this).getValueId();
- }
-
-
-
-
-
-}
+package org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.basyx.aas.api.exception.FeatureNotImplementedException;
+import org.eclipse.basyx.aas.api.metamodel.aas.qualifier.qualifiable.IConstraint;
+import org.eclipse.basyx.aas.api.metamodel.aas.reference.IReference;
+import org.eclipse.basyx.aas.api.metamodel.aas.submodelelement.ISubmodelElement;
+import org.eclipse.basyx.aas.api.metamodel.aas.submodelelement.ISubmodelElementCollection;
+import org.eclipse.basyx.aas.api.resources.IContainerProperty;
+import org.eclipse.basyx.aas.api.resources.IOperation;
+import org.eclipse.basyx.aas.api.resources.IProperty;
+import org.eclipse.basyx.aas.api.resources.PropertyType;
+import org.eclipse.basyx.aas.metamodel.facades.HasDataSpecificationFacade;
+import org.eclipse.basyx.aas.metamodel.facades.HasKindFacade;
+import org.eclipse.basyx.aas.metamodel.facades.HasSemanticsFacade;
+import org.eclipse.basyx.aas.metamodel.facades.OperationFacade;
+import org.eclipse.basyx.aas.metamodel.facades.PropertyFacade;
+import org.eclipse.basyx.aas.metamodel.facades.QualifiableFacade;
+import org.eclipse.basyx.aas.metamodel.facades.ReferableFacade;
+import org.eclipse.basyx.aas.metamodel.facades.SubmodelElementCollectionFacade;
+import org.eclipse.basyx.aas.metamodel.hashmap.VABElementContainer;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.operation.Operation;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.property.Property;
+import org.eclipse.basyx.aas.metamodel.hashmap.aas.submodelelement.property.valuetypedef.PropertyValueTypeDefHelper;
+
+/**
+ * SubmodelElementCollection as defined by DAAS document <br/>
+ * A submodel element collection is a set or list of submodel elements
+ *
+ * @author schnicke
+ *
+ */
+public class SubmodelElementCollection extends SubmodelElement implements IContainerProperty, VABElementContainer,ISubmodelElementCollection {
+ private static final long serialVersionUID = 1L;
+
+ public static final String VALUE="value";
+ public static final String ORDERED="ordered";
+ public static final String ALLOWDUPLICATES= "allowDuplicates";
+ public static final String ELEMENTS="elements";
+ public static final String PROPERTIES="dataElements";
+ public static final String OPERATIONS= "operations";
+
+ /**
+ * Constructor
+ */
+ public SubmodelElementCollection() {
+ // Put attributes
+ put(VALUE, new ArrayList<>());
+ put(ORDERED, true);
+ put(ALLOWDUPLICATES, true);
+
+ put(ELEMENTS, new HashMap<>());
+
+ // Helper for operations and properties
+ put(PROPERTIES, new HashMap<>());
+ put(OPERATIONS, new HashMap<>());
+ }
+
+ /**
+ *
+ * @param value
+ * Submodel element contained in the collection
+ * @param ordered
+ * If ordered=false then the elements in the property collection are
+ * not ordered. If ordered=true then the elements in the collection
+ * are ordered.
+ * @param allowDuplicates
+ * If allowDuplicates=true then it is allowed that the collection
+ * contains the same element several times
+ */
+ public SubmodelElementCollection(Collection<SubmodelElement> value, boolean ordered, boolean allowDuplicates) {
+ // Put attributes
+ put(VALUE, value);
+ put(ORDERED, ordered);
+ put(ALLOWDUPLICATES, allowDuplicates);
+
+ put(ELEMENTS, new HashMap<>());
+
+ // Helper for operations and properties
+ put(PROPERTIES, new HashMap<>());
+ put(OPERATIONS, new HashMap<>());
+
+ for (SubmodelElement elem : value) {
+ if (elem instanceof IProperty) {
+ getProperties().put(elem.getId(), (IProperty) elem);
+ } else if (elem instanceof IOperation) {
+ getOperations().put(elem.getId(), (IOperation) elem);
+ }
+ }
+ }
+
+ public void addSubmodelElement(SubmodelElement elem) {
+ if (elem instanceof IProperty) {
+ addProperty((IProperty) elem);
+ } else if (elem instanceof IOperation) {
+ addOperation((IOperation) elem);
+ }
+ getElements().put(elem.getId(), elem);
+ }
+
+ public void addProperty(IProperty property) {
+ getElements().put(property.getId(), (SubmodelElement) property);
+ getProperties().put(property.getId(), property);
+ }
+
+ public void addOperation(IOperation operation) {
+ getElements().put(operation.getId(), (SubmodelElement) operation);
+ getOperations().put(operation.getId(), operation);
+ }
+
+ @Override
+ public PropertyType getPropertyType() {
+ return PropertyType.Container;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map<String, IProperty> getProperties() {
+ return (Map<String, IProperty>) get(PROPERTIES);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Map<String, IOperation> getOperations() {
+ return (Map<String, IOperation>) get(OPERATIONS);
+ }
+
+ @Override
+ public void addDataElement(DataElement element) {
+ if (element instanceof IProperty) {
+ addProperty((IProperty) element);
+ } else {
+ throw new RuntimeException("Tried to add DataElement with id " + element.getId() + " which is does not implement IProperty");
+ }
+ }
+
+ @Override
+ public void addOperation(Operation operation) {
+ if (operation instanceof IOperation) {
+ addOperation((IOperation) operation);
+ } else {
+ throw new RuntimeException("Tried to add Operation with id " + operation.getId() + " which is does not implement IOperation");
+ }
+ }
+
+ @Override
+ public void addEvent(Object event) {
+ // TODO Auto-generated method stub
+ throw new FeatureNotImplementedException();
+ }
+
+ @Override
+ public void addElementCollection(SubmodelElementCollection collection) {
+ getElements().put(collection.getId(), collection);
+ if (collection instanceof IProperty) {
+ getProperties().put(collection.getId(), collection);
+ }
+ }
+
+
+
+
+
+ @Override
+ public HashSet<IReference> getDataSpecificationReferences() {
+ return new HasDataSpecificationFacade(this).getDataSpecificationReferences();
+ }
+
+ @Override
+ public void setDataSpecificationReferences(HashSet<IReference> ref) {
+ new HasDataSpecificationFacade(this).setDataSpecificationReferences(ref);
+
+ }
+
+ @Override
+ public String getIdshort() {
+ return new ReferableFacade(this).getIdshort();
+ }
+
+ @Override
+ public String getCategory() {
+ return new ReferableFacade(this).getCategory();
+ }
+
+ @Override
+ public String getDescription() {
+ return new ReferableFacade(this).getDescription();
+ }
+
+ @Override
+ public IReference getParent() {
+ return new ReferableFacade(this).getParent();
+ }
+
+ @Override
+ public void setIdshort(String idShort) {
+ new ReferableFacade(this).setIdshort(idShort);
+
+ }
+
+ @Override
+ public void setCategory(String category) {
+ new ReferableFacade(this).setCategory(category);
+
+ }
+
+ @Override
+ public void setDescription(String description) {
+ new ReferableFacade(this).setDescription(description);
+
+ }
+
+ @Override
+ public void setParent(IReference obj) {
+ new ReferableFacade(this).setParent(obj);
+
+ }
+
+ @Override
+ public void setQualifier(Set<IConstraint> qualifiers) {
+ new QualifiableFacade(this).setQualifier(qualifiers);
+
+ }
+
+ @Override
+ public Set<IConstraint> getQualifier() {
+ return new QualifiableFacade(this).getQualifier();
+ }
+
+ @Override
+ public IReference getSemanticId() {
+ return new HasSemanticsFacade(this).getSemanticId();
+ }
+
+ @Override
+ public void setSemanticID(IReference ref) {
+ new HasSemanticsFacade(this).setSemanticID(ref);
+
+ }
+
+ @Override
+ public String getHasKindReference() {
+ return new HasKindFacade(this).getHasKindReference();
+ }
+
+ @Override
+ public void setHasKindReference(String kind) {
+ new HasKindFacade(this).setHasKindReference(kind);
+
+ }
+
+ @Override
+ public String getId() {
+ return new OperationFacade(this).getId();
+ }
+
+ @Override
+ public void setId(String id) {
+ new OperationFacade(this).setId(id);
+
+ }
+
+ @Override
+ public void setValue(ArrayList<?> value) {
+ new SubmodelElementCollectionFacade(this).setValue(value);
+
+ }
+
+ @Override
+ public ArrayList<?> getValue() {
+ return new SubmodelElementCollectionFacade(this).getValue();
+ }
+
+ @Override
+ public void setOrdered(boolean value) {
+ new SubmodelElementCollectionFacade(this).setOrdered(value);
+
+ }
+
+ @Override
+ public boolean isOrdered() {
+ return new SubmodelElementCollectionFacade(this).isOrdered();
+ }
+
+ @Override
+ public void setAllowDuplicates(boolean value) {
+ new SubmodelElementCollectionFacade(this).setAllowDuplicates(value);
+
+ }
+
+ @Override
+ public boolean isAllowDuplicates() {
+ return new SubmodelElementCollectionFacade(this).isAllowDuplicates();
+ }
+
+ @Override
+ public void setElements(HashMap<String, ISubmodelElement> value) {
+ new SubmodelElementCollectionFacade(this).setElements(value);
+
+ }
+
+ @Override
+ public HashMap<String, ISubmodelElement> getElements() {
+ return new SubmodelElementCollectionFacade(this).getElements();
+ }
+
+ @Override
+ public void setValue(Object obj) {
+ put(Property.VALUE, obj);
+ put(Property.VALUETYPE, PropertyValueTypeDefHelper.fromObject(obj).toString());
+
+ }
+
+ @Override
+ public void setValueId(Object obj) {
+ new PropertyFacade(this).setValueId(obj);
+
+ }
+
+ @Override
+ public Object getValueId() {
+ return new PropertyFacade(this).getValueId();
+ }
+
+
+
+
+
+}