edu.jhu.cnds.Frugal
Class FrugalResourceServer

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--edu.jhu.cnds.Frugal.FrugalResourceServer

public class FrugalResourceServer
extends java.rmi.server.UnicastRemoteObject
implements FrugalServiceRemote

A server class, designed to register Frugal Resource implementations with lookup services.

Version:
2.0
Author:
R. Sean Borgstrom
See Also:
Serialized Form

Field Summary
protected  net.jini.lookup.JoinManager isabella
          Workhorse server class from Sun.
protected  net.jini.lease.LeaseRenewalManager serviceLease
          LeaseRenewalManager for this class' leases.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
FrugalResourceServer(java.lang.String[] argv)
          Loads persistent data, creates an implementation of the Frugal Resource service, and registers it.
 
Method Summary
 void checkpoint()
          Saves recent changes to this class' persistent data.
 void dock()
          Kills the service.
 java.lang.Object getAdmin()
          Returns an administrative interface for the relevant Frugal Manager.
 net.jini.lookup.JoinManager getIsabella()
          Returns this class' JoinManager.
 java.io.File getMonument()
          Returns the persistent storage for this server.
static void main(java.lang.String[] argv)
          Starts the server running.
 void setMonument(java.io.File monument)
          Sets the persistent storage for this server.
protected  void update()
          Updates the Entries associated with the relevant Frugal Resource every 5 seconds.
static void usageError()
          Complains about improper commandline arguments.
 
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

serviceLease

protected transient net.jini.lease.LeaseRenewalManager serviceLease
LeaseRenewalManager for this class' leases.

isabella

protected net.jini.lookup.JoinManager isabella
Workhorse server class from Sun.
Constructor Detail

FrugalResourceServer

public FrugalResourceServer(java.lang.String[] argv)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Loads persistent data, creates an implementation of the Frugal Resource service, and registers it.
Parameters:
argv - These should be the same arguments as those passed to main.
Method Detail

main

public static void main(java.lang.String[] argv)
Starts the server running. Invoke with -f [logfile] on the first execution to create the persistent storage logfile and store a unique ID string. Otherwise, invoke with [logfile] to read from persistent storage.
Parameters:
argv - List of command-line argument strings.

usageError

public static void usageError()
Complains about improper commandline arguments.

update

protected void update()
               throws java.io.IOException
Updates the Entries associated with the relevant Frugal Resource every 5 seconds.

dock

public void dock()
Kills the service.

getMonument

public java.io.File getMonument()
Returns the persistent storage for this server.
Returns:
The file where the server stores its ID and other persistent attributes.

setMonument

public void setMonument(java.io.File monument)
Sets the persistent storage for this server.
Parameters:
monument - The new persistent storage location.

getIsabella

public net.jini.lookup.JoinManager getIsabella()
Returns this class' JoinManager.
Returns:
A workhorse class for service registration.

getAdmin

public java.lang.Object getAdmin()
                          throws java.rmi.RemoteException
Returns an administrative interface for the relevant Frugal Manager.
Returns:
An administrative interface for the relevant Frugal Manager.

checkpoint

public void checkpoint()
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Saves recent changes to this class' persistent data.