diff --git a/.github/workflows/maven-publish-snapshot.yml b/.github/workflows/maven-publish-snapshot.yml
new file mode 100644
index 00000000..27628dd4
--- /dev/null
+++ b/.github/workflows/maven-publish-snapshot.yml
@@ -0,0 +1,42 @@
+# This workflow will build a package using Maven and then publish it to GitHub packages when a PR is accepted/new content is pushed
+# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
+
+name: Maven Publish Snapshot
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - development
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ java-version: '11'
+ distribution: 'adopt'
+ server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
+ settings-path: ${{ github.workspace }} # location for the settings.xml file
+
+ - name: Build with Maven
+ run: mvn -B package --file pom.xml
+
+ - name: Delete old sdk package
+ uses: actions/delete-package-versions@v3
+ continue-on-error: true
+ with:
+ package-name: 'org.eclipse.basyx.basyx.sdk'
+
+ - name: Publish to GitHub Packages Apache Maven
+ run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
diff --git a/.gitignore b/.gitignore
index e0e5af10..42281a30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,4 +69,7 @@ local.properties
# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
-.worksheet
\ No newline at end of file
+.worksheet
+
+.idea
+*.iml
diff --git a/LICENSE b/LICENSE
index e23ece2c..014071fd 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,277 +1,18 @@
-Eclipse Public License - v 2.0
-
- THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
- PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
- OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-1. DEFINITIONS
-
-"Contribution" means:
-
- a) in the case of the initial Contributor, the initial content
- Distributed under this Agreement, and
-
- b) in the case of each subsequent Contributor:
- i) changes to the Program, and
- ii) additions to the Program;
- where such changes and/or additions to the Program originate from
- and are Distributed by that particular Contributor. A Contribution
- "originates" from a Contributor if it was added to the Program by
- such Contributor itself or anyone acting on such Contributor's behalf.
- Contributions do not include changes or additions to the Program that
- are not Modified Works.
-
-"Contributor" means any person or entity that Distributes the Program.
-
-"Licensed Patents" mean patent claims licensable by a Contributor which
-are necessarily infringed by the use or sale of its Contribution alone
-or when combined with the Program.
-
-"Program" means the Contributions Distributed in accordance with this
-Agreement.
-
-"Recipient" means anyone who receives the Program under this Agreement
-or any Secondary License (as applicable), including Contributors.
-
-"Derivative Works" shall mean any work, whether in Source Code or other
-form, that is based on (or derived from) the Program and for which the
-editorial revisions, annotations, elaborations, or other modifications
-represent, as a whole, an original work of authorship.
-
-"Modified Works" shall mean any work in Source Code or other form that
-results from an addition to, deletion from, or modification of the
-contents of the Program, including, for purposes of clarity any new file
-in Source Code form that contains any contents of the Program. Modified
-Works shall not include works that contain only declarations,
-interfaces, types, classes, structures, or files of the Program solely
-in each case in order to link to, bind by name, or subclass the Program
-or Modified Works thereof.
-
-"Distribute" means the acts of a) distributing or b) making available
-in any manner that enables the transfer of a copy.
-
-"Source Code" means the form of a Program preferred for making
-modifications, including but not limited to software source code,
-documentation source, and configuration files.
-
-"Secondary License" means either the GNU General Public License,
-Version 2.0, or any later versions of that license, including any
-exceptions or additional permissions as identified by the initial
-Contributor.
-
-2. GRANT OF RIGHTS
-
- a) Subject to the terms of this Agreement, each Contributor hereby
- grants Recipient a non-exclusive, worldwide, royalty-free copyright
- license to reproduce, prepare Derivative Works of, publicly display,
- publicly perform, Distribute and sublicense the Contribution of such
- Contributor, if any, and such Derivative Works.
-
- b) Subject to the terms of this Agreement, each Contributor hereby
- grants Recipient a non-exclusive, worldwide, royalty-free patent
- license under Licensed Patents to make, use, sell, offer to sell,
- import and otherwise transfer the Contribution of such Contributor,
- if any, in Source Code or other form. This patent license shall
- apply to the combination of the Contribution and the Program if, at
- the time the Contribution is added by the Contributor, such addition
- of the Contribution causes such combination to be covered by the
- Licensed Patents. The patent license shall not apply to any other
- combinations which include the Contribution. No hardware per se is
- licensed hereunder.
-
- c) Recipient understands that although each Contributor grants the
- licenses to its Contributions set forth herein, no assurances are
- provided by any Contributor that the Program does not infringe the
- patent or other intellectual property rights of any other entity.
- Each Contributor disclaims any liability to Recipient for claims
- brought by any other entity based on infringement of intellectual
- property rights or otherwise. As a condition to exercising the
- rights and licenses granted hereunder, each Recipient hereby
- assumes sole responsibility to secure any other intellectual
- property rights needed, if any. For example, if a third party
- patent license is required to allow Recipient to Distribute the
- Program, it is Recipient's responsibility to acquire that license
- before distributing the Program.
-
- d) Each Contributor represents that to its knowledge it has
- sufficient copyright rights in its Contribution, if any, to grant
- the copyright license set forth in this Agreement.
-
- e) Notwithstanding the terms of any Secondary License, no
- Contributor makes additional grants to any Recipient (other than
- those set forth in this Agreement) as a result of such Recipient's
- receipt of the Program under the terms of a Secondary License
- (if permitted under the terms of Section 3).
-
-3. REQUIREMENTS
-
-3.1 If a Contributor Distributes the Program in any form, then:
-
- a) the Program must also be made available as Source Code, in
- accordance with section 3.2, and the Contributor must accompany
- the Program with a statement that the Source Code for the Program
- is available under this Agreement, and informs Recipients how to
- obtain it in a reasonable manner on or through a medium customarily
- used for software exchange; and
-
- b) the Contributor may Distribute the Program under a license
- different than this Agreement, provided that such license:
- i) effectively disclaims on behalf of all other Contributors all
- warranties and conditions, express and implied, including
- warranties or conditions of title and non-infringement, and
- implied warranties or conditions of merchantability and fitness
- for a particular purpose;
-
- ii) effectively excludes on behalf of all other Contributors all
- liability for damages, including direct, indirect, special,
- incidental and consequential damages, such as lost profits;
-
- iii) does not attempt to limit or alter the recipients' rights
- in the Source Code under section 3.2; and
-
- iv) requires any subsequent distribution of the Program by any
- party to be under a license that satisfies the requirements
- of this section 3.
-
-3.2 When the Program is Distributed as Source Code:
-
- a) it must be made available under this Agreement, or if the
- Program (i) is combined with other material in a separate file or
- files made available under a Secondary License, and (ii) the initial
- Contributor attached to the Source Code the notice described in
- Exhibit A of this Agreement, then the Program may be made available
- under the terms of such Secondary Licenses, and
-
- b) a copy of this Agreement must be included with each copy of
- the Program.
-
-3.3 Contributors may not remove or alter any copyright, patent,
-trademark, attribution notices, disclaimers of warranty, or limitations
-of liability ("notices") contained within the Program from any copy of
-the Program which they Distribute, provided that Contributors may add
-their own appropriate notices.
-
-4. COMMERCIAL DISTRIBUTION
-
-Commercial distributors of software may accept certain responsibilities
-with respect to end users, business partners and the like. While this
-license is intended to facilitate the commercial use of the Program,
-the Contributor who includes the Program in a commercial product
-offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes
-the Program in a commercial product offering, such Contributor
-("Commercial Contributor") hereby agrees to defend and indemnify every
-other Contributor ("Indemnified Contributor") against any losses,
-damages and costs (collectively "Losses") arising from claims, lawsuits
-and other legal actions brought by a third party against the Indemnified
-Contributor to the extent caused by the acts or omissions of such
-Commercial Contributor in connection with its distribution of the Program
-in a commercial product offering. The obligations in this section do not
-apply to any claims or Losses relating to any actual or alleged
-intellectual property infringement. In order to qualify, an Indemnified
-Contributor must: a) promptly notify the Commercial Contributor in
-writing of such claim, and b) allow the Commercial Contributor to control,
-and cooperate with the Commercial Contributor in, the defense and any
-related settlement negotiations. The Indemnified Contributor may
-participate in any such claim at its own expense.
-
-For example, a Contributor might include the Program in a commercial
-product offering, Product X. That Contributor is then a Commercial
-Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance
-claims and warranties are such Commercial Contributor's responsibility
-alone. Under this section, the Commercial Contributor would have to
-defend claims against the other Contributors related to those performance
-claims and warranties, and if a court requires any other Contributor to
-pay any damages as a result, the Commercial Contributor must pay
-those damages.
-
-5. NO WARRANTY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
-PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
-BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
-IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
-TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
-PURPOSE. Each Recipient is solely responsible for determining the
-appropriateness of using and distributing the Program and assumes all
-risks associated with its exercise of rights under this Agreement,
-including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs
-or equipment, and unavailability or interruption of operations.
-
-6. DISCLAIMER OF LIABILITY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
-PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
-SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
-PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
-EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-7. GENERAL
-
-If any provision of this Agreement is invalid or unenforceable under
-applicable law, it shall not affect the validity or enforceability of
-the remainder of the terms of this Agreement, and without further
-action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.
-
-If Recipient institutes patent litigation against any entity
-(including a cross-claim or counterclaim in a lawsuit) alleging that the
-Program itself (excluding combinations of the Program with other software
-or hardware) infringes such Recipient's patent(s), then such Recipient's
-rights granted under Section 2(b) shall terminate as of the date such
-litigation is filed.
-
-All Recipient's rights under this Agreement shall terminate if it
-fails to comply with any of the material terms or conditions of this
-Agreement and does not cure such failure in a reasonable period of
-time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use
-and distribution of the Program as soon as reasonably practicable.
-However, Recipient's obligations under this Agreement and any licenses
-granted by Recipient relating to the Program shall continue and survive.
-
-Everyone is permitted to copy and distribute copies of this Agreement,
-but in order to avoid inconsistency the Agreement is copyrighted and
-may only be modified in the following manner. The Agreement Steward
-reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement
-Steward has the right to modify this Agreement. The Eclipse Foundation
-is the initial Agreement Steward. The Eclipse Foundation may assign the
-responsibility to serve as the Agreement Steward to a suitable separate
-entity. Each new version of the Agreement will be given a distinguishing
-version number. The Program (including Contributions) may always be
-Distributed subject to the version of the Agreement under which it was
-received. In addition, after a new version of the Agreement is published,
-Contributor may elect to Distribute the Program (including its
-Contributions) under the new version.
-
-Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
-receives no rights or licenses to the intellectual property of any
-Contributor under this Agreement, whether expressly, by implication,
-estoppel or otherwise. All rights in the Program not expressly granted
-under this Agreement are reserved. Nothing in this Agreement is intended
-to be enforceable by any entity that is not a Contributor or Recipient.
-No third-party beneficiary rights are created under this Agreement.
-
-Exhibit A - Form of Secondary Licenses Notice
-
-"This Source Code may also be made available under the following
-Secondary Licenses when the conditions for such availability set forth
-in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
-version(s), and exceptions or additional permissions here}."
-
- Simply including a copy of this Agreement, including this Exhibit A
- is not sufficient to license the Source Code under Secondary Licenses.
-
- If it is not possible or desirable to put the notice in a particular
- file, then You may include the notice in a location (such as a LICENSE
- file in a relevant directory) where a recipient would be likely to
- look for such a notice.
-
- You may add additional accurate notices of copyright ownership.
\ No newline at end of file
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/NOTICE b/NOTICE
index 41bc3278..e0fe73c7 100644
--- a/NOTICE
+++ b/NOTICE
@@ -6,10 +6,26 @@ of Education and Research (BMBF), grant number 01IS16022.
## Declared Project Licenses
-This program and the accompanying materials are made available under the terms of the Eclipse Public License v. 2.0 which is available at
-https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
-
-SPDX-License-Identifier: EPL-2.0
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+SPDX-License-Identifier: MIT
## Source Code
diff --git a/README.md b/README.md
index d3150a7e..33a30dc6 100644
--- a/README.md
+++ b/README.md
@@ -28,4 +28,4 @@ Additionally, you can also find videos explaining the BaSyx middleware on youtub
If you would like to contribute, please notice the [contribution guidelines](CONTRIBUTING.md). The overall process is described in the [Eclipse wiki](https://wiki.eclipse.org/BaSyx_/_Developer_/_Contributing).
-This GitHub project is migrated from the Eclipse infrastructure. For the archived history, see the [previous repository](https://git.eclipse.org/c/basyx/basyx.git/).
+This GitHub project is migrated from the Eclipse infrastructure. For the archived history, see the [previous repository](https://git.eclipse.org/c/basyx/basyx.git/).
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 29433b27..b197dbc6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,15 +5,15 @@
org.eclipse.basyxbasyx.sdk
- 1.0.2
+ 1.1.0BaSyx SDKBaSyx Software Development Kithttps://www.eclipse.org/basyx/
- Eclipse Public License 2.0
- https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
+ MIT
+ https://opensource.org/licenses/MIT
@@ -33,11 +33,20 @@
https://github.com/eclipse-basyx/basyx-java-sdk
+
+
+ github
+ GitHub Eclipse BaSyx Apache Maven Packages
+ https://maven.pkg.github.com/eclipse-basyx/basyx-java-sdk
+
+
+
jarUTF-8UTF-8
+ 5.5.3
@@ -46,11 +55,6 @@
Eclipse Paho Repohttps://repo.eclipse.org/content/repositories/paho-releases/
-
-
- bintray
- https://jcenter.bintray.com
-
@@ -168,12 +172,20 @@
4.13.1test
-
+
+
+
+ org.mockito
+ mockito-core
+ 4.1.0
+ test
+
+
io.moquettemoquette-broker
- 0.12.1
+ 0.15test
@@ -187,14 +199,14 @@
org.eclipse.milosdk-client
- 0.3.6
+ 0.6.1org.eclipse.milosdk-server
- 0.3.6
+ 0.6.1
@@ -241,9 +253,9 @@
- ch.qos.logback
- logback-classic
- 1.2.3
+ ch.qos.logback
+ logback-classic
+ 1.2.3
@@ -267,7 +279,63 @@
2.8.5
+
+
+ commons-io
+ commons-io
+ 2.6
+
+
+
+
+ commons-fileupload
+ commons-fileupload
+ 1.4
+
+
+
+
+ org.apache.httpcomponents
+ httpmime
+ 4.5.13
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.13
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.12.0
+
+
+
+ org.springframework.security
+ spring-security-oauth2-resource-server
+
+
+ org.springframework.security
+ spring-security-oauth2-jose
+
+
+
+
+
+ org.springframework.security
+ spring-security-bom
+ ${spring-security-version}
+ pom
+ import
+
+
+
+
@@ -318,7 +386,6 @@
true
-
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregator.java b/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregator.java
index c3f7810b..0b56404e 100644
--- a/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregator.java
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregator.java
@@ -1,16 +1,31 @@
/*******************************************************************************
* Copyright (C) 2021 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
*
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
- * SPDX-License-Identifier: EPL-2.0
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
******************************************************************************/
package org.eclipse.basyx.aas.aggregator;
import java.util.Collection;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Collectors;
@@ -23,9 +38,10 @@
import org.eclipse.basyx.aas.restapi.api.IAASAPI;
import org.eclipse.basyx.aas.restapi.api.IAASAPIFactory;
import org.eclipse.basyx.aas.restapi.vab.VABAASAPIFactory;
+import org.eclipse.basyx.submodel.aggregator.SubmodelAggregatorFactory;
+import org.eclipse.basyx.submodel.aggregator.api.ISubmodelAggregatorFactory;
import org.eclipse.basyx.submodel.metamodel.api.identifier.IIdentifier;
import org.eclipse.basyx.submodel.restapi.api.ISubmodelAPIFactory;
-import org.eclipse.basyx.submodel.restapi.vab.VABSubmodelAPIFactory;
import org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException;
import org.eclipse.basyx.vab.modelprovider.api.IModelProvider;
import org.eclipse.basyx.vab.protocol.api.IConnectorFactory;
@@ -33,63 +49,64 @@
/**
* An implementation of the IAASAggregator interface using maps internally
- *
+ *
* @author conradi, schnicke
*
*/
public class AASAggregator implements IAASAggregator {
- protected Map aasProviderMap = new HashMap<>();
+ protected Map aasProviderMap = new LinkedHashMap<>();
protected IAASRegistry registry;
/**
* Store AAS API Provider. By default, uses the VAB API Provider
*/
- protected IAASAPIFactory aasApiProvider;
+ protected IAASAPIFactory aasApiFactory;
+
+ protected ISubmodelAggregatorFactory submodelAggregatorFactory;
+
+ public AASAggregator(IAASAPIFactory aasApiFactory, ISubmodelAggregatorFactory submodelAggregatorFactory) {
+ this.aasApiFactory = aasApiFactory;
+ this.submodelAggregatorFactory = submodelAggregatorFactory;
+ }
+
+ public AASAggregator(IAASAPIFactory aasApiFactory, ISubmodelAggregatorFactory submodelAggregatorFactory, IAASRegistry registry) {
+ this(aasApiFactory, submodelAggregatorFactory);
+ this.registry = registry;
+ }
/**
- * Store Submodel API Provider. By default, uses the VAB Submodel Provider
+ * Constructs AAS Aggregator using the passed registry. This registry is used to
+ * resolve requests for remote submodels. Additionally takes custom API
+ * providers;
*/
- protected ISubmodelAPIFactory smApiProvider;
+ public AASAggregator(IAASAPIFactory aasApiFactory, ISubmodelAPIFactory submodelApiFactory, IAASRegistry registry) {
+ this(aasApiFactory, new SubmodelAggregatorFactory(submodelApiFactory), registry);
+ }
/**
* Constructs default AAS Aggregator
*/
public AASAggregator() {
- this.aasApiProvider = new VABAASAPIFactory();
- this.smApiProvider = new VABSubmodelAPIFactory();
+ this(new VABAASAPIFactory(), new SubmodelAggregatorFactory());
}
/**
* Constructs an AAS aggregator with custom API providers
*/
- public AASAggregator(IAASAPIFactory aasApiProvider, ISubmodelAPIFactory smApiProvider) {
- this.aasApiProvider = aasApiProvider;
- this.smApiProvider = smApiProvider;
+ public AASAggregator(IAASAPIFactory aasApiFactory, ISubmodelAPIFactory submodelApiFactory) {
+ this(aasApiFactory, new SubmodelAggregatorFactory(submodelApiFactory));
}
/**
* Constructs AAS Aggregator using the passed registry. This registry is used to
* resolve requests for remote submodels
- *
+ *
* @param registry
*/
public AASAggregator(IAASRegistry registry) {
- this.registry = registry;
- this.aasApiProvider = new VABAASAPIFactory();
- this.smApiProvider = new VABSubmodelAPIFactory();
- }
-
- /**
- * Constructs AAS Aggregator using the passed registry. This registry is used to
- * resolve requests for remote submodels. Additionally takes custom API providers;
- */
- public AASAggregator(IAASAPIFactory aasApiProvider, ISubmodelAPIFactory smApiProvider,
- IAASRegistry registry) {
- this.registry = registry;
- this.aasApiProvider = aasApiProvider;
- this.smApiProvider = smApiProvider;
+ this(new VABAASAPIFactory(), new SubmodelAggregatorFactory(), registry);
}
@SuppressWarnings("unchecked")
@@ -128,16 +145,21 @@ public void createAAS(AssetAdministrationShell aas) {
@Override
public void updateAAS(AssetAdministrationShell aas) {
- aasProviderMap.put(aas.getIdentification().getId(), createMultiSubmodelProvider(aas));
+ MultiSubmodelProvider oldProvider = (MultiSubmodelProvider) getAASProvider(aas.getIdentification());
+ IAASAPI aasApi = aasApiFactory.create(aas);
+ AASModelProvider contentProvider = new AASModelProvider(aasApi);
+ IConnectorFactory connectorFactory = oldProvider.getConnectorFactory();
+
+ MultiSubmodelProvider updatedProvider = new MultiSubmodelProvider(contentProvider, registry, connectorFactory, aasApiFactory, oldProvider.getSmAggregator());
+
+ aasProviderMap.put(aas.getIdentification().getId(), updatedProvider);
}
private MultiSubmodelProvider createMultiSubmodelProvider(AssetAdministrationShell aas) {
- IConnectorFactory connProvider = new HTTPConnectorFactory();
- IAASAPI aasApi = aasApiProvider.getAASApi(aas);
+ IConnectorFactory connectorFactory = new HTTPConnectorFactory();
+ IAASAPI aasApi = aasApiFactory.create(aas);
AASModelProvider contentProvider = new AASModelProvider(aasApi);
- MultiSubmodelProvider multiAASProvider = new MultiSubmodelProvider(contentProvider, registry,
- connProvider, smApiProvider, aasApiProvider);
- return multiAASProvider;
+ return new MultiSubmodelProvider(contentProvider, registry, connectorFactory, aasApiFactory, submodelAggregatorFactory.create());
}
@Override
@@ -152,7 +174,7 @@ public IModelProvider getAASProvider(IIdentifier aasId) {
if (provider == null) {
throw new ResourceNotFoundException("AAS with Id " + aasId.getId() + " does not exist");
}
-
return provider;
}
+
}
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregatorAPIHelper.java b/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregatorAPIHelper.java
new file mode 100644
index 00000000..6481fe5a
--- /dev/null
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregatorAPIHelper.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+* Copyright (C) 2021 the Eclipse BaSyx Authors
+*
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*
+* SPDX-License-Identifier: MIT
+******************************************************************************/
+
+package org.eclipse.basyx.aas.aggregator;
+
+import org.eclipse.basyx.aas.aggregator.restapi.AASAggregatorProvider;
+import org.eclipse.basyx.submodel.metamodel.api.identifier.IIdentifier;
+import org.eclipse.basyx.vab.modelprovider.VABPathTools;
+
+/**
+ * API helper for AAS Aggregator
+ *
+ * @author haque
+ *
+ */
+public class AASAggregatorAPIHelper {
+ public static final String AAS_SUFFIX = "aas";
+
+ public static String getAggregatorPath() {
+ return AASAggregatorProvider.PREFIX;
+ }
+
+ /**
+ * Retrieves access path for creating, updating, deleting single AAS
+ *
+ * @param aasId
+ * @return
+ */
+ public static String getAASEntryPath(IIdentifier aasId) {
+ return VABPathTools.concatenatePaths(getAggregatorPath(), VABPathTools.encodePathElement(aasId.getId()));
+ }
+
+ /**
+ * Retrieves access path for getting single AAS
+ *
+ * @param aasId
+ * @return
+ */
+ public static String getAASAccessPath(IIdentifier aasId) {
+ return VABPathTools.concatenatePaths(getAASEntryPath(aasId), AASAggregatorAPIHelper.AAS_SUFFIX);
+ }
+}
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregatorFactory.java b/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregatorFactory.java
new file mode 100644
index 00000000..b0760bb1
--- /dev/null
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/AASAggregatorFactory.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (C) 2022 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+package org.eclipse.basyx.aas.aggregator;
+
+import org.eclipse.basyx.aas.aggregator.api.IAASAggregator;
+import org.eclipse.basyx.aas.aggregator.api.IAASAggregatorFactory;
+import org.eclipse.basyx.aas.registration.api.IAASRegistry;
+import org.eclipse.basyx.aas.restapi.api.IAASAPIFactory;
+import org.eclipse.basyx.submodel.aggregator.api.ISubmodelAggregatorFactory;
+import org.eclipse.basyx.submodel.restapi.api.ISubmodelAPIFactory;
+
+/**
+ *
+ * Factory that constructs a AASAggregator with the given API
+ *
+ * @author fried
+ *
+ */
+public class AASAggregatorFactory implements IAASAggregatorFactory {
+
+ private IAASAPIFactory aasApiFactory;
+ private ISubmodelAggregatorFactory submodelAggregatorFactory;
+ private IAASRegistry registry;
+ private ISubmodelAPIFactory submodelApiFactory;
+
+ public AASAggregatorFactory() {
+ }
+
+ public AASAggregatorFactory(IAASAPIFactory aasApiFactory, ISubmodelAggregatorFactory submodelAggregatorFactory) {
+ this.aasApiFactory = aasApiFactory;
+ this.submodelAggregatorFactory = submodelAggregatorFactory;
+ }
+
+ public AASAggregatorFactory(IAASAPIFactory aasApiFactory, ISubmodelAggregatorFactory submodelAggregatorFactory, IAASRegistry registry) {
+ this.aasApiFactory = aasApiFactory;
+ this.submodelAggregatorFactory = submodelAggregatorFactory;
+ this.registry = registry;
+ }
+
+ public AASAggregatorFactory(IAASAPIFactory aasApiFactory, ISubmodelAPIFactory submodelApiFactory) {
+ this.aasApiFactory = aasApiFactory;
+ this.submodelApiFactory = submodelApiFactory;
+ }
+
+ public AASAggregatorFactory(IAASAPIFactory aasApiFactory, ISubmodelAPIFactory submodelApiFactory, IAASRegistry registry) {
+ this.aasApiFactory = aasApiFactory;
+ this.submodelApiFactory = submodelApiFactory;
+ this.registry = registry;
+ }
+
+ public AASAggregatorFactory(IAASRegistry registry) {
+ this.registry = registry;
+ }
+
+ @Override
+ public IAASAggregator create() {
+ return constructAASAggregatorWithGivenArguments();
+ }
+
+ private IAASAggregator constructAASAggregatorWithGivenArguments() {
+ if (isRegistrySet() && isAasApiAndSubmodelAggregatorSet()) {
+ return new AASAggregator(aasApiFactory, submodelAggregatorFactory, registry);
+ } else if (isRegistrySet() && isAasApiAndSubmodelApiSet()) {
+ return new AASAggregator(aasApiFactory, submodelApiFactory, registry);
+ } else if (isOnlyRegistrySet()) {
+ return new AASAggregator(registry);
+ } else if (isAasApiAndSubmodelAggregatorSet()) {
+ return new AASAggregator(aasApiFactory, submodelAggregatorFactory);
+ } else if (isAasApiAndSubmodelApiSet()) {
+ return new AASAggregator(aasApiFactory, submodelApiFactory);
+ } else {
+ return new AASAggregator();
+ }
+ }
+
+ private boolean isRegistrySet() {
+ return registry != null;
+ }
+
+ private boolean isAasApiAndSubmodelAggregatorSet() {
+ return aasApiFactory != null && submodelAggregatorFactory != null;
+ }
+
+ private boolean isAasApiAndSubmodelApiSet() {
+ return aasApiFactory != null && submodelApiFactory != null;
+ }
+
+ private boolean isOnlyRegistrySet() {
+ return isRegistrySet() && aasApiFactory == null && submodelAggregatorFactory == null && submodelApiFactory == null;
+ }
+}
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregator.java b/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregator.java
index a8241e25..20ec9ade 100644
--- a/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregator.java
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregator.java
@@ -1,11 +1,26 @@
/*******************************************************************************
* Copyright (C) 2021 the Eclipse BaSyx Authors
*
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
*
- * SPDX-License-Identifier: EPL-2.0
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
******************************************************************************/
package org.eclipse.basyx.aas.aggregator.api;
@@ -17,7 +32,6 @@
import org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException;
import org.eclipse.basyx.vab.modelprovider.api.IModelProvider;
-
/**
* Interface for the Asset Administration Shell Aggregator API
* It is used to manage multiple AASs at the same endpoint
@@ -26,26 +40,28 @@
*
*/
public interface IAASAggregator {
-
+
/**
* Retrieves all Asset Administration Shells from the endpoint
*
* @return a List of all found Asset Administration Shells
*/
public Collection getAASList();
-
+
/**
* Retrieves a specific Asset Administration Shell
*
- * @param aasId the ID of the AAS
+ * @param aasId
+ * the ID of the AAS
* @return the requested AAS
*/
public IAssetAdministrationShell getAAS(IIdentifier aasId) throws ResourceNotFoundException;
-
+
/**
* Retrieves the provider for a specific Asset Administration Shell
*
- * @param aasId the ID of the AAS
+ * @param aasId
+ * the ID of the AAS
* @return the requested AAS provider
*/
public IModelProvider getAASProvider(IIdentifier aasId) throws ResourceNotFoundException;
@@ -53,21 +69,24 @@ public interface IAASAggregator {
/**
* Creates a new Asset Administration Shell at the endpoint
*
- * @param aas the AAS to be created
+ * @param aas
+ * the AAS to be created
*/
public void createAAS(AssetAdministrationShell aas);
-
+
/**
* Updates a specific Asset Administration Shell
*
- * @param aas the updated AAS
+ * @param aas
+ * the updated AAS
*/
public void updateAAS(AssetAdministrationShell aas) throws ResourceNotFoundException;
-
+
/**
* Deletes a specific Asset Administration Shell
*
- * @param aasId the ID of the AAS to be deleted
+ * @param aasId
+ * the ID of the AAS to be deleted
*/
public void deleteAAS(IIdentifier aasId);
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregatorFactory.java b/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregatorFactory.java
new file mode 100644
index 00000000..e86fca03
--- /dev/null
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/api/IAASAggregatorFactory.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (C) 2022 the Eclipse BaSyx Authors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
+ ******************************************************************************/
+package org.eclipse.basyx.aas.aggregator.api;
+
+/**
+ *
+ * Interface for providing an AASAggregator
+ *
+ * @author fried
+ *
+ */
+public interface IAASAggregatorFactory {
+ /**
+ * Creates an AASAggregator for the Factory
+ *
+ * @return constructed AASAggregator
+ */
+ public IAASAggregator create();
+}
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/observing/IAASAggregatorObserver.java b/src/main/java/org/eclipse/basyx/aas/aggregator/observing/IAASAggregatorObserver.java
new file mode 100644
index 00000000..a455bbf0
--- /dev/null
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/observing/IAASAggregatorObserver.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+* Copyright (C) 2021 the Eclipse BaSyx Authors
+*
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*
+* SPDX-License-Identifier: MIT
+******************************************************************************/
+
+package org.eclipse.basyx.aas.aggregator.observing;
+
+import org.eclipse.basyx.submodel.observer.IObserver;
+
+/**
+ * Interface for an observer of {@link ObservableAASAggregator}
+ *
+ * @author haque
+ *
+ */
+public interface IAASAggregatorObserver extends IObserver {
+
+ /**
+ * Is called when an AAS is created
+ *
+ * @param aasId
+ * id of the created AAS
+ */
+ public void aasCreated(String aasId);
+
+ /**
+ * Is called when an AAS is updated
+ *
+ * @param aasId
+ * id of the updated AAS
+ */
+ public void aasUpdated(String aasId);
+
+ /**
+ * Is called when an AAS is deleted
+ *
+ * @param aasId
+ * id of the deleted AAS
+ */
+ public void aasDeleted(String aasId);
+}
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/observing/ObservableAASAggregator.java b/src/main/java/org/eclipse/basyx/aas/aggregator/observing/ObservableAASAggregator.java
new file mode 100644
index 00000000..43b5a1dd
--- /dev/null
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/observing/ObservableAASAggregator.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+* Copyright (C) 2021 the Eclipse BaSyx Authors
+*
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*
+* SPDX-License-Identifier: MIT
+******************************************************************************/
+
+package org.eclipse.basyx.aas.aggregator.observing;
+
+import java.util.Collection;
+
+import org.eclipse.basyx.aas.aggregator.api.IAASAggregator;
+import org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell;
+import org.eclipse.basyx.aas.metamodel.map.AssetAdministrationShell;
+import org.eclipse.basyx.submodel.metamodel.api.identifier.IIdentifier;
+import org.eclipse.basyx.submodel.observer.Observable;
+import org.eclipse.basyx.vab.exception.provider.ResourceNotFoundException;
+import org.eclipse.basyx.vab.modelprovider.api.IModelProvider;
+
+/**
+ *
+ * Implementation of {@link IAASAggregator} that calls back registered
+ * {@link IAASAggregatorObserver} when changes on AAS occur
+ *
+ * @author haque
+ *
+ */
+public class ObservableAASAggregator extends Observable implements IAASAggregator {
+
+ private IAASAggregator aasAggregator;
+
+ public ObservableAASAggregator(IAASAggregator aggregator) {
+ this.aasAggregator = aggregator;
+ }
+
+ @Override
+ public Collection getAASList() {
+ return aasAggregator.getAASList();
+ }
+
+ @Override
+ public IAssetAdministrationShell getAAS(IIdentifier aasId) throws ResourceNotFoundException {
+ return aasAggregator.getAAS(aasId);
+ }
+
+ @Override
+ public IModelProvider getAASProvider(IIdentifier aasId) throws ResourceNotFoundException {
+ return aasAggregator.getAASProvider(aasId);
+ }
+
+ @Override
+ public void createAAS(AssetAdministrationShell aas) {
+ aasAggregator.createAAS(aas);
+ observers.stream().forEach(o -> o.aasCreated(aas.getIdentification().getId()));
+ }
+
+ @Override
+ public void updateAAS(AssetAdministrationShell aas) throws ResourceNotFoundException {
+ aasAggregator.updateAAS(aas);
+ observers.stream().forEach(o -> o.aasUpdated(aas.getIdentification().getId()));
+ }
+
+ @Override
+ public void deleteAAS(IIdentifier aasId) {
+ aasAggregator.deleteAAS(aasId);
+ observers.stream().forEach(o -> o.aasDeleted(aasId.getId()));
+ }
+}
diff --git a/src/main/java/org/eclipse/basyx/aas/aggregator/proxy/AASAggregatorProxy.java b/src/main/java/org/eclipse/basyx/aas/aggregator/proxy/AASAggregatorProxy.java
index c3fc9a72..cc44d33f 100644
--- a/src/main/java/org/eclipse/basyx/aas/aggregator/proxy/AASAggregatorProxy.java
+++ b/src/main/java/org/eclipse/basyx/aas/aggregator/proxy/AASAggregatorProxy.java
@@ -1,11 +1,26 @@
/*******************************************************************************
* Copyright (C) 2021 the Eclipse BaSyx Authors
*
- * This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License 2.0
- * which is available at https://www.eclipse.org/legal/epl-2.0/
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
*
- * SPDX-License-Identifier: EPL-2.0
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * SPDX-License-Identifier: MIT
******************************************************************************/
package org.eclipse.basyx.aas.aggregator.proxy;
@@ -13,6 +28,7 @@
import java.util.Map;
import java.util.stream.Collectors;
+import org.eclipse.basyx.aas.aggregator.AASAggregatorAPIHelper;
import org.eclipse.basyx.aas.aggregator.api.IAASAggregator;
import org.eclipse.basyx.aas.aggregator.restapi.AASAggregatorProvider;
import org.eclipse.basyx.aas.metamodel.api.IAssetAdministrationShell;
@@ -29,9 +45,9 @@
import org.slf4j.LoggerFactory;
public class AASAggregatorProxy implements IAASAggregator {
+ protected IModelProvider provider;
private static Logger logger = LoggerFactory.getLogger(AASRegistryProxy.class);
- private IModelProvider provider;
-
+
/**
* Constructor for an AAS aggregator proxy based on a HTTP connection
*
@@ -53,19 +69,19 @@ public AASAggregatorProxy(IModelProvider provider) {
}
/**
- * Adds the "/shells" suffix if it does not exist
+ * Removes the "/shells" suffix if it exists
*
* @param url
* @return
*/
- private static String harmonizeURL(String url) {
- return VABPathTools.harmonizePathWithSuffix(url, AASAggregatorProvider.PREFIX);
+ protected static String harmonizeURL(String url) {
+ return VABPathTools.stripFromPath(url, AASAggregatorProvider.PREFIX);
}
@SuppressWarnings("unchecked")
@Override
public Collection getAASList() {
- Collection