org.ejen.ext
Class Messenger

java.lang.Object
  |
  +--org.ejen.ext.Messenger

public class Messenger
extends Object

Messages utility (static methods).

Usage (XSL stylesheet)
  <?xml version="1.0" encoding="iso-8859-1"?>

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  ...
                  xmlns:msg="org.ejen.ext.Messenger"
                  extension-element-prefixes="msg ..."
                  exclude-result-prefixes="msg ..."
                  version="1.0">

    <xsl:output method="text" encoding="iso-8859-1"/>

    <xsl:template match="ejen">

      <msg:send message="Oop!"/>
      <msg:throwSQLException message="Table not found" code="0"/>
      <msg:throwRuntimeException message="Bug!"/>

    </xsl:template>

  </xsl:stylesheet>
 

Version:
1.0
Author:
F. Wolff

Constructor Summary
protected Messenger()
          Protected constructor (prevents instanciation).
 
Method Summary
static void send(XSLProcessorContext context, ElemExtensionCall elem)
          Sends a message to the current EjenListener.
static void throwRuntimeException(XSLProcessorContext context, ElemExtensionCall elem)
          Throws a RuntimeException.
static void throwSQLException(XSLProcessorContext context, ElemExtensionCall elem)
          Throws a SQLException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Messenger

protected Messenger()
Protected constructor (prevents instanciation).

Method Detail

send

public static void send(XSLProcessorContext context,
                        ElemExtensionCall elem)
Sends a message to the current EjenListener.


  <msg:send message="Hello {people[$i]/@name} !"/>
 

XSLT Attributes:
message [Mandatory/AVT] - message to be sent.

Parameters:
context - automatically passed by the xalan extension mechanism.
elem - automatically passed by the xalan extension mechanism.
Throws:
WrappedRuntimeException - with a XSL Exception if something goes wrong.

throwSQLException

public static void throwSQLException(XSLProcessorContext context,
                                     ElemExtensionCall elem)
                              throws SQLException
Throws a SQLException.


  <msg:throwSQLException message="Table not found" code="2"/>
 

XSLT Attributes:
message [Mandatory/AVT] - SQLException message.
code [Mandatory/AVT] - SQLException code.

Parameters:
context - automatically passed by the xalan extension mechanism.
elem - automatically passed by the xalan extension mechanism.
Throws:
SQLException - with supplied message/code.
WrappedRuntimeException - if one of 'message' or 'code' attributes is missing, or if 'code' cannot be parsed as an integer.

throwRuntimeException

public static void throwRuntimeException(XSLProcessorContext context,
                                         ElemExtensionCall elem)
Throws a RuntimeException.


  <msg:throwRuntimeException message="Didn't want to work anymore"/>
 

XSLT Attributes:
message [Mandatory/AVT] - RuntimeException message.

Parameters:
context - automatically passed by the xalan extension mechanism.
elem - automatically passed by the xalan extension mechanism.
Throws:
RuntimeException - with supplied message.
WrappedRuntimeException - if the 'message' attribute is missing.