radtools.services.linux
Class LinuxSession

java.lang.Object
  extended by rcf.core.framework.component.DynamicComponent.Abstract
      extended by radtools.services.AbstractRADService
          extended by radtools.services.linux.LinuxSession
All Implemented Interfaces:
SecureSession<UsernamePasswordPrincipal>, HostedRADService, NetworkSession<UsernamePasswordPrincipal>, RADService, DynamicBound, DynamicComponent, ReflectedBindable<DynamicComponent>, ReflectedComponent, rcf.core.util.accessor.GUIAccessible

@Revision(value="$Revision: 1.14 $",
          date="$Date: 2006/12/15 20:37:51 $",
          tag="$Name:  $")
public class LinuxSession
extends AbstractRADService
implements NetworkSession<UsernamePasswordPrincipal>

TODO: Javadoc

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

Version:
$Revision: 1.14 $
Author:
Greg Gibeling

Nested Class Summary
protected  class LinuxSession.State
          TODO: Javadoc
protected static class LinuxSession.Tunnel
          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 rcf.core.framework.component.DynamicComponent
DynamicComponent.Abstract, DynamicComponent.Default
 
Nested classes/interfaces inherited from interface rcf.core.framework.component.DynamicBound
DynamicBound.GUIType
 
Field Summary
private  boolean cached
          TODO: Javadoc
private static rcf.temp.jsch.ssh.JSch jsch
          TODO: Javadoc
protected  rcf.temp.jsch.ssh.Session ssh
          TODO: Javadoc
 
Fields inherited from class radtools.services.AbstractRADService
composition, dependency, management, proxy, state, window
 
Fields inherited from class rcf.core.framework.component.DynamicComponent.Abstract
component, operations, properties
 
Constructor Summary
protected LinuxSession(RADService _management, LinuxSystem _system, RADService _composition, boolean _cached)
          TODO: Javadoc
protected LinuxSession(RADService _management, LinuxSystem _system, RADService _composition, UsernamePasswordPrincipal _principal, boolean _cached)
          TODO: Javadoc
 
Method Summary
 void close()
          TODO: Javadoc
 NetworkTunnel<UsernamePasswordPrincipal> forward(HostPort hostport)
          TODO: Javadoc
 NetworkTunnel<UsernamePasswordPrincipal> forward(RADService _composition, HostPort hostport)
          TODO: Javadoc
private static void getError(InputStream in, int check)
          TODO: Javadoc
 LinuxSystem host()
          TODO: Javadoc
 boolean isConcrete()
          Determine if this RADService is a concrete service, or simply an arbitrary abstraction built for management purposes.
 boolean isOpen()
          TODO: Javadoc
 DynamicProperty<RADService.State> radServiceState()
          Returns the dynamic property object for the state of this service.
 ImmutablePairInterface<Long,InputStream> read(String filename, File file)
          TODO: Javadoc
 rcf.core.util.text.Text run(String command, rcf.core.scientific.units.measures.Measure<?,?,rcf.core.scientific.units.quantities.Duration> timeout)
          TODO: Javadoc
 LinuxSystem system()
          TODO: Javadoc
 String toString()
           
 boolean write(String filename, File contents)
          TODO: Javadoc
 boolean write(String filename, long length, InputStream contents)
          TODO: Javadoc
 boolean write(String filename, String contents)
          TODO: Javadoc
 
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, equals, finalize, getClass, hashCode, 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.util.accessor.GUIAccessible
icon, popupMenu
 
Methods inherited from interface rcf.core.framework.component.ReflectedComponent
interfaces, isInstance
 
Methods inherited from interface rcf.core.framework.component.ReflectedBindable
bind
 

Field Detail

jsch

private static final rcf.temp.jsch.ssh.JSch jsch
TODO: Javadoc


ssh

protected final rcf.temp.jsch.ssh.Session ssh
TODO: Javadoc


cached

private final boolean cached
TODO: Javadoc

Constructor Detail

LinuxSession

protected LinuxSession(RADService _management,
                       LinuxSystem _system,
                       RADService _composition,
                       boolean _cached)
TODO: Javadoc

Parameters:
_management -
_system -
_composition -
_cached -

LinuxSession

protected LinuxSession(RADService _management,
                       LinuxSystem _system,
                       RADService _composition,
                       UsernamePasswordPrincipal _principal,
                       boolean _cached)
TODO: Javadoc

Parameters:
_management -
_system -
_composition -
_principal -
_cached -
Method Detail

getError

private static void getError(InputStream in,
                             int check)
                      throws IOException
TODO: Javadoc

Parameters:
in -
check -
Throws:
IOException

close

public void close()
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
close in interface SecureSession<UsernamePasswordPrincipal>

forward

public NetworkTunnel<UsernamePasswordPrincipal> forward(HostPort hostport)
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
forward in interface SecureSession<UsernamePasswordPrincipal>
Specified by:
forward in interface NetworkSession<UsernamePasswordPrincipal>
Returns:

forward

public NetworkTunnel<UsernamePasswordPrincipal> forward(RADService _composition,
                                                        HostPort hostport)
TODO: Javadoc

Parameters:
_composition -
hostport -
Returns:

host

public LinuxSystem host()
Description copied from interface: HostedRADService
TODO: Javadoc

Specified by:
host in interface HostedRADService
Specified by:
host in interface NetworkSession<UsernamePasswordPrincipal>
Returns:
dependency().parent().get()

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.

isOpen

public boolean isOpen()
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
isOpen in interface SecureSession<UsernamePasswordPrincipal>
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.

read

public ImmutablePairInterface<Long,InputStream> read(String filename,
                                                     File file)
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
read in interface SecureSession<UsernamePasswordPrincipal>
Returns:
A pair of the number of bytes read, and an input stream to get those bytes from. This interface allows an implementor to use either an in-memory buffer or a temporary file for storing the read data.

run

public rcf.core.util.text.Text run(String command,
                                   rcf.core.scientific.units.measures.Measure<?,?,rcf.core.scientific.units.quantities.Duration> timeout)
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
run in interface SecureSession<UsernamePasswordPrincipal>
Returns:

system

public LinuxSystem system()
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
system in interface SecureSession<UsernamePasswordPrincipal>
Returns:

toString

public String toString()
Overrides:
toString in class Object

write

public boolean write(String filename,
                     File contents)
              throws FileNotFoundException
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
write in interface SecureSession<UsernamePasswordPrincipal>
Returns:
Throws:
FileNotFoundException

write

public boolean write(String filename,
                     long length,
                     InputStream contents)
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
write in interface SecureSession<UsernamePasswordPrincipal>
Returns:

write

public boolean write(String filename,
                     String contents)
Description copied from interface: SecureSession
TODO: Javadoc

Specified by:
write in interface SecureSession<UsernamePasswordPrincipal>
Returns: