Search in sources :

Example 6 with ActionReport

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);
}
Also used : Target(org.glassfish.internal.api.Target) CommandTarget(org.glassfish.config.support.CommandTarget) PortUnification(org.glassfish.grizzly.config.dom.PortUnification) Config(com.sun.enterprise.config.serverbeans.Config) ActionReport(org.glassfish.api.ActionReport) Protocol(org.glassfish.grizzly.config.dom.Protocol) ProtocolFinder(org.glassfish.grizzly.config.dom.ProtocolFinder)

Example 7 with ActionReport

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);
}
Also used : Target(org.glassfish.internal.api.Target) CommandTarget(org.glassfish.config.support.CommandTarget) Config(com.sun.enterprise.config.serverbeans.Config) ActionReport(org.glassfish.api.ActionReport) Transport(org.glassfish.grizzly.config.dom.Transport)

Example 8 with ActionReport

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);
}
Also used : Target(org.glassfish.internal.api.Target) Config(com.sun.enterprise.config.serverbeans.Config) ActionReport(org.glassfish.api.ActionReport) VirtualServer(com.sun.enterprise.config.serverbeans.VirtualServer)

Example 9 with ActionReport

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");
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) ActionReport(org.glassfish.api.ActionReport) EnvEntry(org.glassfish.web.config.serverbeans.EnvEntry)

Example 10 with ActionReport

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");
    }
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) ActionReport(org.glassfish.api.ActionReport)

Aggregations

ActionReport (org.glassfish.api.ActionReport)508 TransactionFailure (org.jvnet.hk2.config.TransactionFailure)86 Properties (java.util.Properties)83 Config (com.sun.enterprise.config.serverbeans.Config)73 PropertyVetoException (java.beans.PropertyVetoException)72 ParameterMap (org.glassfish.api.admin.ParameterMap)66 Logger (java.util.logging.Logger)56 IOException (java.io.IOException)47 ArrayList (java.util.ArrayList)47 HashMap (java.util.HashMap)43 File (java.io.File)41 CommandTarget (org.glassfish.config.support.CommandTarget)30 Target (org.glassfish.internal.api.Target)30 Map (java.util.Map)27 Server (com.sun.enterprise.config.serverbeans.Server)25 List (java.util.List)25 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)24 CommandRunner (org.glassfish.api.admin.CommandRunner)23 ExtendedDeploymentContext (org.glassfish.internal.deployment.ExtendedDeploymentContext)23 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)19