Syslog White Paper FAQ Examples JavaDoc Classloader
Protomatter Software v1.1.7

com.protomatter.syslog.xml
Class JDK14PerChannelPolicy_Helper

java.lang.Object
  |
  +--com.protomatter.syslog.xml.SimpleLogPolicy_Helper
        |
        +--com.protomatter.syslog.xml.JDK14PerChannelPolicy_Helper
All Implemented Interfaces:
XMLConfigHelper

public class JDK14PerChannelPolicy_Helper
extends SimpleLogPolicy_Helper

XML configuration helper for JDK14PerChannelPolicy.


Constructor Summary
JDK14PerChannelPolicy_Helper()
           
 
Method Summary
 void configure(java.lang.Object o, org.jdom.Element e)
          Configure this policy given the XML element.
 void configureGroup(JDK14PerChannelPolicy.PolicyGroup g, org.jdom.Element e)
           
 org.jdom.Element getConfiguration(java.lang.Object o, org.jdom.Element element)
          Encode the given object's configuration into the given XML element.
 org.jdom.Element getConfigurationGroup(JDK14PerChannelPolicy.PolicyGroup g, org.jdom.Element element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDK14PerChannelPolicy_Helper

public JDK14PerChannelPolicy_Helper()
Method Detail

configure

public void configure(java.lang.Object o,
                      org.jdom.Element e)
               throws SyslogInitException
Configure this policy given the XML element. This class inherits the policy element parameters that SimpleLogPolicy_Helper understands. The additional Policy elements should look like this:



  <Policy class="com.protomatter.syslog.JDK14PerChannelPolicy" >

    <!--
     Config params from SimpleLogPolicy_Helper can
     get inserted here.
    -->

    <PolicyGroup>

      <!--
       Config params from SimpleLogPolicy_Helper can
       get inserted here.
      -->

      <channelPattern>ChannelPattern-1</channelPattern>
      <channelPattern>ChannelPattern-2</channelPattern>
      ...
      <channelPattern>ChannelPattern-N</channelPattern>

      <channelName>ChannelName-1</channelName>
      <channelName>ChannelName-2</channelName>
      ...
      <channelName>ChannelName-N</channelName>
    </PolicyGroup>

    <!-- Insert more PolicyGroups here -->

  </Policy>
  

This class basically reads each <PolicyGroup> element and creates a new PolicyGroup instance and configures that instance with the <PolicyGroup> element.

If none of the pattern groups has anything to say about logging the message, the decision is deferred to the superclass and it makes the decision based on the log mask and channel information that was defined in the enclosing Policy element.

Element
name value required
PolicyGroup See PolicyGroup docs. no

The following example should explain things better:



  <Policy class="com.protomatter.syslog.JDK14PerChannelPolicy" >

    <!--
     Defaults -- if none of the groups below match,
     then only allow messages at or above the WARNING level.
    -->
    <logMask>WARNING</logMask>
    <channels>ALL_CHANNEL</channels>

    <!--
     Log DEBUG and above messages for messages coming from
     the com.protomatter.xml.* and com.protomatter.jdbc.*
     packages, and from the com.protomatter.util.Mutex channel.
    -->
    <PolicyGroup>
      <logMask>DEBUG</logMask>
      <channels>ALL_CHANNEL</channels>

      <channelPattern>com.protomatter.xml.*</channelPattern>
      <channelPattern>com.protomatter.jdbc.*</channelPattern>

      <channelName>com.protomatter.util.Mutex</channelName>
    </PolicyGroup>

    <!--
     Log INFO and above messages for messages coming from
     the com.protomatter.pas.* and com.protomatter.util.*
     packages, and from the com.protomatter.jdbc.pool channel.
    -->
    <PolicyGroup>
      <logMask>INFO</logMask>
      <channels>ALL_CHANNEL</channels>

      <channelPattern>com.protomatter.pas.*</channelPattern>
      <channelPattern>com.protomatter.util.*</channelPattern>

      <channelName>com.protomatter.jdbc.pool</channelName>
    </PolicyGroup>

    <!--
     If the channel name contains the word "Debug" then allow
     messages at or above the ERROR level.
    -->
    <PolicyGroup>
      <logMask>ERROR</logMask>
      <channels>ALL_CHANNEL</channels>

      <channelPattern>*Debug*</channelPattern>
    </PolicyGroup>

  </Policy>
  

Overrides:
configure in class SimpleLogPolicy_Helper

configureGroup

public void configureGroup(JDK14PerChannelPolicy.PolicyGroup g,
                           org.jdom.Element e)
                    throws SyslogInitException

getConfiguration

public org.jdom.Element getConfiguration(java.lang.Object o,
                                         org.jdom.Element element)
Description copied from interface: XMLConfigHelper
Encode the given object's configuration into the given XML element.
Overrides:
getConfiguration in class SimpleLogPolicy_Helper

getConfigurationGroup

public org.jdom.Element getConfigurationGroup(JDK14PerChannelPolicy.PolicyGroup g,
                                              org.jdom.Element element)

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7