From 9678c2e9288a73589e84f9fd254c26aed6a93297 Mon Sep 17 00:00:00 2001 From: TonyRowntree <33454202+TonyRowntree@users.noreply.github.com> Date: Thu, 17 Jun 2021 12:34:06 +0000 Subject: [PATCH] feat(core-api): plugin async initializer method Signed-off-by: TonyRowntree <33454202+TonyRowntree@users.noreply.github.com> --- .../src/main/typescript/plugin/i-cactus-plugin.ts | 2 ++ .../src/main/typescript/plugin-consortium-manual.ts | 4 ++++ .../src/main/typescript/plugin-htlc-eth-besu-erc20.ts | 4 ++++ .../src/main/typescript/plugin-htlc-eth-besu.ts | 4 ++++ .../src/main/typescript/plugin-keychain-memory.ts | 4 ++++ .../src/main/typescript/plugin-keychain-vault.ts | 4 ++++ .../src/main/typescript/plugin-ledger-connector-besu.ts | 4 ++++ .../src/main/typescript/plugin-ledger-connector-corda.ts | 4 ++++ .../src/main/typescript/plugin-ledger-connector-fabric.ts | 4 ++++ .../src/main/typescript/plugin-ledger-connector-quorum.ts | 4 ++++ .../src/main/typescript/plugin-ledger-connector-xdai.ts | 4 ++++ 11 files changed, 42 insertions(+) diff --git a/packages/cactus-core-api/src/main/typescript/plugin/i-cactus-plugin.ts b/packages/cactus-core-api/src/main/typescript/plugin/i-cactus-plugin.ts index 3a11fa484a..8f2a7a7170 100644 --- a/packages/cactus-core-api/src/main/typescript/plugin/i-cactus-plugin.ts +++ b/packages/cactus-core-api/src/main/typescript/plugin/i-cactus-plugin.ts @@ -68,6 +68,8 @@ export interface ICactusPlugin { * Hyperledger Besu deployment) */ getPackageName(): string; + + onPluginInit(): Promise; } export function isICactusPlugin(x: unknown): x is ICactusPlugin { diff --git a/packages/cactus-plugin-consortium-manual/src/main/typescript/plugin-consortium-manual.ts b/packages/cactus-plugin-consortium-manual/src/main/typescript/plugin-consortium-manual.ts index f3a1c97777..10797cf79f 100644 --- a/packages/cactus-plugin-consortium-manual/src/main/typescript/plugin-consortium-manual.ts +++ b/packages/cactus-plugin-consortium-manual/src/main/typescript/plugin-consortium-manual.ts @@ -91,6 +91,10 @@ export class PluginConsortiumManual return this.instanceId; } + public async onPluginInit(): Promise { + return; + } + public getPrometheusExporter(): PrometheusExporter { return this.prometheusExporter; } diff --git a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/plugin-htlc-eth-besu-erc20.ts b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/plugin-htlc-eth-besu-erc20.ts index d347710072..bfe4b78496 100644 --- a/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/plugin-htlc-eth-besu-erc20.ts +++ b/packages/cactus-plugin-htlc-eth-besu-erc20/src/main/typescript/plugin-htlc-eth-besu-erc20.ts @@ -74,6 +74,10 @@ export class PluginHtlcEthBesuErc20 return; } + public async onPluginInit(): Promise { + return; + } + public getInstanceId(): string { return this.instanceId; } diff --git a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/plugin-htlc-eth-besu.ts b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/plugin-htlc-eth-besu.ts index 082a92898c..a70acf1da9 100644 --- a/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/plugin-htlc-eth-besu.ts +++ b/packages/cactus-plugin-htlc-eth-besu/src/main/typescript/plugin-htlc-eth-besu.ts @@ -83,6 +83,10 @@ export class PluginHtlcEthBesu implements ICactusPlugin, IPluginWebService { return "@hyperledger/cactus-plugin-htlc-eth-besu"; } + public async onPluginInit(): Promise { + return; + } + async registerWebServices(app: Express): Promise { const webServices = await this.getOrCreateWebServices(); webServices.forEach((ws) => ws.registerExpress(app)); diff --git a/packages/cactus-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts b/packages/cactus-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts index 936ac7a943..d94e2dd49f 100644 --- a/packages/cactus-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts +++ b/packages/cactus-plugin-keychain-memory/src/main/typescript/plugin-keychain-memory.ts @@ -112,6 +112,10 @@ export class PluginKeychainMemory { return `@hyperledger/cactus-plugin-keychain-memory`; } + public async onPluginInit(): Promise { + return; + } + async get(key: string): Promise { return this.backend.get(key) as T; } diff --git a/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault.ts b/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault.ts index 3ce31940e5..c1b29ca4b5 100644 --- a/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault.ts +++ b/packages/cactus-plugin-keychain-vault/src/main/typescript/plugin-keychain-vault.ts @@ -194,6 +194,10 @@ export class PluginKeychainVault implements ICactusPlugin, IPluginWebService { return `@hyperledger/cactus-plugin-keychain-vault`; } + public async onPluginInit(): Promise { + return; + } + async rotateEncryptionKeys(): Promise { throw new Error("Method not implemented."); } diff --git a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts index ac5930b15d..106d8fac89 100644 --- a/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts +++ b/packages/cactus-plugin-ledger-connector-besu/src/main/typescript/plugin-ledger-connector-besu.ts @@ -155,6 +155,10 @@ export class PluginLedgerConnectorBesu return this.instanceId; } + public async onPluginInit(): Promise { + return; + } + public getHttpServer(): Optional { return Optional.ofNullable(this.httpServer); } diff --git a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts index 522d1333ad..68e7337927 100644 --- a/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts +++ b/packages/cactus-plugin-ledger-connector-corda/src/main/typescript/plugin-ledger-connector-corda.ts @@ -108,6 +108,10 @@ export class PluginLedgerConnectorCorda return "@hyperledger/cactus-plugin-ledger-connector-corda"; } + public async onPluginInit(): Promise { + return; + } + public deployContract(): Promise { throw new Error("Method not implemented."); } diff --git a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts index 161887c5d5..a91e2a47b6 100644 --- a/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts +++ b/packages/cactus-plugin-ledger-connector-fabric/src/main/typescript/plugin-ledger-connector-fabric.ts @@ -198,6 +198,10 @@ export class PluginLedgerConnectorFabric return Optional.empty(); } + public async onPluginInit(): Promise { + return; + } + public async getConsensusAlgorithmFamily(): Promise< ConsensusAlgorithmFamily > { diff --git a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts index 9f2951aa07..e26abc5318 100644 --- a/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts +++ b/packages/cactus-plugin-ledger-connector-quorum/src/main/typescript/plugin-ledger-connector-quorum.ts @@ -149,6 +149,10 @@ export class PluginLedgerConnectorQuorum } } + public async onPluginInit(): Promise { + return; + } + async registerWebServices(app: Express): Promise { const webServices = await this.getOrCreateWebServices(); await Promise.all(webServices.map((ws) => ws.registerExpress(app))); diff --git a/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts b/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts index ec682f65a8..f9c43ff64f 100644 --- a/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts +++ b/packages/cactus-plugin-ledger-connector-xdai/src/main/typescript/plugin-ledger-connector-xdai.ts @@ -140,6 +140,10 @@ export class PluginLedgerConnectorXdai return this.instanceId; } + public async onPluginInit(): Promise { + return; + } + public getHttpServer(): Optional { return Optional.ofNullable(this.httpServer); }