org.peace_tools.workspace
Class Server

java.lang.Object
  extended by org.peace_tools.workspace.Server

public class Server
extends java.lang.Object

Class to encapsulate information regarding a Server entry in a PEACE work space configuration file. A Server entry represents either a single stand alone machine or the head node of a supercomputing cluster on which Jobs can be run. A server entry encapsulates all the information needed to access the server and run jobs on it. In addition, it also provides the necessary infrastructure for marshaling and un-marshaling data for persisting the information in the work space configuration file.


Nested Class Summary
static class Server.ServerStatusType
          Different enumerations defining the last known operational status of a given Server entry.
 
Field Summary
private  java.lang.String description
          A user-assigned description for this server entry.
private  java.lang.String ID
          A unique identifier for this Server entry.
private  java.lang.String installPath
          The location on the Server where PEACE is installed and the necessary runtime components of PEACE are located.
private  java.lang.String name
          The domain name (such as: redhawk.hpc.muohio.edu) or IP address (such as: 134.53.13.131) to be used for accessing the server.
private  java.lang.String password
          This is a transient field that is never persisted (for security purposes).
private  javax.xml.datatype.Duration pollTime
          The delay between successive checks for job status on the server.
private  boolean remote
          This instance variable indicates if this server entry represents a local or a remote server.
private  Server.ServerStatusType status
          The current operational status of this server.
private  java.lang.String userID
          The login user ID to be used for accessing remote clusters.
 
Constructor Summary
Server(java.lang.String ID, java.lang.String name, java.lang.String description, java.lang.String userID, java.lang.String installPath, javax.xml.datatype.Duration pollTime, boolean remote)
          The constructor.
 
Method Summary
static Server create(org.w3c.dom.Element serverNode)
          Helper method to utilize data from a DOM tree to create a suitable Server entry.
 java.lang.String getDescription()
          Obtain the user-specified description for this entry.
 java.lang.String getID()
          Returns the workspace-unique ID assigned for this server entry.
 java.lang.String getInstallPath()
          Obtain the directory where the runtime files associated with PEACE are installed on the server.
 java.lang.String getName()
          Returns the server's domain name (or IP address) set for for this server entry.
 java.lang.String getPassword()
          Return the password to be used for logging on to a remote server.
 long getPollTime()
          Obtain the delay between successive polling efforts for this server.
 Server.ServerStatusType getStatus()
          Obtain the current status set for this server.
 java.lang.String getUserID()
          Obtain the user ID to be used for logging onto this server.
 boolean isRemote()
          Method to determine if this Server entry represents a local or a remote server.
 void marshall(org.w3c.dom.Element serverList)
          Method to marshall the data stored in this object to become part of a DOM tree element passed in.
 void marshall(java.io.PrintWriter out)
          Method to marshall the data stored in this object directly to a XML fragment.
 void setDescription(java.lang.String description)
          Change the description set for this server entry.
protected  void setID(java.lang.String serverID)
          Set the unique ID for this server.
 void setInstallPath(java.lang.String path)
          Set the directory where the runtime files associated with PEACE are installed on the server.
 void setName(java.lang.String name)
          Change the server's domain name (or IP address).
 void setPassword(java.lang.String password)
          Set the password to be used for logging on to a remote server.
 void setPollTime(long seconds)
          Change the delay between successive polling efforts on status checks on this server.
 void setRemote(boolean remote)
          Method to set if this server entry represents a local or a remote server.
 void setStatus(Server.ServerStatusType status)
          Change the status for this server.
 void setUserID(java.lang.String userID)
          Set the user ID to be used for this server entry.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

private java.lang.String ID
A unique identifier for this Server entry. For new Server entries this value is obtained via the ServerList.reserveServerID() method.


name

private java.lang.String name
The domain name (such as: redhawk.hpc.muohio.edu) or IP address (such as: 134.53.13.131) to be used for accessing the server. For local machine, this value is simply set to null.


description

private java.lang.String description
A user-assigned description for this server entry. The description can be anything the user chooses. This is meant to be meaningful only to the user.


userID

private java.lang.String userID
The login user ID to be used for accessing remote clusters. For the local machine, this value is set to null.


installPath

private java.lang.String installPath
The location on the Server where PEACE is installed and the necessary runtime components of PEACE are located.


pollTime

private javax.xml.datatype.Duration pollTime
The delay between successive checks for job status on the server.


remote

private boolean remote
This instance variable indicates if this server entry represents a local or a remote server.


status

private Server.ServerStatusType status
The current operational status of this server. This value changes periodically as the server is installed, used, and uninstalled.


password

private transient java.lang.String password
This is a transient field that is never persisted (for security purposes). Typically, it is set once (each time the GUI is run) when an attempt is made to access the server.

Constructor Detail

Server

public Server(java.lang.String ID,
              java.lang.String name,
              java.lang.String description,
              java.lang.String userID,
              java.lang.String installPath,
              javax.xml.datatype.Duration pollTime,
              boolean remote)
The constructor. The constructor merely initializes all the instance variables using the supplied parameters. The parameter values are either read from a configuration file (via the createServer method) or obtain from the user (via a suitable GUI dialog).

