private String filterForbidden(String key, String value) { if(StringUtils.ok(key) && key.startsWith("javax.net.ssl.") && key.indexOf("password") >= 0) return "********"; else return value; } }
private static boolean needsQuoting(String path) { return ok(path) && (path.indexOf(' ') >= 0 || path.indexOf('\t') >= 0); }
/** * Gets the GlassFish installation root (using property com.sun.aas.installRoot), * * @return path of GlassFish install root * @throws CommandException if the GlassFish install root is not found */ protected String getInstallRootPath() throws IOException { String installRootPath = System.getProperty( SystemPropertyConstants.INSTALL_ROOT_PROPERTY); if (!StringUtils.ok(installRootPath)) throw new IOException("noInstallDirPath"); return installRootPath; }
/** * Gets the GlassFish installation root (using property com.sun.aas.installRoot), * * @return path of GlassFish install root * @throws CommandException if the GlassFish install root is not found */ protected String getInstallRootPath() throws IOException { String installRootPath = System.getProperty( SystemPropertyConstants.INSTALL_ROOT_PROPERTY); if (!StringUtils.ok(installRootPath)) throw new IOException("noInstallDirPath"); return installRootPath; }
private void setOsgiPort() { String s = sysProps.get("osgi.shell.telnet.port"); // not configured if (!ok(s)) return; try { osgiPort = Integer.parseInt(s); } catch (Exception e) { // already handled -- it is already set to -1 } } Map<String, String> sysProps = new HashMap<String, String>();
private void stripOperandFromArgs() { // remove the domain-name operand // it may not be here! if (args.length < 2 || !StringUtils.ok(serverName)) return; int newlen = args.length - 1; if (serverName.equals(args[newlen])) { String[] newargs = new String[newlen]; System.arraycopy(args, 0, newargs, 0, newlen); args = newargs; } }
private boolean isJps(String id) { if (!ok(id)) { return false; } if (id.equals(getClass().getName())) { return true; } if (id.equals("sun.tools.jps.Jps")) { return true; } return false; }
private boolean skipToStartButNotPast(String startName, String stopName) throws XMLStreamException { if (!StringUtils.ok(startName) || !StringUtils.ok(stopName)) throw new IllegalArgumentException(); while (reader.hasNext()) { reader.next(); // getLocalName() will throw an exception in many states. Be careful!! if (reader.isStartElement() && startName.equals(reader.getLocalName())) return true; if (reader.isEndElement() && stopName.equals(reader.getLocalName())) return false; } return false; }
private String notSoSimpleGetOutputData() { StringBuilder out = new StringBuilder(); if (ok(actionDescription)) { out.append("Description: ").append(actionDescription); } write("", topMessage, out); return out.toString(); }
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 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"; }
/** * Note that dxpp.getClusterName() will definitely return null * for stand-alone instances. This is normal. * * @return true if we want to filter out this cluster element */ private boolean handleCluster(XMLStreamReader reader) { String name = reader.getAttributeValue(null, NAME); String myCluster = dxpp.getClusterName(); if (StringUtils.ok(myCluster) && myCluster.equals(name)) return false; return true; }
/** * @return true if we want to filter out this server element */ private boolean handleServer(XMLStreamReader r) { String name = r.getAttributeValue(null, NAME); if (StringUtils.ok(name) && dxpp.getServerNames().contains(name)) return false; return true; }
private void setInstallRootDir() { String ir = System.getProperty(SystemPropertyConstants.INSTALL_ROOT_PROPERTY); if (!StringUtils.ok(ir)) throw new RuntimeException(Strings.get("internal.error", "System Property not set: " + SystemPropertyConstants.INSTALL_ROOT_PROPERTY)); installRootDir = SmartFile.sanitize(new File(ir)); if (!installRootDir.isDirectory()) throw new RuntimeException(Strings.get("internal.error", "Not a directory: " + installRootDir)); }
public void validate() { if (!StringUtils.ok(serviceName)) serviceName = serverDirs.getServerName(); date = new Date(); setInstallRootDir(); setLibDir(); setAsadmin(); osUser = System.getProperty("user.name"); // used by SMF only fqsn = serverDirs.getServerName() + serverDirs.getServerParentDir().getPath().replace('/', '_'); smfFullServiceName = SERVICE_NAME_PREFIX + serviceName; }
private String initializeInstance() { if (!StringUtils.ok(instanceName)) return Strings.get("stop.instance.noInstanceName", cmdName); instance = helper.getServer(instanceName); if (instance == null) return Strings.get("stop.instance.noSuchInstance", instanceName); return null; }
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); }
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); }