Search in sources :

Example 1 with PhoneHomeRuntimeConfiguration

use of fish.payara.nucleus.phonehome.PhoneHomeRuntimeConfiguration in project Payara by payara.

the class DisablePhoneHome method execute.

@Override
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    try {
        ConfigSupport.apply(new SingleConfigCode<PhoneHomeRuntimeConfiguration>() {

            @Override
            public Object run(PhoneHomeRuntimeConfiguration configurationProxy) throws PropertyVetoException, TransactionFailure {
                configurationProxy.setEnabled("false");
                return configurationProxy;
            }
        }, configuration);
    } catch (TransactionFailure ex) {
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    }
    service.stop();
    report.setMessage("Phone Home Service is disabled");
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) ActionReport(org.glassfish.api.ActionReport) PhoneHomeRuntimeConfiguration(fish.payara.nucleus.phonehome.PhoneHomeRuntimeConfiguration)

Example 2 with PhoneHomeRuntimeConfiguration

use of fish.payara.nucleus.phonehome.PhoneHomeRuntimeConfiguration in project Payara by payara.

the class EnablePhoneHome method execute.

@Override
public void execute(AdminCommandContext context) {
    final ActionReport report = context.getActionReport();
    try {
        ConfigSupport.apply(new SingleConfigCode<PhoneHomeRuntimeConfiguration>() {

            @Override
            public Object run(PhoneHomeRuntimeConfiguration configurationProxy) throws PropertyVetoException, TransactionFailure {
                configurationProxy.setEnabled("true");
                return configurationProxy;
            }
        }, configuration);
    } catch (TransactionFailure ex) {
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
    }
    service.start();
    report.setMessage("Phone Home Service is enabled");
    report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) TransactionFailure(org.jvnet.hk2.config.TransactionFailure) ActionReport(org.glassfish.api.ActionReport) PhoneHomeRuntimeConfiguration(fish.payara.nucleus.phonehome.PhoneHomeRuntimeConfiguration)

Aggregations

PhoneHomeRuntimeConfiguration (fish.payara.nucleus.phonehome.PhoneHomeRuntimeConfiguration)2 PropertyVetoException (java.beans.PropertyVetoException)2 ActionReport (org.glassfish.api.ActionReport)2 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)2