use of org.eclipse.winery.common.configuration.AccountabilityConfigurationManager in project winery by eclipse.
the class AccountabilityConfigurationResource method restoreDefaults.
@DELETE
public Response restoreDefaults() throws IOException {
// Refactor this when the manager is moved to accountability
AccountabilityConfigurationManager manager = AccountabilityConfigurationManager.getInstance();
manager.restoreDefaults();
return Response.noContent().build();
}
use of org.eclipse.winery.common.configuration.AccountabilityConfigurationManager in project winery by eclipse.
the class AccountabilityConfigurationResource method setAccountabilityConfiguration.
@PUT
@Consumes({ MediaType.MULTIPART_FORM_DATA })
public Response setAccountabilityConfiguration(@FormDataParam("keystoreFile") InputStream keystoreFileStream, @FormDataParam("keystoreFile") FormDataContentDisposition disposition, @FormDataParam("blockhainNodeUrl") String blockchainNodeUrl, @FormDataParam("keystorePassword") String keystorePassword, @FormDataParam("authorizationSmartContractAddress") String authorizationSmartContractAddress, @FormDataParam("provenanceSmartContractAddress") String provenanceSmartContractAddress, @FormDataParam("swarmGatewayUrl") String swarmGatewayUrl) {
AccountabilityConfigurationManager manager = AccountabilityConfigurationManager.getInstance();
try {
// sending a new keystore file is optional
if (keystoreFileStream != null && disposition != null) {
manager.setNewKeystoreFile(keystoreFileStream, disposition.getFileName());
}
AccountabilityConfigurationObject props = Environments.getInstance().getAccountabilityConfig();
props.setEthereumAuthorizationSmartContractAddress(authorizationSmartContractAddress);
props.setEthereumProvenanceSmartContractAddress(provenanceSmartContractAddress);
props.setGethUrl(blockchainNodeUrl);
props.setEthereumPassword(keystorePassword);
props.setSwarmGatewayUrl(swarmGatewayUrl);
Environments.save(props);
return Response.noContent().build();
} catch (IOException e) {
return Response.serverError().entity(e.getMessage()).build();
}
}
Aggregations