Package com.sshtools.j2ssh.forwarding

Examples of com.sshtools.j2ssh.forwarding.ForwardingConfiguration


*/
    protected void addRemoteForwardingConfiguration(String addressToBind,
        int portToBind) throws ForwardingConfigurationException {
        // Is the server already listening
        Iterator it = remoteForwardings.iterator();
        ForwardingConfiguration config;

        while (it.hasNext()) {
            config = (ForwardingConfiguration) it.next();

            if (config.getAddressToBind().equals(addressToBind) &&
                    (config.getPortToBind() == portToBind)) {
                throw new ForwardingConfigurationException(
                    "The address and port are already in use!");
            }
        }

        config = new ForwardingConfiguration(addressToBind, portToBind);

        // Check the security mananger
        SecurityManager manager = System.getSecurityManager();

        if (manager != null) {
View Full Code Here


*
* @throws ForwardingConfigurationException
*/
    protected void removeRemoteForwarding(String addressToBind, int portToBind)
        throws ForwardingConfigurationException {
        ForwardingConfiguration config = getRemoteForwardingByAddress(addressToBind,
                portToBind);

        // Stop the forwarding
        config.stop();

        // Remove from the remote forwardings list
        remoteForwardings.remove(config);
    }
View Full Code Here

        it = localForwardings.values().iterator();
        xml += ("   <ForwardingAutoStart value=\"" +
        String.valueOf(forwardingAutoStart) + "\"/>\n");

        while (it.hasNext()) {
            ForwardingConfiguration config = (ForwardingConfiguration) it.next();
            xml += ("   <LocalPortForwarding Name=\"" + config.getName() +
            "\" AddressToBind=\"" + config.getAddressToBind() +
            "\" PortToBind=\"" + String.valueOf(config.getPortToBind()) +
            "\" AddressToConnect=\"" + config.getHostToConnect() +
            "\" PortToConnect=\"" + String.valueOf(config.getPortToConnect()) +
            "\"/>\n");
        }

        it = remoteForwardings.values().iterator();

        while (it.hasNext()) {
            ForwardingConfiguration config = (ForwardingConfiguration) it.next();
            xml += ("   <RemotePortForwarding Name=\"" + config.getName() +
            "\" AddressToBind=\"" + config.getAddressToBind() +
            "\" PortToBind=\"" + String.valueOf(config.getPortToBind()) +
            "\" AddressToConnect=\"" + config.getHostToConnect() +
            "\" PortToConnect=\"" + String.valueOf(config.getPortToConnect()) +
            "\"/>\n");
        }

        xml += "</SshToolsConnectionProfile>";
View Full Code Here

                            throw new SAXException(
                                "Required attribute missing for <" + qname +
                                "> element");
                        }

                        ForwardingConfiguration config = new ForwardingConfiguration(name,
                                addressToBind, Integer.parseInt(portToBind),
                                addressToConnect,
                                Integer.parseInt(portToConnect));

                        if (qname.equals("LocalPortForwarding")) {
View Full Code Here

TOP

Related Classes of com.sshtools.j2ssh.forwarding.ForwardingConfiguration

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.