arlut.csd.ganymede
Class GanymedeAdmin

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--arlut.csd.ganymede.GanymedeAdmin
All Implemented Interfaces:
adminSession, java.rmi.Remote, java.io.Serializable, java.rmi.server.Unreferenced

class GanymedeAdmin
extends java.rmi.server.UnicastRemoteObject
implements adminSession, java.rmi.server.Unreferenced

GanymedeAdmin is the server-side implementation of the adminSession interface; GanymedeAdmin provides the means by which privileged users can carry out privileged operations on the Ganymede server, including status monitoring and administrative activities.

GanymedeAdmin is actually a dual purpose class. One the one hand, GanymedeAdmin implements adminSession, providing a hook for the admin console to talk to. On the other, GanymedeAdmin contains a lot of static fields and methods which the server code uses to communicate information to any admin consoles that are attached to the server at any given time.

See Also:
Serialized Form

Field Summary
private  java.lang.String adminName
          The name that the admin console authenticated with.
private static java.util.Vector badConsoles
          Static vector of GanymedeAdmin instances for which remote exceptions were caught in the static update methods.
private  java.lang.String clientHost
          The name or ip address of the system that this admin console is attached from.
(package private) static java.util.Vector consoles
          Static vector of GanymedeAdmin instances, used to keep track of the attached admin consoles.
private static long freeMem
          Free memory statistic that the server sends to admin consoles
private  boolean fullprivs
          If true, the admin console is attached with full privileges to run tasks, shut down the server, and so on.
private static java.util.Date lastDumpDate
          Timestamp that the Ganymede server last consolidated its journal file and dumped its database to disk.
(package private)  serverAdminProxy proxy
          A server-side proxy that maintains an event queue for the admin console attached to this GanymedeAdmin object.
private static java.lang.String state
          The overall server state..
private static long totalMem
          Total memory statistic that the server sends to admin consoles
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
GanymedeAdmin(Admin admin, boolean fullprivs, java.lang.String adminName, java.lang.String clientHost)
          This is the GanymedeAdmin constructor, used to create a new server-side admin console attachment.
 
Method Summary
private static void detachBadConsoles()
          This is a private convenience function, it's purpose is to out any consoles that we caught a remote exception from, the context of a loop over consoles that we might interfere here.
 ReturnVal disableTask(java.lang.String name)
          Causes a registered task to be made ineligible for execution until enableTask() is called.
 ReturnVal dumpDB()
          dump the current state of the db to disk
 SchemaEdit editSchema()
          lock the server and edit the schema
 ReturnVal enableTask(java.lang.String name)
          Causes a task that was temporarily disabled by disableTask() to be available for execution again.
 ReturnVal forceBuild()
          This method is called by admin console code to force a complete rebuild of all external builds.
 ReturnVal kill(java.lang.String user)
          Kick a user off of the Ganymede server on behalf of this admin console
 ReturnVal killAll()
          Kick all users off of the Ganymede server on behalf of this admin console
 void logout()
          Disconnect the remote admin console associated with this object
 void logout(java.lang.String reason)
          Disconnect the remote admin console associated with this object
 void refreshMe()
          This method lets the admin console explicitly request a refresh.
static void refreshTasks()
          This static method is used to update the list of connnected users that appears in any admin consoles attached to the Ganymede server.
static void refreshUsers()
          This static method is used to update the list of connnected users that appears in any admin consoles attached to the Ganymede server.
 ReturnVal runEmbeddedSweep()
          Removes any embedded objects which do not have containers.
 ReturnVal runEmbeddedTest()
          run a verification on the integrity of embedded objects and their containers
 ReturnVal runInvidSweep()
          run a long-running verification suite on the invid links
 ReturnVal runInvidTest()
          run a long-running verification suite on the invid links
 ReturnVal runTaskNow(java.lang.String name)
          Causes a pre-registered task in the Ganymede server to be executed as soon as possible.
static void setState()
          This method updates the state on all attached consoles
static void setState(GanymedeAdmin console)
          This method updates the state on a single console
static void setState(java.lang.String state)
          This method changes the system state and sends it out to the consoles
