public String findPropertyInReport(String key) { if (actionReport == null) { return null; } return actionReport.findProperty(key); }
protected final int getServerPid() { try { return Integer.parseInt( new RemoteCLICommand("__locations", programOpts, env) .executeAndReturnActionReport(new String[]{"__locations"}) .findProperty("Pid")); } catch (Exception e) { return -1; } }
private void setDomainName() throws CommandException { RemoteCLICommand rc = new RemoteCLICommand("_get-runtime-info", this.programOpts, this.env); ActionReport report = rc.executeAndReturnActionReport("_get-runtime-info", "--target", "server"); this.domainName = report.findProperty("domain_name"); }
/** * See if the server is restartable * As of March 2011 -- this only returns false if a passwordfile argument was given * when the server started -- but it is no longer available - i.e. the user * deleted it or made it unreadable. */ protected final boolean isRestartable() throws CommandException { // false negative is worse than false positive. // there is one and only one case where we return false RemoteCLICommand cmd = new RemoteCLICommand("_get-runtime-info", programOpts, env); ActionReport report = cmd.executeAndReturnActionReport("_get-runtime-info"); if (report != null) { String val = report.findProperty("restartable_value"); if (ok(val) && val.equals("false")) return false; } return true; }
/** * See if the server is alive and is the one at the specified directory. * * @return true if it's the DAS at this domain directory */ protected final boolean isThisServer(File ourDir, String directoryKey) { if (!ok(directoryKey)) throw new NullPointerException(); ourDir = getUniquePath(ourDir); logger.log(Level.FINER, "Check if server is at location {0}", ourDir); try { RemoteCLICommand cmd = new RemoteCLICommand("__locations", programOpts, env); ActionReport report = cmd.executeAndReturnActionReport(new String[]{"__locations"}); String theirDirPath = report.findProperty(directoryKey); logger.log(Level.FINER, "Remote server has root directory {0}", theirDirPath); if (ok(theirDirPath)) { File theirDir = getUniquePath(new File(theirDirPath)); return theirDir.equals(ourDir); } return false; } catch (Exception ex) { return false; } }
/** Search in message parts properties then in extra properties and then * in sub reports. Returns first occurrence of the key. */ public String findProperty(String key) { MessagePart topMessagePart = getTopMessagePart(); if (topMessagePart != null) { String value = topMessagePart.findProperty(key); if (value != null) { return value; } } if (extraProperties != null) { String value = extraProperties.getProperty(key); if (value != null) { return value; } } if (getSubActionsReport() != null) { for (ActionReport subReport : getSubActionsReport()) { String value = subReport.findProperty(key); if (value != null) { return value; } } } return null; } }
/** Search in message parts properties then in extra properties and then * in sub reports. Returns first occurrence of the key. */ public String findProperty(String key) { MessagePart topMessagePart = getTopMessagePart(); if (topMessagePart != null) { String value = topMessagePart.findProperty(key); if (value != null) { return value; } } if (extraProperties != null) { String value = extraProperties.getProperty(key); if (value != null) { return value; } } if (getSubActionsReport() != null) { for (ActionReport subReport : getSubActionsReport()) { String value = subReport.findProperty(key); if (value != null) { return value; } } } return null; } }