nodehost = node.getNodeHost(); installdir = node.getInstallDir(); nodedir = node.getNodeDir(); windowsdomain = node.getWindowsDomain(); windowsdomain = node.getNodeHost(); SshConnector sshc = node.getSshConnector(); if (sshc == null) { return;
String name = n.getName(); String nodeType = n.getType(); String host = n.getNodeHost(); String installDir = n.getInstallDir();
String remoteNodeDirUnixStyle(final Node node, final String remoteNodeDir) { /* * Use the node dir if it was specified when the node was created. * Otherwise derive it: ${remote-install-dir}/glassfish/${node-name} */ String result; if (remoteNodeDir != null) { result = remoteNodeDir; } else { result = new StringBuilder(ensureTrailingSlash(node.getInstallDirUnixStyle())).append("glassfish/nodes/").append(node.getName()).toString(); } return ensureTrailingSlash(result.replaceAll("\\\\", "/")); }
public final static String getNodesDir(final Node node) { if (node == null) // don't do that! throw new NullPointerException(); String nodesDir = node.getNodeDirAbsoluteUnixStyle(); if (nodesDir == null) nodesDir = node.getInstallDirUnixStyle() + "/glassfish/nodes"; return nodesDir; }
public static String getNodeDirAbsolute(Node node) { // If nodedir is relative make it absolute relative to installRoot String nodeDir = node.getNodeDir(); if (nodeDir == null || nodeDir.length() == 0) return null; File nodeDirFile = new File(nodeDir); if (nodeDirFile.isAbsolute()) { return nodeDir; } // node-dir is relative. Make it absolute. We root it under the // GlassFish root install directory. String installDir = node.getInstallDir(); File installRootFile = new File(installDir, "glassfish"); File absoluteNodeDirFile = new File(installRootFile, nodeDir); return absoluteNodeDirFile.getPath(); }
Node writeableNode = t.enroll(node); if (windowsdomain != null) writeableNode.setWindowsDomain(windowsdomain); if (nodedir != null) writeableNode.setNodeDir(nodedir); if (nodehost != null) writeableNode.setNodeHost(nodehost); if (installdir != null) writeableNode.setInstallDir(installdir); if (type != null) writeableNode.setType(type); if (sshport != null || sshnodehost != null ||sshuser != null || sshkeyfile != null){ SshConnector sshC = writeableNode.getSshConnector(); if (sshC == null) { sshC =writeableNode.createChild(SshConnector.class); }else sshC = t.enroll(sshC); sshC.setSshAuth(sshA); writeableNode.setSshConnector(sshC);
private void createDefaultNode(Domain d, Nodes nodes) throws TransactionFailure, PropertyVetoException { Property domainProp = d.getProperty("administrative.domain.name"); String domainName = domainProp.getValue(); Node node = nodes.createChild(Node.class); node.setName("localhost" + "-" + domainName); node.setType("CONFIG"); node.setNodeHost("localhost"); node.setInstallDir("${com.sun.aas.productRoot}"); nodes.getNode().add(node); } }
void validate(Node node) throws CommandValidationException { // Put node values into parameter map and validate ParameterMap map = new ParameterMap(); map.add("DEFAULT", node.getName()); map.add(NodeUtils.PARAM_INSTALLDIR, node.getInstallDir()); map.add(NodeUtils.PARAM_NODEHOST, node.getNodeHost()); map.add(NodeUtils.PARAM_NODEDIR, node.getNodeDirAbsolute()); SshConnector sshc = node.getSshConnector(); if (sshc != null) { map.add(NodeUtils.PARAM_REMOTEPORT, sshc.getSshPort()); SshAuth ssha = sshc.getSshAuth(); map.add(NodeUtils.PARAM_REMOTEUSER, ssha.getUserName()); map.add(NodeUtils.PARAM_SSHKEYFILE, ssha.getKeyfile()); map.add(NodeUtils.PARAM_REMOTEPASSWORD, ssha.getPassword()); map.add(NodeUtils.PARAM_SSHKEYPASSPHRASE, ssha.getKeyPassphrase()); map.add(NodeUtils.PARAM_TYPE, node.getType()); } validate(map); return; }
nodeHost = theNode.getNodeHost(); nodeDir = theNode.getNodeDirAbsolute(); installDir = theNode.getInstallDir(); if (theNode.isLocal()){ validateInstanceDirUnique(report, context); if (report.getActionExitCode() != ActionReport.ExitCode.SUCCESS if (theNode.isLocal() && installDir == null) { ci = cr.getCommandInvocation("_update-node", report, context.getSubject()); map = new ParameterMap(); map.add("installdir", "${com.sun.aas.productRoot}"); map.add("type", "CONFIG"); map.add("DEFAULT", theNode.getName()); ci.parameters(map); ci.execute();
if ((node.getType() != null) && !(node.getType().equals("SSH") )){ SshConnector sshC = node.getSshConnector(); SshAuth sshAuth = sshC.getSshAuth(); info.add(NodeUtils.PARAM_SSHKEYFILE, sshAuth.getKeyfile()); info.add(NodeUtils.PARAM_INSTALLDIR, node.getInstallDir()); info.add(NodeUtils.PARAM_SSHPORT, sshC.getSshPort()); info.add(NodeUtils.PARAM_SSHUSER, sshAuth.getUserName()); info.add(NodeUtils.PARAM_NODEHOST, node.getNodeHost());
/** * Get the version string from a glassfish installation on the node. * @param node * @return version string */ String getGlassFishVersionOnNode(Node node) throws CommandValidationException { if (node == null) return ""; List<String> command = new ArrayList<String>(); command.add("version"); command.add("--local"); command.add("--terse"); NodeRunner nr = new NodeRunner(habitat, logger); StringBuilder output = new StringBuilder(); try { int commandStatus = nr.runAdminCommandOnNode(node, output, command); if (commandStatus != 0) { return "unknown version: " + output.toString(); } } catch (Exception e) { throw new CommandValidationException( Strings.get("failed.to.run", command.toString(), node.getNodeHost()), e); } return output.toString().trim(); }
String msg2 = ""; String msg3 = ""; String nodeHost = node.getNodeHost(); String nodeName = node.getName(); String installDir = node.getInstallDir();
public static Node getNode(Nodes nodes, String name) { if (name == null || nodes == null) { return null; } for (Node node : nodes.getNode()) { if (node.getName().equals(name)) { return node; } } return null; }
private void setupSupplemental(AdminCommandContext context, final Server instance) { if (clusterName != null) { InstanceRegisterInstanceCommandParameters cp = new InstanceRegisterInstanceCommandParameters(); context.getActionReport(). setResultType(InstanceRegisterInstanceCommandParameters.class, cp); Node instNode = domain.getNodeNamed(node); cp.config = instance.getConfigRef(); cp.nodehost = instNode.getNodeHost(); cp.nodedir = instNode.getNodeDir(); cp.installdir = instNode.getInstallDir(); List<SystemProperty> spList = instance.getSystemProperty(); if (spList != null) { Properties p = new Properties(); for (SystemProperty sp : spList) { p.put(sp.getName(), sp.getValue()); } cp.systemProperties = p; } } }
if (node.isDefaultLocalNode()) { String m = Strings.get("update.node.config.defaultnode", name); logger.warning(m); if (!StringUtils.ok(nodehost) && !StringUtils.ok(node.getNodeHost())) { String m = Strings.get("update.node.config.missing.attribute", node.getName(), NodeUtils.PARAM_NODEHOST); logger.warning(m); report.setActionExitCode(ActionReport.ExitCode.FAILURE);
public static boolean isLocal(Node node) { // Short circuit common case for efficiency Dom serverDom = Dom.unwrap(node); Domain domain = serverDom.getHabitat().getService(Domain.class); if (node.getName().equals("localhost-" + domain.getName())) { return true; } String nodeHost = node.getNodeHost(); if (nodeHost == null || nodeHost.length() == 0) { return false; } return NetUtils.isThisHostLocal(nodeHost); }
theNode.getInstallDir(), nodeUtils.getGlassFishVersionOnNode(theNode, context)); theNode.getNodeHost(), theNode.getType()); if (StringUtils.ok(version)) { m1 = m1 + NL + version; theNode.getNodeHost(), theNode.getType()); msg.append(StringUtils.cat(NL, m1, e.getMessage())); report.setMessage(msg.toString());
/** * Make sure we can make an SSH connection using an existing node. * * @param node Node to connect to * @throws CommandValidationException */ void pingRemoteConnection(Node node) throws CommandValidationException { RemoteType type = RemoteType.valueOf(node.getType()); validateHostName(node.getNodeHost()); switch (type) { case SSH: pingSSHConnection(node); break; default: throw new CommandValidationException("Internal Error: unknown type"); } }
if (node.nodeInUse()) { String badparam = null; String configNodedir = node.getNodeDir(); String configInstalldir = node.getInstallDir();