Class GNS

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by GNS
All Implemented Interfaces:
GNSInterface, java.io.Serializable, java.rmi.Remote

public class GNS
extends java.rmi.server.UnicastRemoteObject
implements GNSInterface

This class represents the Global Name Server that create the simulation world and maintains the routing information for all the PEs.

Since:
2.0
Version:
2.0(10/2006)
Author:
Yin Xiong
See Also:
Serialized Form

Field Summary
(package private)  Flag flag
          the flag indicating the end of the simulation
(package private)  java.util.Vector<LPConfigInfo> lpConfigInfoVector
          the vector that contains the LP configuration information obtained from a file
(package private)  int lpForEach
          the number of LPs for each PE
(package private)  int lpForFirst
          the number of LPs for the first PE which can be different from other PEs
(package private)  int numLPs
          the total number of LPs for this simulation
(package private)  int numPEs
          the total number of PEs for this simulation
(package private)  int PEcount
          the current number of PEs registered with the GNS
(package private)  java.util.Vector<PEInfo> PEtable
          the table that contains the information about the PEs
(package private)  java.util.Vector<RoutingInfo> routingTable
          the routing table
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
GNS()
          Constructor
 
Method Summary
(package private)  void dumpPEtable()
          Dumps the PEtable; for debugging only
(package private)  void dumpRoutingTable()
          Prints out the information contained in the routing table; for debugging only
 int getEOSflag()
          Gets the end of simulation flag.
(package private)  java.util.Vector<LPConfigInfo> getLPConfigInfo(boolean isRegistered, int peid, java.lang.String peip, java.lang.String pm, int begin, int end)
          Returns the LP configuration information to a newly-registered PE.
(package private)  int getLPNumForEach()
          Returns the number of LPs for each PE.
 RoutingInfo getRoutingInfoByAid(java.lang.String appid)
          Looks up the routing info by an LP's application id.
 RoutingInfo getRoutingInfoByLid(int lid)
          Looks up the routing info by an LP id.
static void main(java.lang.String[] args)
          main function
 void procConfigFile(java.lang.String configFile, int size)
          Processes the configuration file.
 java.util.Vector<LPConfigInfo> registerPE(java.lang.String pm)
          Remote method that register a new PE and returns the LP configuration information to the new PE.
 void setEOSflag(int f)
          Sets the end of simulation flag, sends the flag to each PE and shuts down the RMI server for each PE.
 void startGNS()
          Starts the GNS as a rmi server offering remote methods for the PEs.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

flag

Flag flag
the flag indicating the end of the simulation


PEcount

int PEcount
the current number of PEs registered with the GNS


PEtable

java.util.Vector<PEInfo> PEtable
the table that contains the information about the PEs


routingTable

java.util.Vector<RoutingInfo> routingTable
the routing table


numPEs

int numPEs
the total number of PEs for this simulation


numLPs

int numLPs
the total number of LPs for this simulation


lpConfigInfoVector

java.util.Vector<LPConfigInfo> lpConfigInfoVector
the vector that contains the LP configuration information obtained from a file


lpForEach

int lpForEach
the number of LPs for each PE


lpForFirst

int lpForFirst
the number of LPs for the first PE which can be different from other PEs

Constructor Detail

GNS

public GNS()
    throws java.rmi.RemoteException
Constructor

Throws:
java.rmi.RemoteException
Method Detail

getEOSflag

public int getEOSflag()
Gets the end of simulation flag.

Specified by:
getEOSflag in interface GNSInterface

setEOSflag

public void setEOSflag(int f)
Sets the end of simulation flag, sends the flag to each PE and shuts down the RMI server for each PE.

Specified by:
setEOSflag in interface GNSInterface
Parameters:
f - int negative number indicating the end of simulation

dumpPEtable

void dumpPEtable()
Dumps the PEtable; for debugging only


startGNS

public void startGNS()
              throws java.rmi.RemoteException
Starts the GNS as a rmi server offering remote methods for the PEs.

Throws:
java.rmi.RemoteException

registerPE

public java.util.Vector<LPConfigInfo> registerPE(java.lang.String pm)
Remote method that register a new PE and returns the LP configuration information to the new PE.

Specified by:
registerPE in interface GNSInterface
Parameters:
pm - String the machine name of the PE

main

public static void main(java.lang.String[] args)
main function


dumpRoutingTable

void dumpRoutingTable()
Prints out the information contained in the routing table; for debugging only


getRoutingInfoByAid

public RoutingInfo getRoutingInfoByAid(java.lang.String appid)
Looks up the routing info by an LP's application id.

Specified by:
getRoutingInfoByAid in interface GNSInterface
Parameters:
appid - String representing the application id of the LP.

getRoutingInfoByLid

public RoutingInfo getRoutingInfoByLid(int lid)
Looks up the routing info by an LP id.

Specified by:
getRoutingInfoByLid in interface GNSInterface
Parameters:
lid - int representing the LP id.

procConfigFile

public void procConfigFile(java.lang.String configFile,
                           int size)
Processes the configuration file. The configuration file is text file. Each line contains configuration information for an LP in the format of:
applicationID applicationName className data

Parameters:
configFile - String indicating the name of the configuration file.
size - int the number of PEs.

getLPConfigInfo

java.util.Vector<LPConfigInfo> getLPConfigInfo(boolean isRegistered,
                                               int peid,
                                               java.lang.String peip,
                                               java.lang.String pm,
                                               int begin,
                                               int end)
Returns the LP configuration information to a newly-registered PE.

Parameters:
peid - int the system-wide id for the PE
peip - String the IP address of this PE
pm - String the machine name of the PE
begin - int the beginning point of the LP configuration information
end - int the ending point of the LP configuration information

getLPNumForEach

int getLPNumForEach()
Returns the number of LPs for each PE.