Search in sources :

Example 1 with WebModuleConfig

use of org.glassfish.web.config.serverbeans.WebModuleConfig 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 2 with WebModuleConfig

use of org.glassfish.web.config.serverbeans.WebModuleConfig 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)

Example 3 with WebModuleConfig

use of org.glassfish.web.config.serverbeans.WebModuleConfig in project Payara by payara.

the class SetWebEnvEntryCommand method setEnvEntry.

private void setEnvEntry(final Engine owningEngine, final String name, final String description, final Boolean ignoreDescriptorItem, final String value, final String envEntryType, final ActionReport report) throws PropertyVetoException, TransactionFailure {
    WebModuleConfig config = WebModuleConfig.Duck.webModuleConfig(owningEngine);
    if (config == null) {
        createEnvEntryOnNewWMC(owningEngine, name, value, envEntryType, description, ignoreDescriptorItem);
    } else {
        EnvEntry entry = config.getEnvEntry(name);
        if (entry == null) {
            if (isTypeOrIgnorePresent(ignoreDescriptorItem, envEntryType, report)) {
                createEnvEntryOnExistingWMC(config, name, value, envEntryType, description, ignoreDescriptorItem);
            }
        } else {
            modifyEnvEntry(entry, value, envEntryType, description, ignoreDescriptorItem);
            succeed(report, "setWebEnvEntryOverride", "Previous env-entry setting of {0} for application/module {1} was overridden.", name, appNameAndOptionalModuleName());
        }
    }
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) EnvEntry(org.glassfish.web.config.serverbeans.EnvEntry)

Example 4 with WebModuleConfig

use of org.glassfish.web.config.serverbeans.WebModuleConfig in project Payara by payara.

the class WebModuleConfigCommand method webModuleConfig.

protected WebModuleConfig webModuleConfig(final ActionReport report) {
    Module m = module(report);
    if (m == null) {
        return null;
    }
    WebModuleConfig config = (WebModuleConfig) engine(report).getApplicationConfig();
    return config;
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) Module(com.sun.enterprise.config.serverbeans.Module)

Example 5 with WebModuleConfig

use of org.glassfish.web.config.serverbeans.WebModuleConfig in project Payara by payara.

the class ListWebContextParamCommand 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("listWebContextParamFormat", "{0} = {1} ignoreDescriptorItem={2} //{3}");
    int reported = 0;
    for (ContextParam param : config.contextParamsMatching(name)) {
        ActionReport.MessagePart childPart = part.addChild();
        childPart.setMessage(MessageFormat.format(format, param.getParamName(), param.getParamValue(), param.getIgnoreDescriptorItem(), descriptionValueOrNotSpecified(param.getDescription())));
        reported++;
    }
    succeed(report, "listSummary", "Reported {0,choice,0#no {1} settings|1#one {1} setting|1<{0,number,integer} {1} settings}", reported, "context-param");
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) ActionReport(org.glassfish.api.ActionReport) ContextParam(org.glassfish.web.config.serverbeans.ContextParam)

Aggregations

WebModuleConfig (org.glassfish.web.config.serverbeans.WebModuleConfig)7 ActionReport (org.glassfish.api.ActionReport)4 ContextParam (org.glassfish.web.config.serverbeans.ContextParam)2 EnvEntry (org.glassfish.web.config.serverbeans.EnvEntry)2 Module (com.sun.enterprise.config.serverbeans.Module)1