ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzatz_5.4.0.1/51/program/jrasxtf.htm

75 lines
7.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Extending the JRas framework</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h4><a name="JRasextf"></a>Extending the JRas framework</h4>
<p>Since the JRas extensions classes do not provide the flexibility and behavior required for many scenarios, a variety of extension points have been defined. You are allowed to write your own implementation classes to obtain the required behavior.</p>
<p>In general, the JRas extensions require you to call the Manager class to obtain a message logger or trace logger. No provision is made to allow you to provide your own message or trace logger subclasses. In general, user-provided extensions cannot be used to affect the integrated mode of operation.The behavior of the integrated mode of operation is solely determined by the WebSphere Application Server runtime and the JRas extensions classes.</p>
<p>
<strong>Handlers</strong></p>
<p>The standalone JRas logging toolkit defines the RASIHandler interface. All handlers must implement this interface. You can write your own handler classes that implement the RASIHandler interface. You should directly create instances of user-defined handlers and add them to the loggers obtained from the Manager.</p>
<p>The standalone JRas logging toolkit provides several handler implementation classes. These handler classes are inappropriate for usage in the J2EE environment. You cannot directly use or subclass any of the Handler classes provided by the standalone JRas logging toolkit. Doing so is a violation of the programming model.</p>
<p><strong>Formatters</strong></p>
<p>
The standalone JRas logging toolkit defines the RASIFormatter interface. All formatters must implement this interface. You can write your own formatter classes that implement the RASIFormatter interface. You can only add these classes to a user-defined handler. WebSphere Application Server - Express handlers cannot be configured to use user-defined formatters. Instead, directly create instances of your formatters and add them to the your handlers appropriately.</p>
<p>As with handlers, the standalone JRas logging toolkit provides several formatter implementation classes. Direct usage of these formatter classes is not supported.</p>
<p><strong>Message event types</strong></p>
<p>The standalone JRas toolkit defines message event types in the RASIMessageEvent interface. In addition, the WebSphere Application Server - Express reserves a range of message event types for future use. The RASIMessageEvent interface defines three types, with values of 0x01, 0x02, and 0x04. The values 0x08 through 0x8000 are reserved for future use. You can provide your own message event types by extending this interface appropriately. User-defined message types must have a value of 0x1000 or greater.</p>
<p>Message loggers retrieved from the Manager have their message masks set to pass or process all message event types defined in the RASIMessageEvent interface. In order to process user-defined message types, you must manually set the message logger mask to the appropriate state by user code after the message logger has been obtained from the Manager. WebSphere Application Server - Express does not provide any built-in systems management support for managing any message types.</p>
<p><strong>Message event objects</strong></p>
<p>
The standalone JRas toolkit provides a RASMessageEvent implementation class. When a message logging method is called on the message logger, and the message type is currently enabled, the logger creates and distributes an event of this class to all handlers currently registered with that logger.</p>
<p>You can provide your own message event classes, but they must implement the RASIEvent interface. You must directly create instances of such user-defined message event classes. Once it is created, pass your message event to the message logger by calling the message logger's fireRASEvent() method directly. WebSphere Application Server - Express message loggers cannot directly create instances of user-defined types in response to calling a logging method (msg(), message()...) on the logger. In addition, instances of user-defined message types are never processed by the WebSphere Application Server - Express handler. You cannot create instances of the RASMessageEvent class directly.</p>
<p><strong>Trace event types</strong></p>
<p>The standalone JRas toolkit defines trace event types in the RASITraceEvent interface. You can provide your own trace event types by extending this interface appropriately. In such a case you must ensure that the values for the user-defined trace event types do not collide with the values of the types defined in the RASITraceEvent interface.</p>
<p>Trace loggers retrieved from the Manager typically have their trace masks set to reject all types. A different starting state can be specified by using WebSphere Application Server - Express systems management facilities. In addition, the state of the trace mask for a logger can be changed at runtime using WebSphere Application Server - Express systems management facilities.</p>
<p>In order to process user-defined trace types, the trace logger mask must be manually set to the appropriate state by user code. WebSphere Application Server - Express systems management facilities cannot be used to manage user-defined trace types, either at start time or runtime.</p>
<p><strong>Trace event objects</strong></p>
<p>The standalone JRas toolkit provides a RASTraceEvent implementation class. When a trace logging method is called on the WebSphere Application Server - Express trace logger and the type is currently enabled, the logger creates and distributes an event of this class to all handlers currently registered with that logger.</p>
<p>You can provide your own trace event classes. Such trace event classes must implement the RASIEvent interface. You must create instances of such user-defined event classes directly. Once it is created, pass the trace event to the trace logger by calling the trace logger's fireRASEvent() method directly. WebSphere Application Server - Express trace loggers cannot directly create instances of user-defined types in response to calling a trace method (entry(), exit(), trace()) on the trace logger. In addition, instances of user-defined trace types are never processed by the WebSphere Application Server - Express handler. You cannot create instances of the RASTraceEvent class directly.</p>
<p><strong>User defined types, user defined events and WebSphere Application Server - Express</strong></p>
<p>By definition, the WebSphere Application Server - Express handler will process user-defined message or trace types, or user-defined message or trace event classes. Message and trace entries of either a user-defined type or user-defined event class cannot be written to the WebSphere Application Server - Express runtime logs.</p>
<p>For more information about extending the JRas framework, see the following topics:</p>
<ul>
<li><p><strong><a href="jraswue.htm">Writing User Extensions</a></strong>
<br>This topic describes how to write user written handlers and formatters.</p></li>
<li><p><strong><a href="jrasuwh.htm">Example: user written handler</a></strong>
<br>This topic gives an example of a user written handler class that writes formatted events to a file.</p></li>
<li><p><strong><a href="jrasuwf.htm">Example: user written formatter</a></strong>
<br>This topic gives an example of a user written formatter class.</p></li>
</ul>
</body>
</html>