Oracle GlassFish Server 3.0.1 Add-On Component Development Guide

Defining an Event Provider by Writing an XML Fragment

To define an event provider, write an extensible markup language (XML) fragment that contains a single probe-provider element.

To create a name space for event providers and to uniquely identify an event provider to the monitoring infrastructure of GlassFish Server, set the attributes of the probe-provider element as follows:

moduleProviderName

Your choice of text to identify the application to which the event provider belongs. The value of the moduleProviderName attribute is not required to be unique.

For example, for event providers from Oracle GlassFish Server, moduleProviderName is glassfish.

moduleName

Your choice of name for the module for which the event provider is defined. A module provides significant functionality of an application. The value of the moduleName attribute is not required to be unique.

In GlassFish Server, examples of module names are web-container, ejb-container, transaction, and webservices.

probeProviderName

Your choice of name to identify the event provider. To uniquely identify the event provider, ensure that probeProviderName is unique for all event providers in the same module.

In GlassFish Server, examples of event—provider names are jsp, servlet, and web-module.

Within the probe-provider element, add one probe element for each event type that you are defining. To identify the event type, set the name attribute of the probe element to the type.

To define the characteristics of each event type, add the following elements within the probe element:

class

This element contains the fully qualified Java class name of the component that generates the statistics for which you are defining events.

method

This element contains the name of the method that is invoked to generate the statistic.

signature

This element contains the following information about the signature if the method:

return-type (paramater-type-list)
return-type

The return type of the method.

paramater-type-list

A comma-separated- list of the types of the parameters in the method signature.

probe-param

The attributes of this element identify the type and the name of a parameter in the method signature. One probe-param element is required for each parameter in the method signature. The probe-param element does not contain any data.

The attributes of the probe-param element are as follows:

type

Specifies the type of the parameter.

name

Specifies the name of the parameter.

return-param

The type attribute of this element specifies the return type of the method. The return-param element does not contain any data.


Example 5–2 Defining an Event Provider by Writing an XML Fragment

This example defines an event provider for the glassfish:web:jsp component. The Java class of this component is com.sun.enterprise.web.jsp.JspProbeEmitterImpl. The event provider defines one event of type jspLoadedEvent. The signature of the method that is associated with this event is as follows:

void jspLoaded (String jsp, String hostName)
<probe-provider moduleProviderName="glassfish" moduleName="web" probeProviderName="jsp" >
    <probe name="jspLoadedEvent">
       <class>com.sun.enterprise.web.jsp.JspProbeEmitterImpl</class>
       <method>jspLoaded</method>
       <signature>void (String,String)</signature>
       <probe-param type="String" name="jsp"/>
       <probe-param type="String" name="hostName"/>
       <return-param type="void" />
    </probe>
</probe-provider>