org.PingOO.DLAI.PPM
Class PPM

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--org.PingOO.DLAI.lib.PWidget.PFrame
                                      |
                                      +--org.PingOO.DLAI.PPM.PPM

public final class PPM
extends PFrame
implements PAppli

This is the PingOO's DLAI Java PPM which dislays all the user's resources, launchable slave applications and discusses with the PingOO PERL server.
It is also called the program manager.

Since:
PingOO 2.0
Version:
2.0.2
Author:
Fabrice Bouyé (bouye@cur-archamps.fr)
See Also:
PAppli, PFrame, Serialized Form

Inner Class Summary
private  class PPM.AboutInternalFrame
          An in internal frame with an "about" content.
private  class PPM.DesktopMouseListener
          Mouse listener for the desktop.
private  class PPM.ExitRunnable
          Provokes a final exit.
private static class PPM.LoginWindowRestartRunnable
          Defines the runnable object which will allow to restart the login window.
private  class PPM.ManagerMenuBar
          This is the menu bar of the DLAI desktop.
private  class PPM.PingRunnable
          Makes a ping on the server, get informations about connected slave.
private  class PPM.PPMAdapter
          An appli listener for the master.
private  class PPM.ProgramManagerRestartRunnable
          Defines the runnable object which will allow to restart the program manager
Caution!
private  class PPM.StartSlaveAction
          The action associated with each slave.
private  class PPM.StartSlaveRunnable
          The runnable object that will allow to start slaves.
private  class PPM.StartToolAction
          The action associated which each tool.
private  class PPM.StartToolRunnable
          The runnable object that will allow to start tools.
 
Inner classes inherited from class org.PingOO.DLAI.lib.PWidget.PFrame
PFrame.PExternalMouseInputListener
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
private static AppliEventListenerList appliListenerList
          Contains all registered listener for appli events.
protected  ClockPanel clockPanel
          The appli's manager clock.
private  PPM.StartToolAction configureAction
          Action used to start the configuration panel.
private  AppliAdapter defaultAppliAdapter
          The default appli listener for this appli manager.
private  java.awt.event.MouseListener defaultDesktopMouseListener
          Default moue listener for the desktop.
private  MainDesktop desktop
          The destop were all applications will be displayed.
private static java.lang.Runnable doStartLoginWindow
          Runnable used to restart login window.
private  java.lang.Runnable doStartProgramManager
          Runnable used to restart the program manager.
private static int EXIT_TIMER
          Time before exit 30s.
private static int FINAL_EXIT_TIMER
          The timer before final exit 10mm.
private  PPM.ManagerMenuBar menuBar
          The menu bar of the manager.
private static int PING_TIMER
          Time between each ping 30s.
private  PPM.PingRunnable pingRunnable
          The appli's manager ping thread.
private static PPM pPM
          Just an instance of the current launched PPM.
private static int PPM_NUMBER
          The identifier generator.
private  int pPMIdentifier
          The unique identifier.
protected  PThreadGroup pPMThreadGroup
          The thread group associated with the PPM.
private  Request request
          The object to which are sent the requests.
private  java.util.Hashtable runningSlaveTable
          This Hashtable contains all launched slaves.
private  java.util.Hashtable runningToolTable
          This Hashtable contains all launched tool.
private  java.util.Vector slaveActionVector
          This table contains all slave actions.
private  java.util.Hashtable startedSlaveActionTable
          This table contains all disabled slave actions.
private  java.util.Hashtable startedToolActionTable
          This table contains all disabled tool actions.
private  java.util.Vector toolActionVector
          This table contains all tool actions.
 
Fields inherited from class org.PingOO.DLAI.lib.PWidget.PFrame
defaultMouseInputListener, manager, module, titleKey
 
Fields inherited from class javax.swing.JFrame
accessibleContext, defaultCloseOperation, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
 
Fields inherited from class java.awt.Window
active, base, focusMgr, inputContext, nameCounter, OPENED, ownedWindowList, serialVersionUID, state, warningString, weakThis, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
private PPM(java.lang.String loginName, java.lang.String loginPassword, java.lang.String serverName, int serverPort, Request request)
          Creates a new DLAI.
 
Method Summary
 void addAppliListener(AppliListener listener)
          Adds a specific AppliListener.
private  void clearAllCaches()
          Clears icon, images, sounds, cursors, ... caches.
private  void connectionBroken()
          what to do when the server does not respond ?
private  void createPopUp(int x, int y)
          Creates popup window on the desktop.
