Skip to content

Commit

Permalink
Refactors and move InMemoryCrud Repo implementation to common (#496)
Browse files Browse the repository at this point in the history
* Moves InMemory CrudRepository to inmemory core module

Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>

* Refactors *InMemory Crud Repo to common

Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>

* Removes NO_LIMIT_PAGINATION_INFO

Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>

* Addresses review remarks

Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>

---------

Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
  • Loading branch information
mdanish98 authored Oct 21, 2024
1 parent a67a24f commit d4a4fed
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 513 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasdiscoveryservice-backend</artifactId>
</dependency>

</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.backend.inmemory.core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasdiscoveryservice-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.eclipse.digitaltwin.basyx.aasdiscoveryservice.backend.AasDiscoveryBackendProvider;
import org.eclipse.digitaltwin.basyx.aasdiscoveryservice.backend.AasDiscoveryDocument;
import org.eclipse.digitaltwin.basyx.common.backend.inmemory.core.InMemoryCrudRepository;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;
Expand All @@ -41,7 +42,7 @@
@Component
public class AasDiscoveryInMemoryBackendProvider implements AasDiscoveryBackendProvider {

private AasDiscoveryInMemoryCrudRepository repository = new AasDiscoveryInMemoryCrudRepository();
private CrudRepository<AasDiscoveryDocument, String> repository = new InMemoryCrudRepository<AasDiscoveryDocument>(AasDiscoveryDocument::getShellIdentifier);

@Override
public CrudRepository<AasDiscoveryDocument, String> getCrudRepository() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasrepository-backend</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.backend.inmemory.core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasrepository-core</artifactId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.eclipse.digitaltwin.aas4j.v3.model.AssetAdministrationShell;
import org.eclipse.digitaltwin.basyx.aasrepository.backend.AasBackendProvider;
import org.eclipse.digitaltwin.basyx.common.backend.inmemory.core.InMemoryCrudRepository;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;
Expand All @@ -35,15 +36,15 @@
*
* InMemory backend provider for the AAS
*
* @author mateusmolina
* @author mateusmolina, danish
*/
@ConditionalOnExpression("'${basyx.backend}'.equals('InMemory')")
@Component
public class AasInMemoryBackendProvider implements AasBackendProvider {

@Override
public CrudRepository<AssetAdministrationShell, String> getCrudRepository() {
return new AasInMemoryBackend();
return new InMemoryCrudRepository<AssetAdministrationShell>(AssetAdministrationShell::getId);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasxfileserver-core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.backend.inmemory.core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.digitaltwin.basyx</groupId>
<artifactId>basyx.aasxfileserver-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import org.eclipse.digitaltwin.basyx.aasxfileserver.backend.AASXFileServerBackendProvider;
import org.eclipse.digitaltwin.basyx.aasxfileserver.model.Package;
import org.eclipse.digitaltwin.basyx.common.backend.inmemory.core.InMemoryCrudRepository;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;
Expand All @@ -36,7 +37,7 @@
@Component
public class AASXFileServerInMemoryBackendProvider implements AASXFileServerBackendProvider {

private AASXFileServerInMemoryCrudRepository repository = new AASXFileServerInMemoryCrudRepository();
private CrudRepository<Package, String> repository = new InMemoryCrudRepository<Package>(Package::getPackageId);

@Override
public CrudRepository<Package, String> getCrudRepository() {
Expand Down
Loading

0 comments on commit d4a4fed

Please sign in to comment.