All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class examples.recover.CounterBean

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----examples.recover.CounterBean

public class CounterBean
extends Frame
implements Runnable, ActivatableIf
This class is a simple m-bean that implements a counter. The counter is incremented through the framework to ensure that the repository is updated. To be registered with the Restart service it implements the ActivatableIf interface. The counter is displayed in a small frame on the screen. If the frame is closed the agent will be stopped with the counter.

See Also:
RecoveryRepSrv

Constructor Index

 o CounterBean()
Default constructor.

Method Index

 o deleteCmf()
Calls the performStop method if counter is active.
 o draw(Graphics)
Draws the counter.
 o getCount()
Gets the count value of the counter.
 o init()
Initializes the counter.
 o initCmf(Framework, ObjectName, boolean, ModificationList)
Initializes this m-bean and calls the performStart() method to start the counter thread.
 o isActive()
Tests if the counter is active.
 o paint(Graphics)
Paints the counter.
 o performStart()
Starts the counter.
 o performStop()
Stops the counter.
 o processEvent(AWTEvent)
Processes events occurring on the counter.
 o processMouseEvent(MouseEvent)
Processes mouse events occurring on the counter.
 o run()
Increments the counter and update the counter display.
 o setCount(int)
Sets the count value of the counter.
 o update(Graphics)
Updates the counter.

Constructors

 o CounterBean
 public CounterBean()
Default constructor.

Methods

 o initCmf
 public void initCmf(Framework cmf,
                     ObjectName name,
                     boolean db,
                     ModificationList list) throws InstanceAlreadyExistException
Initializes this m-bean and calls the performStart() method to start the counter thread.
For internal use only.

Parameters:
cmf - The core management framework to register the service with.
name - Object name.
db - Indicates if persistent storage is required.
list - The modification list to use for setting up parameters.
Throws: InstanceAlreadyExistException
The m-bean is already registered in the repository.
 o deleteCmf
 public void deleteCmf()
Calls the performStop method if counter is active.

 o performStart
 public void performStart()
Starts the counter.

 o performStop
 public void performStop()
Stops the counter.

 o isActive
 public boolean isActive()
Tests if the counter is active.

Returns:
Returns true if the counter is active, otherwise false.
Overrides:
isActive in class Window
 o setCount
 public void setCount(int count)
Sets the count value of the counter.

Parameters:
count - The new counter value.
 o getCount
 public int getCount()
Gets the count value of the counter.

Returns:
A snap shot of the counter value.
 o run
 public void run()
Increments the counter and update the counter display.

 o init
 public void init()
Initializes the counter.

 o update
 public void update(Graphics g)
Updates the counter.

Parameters:
g - The graphics context to use for printing.
Overrides:
update in class Container
 o draw
 public void draw(Graphics g)
Draws the counter.

Parameters:
g - The graphics context to use for printing.
 o paint
 public void paint(Graphics g)
Paints the counter.

Parameters:
g - The graphics context to use for printing.
Overrides:
paint in class Container
 o processMouseEvent
 public void processMouseEvent(MouseEvent e)
Processes mouse events occurring on the counter.

Parameters:
The - mouse event.
Overrides:
processMouseEvent in class Component
 o processEvent
 public void processEvent(AWTEvent e)
Processes events occurring on the counter.

Parameters:
e - The event.
Overrides:
processEvent in class Window

All Packages  Class Hierarchy  This Package  Previous  Next  Index