CTL.Types
Class Location

java.lang.Object
  extended by CTL.Types.Location
All Implemented Interfaces:
Writable

public class Location
extends java.lang.Object
implements Writable

Location of a remote CTL service


Field Summary
protected  java.lang.String cmd
          Command which starts the service
static int DMN
           
static int FILE
           
protected  java.lang.String host
          Remote host
static int HTTP
           
static int LAM
           
static int LIB
           
protected  int linkage
          Linkage
static int MPI
           
private  java.lang.String pass
          Password (will be prompted if not specified
protected  java.lang.String path
          Path to the executable
static int PIPE
           
protected  int port
          Port (22 is default for SSH)
static int PVM
           
static int SERIAL
           
static int SSH
           
static int TCP
           
static int THREAD
           
static int UNDEF
           
 java.lang.String user
          Username
 
Constructor Summary
Location(java.lang.String loc)
          Location constructor from a string
Location(java.lang.String host, int port, int linkage)
          Location constructor for a service which is already running
Location(java.lang.String cmd, java.lang.String path, java.lang.String host, int port, java.lang.String user, java.lang.String pass, int linkage)
          Location constructor
Location(java.lang.String cmd, java.lang.String path, java.lang.String host, java.lang.String user, int linkage)
          Location constructor with default port and password prompt
Location(java.lang.String cmd, java.lang.String path, java.lang.String host, java.lang.String user, java.lang.String pass)
          Location constructor with default linkage and port
Location(java.lang.String cmd, java.lang.String path, java.lang.String host, java.lang.String user, java.lang.String pass, int linkage)
          Location constructor with default port
 
Method Summary
 java.lang.String cmd()
          Retrieve command
 boolean hasPassword()
          Check if a password was given
 java.lang.String host()
          Retrieve the hostname
 boolean isLocal()
          Check whether this object refers to a local location
 int linkage()
          Retrieve linkage
static java.lang.String linkage2str(int linkage)
          Convert linkage to string
static java.util.LinkedList<Location> parseFile(java.io.File file)
          Read a bunch of locations from a file
static java.util.LinkedList<Location> parseFile(java.lang.String fname)
          Read a bunch of locations from a file
 java.lang.String path()
          Retrieve path
 int port()
          Retrieve the port
 void read(SerialIn in)
          Read from stream
 void setFromString(java.lang.String loc)
          Set attributes to values extracted from a location string
 void setPassword(com.jcraft.jsch.Session sess)
          Set the password for an SSHv2 session
 java.lang.String toString()
          Retrieve a string representation of this object
 void write(SerialOut out)
          Write to stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILE

public static final int FILE
See Also:
Constant Field Values

SERIAL

public static final int SERIAL
See Also:
Constant Field Values

MPI

public static final int MPI
See Also:
Constant Field Values

LAM

public static final int LAM
See Also:
Constant Field Values

PVM

public static final int PVM
See Also:
Constant Field Values

THREAD

public static final int THREAD
See Also:
Constant Field Values

TCP

public static final int TCP
See Also:
Constant Field Values

LIB

public static final int LIB
See Also:
Constant Field Values

DMN

public static final int DMN
See Also:
Constant Field Values

SSH

public static final int SSH
See Also:
Constant Field Values

PIPE

public static final int PIPE
See Also:
Constant Field Values

UNDEF

public static final int UNDEF
See Also:
Constant Field Values

HTTP

public static final int HTTP
See Also:
Constant Field Values

cmd

protected java.lang.String cmd
Command which starts the service


path

protected java.lang.String path
Path to the executable


host

protected java.lang.String host
Remote host


port

protected int port
Port (22 is default for SSH)


user

public java.lang.String user
Username


pass

private java.lang.String pass
Password (will be prompted if not specified


linkage

protected int linkage
Linkage

Constructor Detail

Location

public Location(java.lang.String cmd,
                java.lang.String path,
                java.lang.String host,
                int port,
                java.lang.String user,
                java.lang.String pass,
                int linkage)
Location constructor


Location

public Location(java.lang.String cmd,
                java.lang.String path,
                java.lang.String host,
                java.lang.String user,
                java.lang.String pass,
                int linkage)
Location constructor with default port


Location

public Location(java.lang.String cmd,
                java.lang.String path,
                java.lang.String host,
                java.lang.String user,
                java.lang.String pass)
Location constructor with default linkage and port


Location

public Location(java.lang.String cmd,
                java.lang.String path,
                java.lang.String host,
                java.lang.String user,
                int linkage)
Location constructor with default port and password prompt


Location

public Location(java.lang.String host,
                int port,
                int linkage)
Location constructor for a service which is already running


Location

public Location(java.lang.String loc)
Location constructor from a string

Parameters:
loc - String
Method Detail

linkage

public int linkage()
Retrieve linkage

Returns:
Linkage

linkage2str

public static java.lang.String linkage2str(int linkage)
Convert linkage to string

Parameters:
linkage - Linkage
Returns:
String

cmd

public java.lang.String cmd()
Retrieve command

Returns:
Command

path

public java.lang.String path()
Retrieve path

Returns:
Path

hasPassword

public boolean hasPassword()
Check if a password was given

Returns:
True if yes, false otherwise.

setPassword

public void setPassword(com.jcraft.jsch.Session sess)
Set the password for an SSHv2 session

Parameters:
sess - Session

read

public void read(SerialIn in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException,
                 java.lang.InstantiationException,
                 java.lang.IllegalAccessException,
                 java.lang.reflect.InvocationTargetException
Read from stream

Specified by:
read in interface Writable
Parameters:
in - Stream to read from
Throws:
java.io.IOException
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

write

public void write(SerialOut out)
           throws java.io.IOException,
                  java.lang.IllegalAccessException,
                  java.lang.reflect.InvocationTargetException
Write to stream

Specified by:
write in interface Writable
Parameters:
out - Stream to write to
Throws:
java.io.IOException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

isLocal

public boolean isLocal()
Check whether this object refers to a local location

Returns:
True if it does, false otherwise

setFromString

public void setFromString(java.lang.String loc)
Set attributes to values extracted from a location string

Parameters:
loc - Location string

toString

public java.lang.String toString()
Retrieve a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
String

host

public java.lang.String host()
Retrieve the hostname

Returns:
Hostname

port

public int port()
Retrieve the port

Returns:
Port

parseFile

public static java.util.LinkedList<Location> parseFile(java.lang.String fname)
Read a bunch of locations from a file

Parameters:
fname - Filename
Returns:
Array of locations

parseFile

public static java.util.LinkedList<Location> parseFile(java.io.File file)
                                                throws java.io.IOException
Read a bunch of locations from a file

Parameters:
file - File
Returns:
Array of locations
Throws:
java.io.IOException