/** * Validate all the parameters used to create a remote node * @param map Map with all parameters used to create a remote node. * The map values can contain system property tokens. * @throws CommandValidationException */ void validate(ParameterMap map) throws CommandValidationException { validatePassword(map.getOne(PARAM_REMOTEPASSWORD)); String nodehost = map.getOne(PARAM_NODEHOST); validateHostName(nodehost); validateRemote(map, nodehost); }
/** * Make sure we can make an SSH connection using an existing node. * * @param node Node to connect to * @throws CommandValidationException */ void pingSSHConnection(Node node) throws CommandValidationException { validateHostName(node.getNodeHost()); try { sshL.init(node, logger); sshL.pingConnection(); } catch (Exception e) { String m1 = e.getMessage(); String m2 = ""; Throwable e2 = e.getCause(); if (e2 != null) { m2 = e2.getMessage(); } String msg = Strings.get("ssh.bad.connect", node.getNodeHost()); logger.warning(StringUtils.cat(": ", msg, m1, m2, sshL.toString())); throw new CommandValidationException(StringUtils.cat(NL, msg, m1, m2)); } }
/** * 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"); } }