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;
}
Aggregations