private  void exit()
          Quits the program manager.
private  void fireKillSlave()
          Fire method to tell this application has been killed.
 java.awt.Dimension getMaximumSize()
          Returns the maximum size of this component.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size of this component.
 java.awt.Dimension getPreferredSize()
          Returns the maximum size of this component.
private  void killSlave(java.lang.Class slaveClass)
          Kills a slave.
private  void killSlave(PSlave slave)
          Kills a slave.
private  void killTool(java.lang.Class toolClass)
          Kills a tool.
private  void killTool(PTool tool)
          Kills a tool.
static void login(java.lang.String loginName, java.lang.String loginPassword)
          Logs in at the server and launches the manager's UI.
static void login(java.lang.String loginName, java.lang.String loginPassword, java.lang.String serverName, int serverPort)
          Logs in at the server and launches the manager's UI.
private  void logoff()
          Quits the program manager and relaunch the login window.
static void main(java.lang.String[] args)
          Starts the PPM.
private  void makeSlaveActions(java.lang.String[] applicationsArray)
          Creates the actions associated with the appli the user is allowed to start.
private  void makeToolActions(java.lang.String[] toolsArray)
          Creates the actions associated with the tool.
 void removeAppliListener(AppliListener listener)
          Removes a specific AppliListener.
private  void restart()
          Restarts the program manager.
 void run()
          Required by the Runnable interface.
 void start()
          Starts the application manager.
private  void stop()
          Clean shutdown for the program manager.
private  void stopAllSlaves()
          Stops all active slaves.
private  void stopAllThreads()
          Stops all currently running threads.
private  void stopAllTools()
          Stops all active tools.
 
Methods inherited from class org.PingOO.DLAI.lib.PWidget.PFrame
getManager, getModule, getTextKey, getTitleKey, getToolTipKey, setLocalizedTitle, setManager, setModule, updateFont, updateLanguage, updateLanguage
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, createRootPaneException, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, countComponents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMouseEventTarget, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, paint, paintComponents, postsOldMouseEvents, preferredSize, print, printComponents, printOneComponent, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

PING_TIMER

private static final int PING_TIMER
Time between each ping 30s. Might be configurable in future.

EXIT_TIMER

private static final int EXIT_TIMER
Time before exit 30s.

FINAL_EXIT_TIMER

private static final int FINAL_EXIT_TIMER
The timer before final exit 10mm.

PPM_NUMBER

private static int PPM_NUMBER
The identifier generator.

pPMIdentifier

private int pPMIdentifier
The unique identifier.

pPM

private static PPM pPM
Just an instance of the current launched PPM.

appliListenerList

private static AppliEventListenerList appliListenerList
Contains all registered listener for appli events.

request

private Request request
The object to which are sent the requests.

menuBar

private PPM.ManagerMenuBar menuBar
The menu bar of the manager.

desktop

private MainDesktop desktop
The destop were all applications will be displayed.

runningSlaveTable

private final java.util.Hashtable runningSlaveTable
This Hashtable contains all launched slaves.

startedSlaveActionTable

private final java.util.Hashtable startedSlaveActionTable
This table contains all disabled slave actions.

slaveActionVector

private final java.util.Vector slaveActionVector
This table contains all slave actions.

runningToolTable

private final java.util.Hashtable runningToolTable
This Hashtable contains all launched tool.

startedToolActionTable

private final java.util.Hashtable startedToolActionTable
This table contains all disabled tool actions.

toolActionVector

private final java.util.Vector toolActionVector
This table contains all tool actions.

pPMThreadGroup

protected PThreadGroup pPMThreadGroup
The thread group associated with the PPM.

clockPanel

protected ClockPanel clockPanel
The appli's manager clock.

pingRunnable

private PPM.PingRunnable pingRunnable
The appli's manager ping thread.

configureAction

private PPM.StartToolAction configureAction
Action used to start the configuration panel.

doStartProgramManager

private java.lang.Runnable doStartProgramManager
Runnable used to restart the program manager.

doStartLoginWindow

private static java.lang.Runnable doStartLoginWindow
Runnable used to restart login window.

defaultAppliAdapter

private AppliAdapter defaultAppliAdapter
The default appli listener for this appli manager.

defaultDesktopMouseListener

private java.awt.event.MouseListener defaultDesktopMouseListener
Default moue listener for the desktop.
Constructor Detail

PPM

