Search in sources :

Example 1 with EnvEntry

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

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

Aggregations

EnvEntry (org.glassfish.web.config.serverbeans.EnvEntry)2 WebModuleConfig (org.glassfish.web.config.serverbeans.WebModuleConfig)2 ActionReport (org.glassfish.api.ActionReport)1