Websphere MQ Everyplace

examples.administration.console
Class AdminFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--examples.awt.AwtFrame
                                |
                                +--examples.administration.console.AdminFrame
All Implemented Interfaces:
javax.accessibility.Accessible, AwtEvent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
AdminCommsListener, AdminConnection, AdminQueue, AdminQueueManager

public abstract class AdminFrame
extends AwtFrame

To provide a simple window interface for managing WebSphere MQ Everywhere resources. Any resource to be managed should be implemented as a subclass of this class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.lang.String action
          All admin requests are stored in admin messages
protected  java.awt.Button actionB
           
protected  java.util.Hashtable actionFields
           
protected  AdminModel adminModel
           
protected  java.awt.Button applyB
           
protected  java.awt.Button cancelB
           
protected  java.util.Hashtable displayedFields
           
protected  java.util.Hashtable displayFields
           
protected  java.util.Hashtable displayFieldsGroups
           
protected  java.util.Vector displayFieldsSeq
           
protected  int fieldCount
           
protected  MQeAdminMsg msg
           
protected  java.util.Hashtable nLSFields
          Information to help display resource
protected  MQeAdminMsg origMsg
           
static short[] version
           
 
Fields inherited from class examples.awt.AwtFrame
borderLayout1, BorderWhere, Center, East, format, Menu, North, panel, South, West
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AdminFrame()
          Default constructor.
AdminFrame(MQeAdminMsg msg, int action, AdminModel adminModel)
          AdminFrame constructor.
AdminFrame(java.lang.String title)
          AdminFrame constructor.
 
Method Summary
 void action(java.lang.Object e, int where, int index, java.lang.String choice, boolean state)
          Called to process an MQe awt event.
 void activate(MQeAdminMsg msg, int action, AdminModel adminModel)
          Initialisation code.
 void addAction(java.lang.String actionName, java.lang.String[][] actionParms)
          Add details about an action.
 void addActionToDisplay(java.lang.String action)
          Add an action to the display (frame).
 void addAlias()
          Add any aliases related to this resource.
 void addCharacteristic(java.lang.String name, java.lang.String displayWidget, java.lang.String parent)
          Add GUI properties for a field.
 void addDisplayedField(java.lang.String name, java.lang.Object[] displayedAttrs)
          Store information about a field that has been displayed.
 void addFieldToDisplay(java.lang.String name, MQeFields baseFields, MQeFields baseErrors)
          Add a field to the display.
 void addNLSName(java.lang.String name, java.lang.String nLSName)
          Add an NLS name for a field.
 void close()
          Close window.
protected  void closeFrame()
          Handle window closing event.
 void display()
          Show the frame.
 java.awt.Panel getActionsPanel(AwtEvent eventHandler)
          Return an actions panel.
 MQeFields getChanges()
          Get any fields which have changed or are mandatory.
 MQeFields getCharacteristics()
          Get the set of characteristics for the managed object.
 java.lang.String[] getErrorFromFields(java.lang.String name, MQeFields values, MQeFields errors)
          Get any errors for a named field.
 java.lang.String getField(java.lang.String name)
          Get the value from the display of a named field.
 java.lang.String getFieldDisplayType(java.lang.String fieldName)
          Return the name of the widget used to display the named field.
 java.lang.String[][] getFieldsForAction(java.lang.String action)
          Return the set of fields for the named action.
 java.lang.String getMessageHelp()
          Returns a string that provides information about the current frame.
 java.lang.String getNLSName(java.lang.String fieldName)
          Return the NLS name for the named field.
 java.lang.String getResourceTitle()
          Return the name of resource being managed.
 MQeFields getSubFields(java.lang.String name, MQeFields baseFields)
          Return embedded fields object for named field from the base fields object.
 java.lang.String[] getValueFromFields(java.lang.String name, MQeFields fields)
          Get the string value of a named field from within a fields object.
 boolean isFieldChanged(java.lang.String name)
          Has the value of the field changed from its initial setting.
 void message(java.lang.String msg)
          Display a message.
 boolean renderCharacteristic(java.lang.String name, MQeFields fields, MQeFields errors, java.lang.String[] value, java.lang.String[] error)
          Handle rendering of a named field.
 void renderError(java.lang.String name, MQeFields errors, java.lang.String[] error, boolean alreadyDisplayed)
          Handle rendering of any errors related to a named field.
 void renderLabel(java.lang.String name)
          Display the label for a field.
 void resourceAction(java.lang.Object e, int where, int index, java.lang.String choice, boolean state)
          Process a queue manager action request.
 void setAdminModel(AdminModel am)
          Sets the AdminModel.
 void setField(java.lang.String name, MQeFields baseFields, java.lang.String value)
          Return embedded fields object for named field from the base fields object.
 MQeAdminMsg setupAction(MQeFields parms)
          Setup the administration message with the action to be performed and the parameters required by the action.
