All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.actuate.env.ApplicationWritableEnvironmentEndpointWebExtension Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.actuate.env;

import java.util.Collections;
import java.util.Map;

import org.springframework.boot.actuate.endpoint.annotation.DeleteOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.boot.actuate.endpoint.web.annotation.EndpointWebExtension;
import org.springframework.boot.actuate.env.EnvironmentEndpointWebExtension;
import org.zodiac.core.context.environment.AppEnvironmentManager;

@EndpointWebExtension(endpoint = ApplicationWritableEnvironmentEndpoint.class)
public class ApplicationWritableEnvironmentEndpointWebExtension extends EnvironmentEndpointWebExtension {

    private AppEnvironmentManager environment;

    public ApplicationWritableEnvironmentEndpointWebExtension(ApplicationWritableEnvironmentEndpoint endpoint,
        AppEnvironmentManager environment) {
        super(endpoint);
        this.environment = environment;
    }

    @WriteOperation
    public Object write(String name, String value) {
        this.environment.setProperty(name, value);
        return Collections.singletonMap(name, value);
    }

    @DeleteOperation
    public Map reset() {
        return this.environment.reset();
    }

    public void setEnvironmentManager(AppEnvironmentManager environment) {
        this.environment = environment;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy