Package org.apache.log4j.joran.spi

Examples of org.apache.log4j.joran.spi.SimpleRuleStore


    return getExecutionContext().getErrorList();
  }


  protected void selfInitialize(LoggerRepository repository) {
    RuleStore rs = new SimpleRuleStore(repository);
    rs.addRule(new Pattern("configuration"), new ConfigurationAction());
    rs.addRule(
      new Pattern("configuration/substitutionProperty"),
      new SubstitutionPropertyAction());
    rs.addRule(
      new Pattern("configuration/repositoryProperty"),
      new RepositoryPropertyAction());
    rs.addRule(
        new Pattern("configuration/conversionRule"),
        new ConversionRuleAction());
    rs.addRule(new Pattern("configuration/plugin"), new PluginAction());
    rs.addRule(new Pattern("configuration/logger"), new LoggerAction());
    rs.addRule(
      new Pattern("configuration/logger/level"), new LevelAction());
    rs.addRule(
      new Pattern("configuration/logger/priority"), new PriorityAction());
    rs.addRule(
      new Pattern("configuration/root"), new RootLoggerAction());
    rs.addRule(
      new Pattern("configuration/root/level"), new LevelAction());
    rs.addRule(
      new Pattern("configuration/root/priority"), new PriorityAction());
    rs.addRule(
      new Pattern("configuration/logger/appender-ref"),
      new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/root/appender-ref"),
      new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/appender"), new AppenderAction());
    rs.addRule(new Pattern("configuration/appender/appender-ref"),
        new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/appender/layout"), new LayoutAction());
    rs.addRule(
         new Pattern("configuration/jndiSubstitutionProperty"),
         new JndiSubstitutionPropertyAction());
    rs.addRule(
      new Pattern("configuration/newRule"), new NewRuleAction());
    rs.addRule(new Pattern("*/param"), new ParamAction());

    joranInterpreter = new Interpreter(rs);
    joranInterpreter.setLoggerRepository(repository);
   
    // The following line adds the capability to parse nested components
View Full Code Here


    return getExecutionContext().getErrorList();
  }


  protected void selfInitialize(LoggerRepository repository) {
    RuleStore rs = new SimpleRuleStore(repository);
    rs.addRule(new Pattern("configuration"), new ConfigurationAction());
    rs.addRule(
      new Pattern("configuration/substitutionProperty"),
      new SubstitutionPropertyAction());
    rs.addRule(
      new Pattern("configuration/repositoryProperty"),
      new RepositoryPropertyAction());
    rs.addRule(
        new Pattern("configuration/conversionRule"),
        new ConversionRuleAction());
    rs.addRule(new Pattern("configuration/plugin"), new PluginAction());
    rs.addRule(new Pattern("configuration/logger"), new LoggerAction());
    rs.addRule(
      new Pattern("configuration/logger/level"), new LevelAction());
    rs.addRule(
      new Pattern("configuration/logger/priority"), new PriorityAction());
    rs.addRule(
      new Pattern("configuration/root"), new RootLoggerAction());
    rs.addRule(
      new Pattern("configuration/root/level"), new LevelAction());
    rs.addRule(
      new Pattern("configuration/root/priority"), new PriorityAction());
    rs.addRule(
      new Pattern("configuration/logger/appender-ref"),
      new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/root/appender-ref"),
      new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/appender"), new AppenderAction());
    rs.addRule(new Pattern("configuration/appender/appender-ref"),
        new AppenderRefAction());
    rs.addRule(
      new Pattern("configuration/appender/layout"), new LayoutAction());
    rs.addRule(
         new Pattern("configuration/jndiSubstitutionProperty"),
         new JndiSubstitutionPropertyAction());
    rs.addRule(
      new Pattern("configuration/newRule"), new NewRuleAction());
    rs.addRule(new Pattern("*/param"), new ParamAction());

    joranInterpreter = new Interpreter(rs);
    joranInterpreter.setLoggerRepository(repository);
   
    // The following line adds the capability to parse nested components
View Full Code Here

*/
public class HelloWorld {
  public static void main(String[] args) throws Exception {
    // Create a simple rule store where pattern and action associations will
    // be kept.
    RuleStore ruleStore = new SimpleRuleStore();

    // Associate "hello-world" pattern with  HelloWorldAction
    ruleStore.addRule(new Pattern("hello-world"), new HelloWorldAction());

    // Create a new Joran Interpreter and hand it our simple rule store.
    Interpreter ji = new Interpreter(ruleStore);

    // Create a SAX parser
View Full Code Here

    // Uncomment the following line in order to enable log statements generated
    // from joran itself.
   
    // org.apache.log4j.BasicConfigurator.configure();
   
    RuleStore ruleStore = new SimpleRuleStore();

    // we start with the rule for the top-most (root) element
    ruleStore.addRule(new Pattern("*/foo"), new NOPAction());


    // Create a new Joran Interpreter and hand it our simple rule store.
    Interpreter ji = new Interpreter(ruleStore);

View Full Code Here

    // Uncomment the following line in order to enable log statements generated
    // from joran itself.
    // org.apache.log4j.BasicConfigurator.configure();
   
    // As usual, we create a simple rule store.
    RuleStore ruleStore = new SimpleRuleStore();

    // we start with the rule for the top-most (root) element
    ruleStore.addRule(new Pattern("*/computation"), new ComputationAction2());

    // Associate "/new-rule" pattern with NewRuleAction from the
    // org.apache.joran.action package.
    //
    // We will let the XML file to teach the Joran interpreter about new rules
    ruleStore.addRule(
      new Pattern("/computation/new-rule"), new NewRuleAction());

    // Create a new Joran Interpreter and hand it our simple rule store.
    Interpreter ji = new Interpreter(ruleStore);

View Full Code Here

 
 
  public static void main(String[] args) throws Exception {
    // Create a simple rule store where pattern and action associations will
    // be kept. This is a basic requirement before invoking a Joran Interpreter.
    RuleStore ruleStore = new SimpleRuleStore();

    // Associate "/computation" pattern with  ComputationAction1
    ruleStore.addRule(new Pattern("/computation"), new ComputationAction1());

    // Other associations
    ruleStore.addRule(new Pattern("/computation/literal"), new LiteralAction());
    ruleStore.addRule(new Pattern("/computation/add"), new AddAction());
    ruleStore.addRule(new Pattern("/computation/multiply"), new MultiplyAction());
   
    // Create a new Joran Interpreter and hand it our simple rule store.
    Interpreter ji = new Interpreter(ruleStore);

    // Create a SAX parser
View Full Code Here

* @author Ceki Güulcü
*/
public class Calculator2 {
  public static void main(String[] args) throws Exception {

    RuleStore ruleStore = new SimpleRuleStore();

    // Note the wild card character '*', in the paterns, signifying any level
    // of nesting.
    ruleStore.addRule(new Pattern("*/computation"), new ComputationAction2());

    ruleStore.addRule(new Pattern("*/computation/literal"), new LiteralAction());
    ruleStore.addRule(new Pattern("*/computation/add"), new AddAction());
    ruleStore.addRule(new Pattern("*/computation/multiply"), new MultiplyAction());
   
    // Create a new Joran Interpreter and hand it our simple rule store.
    Interpreter ji = new Interpreter(ruleStore);

    // Create a SAX parser
View Full Code Here

TOP

Related Classes of org.apache.log4j.joran.spi.SimpleRuleStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.