Package com.google_voltpatches.common.net

Examples of com.google_voltpatches.common.net.HostAndPort


        attemptConnect(host, username, password);

        SSHTools ssh = new SSHTools(username, null);
        SFTPSession sftp = null;

        HostAndPort hostAndPort = HostAndPort.fromString(host);
        if (hostAndPort.hasPort()) {
            sftp = ssh.getSftpSession(username, password, null, hostAndPort.getHostText(), hostAndPort.getPort(), null);
        }
        else {
            sftp = ssh.getSftpSession(username, password, null, host, null);
        }
View Full Code Here


    public static void attemptConnect(String host, String username, String password) throws Exception {
        SSHTools ssh = new SSHTools(username, null);
        SFTPSession sftp = null;

        try {
            HostAndPort hostAndPort = HostAndPort.fromString(host);
            if (hostAndPort.hasPort()) {
                sftp = ssh.getSftpSession(username, password, null, hostAndPort.getHostText(), hostAndPort.getPort(), null);
            }
            else {
                sftp = ssh.getSftpSession(username, password, null, host, null);
            }
        } catch (SFTPException e) {
View Full Code Here

    public SocketChannel getClientChannel(final boolean noTearDown) throws IOException {
        final List<String> listeners = m_config.getListenerAddresses();
        final Random r = new Random();
        final String listener = listeners.get(r.nextInt(listeners.size()));
        byte[] hashedPassword = ConnectionUtil.getHashedPassword(m_password);
        HostAndPort hNp = HostAndPort.fromString(listener);
        int port = Constants.DEFAULT_PORT;
        if (hNp.hasPort()) {
            port = hNp.getPort();
        }
        final SocketChannel channel = (SocketChannel)
            ConnectionUtil.getAuthenticatedConnection(
                    hNp.getHostText(), m_username, hashedPassword, port, null)[0];
        channel.configureBlocking(true);
        if (!noTearDown) {
            synchronized (m_clientChannels) {
                m_clientChannels.add(channel);
            }
View Full Code Here

                }
                // handle from the command line as two strings <catalog> <filename>
                else if (arg.equals("port")) {
                    String portStr = args[++i];
                    if (portStr.indexOf(':') != -1) {
                        HostAndPort hap = MiscUtils.getHostAndPortFromHostnameColonPort(portStr, m_port);
                        m_clientInterface = hap.getHostText();
                        m_port = hap.getPort();
                    } else {
                        m_port = Integer.parseInt(portStr);
                    }
                } else if (arg.equals("adminport")) {
                    String portStr = args[++i];
                    if (portStr.indexOf(':') != -1) {
                        HostAndPort hap = MiscUtils.getHostAndPortFromHostnameColonPort(portStr, VoltDB.DEFAULT_ADMIN_PORT);
                        m_adminInterface = hap.getHostText();
                        m_adminPort = hap.getPort();
                    } else {
                        m_adminPort = Integer.parseInt(portStr);
                    }
                } else if (arg.equals("internalport")) {
                    String portStr = args[++i];
                    if (portStr.indexOf(':') != -1) {
                        HostAndPort hap = MiscUtils.getHostAndPortFromHostnameColonPort(portStr, m_internalPort);
                        m_internalPortInterface = hap.getHostText();
                        m_internalPort = hap.getPort();
                    } else {
                        m_internalPort = Integer.parseInt(portStr);
                    }
                } else if (arg.equals("replicationport")) {
                    String portStr = args[++i];
                    if (portStr.indexOf(':') != -1) {
                        HostAndPort hap = MiscUtils.getHostAndPortFromHostnameColonPort(portStr, VoltDB.DEFAULT_DR_PORT);
                        m_drInterface = hap.getHostText();
                        m_drAgentPortStart = hap.getPort();
                    } else {
                        m_drAgentPortStart = Integer.parseInt(portStr);
                    }
                } else if (arg.equals("httpport")) {
                    String portStr = args[++i];
                    if (portStr.indexOf(':') != -1) {
                        HostAndPort hap = MiscUtils.getHostAndPortFromHostnameColonPort(portStr, VoltDB.DEFAULT_HTTP_PORT);
                        m_httpPortInterface = hap.getHostText();
                        m_httpPort = hap.getPort();
                    } else {
                        m_httpPort = Integer.parseInt(portStr);
                    }
                } else if (arg.startsWith("zkport")) {
                    //zkport should be default to loopback but for openshift needs to be specified as loopback is unavalable.
                    String portStr = args[++i];
                    if (portStr.indexOf(':') != -1) {
                        HostAndPort hap = MiscUtils.getHostAndPortFromHostnameColonPort(portStr, VoltDB.DEFAULT_ZK_PORT);
                        m_zkInterface = hap.getHostText() + ":" + hap.getPort();
                    } else {
                        m_zkInterface = "127.0.0.1:" + portStr.trim();
                    }
                } else if (arg.equals("externalinterface")) {
                    m_externalInterface = args[++i].trim();
View Full Code Here

TOP

Related Classes of com.google_voltpatches.common.net.HostAndPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.