protected  void setupActions()
          Configure the valid set of actions for a particular type of resource.
protected  void setupFields()
          Setup the set of characteristics for a particular type of resource.
protected  void setupNLS()
          Setup NLS names for characteristics of a particular type of resource.
 boolean validateInput()
          Validate the user's input.
 
Methods inherited from class examples.awt.AwtFrame
format, getActionIndex, getActionString, getCheckState, GetChoice, getObject, getPanel, getText, index, processWindowEvent, setPanel, setText, visible, visible
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

version

public static short[] version

cancelB

protected java.awt.Button cancelB

applyB

protected java.awt.Button applyB

actionB

protected java.awt.Button actionB

nLSFields

protected java.util.Hashtable nLSFields
Information to help display resource


actionFields

protected java.util.Hashtable actionFields

displayFields

protected java.util.Hashtable displayFields

displayFieldsGroups

protected java.util.Hashtable displayFieldsGroups

displayFieldsSeq

protected java.util.Vector displayFieldsSeq

displayedFields

protected java.util.Hashtable displayedFields

fieldCount

protected int fieldCount

action

protected java.lang.String action
All admin requests are stored in admin messages


msg

protected MQeAdminMsg msg

origMsg

protected MQeAdminMsg origMsg

adminModel

protected AdminModel adminModel
Constructor Detail

AdminFrame

public AdminFrame()
Default constructor.


AdminFrame

public AdminFrame(MQeAdminMsg msg,
                  int action,
                  AdminModel adminModel)
           throws java.lang.Exception
AdminFrame constructor.

Parameters:
msg - An administration message to contain the parameters for the action. If it already contains any parameters then these are taken as defaults.
action - The action to be performedr
adminModel - The administration model which will send the message.
Throws:
java.lang.Exception

AdminFrame

public AdminFrame(java.lang.String title)
AdminFrame constructor.

Parameters:
title - java.lang.String
Method Detail

action

public void action(java.lang.Object e,
                   int where,
                   int index,
                   java.lang.String choice,
                   boolean state)
Called to process an MQe awt event.

Specified by:
action in interface AwtEvent
Overrides:
action in class AwtFrame
Parameters:
e - java.lang.Object
where - An integer indicating the location
index - An integer containing the type of resource to be managed
choice - java.lang.String
state - A boolean
Returns:
void

activate

public void activate(MQeAdminMsg msg,
                     int action,
                     AdminModel adminModel)
              throws java.lang.Exception
Initialisation code.

Parameters:
msg - com.ibm.mqe.MQeAdminMsg
action - The action to be performed
adminModel - The administration model which will send the message.
Returns:
void
Throws:
java.lang.Exception

addAction

public void addAction(java.lang.String actionName,
                      java.lang.String[][] actionParms)
Add details about an action.

Parameters:
actionName - Name of the action
actionParms - :
 1st dimension : fields required for action
 2nd dimension : information related to each field
                  "M" = mandatory completion
                  "O" = optional input
 
Returns:
void