private PPM(java.lang.String loginName,
            java.lang.String loginPassword,
            java.lang.String serverName,
            int serverPort,
            Request request)
Creates a new DLAI.
By default the desktop covers the entire screen.
Parameters:
loginName - The user's login name.
loginPassword - The user's password.
Method Detail

createPopUp

private final void createPopUp(int x,
                               int y)
Creates popup window on the desktop.

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the maximum size of this component.
Returns:
The maximum size of this component.
Overrides:
getPreferredSize in class java.awt.Container

getMaximumSize

public java.awt.Dimension getMaximumSize()
Returns the maximum size of this component.
Returns:
The maximum size of this component.
Overrides:
getMaximumSize in class java.awt.Container

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size of this component.
Returns:
The minimum size of this component.
Overrides:
getMinimumSize in class java.awt.Container

start

public void start()
Starts the application manager.

run

public final void run()
Required by the Runnable interface.

stop

private final void stop()
Clean shutdown for the program manager.

restart

private final void restart()
Restarts the program manager.

exit

private final void exit()
Quits the program manager.

logoff

private final void logoff()
Quits the program manager and relaunch the login window.

stopAllSlaves

private final void stopAllSlaves()
Stops all active slaves.

stopAllTools

private final void stopAllTools()
Stops all active tools.

stopAllThreads

private final void stopAllThreads()
Stops all currently running threads.

connectionBroken

private final void connectionBroken()
what to do when the server does not respond ?
In future version we might need to make slaves unavailable if the user choose to stay in the administration interface.

clearAllCaches

private final void clearAllCaches()
Clears icon, images, sounds, cursors, ... caches.
Frees memory and leave no tracks of the current user.

main

public static final void main(java.lang.String[] args)
Starts the PPM.
In fact launches the LoginWindow which will starts the PPM at later time.
Parameters:
args - The arguments from the command line.
See Also:
LoginWindow.main(java.lang.String[])

login

public static final void login(java.lang.String loginName,
                               java.lang.String loginPassword)
Logs in at the server and launches the manager's UI.
Parameters:
loginName - The user's login name.
loginPassword - The user's login password.

login

public static final void login(java.lang.String loginName,
                               java.lang.String loginPassword,
                               java.lang.String serverName,
                               int serverPort)
Logs in at the server and launches the manager's UI.
Parameters:
loginName - The user's login name.
loginPassword - The user's login password.
serverName - The name of the server's host.
serverPort - The port of the server on its host.

makeSlaveActions

private final void makeSlaveActions(java.lang.String[] applicationsArray)
Creates the actions associated with the appli the user is allowed to start.
Parameters:
applicationsArray - The list of applis which the user can use.

makeToolActions

private final void makeToolActions(java.lang.String[] toolsArray)
Creates the actions associated with the tool.
Parameters:
applicationsArray - The list of available tools.

addAppliListener

public final void addAppliListener(AppliListener listener)
Adds a specific AppliListener.
Specified by:
addAppliListener in interface PAppli
Parameters:
listener - The listener to be added.

removeAppliListener

public final void removeAppliListener(AppliListener listener)
Removes a specific AppliListener.
Specified by:
removeAppliListener in interface PAppli
Parameters:
listener - The listener to be removed.

fireKillSlave

private void fireKillSlave()
Fire method to tell this application has been killed.

killSlave

private void killSlave(PSlave slave)
Kills a slave.
In fact the slave is designed to kill itself.
This method will make the startSlaveAction available again, so the user can restart the slave.
Parameters:
slave - The slave to be killed.
Since:
PingOO 2.0.2

killSlave

private void killSlave(java.lang.Class slaveClass)
Kills a slave.
In fact the slave is designed to kill itself.
This method will make the startSlaveAction available again, so the user can restart the slave.

Since there can be only one slave of the same type running at a givent time, we can play with the class.

Parameters:
slaveName - The class of the slave to be killed.
Since:
PingOO 2.0.2

killTool

private void killTool(PTool tool)
Kills a tool.
In fact the tool is designed to kill itself.
This method will make the startToolAction available again, so the user can restart the tool.
Parameters:
tool - The tool to be killed.
Since:
PingOO 2.0.2

killTool

private void killTool(java.lang.Class toolClass)
Kills a tool.
In fact the tool is designed to kill itself.
This method will make the startToolAction available again, so the user can restart the tool.

Since there can be only one tool of the same type running at a givent time, we can play with the class.

Parameters:
toolClass - The class of the tool to be killed.
Since:
PingOO 2.0.2