com.sshtools.j2ssh.forwarding
Class ForwardingListener

java.lang.Object
  extended by com.sshtools.j2ssh.forwarding.ForwardingConfiguration
      extended by com.sshtools.j2ssh.forwarding.ForwardingListener
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ForwardingClient.ClientForwardingListener, ForwardingServer.ServerForwardingListener

public abstract class ForwardingListener
extends ForwardingConfiguration
implements java.lang.Runnable

Version:
$Revision: 1.1 $
Author:
$author$

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sshtools.j2ssh.forwarding.ForwardingConfiguration
ForwardingConfiguration.ForwardingConfigurationMonitor
 
Field Summary
private  ConnectionProtocol connection
           
private  boolean listening
           
private static org.apache.commons.logging.Log log
           
private  java.net.ServerSocket server
           
private  java.lang.Thread thread
           
 
Fields inherited from class com.sshtools.j2ssh.forwarding.ForwardingConfiguration
addressToBind, hostToConnect, listenerList, monitor, name, portToBind, portToConnect, state
 
Constructor Summary
ForwardingListener(ConnectionProtocol connection, java.lang.String addressToBind, int portToBind)
          Creates a new ForwardingListener object.
ForwardingListener(java.lang.String name, ConnectionProtocol connection, java.lang.String addressToBind, int portToBind, java.lang.String hostToConnect, int portToConnect)
          Creates a new ForwardingListener object.
 
Method Summary
protected abstract  ForwardingSocketChannel createChannel(java.lang.String hostToConnect, int portToConnect, java.net.Socket socket)
           
 int getLocalPort()
           
 boolean isListening()
           
 boolean isRunning()
           
 void run()
           
 void start()
           
 void stop()
           
 
Methods inherited from class com.sshtools.j2ssh.forwarding.ForwardingConfiguration
addForwardingConfigurationListener, createForwardingBindingChannel, createForwardingIOChannel, createForwardingSocketChannel, getActiveForwardingSocketChannels, getAddressToBind, getHostToConnect, getName, getPortToBind, getPortToConnect, getState, isForwarding, removeForwardingConfigurationListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

connection

private ConnectionProtocol connection

server

private java.net.ServerSocket server

thread

private java.lang.Thread thread

listening

private boolean listening
Constructor Detail

ForwardingListener

public ForwardingListener(java.lang.String name,
                          ConnectionProtocol connection,
                          java.lang.String addressToBind,
                          int portToBind,
                          java.lang.String hostToConnect,
                          int portToConnect)
Creates a new ForwardingListener object.

Parameters:
name -
connection -
addressToBind -
portToBind -
hostToConnect -
portToConnect -

ForwardingListener

public ForwardingListener(ConnectionProtocol connection,
                          java.lang.String addressToBind,
                          int portToBind)
Creates a new ForwardingListener object.

Parameters:
connection -
addressToBind -
portToBind -
Method Detail

getLocalPort

public int getLocalPort()
Returns:

isListening

public boolean isListening()
Returns:

run

public void run()
Specified by:
run in interface java.lang.Runnable

isRunning

public boolean isRunning()
Returns:

start

public void start()
           throws java.io.IOException
Overrides:
start in class ForwardingConfiguration
Throws:
java.io.IOException

stop

public void stop()
Overrides:
stop in class ForwardingConfiguration

createChannel

protected abstract ForwardingSocketChannel createChannel(java.lang.String hostToConnect,
                                                         int portToConnect,
                                                         java.net.Socket socket)
                                                  throws ForwardingConfigurationException
Parameters:
hostToConnect -
portToConnect -
socket -
Returns:
Throws:
ForwardingConfigurationException