use of org.glassfish.api.ActionReport in project Payara by payara.
the class ListProtocolFinders method execute.
public void execute(AdminCommandContext context) {
Target targetUtil = services.getService(Target.class);
Config newConfig = targetUtil.getConfig(target);
if (newConfig != null) {
config = newConfig;
}
final ActionReport report = context.getActionReport();
Protocol protocol = config.getNetworkConfig().getProtocols().findProtocol(protocolName);
if (protocol != null) {
final PortUnification pu = protocol.getPortUnification();
if (pu != null) {
for (ProtocolFinder finder : pu.getProtocolFinder()) {
report.getTopMessagePart().addChild().setMessage(finder.getName());
}
}
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of org.glassfish.api.ActionReport in project Payara by payara.
the class ListTransports method execute.
/**
* Executes the command with the command parameters passed as Properties where the keys are the paramter names and
* the values the parameter values
*
* @param context information
*/
public void execute(AdminCommandContext context) {
Target targetUtil = services.getService(Target.class);
Config newConfig = targetUtil.getConfig(target);
if (newConfig != null) {
config = newConfig;
}
final ActionReport report = context.getActionReport();
List<Transport> list = config.getNetworkConfig().getTransports().getTransport();
for (Transport transport : list) {
report.getTopMessagePart().addChild().setMessage(transport.getName());
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of org.glassfish.api.ActionReport in project Payara by payara.
the class ListVirtualServers method execute.
/**
* Executes the command with the command parameters passed as Properties where the keys are the paramter names and
* the values the parameter values
*
* @param context information
*/
public void execute(AdminCommandContext context) {
Target targetUtil = services.getService(Target.class);
Config newConfig = targetUtil.getConfig(target);
if (newConfig != null) {
config = newConfig;
}
ActionReport report = context.getActionReport();
List<VirtualServer> list = config.getHttpService().getVirtualServer();
for (VirtualServer virtualServer : list) {
report.getTopMessagePart().addChild().setMessage(virtualServer.getId());
}
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
use of org.glassfish.api.ActionReport in project Payara by payara.
the class ListWebEnvEntryCommand method execute.
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
WebModuleConfig config = webModuleConfig(report);
if (config == null) {
return;
}
ActionReport.MessagePart part = report.getTopMessagePart();
final String format = localStrings.getLocalString("listWebEnvEntryFormat", "{0} ({1}) = {2} ignoreDescriptorItem={3} //{4}");
int reported = 0;
for (EnvEntry entry : config.envEntriesMatching(name)) {
ActionReport.MessagePart childPart = part.addChild();
childPart.setMessage(MessageFormat.format(format, entry.getEnvEntryName(), entry.getEnvEntryType(), entry.getEnvEntryValue(), entry.getIgnoreDescriptorItem(), descriptionValueOrNotSpecified(entry.getDescription())));
reported++;
}
succeed(report, "listSummary", "Reported {0,choice,0#no {1} settings|1#one {1} setting|1<{0,number,integer} {1} settings}", reported, "env-entry");
}
use of org.glassfish.api.ActionReport in project Payara by payara.
the class UnsetWebContextParamCommand method execute.
public void execute(AdminCommandContext context) {
ActionReport report = context.getActionReport();
try {
WebModuleConfig config = webModuleConfig(report);
if (config == null) {
return;
}
config.deleteContextParam(name);
} catch (Exception e) {
fail(report, e, "errUnsetContextParam", "Error unsetting context-param");
}
}
Aggregations