static void setStatus(java.lang.String status)
          This static method is used to send debug log info to the consoles.
 ReturnVal shutdown(boolean waitForUsers)
          shutdown the server cleanly, on behalf of this admin console.
 ReturnVal stopTask(java.lang.String name)
          Causes a running task to be stopped as soon as possible.
 void unreferenced()
          This method is called when the Java RMI system detects that this remote object is no longer referenced by any remote objects.
static void updateCheckedOut()
          This method updates the objects checked out count on all consoles.
static void updateCheckedOut(GanymedeAdmin console)
          This method updates the objects checked out count on a single console
static void updateLastDump()
          This method updates the last dump time to all consoles.
static void updateLastDump(java.util.Date date)
          This static method is used to send the last dump time to the consoles.
static void updateLastDump(GanymedeAdmin console)
          This method updates the last dump time on a single console
static void updateLocksHeld()
           
static void updateLocksHeld(GanymedeAdmin console)
          This method updates the number of locks held on a single console
static void updateMemState()
          This method is used to send the server's memory status to all connected admin consoles.
static void updateMemState(GanymedeAdmin console)
          This method updates the server's memory status on a single connected admin console.
static void updateMemState(long freeMem, long totalMem)
          This static method is used to update and transmit the server's memory status to the consoles.
static void updateTransCount()
          This static method is used to send the current transcount to the consoles.
static void updateTransCount(GanymedeAdmin console)
          This static method is used to send the current transcount to an individual consoles.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
, clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, 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, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

consoles

static java.util.Vector consoles
Static vector of GanymedeAdmin instances, used to keep track of the attached admin consoles.

badConsoles

private static java.util.Vector badConsoles
Static vector of GanymedeAdmin instances for which remote exceptions were caught in the static update methods. Used by detachBadConsoles() to remove consoles that we were not able to communicate with.

state

private static java.lang.String state
The overall server state.. 'normal operation', 'shutting down', etc.

lastDumpDate

private static java.util.Date lastDumpDate
Timestamp that the Ganymede server last consolidated its journal file and dumped its database to disk.

freeMem

private static long freeMem
Free memory statistic that the server sends to admin consoles

totalMem

private static long totalMem
Total memory statistic that the server sends to admin consoles

adminName

private java.lang.String adminName
The name that the admin console authenticated with. We keep it here rather than asking the console later so that the console can't decide it should call itself 'supergash' at some later point.

clientHost

private java.lang.String clientHost
The name or ip address of the system that this admin console is attached from.

fullprivs

private boolean fullprivs
If true, the admin console is attached with full privileges to run tasks, shut down the server, and so on. If false, the user just has privileges to watch the server's operation.

proxy

serverAdminProxy proxy

A server-side proxy that maintains an event queue for the admin console attached to this GanymedeAdmin object.

Constructor Detail

GanymedeAdmin

public GanymedeAdmin(Admin admin,
                     boolean fullprivs,
                     java.lang.String adminName,
                     java.lang.String clientHost)
              throws java.rmi.RemoteException

This is the GanymedeAdmin constructor, used to create a new server-side admin console attachment.

Admin is an RMI remote object exported by the client in the form of a callback.

This constructor is called from admin(), which is responsible for authenticating the name and password before calling this constructor.

Method Detail

setStatus

public static void setStatus(java.lang.String status)
This static method is used to send debug log info to the consoles. It is used by Ganymede.debug() to append information to the console logs.

updateTransCount

public static void updateTransCount()
This static method is used to send the current transcount to the consoles.

updateTransCount

public static void updateTransCount(GanymedeAdmin console)
This static method is used to send the current transcount to an individual consoles.

updateLastDump

public static void updateLastDump(java.util.Date date)
This static method is used to send the last dump time to the consoles.

updateLastDump

public static void updateLastDump()
This method updates the last dump time to all consoles.

updateLastDump

public static void updateLastDump(GanymedeAdmin console)
This method updates the last dump time on a single console

updateMemState

public static void updateMemState(long freeMem,
                                  long totalMem)
This static method is used to update and transmit the server's memory status to the consoles.

updateMemState

public static void updateMemState()
This method is used to send the server's memory status to all connected admin consoles.

updateMemState

public static void updateMemState(GanymedeAdmin console)
This method updates the server's memory status on a single connected admin console.

updateCheckedOut

public static void updateCheckedOut()
This method updates the objects checked out count on all consoles.

updateCheckedOut

public static void updateCheckedOut(GanymedeAdmin console)
This method updates the objects checked out count on a single console

