Package org.apache.joran

Examples of org.apache.joran.RuleStore


*/
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


 
 
  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

    // 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

* @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

    // 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

      detachListAppender(repository);
    }
  }

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

    joranInterpreter = new Interpreter(rs);

    // We need to bother with an entity resolver in order to be compatible
    // with config files written for DOMConfigurator containing the following:
View Full Code Here

TOP

Related Classes of org.apache.joran.RuleStore

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.