arlut.csd.ganymede.client
Class glogin

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--arlut.csd.ganymede.client.glogin
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, ClientListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.lang.Runnable, java.io.Serializable

public class glogin
extends javax.swing.JApplet
implements java.lang.Runnable, java.awt.event.ActionListener, ClientListener

Ganymede client start class. This class can be run from the command line via its static main() method, or as an applet loaded into a web browser, generally with Sun's Java plug-in.

This class has a run() method for attempting to connect to the server in the background once the applet is initialized.

Once glogin handles the user's login, a gclient object is constructed, which handles all of the user's interactions with the server.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
protected  javax.swing.JButton _quitButton
           
private static java.awt.Container appletContentPane
           
private  boolean autologin
           
protected  javax.swing.JPanel bPanel
           
protected  boolean connected
           
protected  javax.swing.JButton connector
           
protected static DeathWatcherThread deathThread
          Background thread to handle force disconnect commands from the server.
static boolean debug
           
(package private)  java.awt.Image errorImage
           
static gclient g_client
          The main client class, will be null until the user is logged in to the server.
protected  java.awt.Image ganymede_logo
           
static java.util.Properties ganymedeProperties
          Client-side properties loaded from the command line or from the web page which contains the definition for glogin as an applet.
private  java.awt.GridBagConstraints gbc
           
private  java.awt.GridBagLayout gbl
           
static java.lang.String helpBase
           
protected static ClientBase my_client
          RMI object to handle getting us logged into the server, and to handle asynchronous callbacks from the server on our behalf.
protected static javax.swing.JFrame my_frame
          If we are run from the command line, this frame will be used to contain the glogin applet in an application context.
protected static glogin my_glogin
          We're a singleton pattern..
protected static java.lang.String my_passwd
           
protected static Server my_server
          Reference to the server acquired by RMI naming service.
protected static Session my_session
          Reference to a user session on the server, will be null until the user is logged into the server.
protected  java.lang.Thread my_thread
          Background thread used to attempt to get the initial RMI connection to the Ganymede server.
protected static java.lang.String my_username
           
protected  javax.swing.JPasswordField passwd
           
static java.lang.String properties_file
           
static int registryPortProperty
           
static java.lang.String server_url
           
static java.lang.String serverhost
           
protected  javax.swing.JTextField username
           
private static boolean WeAreApplet
          If true, we are running as an applet and are limited by the Java sandbox.
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.applet.Applet
serialVersionUID, stub
 
Fields inherited from class java.awt.Panel
base, nameCounter
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
glogin()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handle button clicks, and enter being hit in the password field.
 void destroy()
          If the applet is no longer visible on the page, we exit.
 void disconnected(ClientEvent e)
          Handle a forced disconnect message from the ClientBase RMI object.
 void enableButtons(boolean enabled)
           
 java.awt.Image getErrorImage()
          Loads and returns the error Image for use in client dialogs.
 java.lang.String getUserName()
          Reports our username to gclient
 void init()
          Standard applet initialization method.
static boolean isApplet()
          This method returns true if the Ganymede client is running as an applet.
 void logout()
          Logout from the server.
static void main(java.lang.String[] args)
          This main() function will allow this applet to run as an application when it is not executed in the context of a browser.
 void messageReceived(ClientEvent e)
          Handle a message from the ClientBase RMI object.
 void run()
          This will be executed in the thread that tries to connect to the server.
 void setNormalCursor()
          Set the cursor to the normal cursor(usually a pointer).
 void setWaitCursor()
          Set the cursor to a wait cursor(usually a watch.)
private  void startSession(Session session)
          Starts the main Ganymede client.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, createRootPaneException, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paint, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, transferFocus, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

debug

public static boolean debug

properties_file

public static java.lang.String properties_file

serverhost

public static java.lang.String serverhost

server_url

public static java.lang.String server_url

helpBase

public static java.lang.String helpBase

registryPortProperty