updateLocksHeld

public static void updateLocksHeld()

updateLocksHeld

public static void updateLocksHeld(GanymedeAdmin console)
This method updates the number of locks held on a single console

setState

public static void setState(java.lang.String state)
This method changes the system state and sends it out to the consoles

setState

public static void setState()
This method updates the state on all attached consoles

setState

public static void setState(GanymedeAdmin console)
This method updates the state on a single console

refreshUsers

public static void refreshUsers()
This static method is used to update the list of connnected users that appears in any admin consoles attached to the Ganymede server.

refreshTasks

public static void refreshTasks()
This static method is used to update the list of connnected users that appears in any admin consoles attached to the Ganymede server.

logout

public void logout()
Disconnect the remote admin console associated with this object
Specified by:
logout in interface adminSession

logout

public void logout(java.lang.String reason)
Disconnect the remote admin console associated with this object

unreferenced

public void unreferenced()

This method is called when the Java RMI system detects that this remote object is no longer referenced by any remote objects.

This method handles abnormal logouts and time outs for us. By default, the 1.1 RMI time-out is 10 minutes.

Specified by:
unreferenced in interface java.rmi.server.Unreferenced
See Also:
Unreferenced

refreshMe

public void refreshMe()
               throws java.rmi.RemoteException

This method lets the admin console explicitly request a refresh. Upon being called, the server will call several methods on the admin console's Admin interface to pass current status information to the console.

Specified by:
refreshMe in interface adminSession

forceBuild

public ReturnVal forceBuild()

This method is called by admin console code to force a complete rebuild of all external builds. This means that all databases will have their last modification timestamp cleared and all builder tasks will be scheduled for immediate execution.

Specified by:
forceBuild in interface adminSession

killAll

public ReturnVal killAll()
Kick all users off of the Ganymede server on behalf of this admin console
Specified by:
killAll in interface adminSession

kill

public ReturnVal kill(java.lang.String user)
Kick a user off of the Ganymede server on behalf of this admin console
Specified by:
kill in interface adminSession

shutdown

public ReturnVal shutdown(boolean waitForUsers)

shutdown the server cleanly, on behalf of this admin console.

Specified by:
shutdown in interface adminSession
Parameters:
waitForUsers - if true, shutdown will be deferred until all users are logged out. No new users will be allowed to login.

dumpDB

public ReturnVal dumpDB()

dump the current state of the db to disk

Specified by:
dumpDB in interface adminSession

runInvidTest

public ReturnVal runInvidTest()
run a long-running verification suite on the invid links
Specified by:
runInvidTest in interface adminSession

runInvidSweep

public ReturnVal runInvidSweep()
run a long-running verification suite on the invid links
Specified by:
runInvidSweep in interface adminSession

runEmbeddedTest

public ReturnVal runEmbeddedTest()
run a verification on the integrity of embedded objects and their containers
Specified by:
runEmbeddedTest in interface adminSession

runEmbeddedSweep

public ReturnVal runEmbeddedSweep()

Removes any embedded objects which do not have containers.

Specified by:
runEmbeddedSweep in interface adminSession

runTaskNow

public ReturnVal runTaskNow(java.lang.String name)

Causes a pre-registered task in the Ganymede server to be executed as soon as possible. This method call will have no effect if the task is currently running.

Specified by:
runTaskNow in interface adminSession

stopTask

public ReturnVal stopTask(java.lang.String name)

Causes a running task to be stopped as soon as possible. This is not always a safe operation, as the task is stopped abruptly, with possible consequences. Use with caution.

Specified by:
stopTask in interface adminSession

disableTask

public ReturnVal disableTask(java.lang.String name)

Causes a registered task to be made ineligible for execution until enableTask() is called. This method will not stop a task that is currently running.

Specified by:
disableTask in interface adminSession

enableTask

public ReturnVal enableTask(java.lang.String name)

Causes a task that was temporarily disabled by disableTask() to be available for execution again.

Specified by:
enableTask in interface adminSession

editSchema

public SchemaEdit editSchema()
lock the server and edit the schema
Specified by:
editSchema in interface adminSession

detachBadConsoles

private static void detachBadConsoles()
This is a private convenience function, it's purpose is to out any consoles that we caught a remote exception from, the context of a loop over consoles that we might interfere here.