radtools.services.network
Class AbstractNetworkTunnel<SP extends SecurityPrincipal>

java.lang.Object
  extended by rcf.core.framework.component.DynamicComponent.Abstract
      extended by radtools.services.AbstractRADService
          extended by radtools.services.network.AbstractNetworkTunnel<SP>
All Implemented Interfaces:
HostPort, HostedRADService, NetworkTunnel<SP>, RADService, RemoteHostedRADService, RemoteRADService, DynamicBound, DynamicComponent, ReflectedBindable<DynamicComponent>, ReflectedComponent, rcf.core.util.accessor.GUIAccessible
Direct Known Subclasses:
LinuxSession.Tunnel

@Revision(value="$Revision: 1.8 $",
          date="$Date: 2006/12/15 20:37:47 $",
          tag="$Name:  $")
public abstract class AbstractNetworkTunnel<SP extends SecurityPrincipal>
extends AbstractRADService
implements NetworkTunnel<SP>

TODO: Javadoc

TODO: Unit tests, Code review, Javadoc review, Seal/Finalize TODO: equals, hashCode, toString

Version:
$Revision: 1.8 $
Author:
Greg Gibeling

Nested Class Summary
protected  class AbstractNetworkTunnel.SessionStateProxy
          TODO: Javadoc
protected  class AbstractNetworkTunnel.State
          TODO: Javadoc
 
Nested classes/interfaces inherited from class radtools.services.AbstractRADService
AbstractRADService.AbstractRADServiceState, AbstractRADService.RefreshTask, AbstractRADService.StateProxy, AbstractRADService.UpdateTask
 
Nested classes/interfaces inherited from interface radtools.security.HostPort
HostPort.Default
 
Nested classes/interfaces inherited from interface rcf.core.framework.component.DynamicComponent
DynamicComponent.Abstract
 
Nested classes/interfaces inherited from interface rcf.core.framework.component.DynamicBound
DynamicBound.GUIType
 
Nested classes/interfaces inherited from interface rcf.core.framework.component.DynamicComponent
DynamicComponent.Abstract
 
Nested classes/interfaces inherited from interface rcf.core.framework.component.DynamicBound
DynamicBound.GUIType
 
Field Summary
protected  HostPort hostport
          TODO: Javadoc
protected  int port
          TODO: Javadoc
protected  AbstractNetworkTunnel.SessionStateProxy proxy
          TODO: Javadoc
protected  NetworkSession<SP> session
          TODO: Javadoc
 
Fields inherited from class radtools.services.AbstractRADService
composition, dependency, management, state, window
 
Fields inherited from class rcf.core.framework.component.DynamicComponent.Abstract
component, operations, properties
 
Constructor Summary
AbstractNetworkTunnel(RADService _management, NetworkSession<SP> _session, RADService _composition, HostPort _hostport)
          TODO: Javadoc
 
Method Summary
protected abstract  void connect()
          Connect to hostport relative to the remote machine using the session, and set the port field to match the local port being forwarded.
protected abstract  void disconnect()
          Disconnect from hostport relative to the remote machine using the session, and set the port field to 0 to indicate that this tunnel is disconnected.
 boolean equals(Object o)
           
 int hashCode()
           
 NetworkSystem<SP> host()
          TODO: Javadoc
 String hostname()
          TODO: Javadoc
 HostPort hostport()
          TODO: Javadoc
 boolean isConcrete()
          Determine if this RADService is a concrete service, or simply an arbitrary abstraction built for management purposes.
 int port()
          TODO: Javadoc
 DynamicProperty<RADService.State> radServiceState()
          Returns the dynamic property object for the state of this service.
 String toString()
           
 
Methods inherited from class radtools.services.AbstractRADService
check, communication, composition, dependency, icon, management, radTools, refresh, update, window
 
Methods inherited from class rcf.core.framework.component.DynamicComponent.Abstract
bind, component, gui, interfaces, isInstance, o, operations, popupMenu, properties
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface radtools.services.RADService
communication, composition, dependency, management, refresh, update, window
 
