Search in sources :

Example 1 with BlockchainException

use of org.eclipse.winery.accountability.exceptions.BlockchainException in project winery by eclipse.

the class AccountabilityManagerFactory method getAccountabilityManager.

public static AccountabilityManager getAccountabilityManager() throws AccountabilityException {
    if (Objects.isNull(accountabilityManager)) {
        try {
            AccountabilityConfigurationObject properties = Environments.getInstance().getAccountabilityConfig();
            Environments.getInstance().addConfigurationChangeListener(() -> {
                BlockchainFactory.reset();
                ImmutableStorageProviderFactory.reset();
            });
            BlockchainAccess blockchain = BlockchainFactory.getBlockchainAccess(BlockchainFactory.AvailableBlockchains.ETHEREUM, properties);
            ImmutableStorageProvider storageProvider = ImmutableStorageProviderFactory.getStorageProvider(ImmutableStorageProviderFactory.AvailableImmutableStorages.SWARM, properties);
            accountabilityManager = new AccountabilityManagerImpl(blockchain, storageProvider);
        } catch (BlockchainException e) {
            String msg = "Could not instantiate accountability layer: " + e.getMessage();
            LOGGER.error(msg, e);
            throw new AccountabilityException(msg, e);
        }
    }
    return accountabilityManager;
}
Also used : BlockchainException(org.eclipse.winery.accountability.exceptions.BlockchainException) AccountabilityException(org.eclipse.winery.accountability.exceptions.AccountabilityException) BlockchainAccess(org.eclipse.winery.accountability.blockchain.BlockchainAccess) ImmutableStorageProvider(org.eclipse.winery.accountability.storage.ImmutableStorageProvider) AccountabilityConfigurationObject(org.eclipse.winery.common.configuration.AccountabilityConfigurationObject)

Aggregations

BlockchainAccess (org.eclipse.winery.accountability.blockchain.BlockchainAccess)1 AccountabilityException (org.eclipse.winery.accountability.exceptions.AccountabilityException)1 BlockchainException (org.eclipse.winery.accountability.exceptions.BlockchainException)1 ImmutableStorageProvider (org.eclipse.winery.accountability.storage.ImmutableStorageProvider)1 AccountabilityConfigurationObject (org.eclipse.winery.common.configuration.AccountabilityConfigurationObject)1