public static int registryPortProperty

ganymedeProperties

public static java.util.Properties ganymedeProperties
Client-side properties loaded from the command line or from the web page which contains the definition for glogin as an applet.

g_client

public static gclient g_client
The main client class, will be null until the user is logged in to the server.

my_frame

protected static javax.swing.JFrame my_frame
If we are run from the command line, this frame will be used to contain the glogin applet in an application context.

my_server

protected static Server my_server
Reference to the server acquired by RMI naming service. Used to log into the server.

my_client

protected static ClientBase my_client
RMI object to handle getting us logged into the server, and to handle asynchronous callbacks from the server on our behalf.

my_session

protected static Session my_session
Reference to a user session on the server, will be null until the user is logged into the server.

my_username

protected static java.lang.String my_username

my_passwd

protected static java.lang.String my_passwd

my_glogin

protected static glogin my_glogin
We're a singleton pattern.. this is a static reference to our actual login applet.

WeAreApplet

private static boolean WeAreApplet
If true, we are running as an applet and are limited by the Java sandbox. A few features of the client will be disabled if this is true (saving query reports to disk, etc.).

appletContentPane

private static java.awt.Container appletContentPane

deathThread

protected static DeathWatcherThread deathThread
Background thread to handle force disconnect commands from the server. We need this thread because jdk 1.2 has a bug where RMI callbacks are not privileged to interact with the Swing thread. By creating a thread to handle forced logouts ourselves, we can have an RMI callback pass a message to this thread (which has local privileges), which can then throw up a dialog explaining about being disconnected, etc.

my_thread

protected java.lang.Thread my_thread
Background thread used to attempt to get the initial RMI connection to the Ganymede server.

connected

protected boolean connected

autologin

private boolean autologin

gbl

private java.awt.GridBagLayout gbl

gbc

private java.awt.GridBagConstraints gbc

errorImage

java.awt.Image errorImage

ganymede_logo

protected java.awt.Image ganymede_logo

username

protected javax.swing.JTextField username

passwd

protected javax.swing.JPasswordField passwd

connector

protected javax.swing.JButton connector

_quitButton

protected javax.swing.JButton _quitButton

bPanel

protected javax.swing.JPanel bPanel
Constructor Detail

glogin

public glogin()
Method Detail

main

public static void main(java.lang.String[] args)
This main() function will allow this applet to run as an application when it is not executed in the context of a browser.

isApplet

public static boolean isApplet()
This method returns true if the Ganymede client is running as an applet.

init

public void init()
Standard applet initialization method.
Overrides:
init in class java.applet.Applet

run

public void run()
This will be executed in the thread that tries to connect to the server. The thread will terminate after a connection to the server has been made.
Specified by:
run in interface java.lang.Runnable

logout

public void logout()
Logout from the server. This is called from the gclient.

destroy

public void destroy()
If the applet is no longer visible on the page, we exit.
Overrides:
destroy in class java.applet.Applet

getUserName

public java.lang.String getUserName()
Reports our username to gclient

enableButtons

public void enableButtons(boolean enabled)

setWaitCursor

public void setWaitCursor()
Set the cursor to a wait cursor(usually a watch.)

setNormalCursor

public void setNormalCursor()

Set the cursor to the normal cursor(usually a pointer).

This is dependent on the operating system.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handle button clicks, and enter being hit in the password field.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

startSession

private void startSession(Session session)
Starts the main Ganymede client.

messageReceived

public void messageReceived(ClientEvent e)
Handle a message from the ClientBase RMI object.
Specified by:
messageReceived in interface ClientListener

disconnected

public void disconnected(ClientEvent e)
Handle a forced disconnect message from the ClientBase RMI object.
Specified by:
disconnected in interface ClientListener

getErrorImage

public final java.awt.Image getErrorImage()

Loads and returns the error Image for use in client dialogs.

Once the image is loaded, it is cached for future calls to getErrorImage().