A monitoring framework in OGSA-DAI monitors events emitted by activities and pipes during execution of a request by the activity framework. For example, a monitoring framework could be created to monitor data flow during the execution of a request and display progress graphically. A monitoring framework could be used for auditing or debugging purposes.
Monitoring frameworks implement the:
uk.org.ogsadai.monitoring.MonitoringFramework
interface. This interface supports the following operations:
public void registerListeners(RequestDescriptor requestDescriptor,
OGSADAIRequestConfiguration requestContext);
Register listeners on a given request context. This method allows the
monitoring framework to register different listeners depending on both
the actual request itself and the context of the request.
A request context of type
OGSADAIRequestConfiguration provides
two methods that can be used by the monitoring framework to register
coponents that will listen for events from the activity framework.
registerActivityListener
- activity listeners implement the
uk.org.ogsadai.activity.event.ActivityListener
interface
and, when registered in the request context with this method, are
notified of events that occur during the processing of an activity.
registerPipeListener - pipe listeners
implement the
uk.org.ogsadai.activity.event.PipeListener
interface and are notified of pipe events such as when a block is
written or read, and when the pipe is closed, terminated or an error
occurred.
Depending upon the implementation of the monitoring framework it could
register other components that implement either or both of
ActivityListener and
PipeListener interfaces or it could
also implement these interfaces itself and handle the actual events
itself.
OGSA-DAI, by default, distributes the following class that implements the
MonitoringFramework interface:
uk.org.ogsadai.monitoring.NullMonitoringFramework
which does not register any listeners.
To write an OGSA-DAI monitoring framework you need to provide an implementation of the interface:
uk.org.ogsadai.monitoring.MonitoringFramework
You will need to make the following decisions:
A monitoring framework will usually provide its own implementations of activity listeners and pipe listeners which process activity and pipe events as required. The framework creates and registers listeners as appropriate. To make implementations of listeners available you need to place the the listener classes available to the OGSA-DAI server as a JAR file.
A further option is for the monitoring framework to register listeners
that implement the
uk.org.ogsadai.resource.event.ResourceManagerEventListener
interface with the OGSA-DAI resource manager. The OGSA-DAI resource
manager can be acquired from the OGSA-DAI context
(see Section G.2, “OGSA-DAI context”) via the following code:
OGSADAIContext context = OGSADAIContext.getInstance(); ResourceManager manager = context.getResourceManager(); manager.addResourceManagerEventListener(myComponent);
These listeners will then be informed whenever OGSA-DAI resources are added to or removed from the OGSA-DAI resource manager. This can be useful for monitoring the creation and removal of session, request, data source, data sink and data resources.
Once a monitoring framework has been written an OGSA-DAI server can be configured to use the framework to register listeners on the request context and perform other monitoring tasks as described.
A monitoring framework may be specified as part of the JNDI
configuration but this is optional. If the OGSA-DAI server can access
in its OGSADAI context a monitoring framework with ID
uk.org.ogsadai.MONITORING_FRAMEWORK
and which implements the interface
uk.org.ogsadai.monitoring.MonitoringFramework
then it will load and use this monitoring framework.
If no monitoring framework is specified then the default
uk.org.ogsadai.monitoring.NullMonitoringFramework is created
and used.
Section 18.9, “Miscellaneous objects” describes how to add miscellaneous objects to the OGSA-DAI context.
type attribute of the JNDI entry for
the monitoring framework to specify the class of the monitoring
framework you want to use.
The following example shows a JNDI configuration if your monitoring
framework implementation was called
com.example.LoggingMonitoringFramework.
In OGSA-DAI GT the monitoring framework is declared as follows:
<resource name="ogsadai/misc/uk.org.ogsadai.MONITORING_FRAMEWORK"
type="com.example.LoggingMonitoringFramework">
<resourceParams>
<parameter>
<name>factory</name>
<value>org.globus.wsrf.jndi.BeanFactory</value>
</parameter>
</resourceParams>
</resource>