Parameters:
ID - A unique identifier for this Server entry. For new Server entries this value is obtained via the ServerList.reserveServerID() method.
name - The domain name (or IP address) to be used for accessing this server. For local machine, this value is simply set to null.
description - A user-assigned description for this server entry. The description can be anything the user chooses to assign.
userID - The login user ID to be used for accessing remote clusters. For the local machine, this value is set to null.
installPath - The location on the Server where PEACE is installed and the necessary runtime components of PEACE are located.
pollTime - The delay between successive checks for job status on the server.
remote - This flag indicates if this server entry represents a local server or a remote server.
Method Detail

create

public static Server create(org.w3c.dom.Element serverNode)
                     throws java.lang.Exception
Helper method to utilize data from a DOM tree to create a suitable Server entry. This method is typically used to create a suitable Server entry (either LocalServer or RemoteServer) using data from a given DOM element.

Parameters:
serverNode - The DOM element to be used for creating the server entry and populating with the needed data.
Returns:
The newly created server entry based on the DOM data.
Throws:
java.lang.Exception - This method throws an exception when errors occur during reading and processing elements from the DOM node.

getID

public java.lang.String getID()
Returns the workspace-unique ID assigned for this server entry.

Returns:
Return the workspace-unique ID assigned for this server entry. This value is used to make cross references to this server entry in Job and DataFile entries.

getName

public java.lang.String getName()
Returns the server's domain name (or IP address) set for for this server entry.

Returns:
The server's domain name (or IP address).

setName

public void setName(java.lang.String name)
Change the server's domain name (or IP address). Changing the name is meaningful only for remote entries. For local server (the same machine), the name is always null.

Note: Changing the server name does not impact any connections that may be currently open for this server. Note that this method is overridden in the LocalServer class to ignore server name changes.

Parameters:
name - The new domain name (or IP address) to be set for this server entry.

getDescription

public java.lang.String getDescription()
Obtain the user-specified description for this entry.

Returns:
This method returns the user-specified description for this entry. This value is always non-null (but could be an empty string).

setDescription

public void setDescription(java.lang.String description)
Change the description set for this server entry.

Parameters:
description - The new description to be set for this entry. If the new description is null, then the description is reset to an empty string.

getUserID

public java.lang.String getUserID()
Obtain the user ID to be used for logging onto this server.

Returns:
The userID to be used for logging onto this server. For local server, the userID is null.

setUserID

public void setUserID(java.lang.String userID)
Set the user ID to be used for this server entry.

Note: Calling this method on a local server entry has no effect.

Parameters:
userID - The new user ID to be used for logging onto the remote server.

getInstallPath

public java.lang.String getInstallPath()
Obtain the directory where the runtime files associated with PEACE are installed on the server.

Returns:
An absolute path indicating the directory where PEACE runtime files are installed.

setInstallPath

public void setInstallPath(java.lang.String path)
Set the directory where the runtime files associated with PEACE are installed on the server.

Parameters:
path - The new install path to be set for this entry.

getPollTime

public long getPollTime()
Obtain the delay between successive polling efforts for this server.

Returns:
The delay in seconds between two successive polling/ status checks on this server.

setPollTime

public void setPollTime(long seconds)
Change the delay between successive polling efforts on status checks on this server.

Parameters:
seconds - The delay in seconds to be set between successive polling efforts (for job status etc.) on this server.

setPassword

public void setPassword(java.lang.String password)
Set the password to be used for logging on to a remote server. This method does not have any effect for a local server.

Parameters:
password - The password to be used for logging onto a remote server. This value is never persisted but is retained in memory until this workspace is active.

getPassword

public java.lang.String getPassword()
Return the password to be used for logging on to a remote server. If a password is not set then this method returns null. An empty password is indicated by the empty string (""). The password is meaningful only for a remote server.

Returns:
The password to be used for logging onto a remote server. This value is never persisted but is retained in memory until this work space is active.

isRemote

public boolean isRemote()
Method to determine if this Server entry represents a local or a remote server.

Returns:
This method returns true if this Server object is a remote server. For a local server entry, this method returns false.

setRemote

public void setRemote(boolean remote)
Method to set if this server entry represents a local or a remote server.

Parameters:
remote - The parameter must be true to set it as a remote server. Otherwise the entry is set as a local server.

setStatus

public void setStatus(Server.ServerStatusType status)
Change the status for this server. This method also notifies all work space listeners about the change in the status of this server entry.

Parameters:
status - The new status value to be set for this server entry.

getStatus

public Server.ServerStatusType getStatus()
Obtain the current status set for this server. The job status value is the last known status value for this server.

Returns:
The current status for this server.

setID

protected void setID(java.lang.String serverID)
Set the unique ID for this server. This method is typically called only once for each new server entry from the ServerList.add() method.

Parameters:
serverID - The unique ID value to be set for the server.

marshall

public final void marshall(org.w3c.dom.Element serverList)
Method to marshall the data stored in this object to become part of a DOM tree element passed in. This method assumes that the element passed in corresponds to the parent ServerList node in the DOM tree.

Parameters:
serverList - The DOM element corresponding to the ServerList node that contains this entry.

marshall

public final void marshall(java.io.PrintWriter out)
Method to marshall the data stored in this object directly to a XML fragment. The XML fragment is guaranteed to be compatible with the PEACE work space configuration data.

Parameters:
out - The stream to which the XML must be serialized.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object