    All Examples

# package examples.workspace.monitor

##

- DestructionMonitor
- MirrorMonitor
- MonitorDemo
- RangeMonitor
- XXXMonitor

# about this package

This package contains four Monitor classes and a MonitorDemo class, which calls each of the four monitors to demonstrate how Monitors can be used on Workspace objects. The four Monitors are:

- `Destruction Monitor`, which submits an EventMessage to the WebLogic Server when a target object in a Workspace is destroyed.

- `MirrorMonitor`, which mirrors all the monitoring calls to `set` and `destroy` for the target object to another Workspace. This class implements both the SetMonitor and the DestroyMonitor interface.

- `Range Monitor`, which implements the `preSet()` method of the SetMonitor interface. It acts on a Workspace value before it is changed to determine if the range of an int is within 0-99; if not, it vetoes the `set` action by throwing a MonitorException.

- `XXXMonitor`, which demonstrates how to set up and use a Master Monitor. A Master Monitor can actually alter the target object's state, unless vetoed by other monitors of the object. You might use a class like this to compress or encrypt Workspace values before they are saved into the Workspace.

Monitors operate on Workspace objects. Your monitor class must implement one or more of the interfaces in `weblogic.common`, SetMonitor, GetMonitor, and DestroyMonitor. Objects that are targeted for Monitoring must implement one or more of the interfaces in `weblogic.common`, Setable, Getable, and Destroyable.

# how to use this package

### To set up this example:

1. Set up your development shell as described in Setting up your environment.

2. Compile these examples by following the instructions for each of the example pages listed at the top of this document.

3. Start WebLogic Server in a separate shell.

4. Run this example by executing the following command in your development shell:

   $ java examples.workspace.monitor.MonitorDemo t3://hostname:port

   Where hostname:port is the host name and port number of your WebLogic Server.

   MonitorDemo is the only class you will execute directly in this set of examples.

# there's more . . .

First check out the other Workspace-related examples, in the `examples/workspace/shared` and the `examples/workspace` directories.

Then read the section on using monitors in the Developers Guide, Using WebLogic Workspaces.

Copyright © 1997-2000 BEA Systems, Inc. All rights reserved.

Last updated 12/29/1998