Search in sources :

Example 1 with AccountabilityConfigurationManager

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();
}
Also used : AccountabilityConfigurationManager(org.eclipse.winery.common.configuration.AccountabilityConfigurationManager) DELETE(javax.ws.rs.DELETE)

Example 2 with AccountabilityConfigurationManager

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();
    }
}
Also used : AccountabilityConfigurationManager(org.eclipse.winery.common.configuration.AccountabilityConfigurationManager) AccountabilityConfigurationObject(org.eclipse.winery.common.configuration.AccountabilityConfigurationObject) IOException(java.io.IOException) Consumes(javax.ws.rs.Consumes) PUT(javax.ws.rs.PUT)

Aggregations

AccountabilityConfigurationManager (org.eclipse.winery.common.configuration.AccountabilityConfigurationManager)2 IOException (java.io.IOException)1 Consumes (javax.ws.rs.Consumes)1 DELETE (javax.ws.rs.DELETE)1 PUT (javax.ws.rs.PUT)1 AccountabilityConfigurationObject (org.eclipse.winery.common.configuration.AccountabilityConfigurationObject)1