From 7d663d1283846376fb39bcffdbabd48d9353322f Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Fri, 26 May 2023 15:10:36 +0200 Subject: [PATCH] fix: compile errors --- .../credentials/jwt/JwtCredentialsExtension.java | 6 +++++- .../verifier/jwt/JwtCredentialsVerifierExtension.java | 6 +++++- .../store/cosmos/CosmosIdentityHubStoreExtension.java | 7 +++++-- .../store/sql/SqlIdentityHubStoreExtension.java | 7 ++++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/extensions/credentials/identity-hub-credentials-jwt/src/main/java/org/eclipse/edc/identityhub/credentials/jwt/JwtCredentialsExtension.java b/extensions/credentials/identity-hub-credentials-jwt/src/main/java/org/eclipse/edc/identityhub/credentials/jwt/JwtCredentialsExtension.java index 9e6f28fe4..784f29a92 100644 --- a/extensions/credentials/identity-hub-credentials-jwt/src/main/java/org/eclipse/edc/identityhub/credentials/jwt/JwtCredentialsExtension.java +++ b/extensions/credentials/identity-hub-credentials-jwt/src/main/java/org/eclipse/edc/identityhub/credentials/jwt/JwtCredentialsExtension.java @@ -19,6 +19,7 @@ import org.eclipse.edc.runtime.metamodel.annotation.Inject; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.eclipse.edc.spi.types.TypeManager; /** * Extension for handling parsing and encoding verifiable credential in JWT format. @@ -31,6 +32,9 @@ public class JwtCredentialsExtension implements ServiceExtension { @Inject private CredentialEnvelopeTransformerRegistry transformerRegistry; + @Inject + private TypeManager typeManager; + @Override public String name() { return NAME; @@ -38,6 +42,6 @@ public String name() { @Override public void initialize(ServiceExtensionContext context) { - transformerRegistry.register(new JwtCredentialEnvelopeTransformer(context.getTypeManager().getMapper())); + transformerRegistry.register(new JwtCredentialEnvelopeTransformer(typeManager.getMapper())); } } diff --git a/extensions/identity-hub-verifier-jwt/src/main/java/org/eclipse/edc/identityhub/verifier/jwt/JwtCredentialsVerifierExtension.java b/extensions/identity-hub-verifier-jwt/src/main/java/org/eclipse/edc/identityhub/verifier/jwt/JwtCredentialsVerifierExtension.java index 51b8a0fb0..59e9fe2a1 100644 --- a/extensions/identity-hub-verifier-jwt/src/main/java/org/eclipse/edc/identityhub/verifier/jwt/JwtCredentialsVerifierExtension.java +++ b/extensions/identity-hub-verifier-jwt/src/main/java/org/eclipse/edc/identityhub/verifier/jwt/JwtCredentialsVerifierExtension.java @@ -21,6 +21,7 @@ import org.eclipse.edc.spi.monitor.Monitor; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.eclipse.edc.spi.types.TypeManager; import static org.eclipse.edc.identityhub.credentials.jwt.JwtCredentialConstants.DATA_FORMAT; @@ -39,6 +40,9 @@ public class JwtCredentialsVerifierExtension implements ServiceExtension { @Inject private CredentialEnvelopeVerifierRegistry verifierRegistry; + @Inject + private TypeManager typeManager; + @Override public String name() { return "JWT Credentials Verifier"; @@ -48,6 +52,6 @@ public String name() { public void initialize(ServiceExtensionContext context) { var jwtVerifier = new DidJwtCredentialsVerifier(didPublicKeyResolver, monitor); context.registerService(JwtCredentialsVerifier.class, jwtVerifier); - verifierRegistry.register(DATA_FORMAT, new JwtCredentialEnvelopeVerifier(jwtVerifier, context.getTypeManager().getMapper())); + verifierRegistry.register(DATA_FORMAT, new JwtCredentialEnvelopeVerifier(jwtVerifier, typeManager.getMapper())); } } diff --git a/extensions/store/cosmos/identity-hub-store-cosmos/src/main/java/org/eclipse/edc/identityhub/store/cosmos/CosmosIdentityHubStoreExtension.java b/extensions/store/cosmos/identity-hub-store-cosmos/src/main/java/org/eclipse/edc/identityhub/store/cosmos/CosmosIdentityHubStoreExtension.java index 912893c85..8aa813268 100644 --- a/extensions/store/cosmos/identity-hub-store-cosmos/src/main/java/org/eclipse/edc/identityhub/store/cosmos/CosmosIdentityHubStoreExtension.java +++ b/extensions/store/cosmos/identity-hub-store-cosmos/src/main/java/org/eclipse/edc/identityhub/store/cosmos/CosmosIdentityHubStoreExtension.java @@ -27,6 +27,7 @@ import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; import org.eclipse.edc.spi.system.health.HealthCheckService; +import org.eclipse.edc.spi.types.TypeManager; /** * Extension that provides a {@link org.eclipse.edc.identityhub.store.spi.IdentityHubStore} with CosmosDB as backend storage @@ -42,6 +43,8 @@ public class CosmosIdentityHubStoreExtension implements ServiceExtension { private Vault vault; @Inject private CosmosClientProvider clientProvider; + @Inject + private TypeManager typeManager; private CosmosDbApi cosmosDbApi; @@ -53,7 +56,7 @@ public String name() { @Override public void initialize(ServiceExtensionContext context) { context.getService(HealthCheckService.class).addReadinessProvider(() -> cosmosDbApi.get().forComponent(name())); - context.getTypeManager().registerTypes(IdentityHubRecordDocument.class); + typeManager.registerTypes(IdentityHubRecordDocument.class); } @@ -62,6 +65,6 @@ public IdentityHubStore identityHubStore(ServiceExtensionContext context) { var configuration = new CosmosIdentityHubStoreConfig(context); var client = clientProvider.createClient(vault, configuration); cosmosDbApi = new CosmosDbApiImpl(configuration, client); - return new CosmosIdentityHubStore(cosmosDbApi, configuration.getPartitionKey(), context.getTypeManager().getMapper(), retryPolicy); + return new CosmosIdentityHubStore(cosmosDbApi, configuration.getPartitionKey(), typeManager.getMapper(), retryPolicy); } } diff --git a/extensions/store/sql/identity-hub-store-sql/src/main/java/org/eclipse/edc/identityhub/store/sql/SqlIdentityHubStoreExtension.java b/extensions/store/sql/identity-hub-store-sql/src/main/java/org/eclipse/edc/identityhub/store/sql/SqlIdentityHubStoreExtension.java index dab7d0abc..4b0750b8c 100644 --- a/extensions/store/sql/identity-hub-store-sql/src/main/java/org/eclipse/edc/identityhub/store/sql/SqlIdentityHubStoreExtension.java +++ b/extensions/store/sql/identity-hub-store-sql/src/main/java/org/eclipse/edc/identityhub/store/sql/SqlIdentityHubStoreExtension.java @@ -23,6 +23,7 @@ import org.eclipse.edc.runtime.metamodel.annotation.Setting; import org.eclipse.edc.spi.system.ServiceExtension; import org.eclipse.edc.spi.system.ServiceExtensionContext; +import org.eclipse.edc.spi.types.TypeManager; import org.eclipse.edc.transaction.datasource.spi.DataSourceRegistry; import org.eclipse.edc.transaction.spi.TransactionContext; @@ -46,16 +47,20 @@ public class SqlIdentityHubStoreExtension implements ServiceExtension { private DataSourceRegistry dataSourceRegistry; @Inject private TransactionContext trxContext; + @Inject + private TypeManager typeManager; @Override public String name() { return NAME; } + + @Provider public IdentityHubStore identityHubStore(ServiceExtensionContext context) { var s = Objects.requireNonNullElse(statements, new BaseSqlIdentityHubStatements()); var dataSource = context.getSetting(DATASOURCE_NAME_SETTING, DEFAULT_DATASOURCE_NAME); - return new SqlIdentityHubStore(dataSourceRegistry, dataSource, trxContext, s, context.getTypeManager().getMapper()); + return new SqlIdentityHubStore(dataSourceRegistry, dataSource, trxContext, s, typeManager.getMapper()); } }