Refine search
/** * Takes an action report and updates the message in the report with * the message from the root cause of the report. * * @param report */ static void sanitizeReport(ActionReport report) { if (report != null && report.hasFailures() && report.getFailureCause() != null) { Throwable rootCause = ExceptionUtil.getRootCause( report.getFailureCause()); if (rootCause != null && StringUtils.ok(rootCause.getMessage())) { report.setMessage(rootCause.getMessage()); } } }
/** * Parses a string containing substrings separated from * each other by the standard separator characters and returns * a list of strings. * * Splits the string <code>line</code> into individual string elements * separated by the field separators, and returns these individual * strings as a list of strings. The individual string elements are * trimmed of leading and trailing whitespace. Only non-empty strings * are returned in the list. * * @param line The string to split * @return Returns the list containing the individual strings that * the input string was split into. */ public static List<String> parseStringList(String line) { return parseStringList(line, null); }
public String expandPasswordAlias(String alias) { String expandedPassword = null; if (alias == null) { return null; } try { expandedPassword = RelativePathResolver.getRealPasswordFromAlias(alias); } catch (Exception e) { logger.warning(StringUtils.cat(": ", alias, e.getMessage())); return null; } return expandedPassword; }
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); if (StringUtils.ok(nodehost)){ if (NetUtils.isThisHostLocal(nodehost) && StringUtils.ok(installdir)){ TokenResolver resolver = null; report.setMessage(Strings.get("invalid.installdir",installdir)); report.setActionExitCode(ActionReport.ExitCode.FAILURE); return; CommandInvocation ci = cr.getCommandInvocation("_create-node", report, context.getSubject()); ParameterMap map = new ParameterMap(); map.add("DEFAULT", name); if (StringUtils.ok(nodedir)) map.add(NodeUtils.PARAM_NODEDIR, nodedir); if (StringUtils.ok(installdir)) map.add(NodeUtils.PARAM_INSTALLDIR, installdir); if (StringUtils.ok(nodehost)) map.add(NodeUtils.PARAM_NODEHOST, nodehost); map.add(NodeUtils.PARAM_TYPE,"CONFIG");
Server dasServer = servers.getServer(SystemPropertyConstants.DAS_SERVER_NAME); String dasHost = dasServer.getAdminHost(); String dasPort = Integer.toString(dasServer.getAdminPort()); humanCommand, output, waitForReaderThreads); ActionReport report = ctx.getActionReport(); if (report.getActionExitCode() == ActionReport.ExitCode.SUCCESS) { msg = StringUtils.cat(NL, output.toString().trim(), msg); report.setMessage(msg);
@Override public void execute(AdminCommandContext ctx) { ActionReport report = ctx.getActionReport(); logger = ctx.getLogger(); String msg = ""; boolean fsfailure = false; msg = Strings.get("start.instance.noSuchInstance", instanceName); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; instanceHost = instance.getAdminHost(); noderef = instance.getNodeRef(); if(!StringUtils.ok(noderef)) { msg = Strings.get("missingNodeRef", instanceName); fsfailure = true; nodedir = theNode.getNodeDirAbsolute(); deleteInstanceFilesystem(ctx); report = ctx.getActionReport(); if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS) { fsfailure = true;
@Override public void execute(AdminCommandContext ctx) { logger = ctx.getLogger(); ActionReport report = ctx.getActionReport(); String msg = ""; report.setActionExitCode(ActionReport.ExitCode.FAILURE); if(!StringUtils.ok(instanceName)) { msg = Strings.get("start.instance.noInstanceName"); logger.severe(msg); report.setMessage(msg); return; msg = Strings.get("start.instance.noSuchInstance", instanceName); logger.severe(msg); report.setMessage(msg); return; if (instance.isRunning()) { msg = Strings.get("start.instance.already.running", instanceName); logger.info(msg); noderef = instance.getNodeRef(); if(!StringUtils.ok(noderef)) { msg = Strings.get("missingNodeRef", instanceName); logger.severe(msg);
try { executeCommand(params); aReport.setActionExitCode(ActionReport.ExitCode.SUCCESS); if(StringUtils.ok(getCommandOutput())) aReport.setMessage(strings.getLocalString("ice.successmessage", "{0}:\n{1}\n", getServer().getName(), getCommandOutput())); Map<String, String> attributes = this.getAttributes(); for(Map.Entry<String, String> ae : attributes.entrySet()) { if(!key.endsWith("_name")) { if (ae.getValue() != null) { aReport.getTopMessagePart().addProperty(key, ae.getValue()); aReport.setMessage(strings.getLocalString("clusterutil.warnoffline", "WARNING: Instance {0} seems to be offline; command {1} was not replicated to that instance", getServer().getName(), commandName)); else aReport.setMessage(strings.getLocalString("clusterutil.failoffline", "FAILURE: Instance {0} seems to be offline; command {1} was not replicated to that instance", getServer().getName(), commandName)); } else { finalResult = FailurePolicy.applyFailurePolicy(failPolicy, ActionReport.ExitCode.FAILURE);
@Override public void execute(AdminCommandContext context) { ActionReport report = context.getActionReport(); ctx = context; logger = context.logger; String msg = Strings.get("notAllowed"); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; String msg = Strings.get("noSuchNode", node); logger.warning(msg); report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(msg); return; installDir = theNode.getInstallDir(); if (!StringUtils.ok(nodeHost)) { if (!StringUtils.ok(installDir)) { map.add("checkports", "false"); if(StringUtils.ok(portBase)){ map.add("portbase", portBase);
humanCommand, output, waitForReaderThreads); ActionReport report = ctx.getActionReport(); if (report.getActionExitCode() == ActionReport.ExitCode.SUCCESS) { msg = StringUtils.cat(NL, output.toString().trim(), msg); report.setMessage(msg);
ServerPorts(Domain domain, Server theServer) { Cluster cluster = null; Config config = null; if (theServer.isInstance()) cluster = domain.getClusterForInstance(theServer.getName()); String configName = theServer.getConfigRef(); if (StringUtils.ok(configName)) config = domain.getConfigNamed(configName); initialize(cluster, config, domain, theServer); }
public final String getNode(final Server server) { if (server == null) return null; String node = server.getNodeRef(); if (StringUtils.ok(node)) return node; else return "no node"; }
public InstanceInfo(ServiceLocator habitat, Server svr, int port0, String host0, String cluster0, Logger logger0, int timeout0, ActionReport report, InstanceStateService stateService) { if (svr == null ) // if (svr == null || host0 == null) throw new NullPointerException("null arguments"); this.habitat = habitat; this.svr = svr; name = svr.getName(); port = port0; if (host0 == null) host="not yet assigned"; else host = host0; logger = logger0; timeoutInMsec = timeout0; this.report = report; this.stateService = stateService; if (!StringUtils.ok(cluster0)) cluster = null; else cluster = cluster0; future = pingInstance(); }
serverDom.getHabitat().getService(ServerEnvironment.class); if (server.isDas()) { if (env.isDas()) { String nodeName = server.getNodeRef(); if (StringUtils.ok(nodeName)) { Node node = nodes.getNode(nodeName); if (node != null) { if (StringUtils.ok(hostName)) { return hostName;
private List<Cluster> createClusterList() { // 1. no whichTarget specified if (!StringUtils.ok(whichTarget)) return allClusters.getCluster(); ReferenceContainer rc = domain.getReferenceContainerNamed(whichTarget); // 2. Not a server or a cluster. Could be a config or a Node if (rc == null) { return getClustersForNodeOrConfig(); } else if (rc.isServer()) { Server s =((Server) rc); List<Cluster> cl = new LinkedList<Cluster>(); cl.add(s.getCluster()); return cl; } else if (rc.isCluster()) { Cluster cluster = (Cluster) rc; List<Cluster> cl = new LinkedList<Cluster>(); cl.add(cluster); return cl; } else return null; }
private List<Config> createConfigList() { // 1. no target specified if (!StringUtils.ok(target)) return allConfigs.getConfig(); Config c = domain.getConfigNamed(target); if (c != null) { List<Config> cl = new LinkedList<Config>(); cl.add(c); return cl; } ReferenceContainer rc = domain.getReferenceContainerNamed(target); if (rc == null) return null; if (rc.isServer()) { Server s =((Server) rc); List<Config> cl = new LinkedList<Config>(); cl.add(s.getConfig()); return cl; } else if (rc.isCluster()) { Cluster cluster = (Cluster) rc; List<Config> cl = new LinkedList<Config>(); cl.add(domain.getConfigNamed(cluster.getConfigRef())); return cl; } else return null; }
private void prepare() throws InstanceNotRunningException { if (isError()) return; if (!StringUtils.ok(instanceName)) { setError(Strings.get("stop.instance.noInstanceName")); return; } instance = helper.getServer(instanceName); if (instance == null) { setError(Strings.get("stop.instance.noSuchInstance", instanceName)); return; } host = instance.getAdminHost(); if (host == null) { setError(Strings.get("stop.instance.noHost", instanceName)); return; } port = helper.getAdminPort(instance); if (port < 0) { setError(Strings.get("stop.instance.noPort", instanceName)); return; } if (!isInstanceRestartable()) setError(Strings.get("restart.notRestartable", instanceName)); if (logger.isLoggable(Level.FINER)) logger.finer(ObjectAnalyzer.toString(this)); }
if (!StringUtils.ok(installDir)) { throw new IllegalArgumentException("Node does not have an installDir"); SSHCommandExecutionException cee = new SSHCommandExecutionException(StringUtils.cat(":", m1, m2)); cee.setSSHSettings(sshL.toString()); SSHCommandExecutionException cee = new SSHCommandExecutionException(StringUtils.cat(":", m1, m2)); cee.setSSHSettings(sshL.toString());
@Override public void checkpoint(AdminCommand command, AdminCommandContext context) throws IOException { if (!StringUtils.ok(context.getJobId())) { throw new IllegalArgumentException("Command is not managed"); } Job job = get(context.getJobId()); if (job.getJobsFile() == null) { job.setJobsFile(getJobsFile()); } Checkpoint chkp = new Checkpoint(job, command, context); checkpointHelper.save(chkp); if (job instanceof AdminCommandInstanceImpl) { ((AdminCommandInstanceImpl) job).setState(AdminCommandState.State.RUNNING_RETRYABLE); } }