Search in sources :

Example 1 with AsadminRecorderConfiguration

use of fish.payara.asadmin.recorder.AsadminRecorderConfiguration in project Payara by payara.

the class GetAsadminRecorderConfiguration method execute.

@Override
public void execute(AdminCommandContext context) {
    Config config = targetUtil.getConfig(target);
    if (config == null) {
        context.getActionReport().setMessage("No such config named: " + target);
        context.getActionReport().setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
    }
    AsadminRecorderConfiguration asadminRecorderConfiguration = config.getExtensionByType(AsadminRecorderConfiguration.class);
    final ActionReport actionReport = context.getActionReport();
    ColumnFormatter columnFormatter = new ColumnFormatter(headers);
    Object[] values = { asadminRecorderConfiguration.isEnabled(), asadminRecorderConfiguration.filterCommands(), asadminRecorderConfiguration.getOutputLocation(), asadminRecorderConfiguration.getFilteredCommands(), asadminRecorderConfiguration.prependEnabled(), asadminRecorderConfiguration.getPrependedOptions() };
    columnFormatter.addRow(values);
    Map<String, Object> map = new HashMap<String, Object>();
    Properties extraProps = new Properties();
    map.put("enabled", values[0]);
    map.put("filterCommands", values[1]);
    map.put("outputLocation", values[2]);
    map.put("filteredCommands", values[3]);
    map.put("prependEnabled", values[4]);
    map.put("prependedOptions", values[5]);
    extraProps.put("getAsadminRecorderConfiguration", map);
    actionReport.setExtraProperties(extraProps);
    actionReport.setMessage(columnFormatter.toString());
    actionReport.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Also used : AsadminRecorderConfiguration(fish.payara.asadmin.recorder.AsadminRecorderConfiguration) HashMap(java.util.HashMap) Config(com.sun.enterprise.config.serverbeans.Config) ActionReport(org.glassfish.api.ActionReport) Properties(java.util.Properties) ColumnFormatter(com.sun.enterprise.util.ColumnFormatter)

Aggregations

Config (com.sun.enterprise.config.serverbeans.Config)1 ColumnFormatter (com.sun.enterprise.util.ColumnFormatter)1 AsadminRecorderConfiguration (fish.payara.asadmin.recorder.AsadminRecorderConfiguration)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 ActionReport (org.glassfish.api.ActionReport)1