/** * Indicate in the action report that the command succeeded and * include the target property and it's value in the report */ private void success(AdminCommandContext context, String target, String value) { context.getActionReport().setActionExitCode(ActionReport.ExitCode.SUCCESS); ActionReport.MessagePart part = context.getActionReport().getTopMessagePart().addChild(); part.setChildrenType("DottedName"); part.setMessage(target + "=" + value); } }
/** * 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) { final ActionReport report = context.getActionReport(); report.getTopMessagePart().setChildrenType("audit-module"); for (AuditModule am : securityService.getAuditModule()) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(am.getName()); } }
private void processResourceRefs(ActionReport report, List<ResourceRef> resourceRefs) { if (resourceRefs.isEmpty()) { final ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(localStrings.getLocalString( "NothingToList", "Nothing to List.")); } else { for (ResourceRef ref : resourceRefs) { final ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(ref.getRef()); } } } }
private void copyActionReportContent(ActionReport source, ActionReport dest) { if (source == null || dest == null) { return; } dest.setActionExitCode(source.getActionExitCode()); dest.setExtraProperties(source.getExtraProperties()); //No deep copy. Any change of source is unexpected copyMessagePart(source.getTopMessagePart(), dest.getTopMessagePart()); List<? extends ActionReport> subReports = source.getSubActionsReport(); if (subReports != null) { for (ActionReport subrep : subReports) { copyActionReportContent(subrep, dest.addSubActionsReport()); } } }
@Override public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); String[] cipherSuites = sslutils.getSupportedCipherSuites(); for (String cipherSuite : cipherSuites) { if (!cipherSuite.contains("_KRB5_")) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(cipherSuite); } } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } }
public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ActionReport.MessagePart part = report.getTopMessagePart(); Sniffer sniffer = snifferManager.getSniffer(sniffername); if (sniffer != null) { String isVisible = String.valueOf(sniffer.isUserVisible()); part.addProperty(DeploymentProperties.IS_SNIFFER_USER_VISIBLE, isVisible); part.setMessage(isVisible); } } }
ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setChildrenType("DottedName"); part.setMessage(prefix + node.getValue() + "=" + node.getKey().attribute("value")); foundMatch = true; String finalDottedName = node.getValue() + "." + name.getKey(); if (matches(finalDottedName, pattern)) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setChildrenType("DottedName"); part.setMessage(prefix + node.getValue() + "." + name.getKey() + "=" + name.getValue()); foundMatch = true; report.setActionExitCode(ActionReport.ExitCode.FAILURE);
private void processResourceRefs(ActionReport report, List<ResourceRef> resourceRefs) { if (resourceRefs.isEmpty()) { final ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(localStrings.getLocalString( "NothingToList", "Nothing to List.")); } else { for (ResourceRef ref : resourceRefs) { final ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(ref.getRef()); } } } }
@Override public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); String[] cipherSuites = sslutils.getSupportedCipherSuites(); for (String cipherSuite : cipherSuites) { if (!cipherSuite.contains("_KRB5_")) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(cipherSuite); } } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } }
public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ActionReport.MessagePart part = report.getTopMessagePart(); List<String> targets = null; if (appName == null || appName.equals("*")) { targets = domain.getAllTargets(); } else { targets = domain.getAllReferencedTargetsForApplication(appName); } for (String target : targets) { ActionReport.MessagePart childPart = part.addChild(); childPart.setMessage(target); } } }
public static void fillActionReport(final ActionReport ar, final JSONObject json) throws JSONException { ar.setActionExitCode(ActionReport.ExitCode.valueOf(json.getString("exit_code"))); ar.setActionDescription(json.optString("command")); String failure = json.optString("failure_cause"); if (failure != null && !failure.isEmpty()) { ar.setFailureCause(new Exception(failure)); } ar.setExtraProperties((Properties) extractMap(json.optJSONObject("extraProperties"), new Properties())); ar.getTopMessagePart().setMessage(json.optString("top_message", json.optString("message"))); Properties props = (Properties) extractMap(json.optJSONObject("properties"), new Properties()); for (Map.Entry entry : props.entrySet()) { ar.getTopMessagePart().addProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())); } //Sub messages fillSubMessages(ar.getTopMessagePart(), json.optJSONArray("children")); //Sub action reports JSONArray subJsons = json.optJSONArray("subReports"); if (subJsons != null) { for (int i = 0; i < subJsons.length(); i++) { JSONObject subJson = subJsons.getJSONObject(i); fillActionReport(ar.addSubActionsReport(), subJson); } } }
private void fillEndpoints(ActionReport report, Map<String, Map<String, Map<String, DeployedEndpointData>>> endpoints) { if (!endpoints.isEmpty()) { Properties extra = new Properties(); extra.putAll(endpoints); report.setExtraProperties(extra); ActionReport.MessagePart top = report.getTopMessagePart(); for(Map.Entry<String, Map<String, Map<String, DeployedEndpointData>>> app : endpoints.entrySet()) { ActionReport.MessagePart child = top.addChild(); child.setMessage("application:"+app.getKey()); for(Map.Entry<String, Map<String, DeployedEndpointData>> module : app.getValue().entrySet()) { child = child.addChild(); child.setMessage(" module:"+module.getKey()); for(Map.Entry<String, DeployedEndpointData> endpoint : module.getValue().entrySet()) { child = child.addChild(); child.setMessage(" endpoint:"+endpoint.getKey()); for(Map.Entry<String, String> endpointData : endpoint.getValue().getStaticAsMap().entrySet()) { child = child.addChild(); child.setMessage(" "+endpointData.getKey()+":"+endpointData.getValue()); } } } } } }
/** * 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 */ @Override public void execute(AdminCommandContext context) { context.getActionReport().setActionExitCode(ActionReport.ExitCode.SUCCESS); ActionReport report = context.getActionReport(); report.getTopMessagePart().setChildrenType("Command"); for (String name : sortedAdminCommands()) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(name); } }
/** * Executes the command. * * @param context information */ public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ActionReport.MessagePart msgPart = report.getTopMessagePart(); msgPart.setChildrenType("WARNING"); ActionReport.MessagePart childPart = msgPart.addChild(); String commandName = getClass().getAnnotation(Service.class).name(); childPart.setMessage(localStrings.getLocalString("deploydir.command.deprecated", "{0} command deprecated. Please use {1} command instead.", commandName, "deploy")); super.execute(context); } }
private void setModuleMonitoringLevel(String moduleName, String level, ActionReport report) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); if (!isValidString(moduleName)) { part.setMessage(localStrings.getLocalString("enable.monitoring.invalid", "Invalid module name {0}", moduleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } if ((!isValidString(level)) || (!isValidLevel(level))) { part.setMessage(localStrings.getLocalString("enable.monitoring.invalid", "Invalid level {0} for module name {1}", level, moduleName)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); } MonitoringConfig.setMonitoringLevel(ms, moduleName, level, report); }
if (!matches) { String msg = lsm.getString("soft.invalid.xmx", opt); report.getTopMessagePart().addChild().setMessage(msg); report.getTopMessagePart().addChild().setMessage(msg); if (xmsInConfig > xmxGiven) { //i.e. domain.xml contains -Xms1g and you ask -Xmx512m to be set String msg = lsm.getString("soft.xmx.smaller.than.xms", xmxGiven + " MB", xmsInConfig + " MB"); report.getTopMessagePart().addChild().setMessage(msg);
@Override public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); List<JaccProvider> jaccProviders = securityService.getJaccProvider(); JaccProvider jprov = null; for (JaccProvider jaccProv : jaccProviders) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(jaccProv.getName()); } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); }
/** * 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) { final ActionReport report = context.getActionReport(); List <Config> configList = configs.getConfig(); Config config = configList.get(0); SecurityService securityService = config.getSecurityService(); for (AuthRealm realm : securityService.getAuthRealm()) { ActionReport.MessagePart part = report.getTopMessagePart().addChild(); part.setMessage(realm.getName()); } } }
public void getHelp(AdminCommand command, ActionReport report) { CommandModel model = getModel(command); report.setActionDescription(model.getCommandName() + " help"); // XXX - this is a hack for now. if the request mapped to an // XMLContentActionReporter, that means we want the command metadata. if (report instanceof XMLContentActionReporter) { getMetadata(command, model, report); } else { report.setMessage(model.getCommandName() + " - " + model.getLocalizedDescription()); report.getTopMessagePart().addProperty("SYNOPSIS", encodeManPage(new BufferedReader(new StringReader( getUsageText(model))))); for (CommandModel.ParamModel param : model.getParameters()) { addParamUsage(report, param); } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); } }
if (!matches) { String msg = lsm.getString("soft.invalid.xms", opt); report.getTopMessagePart().addChild().setMessage(msg); report.getTopMessagePart().addChild().setMessage(msg); if (xmsGiven > xmxInConfig) { //i.e. domain.xml contains -Xms1g and you ask -Xmx512m to be set String msg = lsm.getString("soft.xms.larger.than.xmx", xmsGiven + " MB", xmxInConfig + " MB"); report.getTopMessagePart().addChild().setMessage(msg);