Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: separate sql stores from datasources #417

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ maven/mavencentral/com.github.java-json-tools/uri-template/0.10, , approved, #15
maven/mavencentral/com.google.code.findbugs/jsr305/2.0.1, BSD-3-Clause AND CC-BY-2.5 AND LGPL-2.1+, approved, CQ13390
maven/mavencentral/com.google.code.findbugs/jsr305/3.0.2, CC-BY-2.5, approved, #15220
maven/mavencentral/com.google.code.gson/gson/2.10.1, Apache-2.0, approved, #6159
maven/mavencentral/com.google.crypto.tink/tink/1.13.0, Apache-2.0, approved, #14502
maven/mavencentral/com.google.crypto.tink/tink/1.14.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.google.crypto.tink/tink/1.14.1, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.11.0, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.22.0, Apache-2.0, approved, #10661
maven/mavencentral/com.google.errorprone/error_prone_annotations/2.26.1, Apache-2.0, approved, #13657
Expand All @@ -65,7 +65,7 @@ maven/mavencentral/com.google.guava/guava/31.1-jre, Apache-2.0, approved, clearl
maven/mavencentral/com.google.guava/guava/33.2.0-jre, Apache-2.0 AND CC0-1.0 AND (Apache-2.0 AND CC-PDDC), approved, #14607
maven/mavencentral/com.google.guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava, Apache-2.0, approved, CQ22657
maven/mavencentral/com.google.j2objc/j2objc-annotations/1.3, Apache-2.0, approved, CQ21195
maven/mavencentral/com.google.protobuf/protobuf-java/3.25.1, BSD-3-Clause, approved, clearlydefined
maven/mavencentral/com.google.protobuf/protobuf-java/3.25.3, BSD-3-Clause, approved, clearlydefined
maven/mavencentral/com.google.protobuf/protobuf-java/4.27.0, BSD-3-Clause, approved, clearlydefined
maven/mavencentral/com.googlecode.libphonenumber/libphonenumber/8.11.1, Apache-2.0, approved, clearlydefined
maven/mavencentral/com.jayway.jsonpath/json-path/2.7.0, Apache-2.0, approved, clearlydefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.edc.spi.types.TypeManager;
import org.eclipse.edc.sql.QueryExecutor;
import org.eclipse.edc.sql.bootstrapper.SqlSchemaBootstrapper;
import org.eclipse.edc.sql.configuration.DataSourceName;
import org.eclipse.edc.transaction.datasource.spi.DataSourceRegistry;
import org.eclipse.edc.transaction.spi.TransactionContext;

