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");
}
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");
}
}
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());
}
}
}
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;
}
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");
}
Aggregations