Example:

 addAction( new String().valueOf(MQeQueueManagerAdminMsg.Action_Update),
                                 new String[][] {
                                   { MQeQueueManagerAdminMsg.Name, "M" },
                                   { MQeQueueManagerAdminMsg.Desc, "O" }
                                 };
          );
 

addActionToDisplay

public void addActionToDisplay(java.lang.String action)
                        throws java.lang.Exception
Add an action to the display (frame).

Parameters:
action - String containing the action to be performed.
Returns:
void
Throws:
java.lang.Exception

addAlias

public void addAlias()
              throws java.lang.Exception
Add any aliases related to this resource.

Returns:
void
Throws:
java.lang.Exception

addCharacteristic

public void addCharacteristic(java.lang.String name,
                              java.lang.String displayWidget,
                              java.lang.String parent)
Add GUI properties for a field.

Parameters:
name - name of field
displayWidget - how to display the field
parent - name of this fields parent (container)

Note: the sequence of addCharacteristic calls determines the sequence that fields are displayed.

Returns:
void

Example :

  addCharacteristic( MQeQueueManagerAdminMsg.Name, "TF", null );
  addCharacteristic( MQeQueueManagerAdminMsg.Routes, "C", null );
  addCharacteristic( MQeQueueManagerAdminMsg.RouteDestination, "TF", MQeQueueManagerAdminMsg.Routes );
 

addDisplayedField

public void addDisplayedField(java.lang.String name,
                              java.lang.Object[] displayedAttrs)
Store information about a field that has been displayed.

Parameters:
name - name of field
displayedAttrs - :
      [0]  -  GUI widget
      [1]  -  initial value
      [2]  -  field type
 
Returns:
void

addFieldToDisplay

public void addFieldToDisplay(java.lang.String name,
                              MQeFields baseFields,
                              MQeFields baseErrors)
                       throws java.lang.Exception
Add a field to the display.

Parameters:
name - Name of the field
baseFields - MQeFields Object
baseErrors - MQeFields Object
Returns:
void
Throws:
java.lang.Exception

addNLSName

public void addNLSName(java.lang.String name,
                       java.lang.String nLSName)
Add an NLS name for a field.

Parameters:
name - Name of the field
nLSName - String containing the NLSName for the field
Returns:
void

close

public void close()
Close window.

Returns:
void

closeFrame

protected void closeFrame()
Handle window closing event.

Overrides:
closeFrame in class AwtFrame
Returns:
void

display

public void display()
Show the frame.

Returns:
void

getActionsPanel

public java.awt.Panel getActionsPanel(AwtEvent eventHandler)
Return an actions panel.

Parameters:
eventHandler - An AwtEvent
Returns:
A Panel

getChanges

public MQeFields getChanges()
                     throws java.lang.Exception
Get any fields which have changed or are mandatory.

Returns:
MQeFields Object
Throws:
java.lang.Exception

getCharacteristics

public MQeFields getCharacteristics()
                             throws java.lang.Exception
Get the set of characteristics for the managed object.

Returns:
MQeFields Object
Throws:
java.lang.Exception

getErrorFromFields

public java.lang.String[] getErrorFromFields(java.lang.String name,
                                             MQeFields values,
                                             MQeFields errors)
                                      throws java.lang.Exception
Get any errors for a named field.

Parameters:
name - Name of the field
values - MQeFields object
errors - MQeFields object
Returns:
A String array
Throws:
java.lang.Exception

getField

public java.lang.String getField(java.lang.String name)
                          throws java.lang.Exception
Get the value from the display of a named field.

Parameters:
name - Name of the field
Returns:
java.lang.String
Throws:
java.lang.Exception

getFieldDisplayType

public java.lang.String getFieldDisplayType(java.lang.String fieldName)
Return the name of the widget used to display the named field.

Parameters:
fieldName - Name of the field
Returns:
java.lang.String

getFieldsForAction

public java.lang.String[][] getFieldsForAction(java.lang.String action)
Return the set of fields for the named action.

Parameters:
action - The action to be performed
Returns:
An array of java.lang.String array

getNLSName

