-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(EdrCache): add SQL implementation of EDR cache store
- Loading branch information
Showing
33 changed files
with
950 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...main/java/org/eclipse/tractusx/edc/edr/core/defaults/EdrCacheEntryPredicateConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.edc.edr.core.defaults; | ||
|
||
import org.eclipse.edc.spi.query.BaseCriterionToPredicateConverter; | ||
import org.eclipse.tractusx.edc.edr.spi.EndpointDataReferenceEntry; | ||
|
||
public class EdrCacheEntryPredicateConverter extends BaseCriterionToPredicateConverter<EndpointDataReferenceEntry> { | ||
|
||
@Override | ||
protected Object property(String key, Object object) { | ||
if (object instanceof EndpointDataReferenceEntry) { | ||
var entry = (EndpointDataReferenceEntry) object; | ||
switch (key) { | ||
case "assetId": | ||
return entry.getAssetId(); | ||
case "agreementId": | ||
return entry.getAgreementId(); | ||
default: | ||
return null; | ||
} | ||
} | ||
throw new IllegalArgumentException("Can only handle objects of type " + EndpointDataReferenceEntry.class.getSimpleName() + " but received an " + object.getClass().getSimpleName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
plugins { | ||
`java-library` | ||
`maven-publish` | ||
} | ||
|
||
dependencies { | ||
implementation(project(":spi:edr-cache-spi")) | ||
|
||
implementation(libs.edc.spi.core) | ||
implementation(libs.edc.core.sql) | ||
implementation(libs.edc.spi.transactionspi) | ||
implementation(libs.edc.spi.transaction.datasource) | ||
|
||
testImplementation(testFixtures(project(":spi:edr-cache-spi"))) | ||
testImplementation(testFixtures(libs.edc.core.sql)) | ||
testImplementation(testFixtures(libs.edc.junit)) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- | ||
-- Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
-- | ||
-- This program and the accompanying materials are made available under the | ||
-- terms of the Apache License, Version 2.0 which is available at | ||
-- https://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- SPDX-License-Identifier: Apache-2.0 | ||
-- | ||
-- Contributors: | ||
-- Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
-- | ||
|
||
CREATE TABLE IF NOT EXISTS edc_edr_cache | ||
( | ||
transfer_process_id VARCHAR NOT NULL PRIMARY KEY, | ||
agreement_id VARCHAR NOT NULL, | ||
asset_id VARCHAR NOT NULL, | ||
edr_id VARCHAR NOT NULL, | ||
created_at BIGINT NOT NULL, | ||
updated_at BIGINT NOT NULL | ||
); |
Oops, something went wrong.