Methods inherited from interface rcf.core.framework.component.DynamicComponent
component, operations, properties
 
Methods inherited from interface rcf.core.framework.component.DynamicBound
gui
 
Methods inherited from interface rcf.core.framework.component.ReflectedComponent
interfaces, isInstance
 
Methods inherited from interface rcf.core.framework.component.ReflectedBindable
bind
 
Methods inherited from interface radtools.services.RADService
communication, composition, dependency, management, refresh, update, window
 
Methods inherited from interface rcf.core.framework.component.DynamicComponent
component, operations, properties
 
Methods inherited from interface rcf.core.framework.component.DynamicBound
gui
 
Methods inherited from interface rcf.core.framework.component.ReflectedComponent
interfaces, isInstance
 
Methods inherited from interface rcf.core.framework.component.ReflectedBindable
bind
 

Field Detail

hostport

protected HostPort hostport
TODO: Javadoc


port

protected int port
TODO: Javadoc


session

protected NetworkSession<SP extends SecurityPrincipal> session
TODO: Javadoc


proxy

protected AbstractNetworkTunnel.SessionStateProxy proxy
TODO: Javadoc

Constructor Detail

AbstractNetworkTunnel

public AbstractNetworkTunnel(RADService _management,
                             NetworkSession<SP> _session,
                             RADService _composition,
                             HostPort _hostport)
TODO: Javadoc

Parameters:
_management -
_session -
_composition -
_hostport -
Method Detail

connect

protected abstract void connect()
                         throws Exception
Connect to hostport relative to the remote machine using the session, and set the port field to match the local port being forwarded.

Throws:
Exception

disconnect

protected abstract void disconnect()
Disconnect from hostport relative to the remote machine using the session, and set the port field to 0 to indicate that this tunnel is disconnected. If the connection has already failed, this method may not throw an exception. The point of this method is to ensure that this tunnel is no longer connected by whatever means necessary.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

host

public NetworkSystem<SP> host()
Description copied from interface: HostedRADService
TODO: Javadoc

Specified by:
host in interface HostedRADService
Specified by:
host in interface NetworkTunnel<SP extends SecurityPrincipal>
Returns:
dependency().parent().get()

hostname

public String hostname()
Description copied from interface: HostPort
TODO: Javadoc

Specified by:
hostname in interface HostPort
Returns:

hostport

public HostPort hostport()
Description copied from interface: RemoteRADService
TODO: Javadoc

Specified by:
hostport in interface RemoteRADService
Returns:

isConcrete

public boolean isConcrete()
Description copied from interface: RADService
Determine if this RADService is a concrete service, or simply an arbitrary abstraction built for management purposes.

Specified by:
isConcrete in interface RADService
Returns:
true if this object represents a concrete service. false if this object represents an arbitrary abstraction, and does not correspond to a real service.

port

public int port()
Description copied from interface: HostPort
TODO: Javadoc

Specified by:
port in interface HostPort
Returns:

radServiceState

public DynamicProperty<RADService.State> radServiceState()
Description copied from interface: RADService
Returns the dynamic property object for the state of this service. The dynamic property can then be used to query the actual state, or to set it. There are few restrictions on state, except that it must be RADService.State.Unknown when RADService.management().parent().get().radServiceState().get() != RADService.State.Running.

Note that the ImmutableSingletonInterface.get() and SingletonInterface#set() methods on the dynamic property refer to the offline state of this service. The RADService.refresh() and RADService.update(boolean, RADService.State) methods can be used to synchronize this state with the state of the actual service. SingletonInterface#set() will schedule a call to RADService.update(boolean, RADService.State) so that the service state will be updated in the future.

Specified by:
radServiceState in interface RADService
Returns:
The dynamic property which represents the offline state of this service.

toString

public String toString()
Overrides:
toString in class Object