Expand All @@ -34,8 +35,12 @@
public class SqlCredentialStoreExtension implements ServiceExtension {
public static final String NAME = "CredentialResource SQL Store Extension";

@Deprecated(since = "0.8.1")
@Setting(value = "Datasource name for the DidResource database", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_SETTING_NAME = "edc.datasource.credentials.name";
@Setting(value = "The datasource to be used", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: i would call the deprecated property DATASOURCE_SETTING_NAME_DEPRECATED, and the new one DATASOURCE_SETTING_NAME

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately I didn't do that in other repositories so I this point I would just let it like this, anyway I think that the @Deprecated annotation should be enough

public static final String DATASOURCE_NAME = "edc.sql.store.credentials.datasource";

@Inject
private DataSourceRegistry dataSourceRegistry;
@Inject
Expand Down Expand Up @@ -66,6 +71,7 @@
}

private String getDataSourceName(ServiceExtensionContext context) {
return context.getConfig().getString(DATASOURCE_SETTING_NAME, DataSourceRegistry.DEFAULT_DATASOURCE);
return DataSourceName.getDataSourceName(DATASOURCE_NAME, DATASOURCE_SETTING_NAME, context.getConfig(), context.getMonitor());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
DataSourceName.getDataSourceName
should be avoided because it has been deprecated.
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.edc.spi.types.TypeManager;
import org.eclipse.edc.sql.QueryExecutor;
import org.eclipse.edc.sql.bootstrapper.SqlSchemaBootstrapper;
import org.eclipse.edc.sql.configuration.DataSourceName;
import org.eclipse.edc.transaction.datasource.spi.DataSourceRegistry;
import org.eclipse.edc.transaction.spi.TransactionContext;

Expand All @@ -34,8 +35,12 @@
public class SqlDidResourceStoreExtension implements ServiceExtension {
public static final String NAME = "DID Resource SQL Store Extension";

@Deprecated(since = "0.8.1")
@Setting(value = "Datasource name for the DidResource database", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_SETTING_NAME = "edc.datasource.didresource.name";
@Setting(value = "The datasource to be used", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_NAME = "edc.sql.store.didresource.datasource";

@Inject
private DataSourceRegistry dataSourceRegistry;
@Inject
Expand All @@ -46,7 +51,6 @@
private QueryExecutor queryExecutor;
@Inject(required = false)
private DidResourceStatements statements;

@Inject
private SqlSchemaBootstrapper sqlSchemaBootstrapper;

Expand All @@ -66,6 +70,6 @@
}

private String getDataSourceName(ServiceExtensionContext context) {
return context.getConfig().getString(DATASOURCE_SETTING_NAME, DataSourceRegistry.DEFAULT_DATASOURCE);
return DataSourceName.getDataSourceName(DATASOURCE_NAME, DATASOURCE_SETTING_NAME, context.getConfig(), context.getMonitor());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
DataSourceName.getDataSourceName
should be avoided because it has been deprecated.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.edc.spi.types.TypeManager;
import org.eclipse.edc.sql.QueryExecutor;
import org.eclipse.edc.sql.bootstrapper.SqlSchemaBootstrapper;
import org.eclipse.edc.sql.configuration.DataSourceName;
import org.eclipse.edc.transaction.datasource.spi.DataSourceRegistry;
import org.eclipse.edc.transaction.spi.TransactionContext;

Expand All @@ -34,8 +35,11 @@
public class SqlKeyPairResourceStoreExtension implements ServiceExtension {
public static final String NAME = "KeyPair Resource SQL Store Extension";

@Deprecated(since = "0.8.1")
@Setting(value = "Datasource name for the KeyPairResource database", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_SETTING_NAME = "edc.datasource.keypair.name";
@Setting(value = "The datasource to be used", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_NAME = "edc.sql.store.keypair.datasource";

@Inject
private DataSourceRegistry dataSourceRegistry;
Expand Down Expand Up @@ -76,6 +80,6 @@
}

private String getDataSourceName(ServiceExtensionContext context) {
return context.getConfig().getString(DATASOURCE_SETTING_NAME, DataSourceRegistry.DEFAULT_DATASOURCE);
return DataSourceName.getDataSourceName(DATASOURCE_NAME, DATASOURCE_SETTING_NAME, context.getConfig(), context.getMonitor());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
DataSourceName.getDataSourceName
should be avoided because it has been deprecated.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.edc.spi.types.TypeManager;
import org.eclipse.edc.sql.QueryExecutor;
import org.eclipse.edc.sql.bootstrapper.SqlSchemaBootstrapper;
import org.eclipse.edc.sql.configuration.DataSourceName;
import org.eclipse.edc.transaction.datasource.spi.DataSourceRegistry;
import org.eclipse.edc.transaction.spi.TransactionContext;

Expand All @@ -34,8 +35,12 @@
public class SqlParticipantContextStoreExtension implements ServiceExtension {
public static final String NAME = "ParticipantContext SQL Store Extension";

@Deprecated(since = "0.8.1")
@Setting(value = "Datasource name for the ParticipantContext database", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_SETTING_NAME = "edc.datasource.participantcontext.name";
@Setting(value = "The datasource to be used", defaultValue = DataSourceRegistry.DEFAULT_DATASOURCE)
public static final String DATASOURCE_NAME = "edc.sql.store.participantcontext.datasource";

@Inject
private DataSourceRegistry dataSourceRegistry;
@Inject
Expand All @@ -46,7 +51,6 @@
private QueryExecutor queryExecutor;
@Inject(required = false)
private ParticipantContextStoreStatements statements;

@Inject
private SqlSchemaBootstrapper sqlSchemaBootstrapper;

Expand All @@ -66,6 +70,6 @@
}

private String getDataSourceName(ServiceExtensionContext context) {
return context.getConfig().getString(DATASOURCE_SETTING_NAME, DataSourceRegistry.DEFAULT_DATASOURCE);
return DataSourceName.getDataSourceName(DATASOURCE_NAME, DATASOURCE_SETTING_NAME, context.getConfig(), context.getMonitor());

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
DataSourceName.getDataSourceName
should be avoided because it has been deprecated.
}
}
Loading