public java.lang.String getNLSName(java.lang.String fieldName)
Return the NLS name for the named field.


getResourceTitle

public java.lang.String getResourceTitle()
Return the name of resource being managed.

Returns:
java.lang.String

getSubFields

public MQeFields getSubFields(java.lang.String name,
                              MQeFields baseFields)
                       throws java.lang.Exception
Return embedded fields object for named field from the base fields object. Fields objects can contain other fields objects. This method returns the fields object that owns a named field from within the root fields object.

java.lang.Exception

getValueFromFields

public java.lang.String[] getValueFromFields(java.lang.String name,
                                             MQeFields fields)
                                      throws java.lang.Exception
Get the string value of a named field from within a fields object.

java.lang.Exception

isFieldChanged

public boolean isFieldChanged(java.lang.String name)
                       throws java.lang.Exception
Has the value of the field changed from its initial setting.

java.lang.Exception

message

public void message(java.lang.String msg)
Display a message.

Parameters:
msg - String containing the message to be displayed.
Returns:
void

renderCharacteristic

public boolean renderCharacteristic(java.lang.String name,
                                    MQeFields fields,
                                    MQeFields errors,
                                    java.lang.String[] value,
                                    java.lang.String[] error)
                             throws java.lang.Exception
Handle rendering of a named field.

Parameters:
name - Name of the field
fields - MQeFields object
errors - MQeFields object
value - A String array
error - A String array
Returns:
boolean
Throws:
java.lang.Exception

renderError

public void renderError(java.lang.String name,
                        MQeFields errors,
                        java.lang.String[] error,
                        boolean alreadyDisplayed)
                 throws java.lang.Exception
Handle rendering of any errors related to a named field.

Parameters:
name - Name of the field
errors - MQeFields object
error - A String array
alreadyDisplayed - A boolean
Returns:
void
Throws:
java.lang.Exception

renderLabel

public void renderLabel(java.lang.String name)
Display the label for a field.

Parameters:
name - Name of the field
Returns:
void

resourceAction

public void resourceAction(java.lang.Object e,
                           int where,
                           int index,
                           java.lang.String choice,
                           boolean state)
                    throws java.lang.Exception
Process a queue manager action request.

Parameters:
e - java.lang.Object
where - An integer indicating the location
index - An integer containing the type of resource to be managed
choice - java.lang.String
state - A boolean
Returns:
void
Throws:
java.lang.Exception

setAdminModel

public void setAdminModel(AdminModel am)
Sets the AdminModel.

Parameters:
am - AdminModel object
Returns:
void

setField

public void setField(java.lang.String name,
                     MQeFields baseFields,
                     java.lang.String value)
              throws java.lang.Exception

Return embedded fields object for named field from the base fields object.

MQeFields objects can contain other fields objects. This method returns the fields object that owns a named field from within the root fields object.

Parameters:
name - Name of the field
baseFields - MQeFields object
value - java.lang.String
Returns:
void
Throws:
java.lang.Exception

setupAction

public MQeAdminMsg setupAction(MQeFields parms)
                        throws java.lang.Exception
Setup the administration message with the action to be performed and the parameters required by the action. MUST be implemented in subclass

Parameters:
parms - MQeFields object
Returns:
MQeAdminMsg object
Throws:
java.lang.Exception

setupActions

protected void setupActions()
Configure the valid set of actions for a particular type of resource. MUST be implemented in subclass.

Returns:
void

setupFields

protected void setupFields()
Setup the set of characteristics for a particular type of resource. MUST be implemented in subclass.

Returns:
void

setupNLS

protected void setupNLS()
Setup NLS names for characteristics of a particular type of resource.

Returns:
void

validateInput

public boolean validateInput()
                      throws java.lang.Exception
Validate the user's input.

Returns:
a boolean value
java.lang.Exception

getMessageHelp

public java.lang.String getMessageHelp()
Returns a string that provides information about the current frame. This is siaplyed in the south panel of the main admin gui when a frame is selected.

Returns:
String documenting the current frame.

Websphere MQ Everyplace