Package org.apache.log4j.joran.spi

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


  public String toString() {
    return this.getClass().getName();
  }

  protected int getColumnNumber(ExecutionContext ec) {
    Interpreter jp = ec.getJoranInterpreter();
    Locator locator = jp.getLocator();
    if (locator != null) {
      return locator.getColumnNumber();
    }
    return -1;
  }
View Full Code Here


    }
    return -1;
  }

  protected int getLineNumber(ExecutionContext ec) {
    Interpreter jp = ec.getJoranInterpreter();
    Locator locator = jp.getLocator();
    if (locator != null) {
      return locator.getLineNumber();
    }
    return -1;
  }
View Full Code Here

         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
    joranInterpreter.addImplicitAction(new NestComponentIA());
    ExecutionContext ec = joranInterpreter.getExecutionContext();
View Full Code Here

         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
    joranInterpreter.addImplicitAction(new NestComponentIA());
    ExecutionContext ec = joranInterpreter.getExecutionContext();
View Full Code Here

  public String toString() {
    return this.getClass().getName();
  }

  protected int getColumnNumber(ExecutionContext ec) {
    Interpreter jp = ec.getJoranInterpreter();
    Locator locator = jp.getLocator();
    if (locator != null) {
      return locator.getColumnNumber();
    }
    return -1;
  }
View Full Code Here

    }
    return -1;
  }

  protected int getLineNumber(ExecutionContext ec) {
    Interpreter jp = ec.getJoranInterpreter();
    Locator locator = jp.getLocator();
    if (locator != null) {
      return locator.getLineNumber();
    }
    return -1;
  }
View Full Code Here

    // 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
    SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser saxParser = spf.newSAXParser();
View Full Code Here

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

    // --------------------------+
    // Add an implicit action.   |
    // --------------------------+
    ji.addImplicitAction(new PrintMeImplicitAction());
   
    // Create a SAX parser
    SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser saxParser = spf.newSAXParser();

    // Parse the file given as the application's first argument and
    // set the SAX ContentHandler to the Joran Interpreter we just created.
    saxParser.parse(args[0], ji);

    // The file has been parsed and interpreted. We now print any errors that
    // might have occured.
    List errorList = ji.getExecutionContext().getErrorList();

    if (errorList.size() > 0) {
      System.out.println("The following errors occured:");

      for (int i = 0; i < errorList.size(); i++) {
View Full Code Here

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

    // Create a SAX parser
    SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser saxParser = spf.newSAXParser();

    // Parse the file given as the application's first argument and
    // set the SAX ContentHandler to the Joran Interpreter we just created.
    saxParser.parse(args[0], ji);


    // The file has been parsed and interpreted. We now print any errors that
    // might have occured.
    List errorList = ji.getExecutionContext().getErrorList();

    if (errorList.size() > 0) {
      System.out.println("The following errors occured:");

      for (int i = 0; i < errorList.size(); i++) {
View Full Code Here

    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
    SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser saxParser = spf.newSAXParser();

    // Parse the file given as the application's first argument and
    // set the SAX ContentHandler to the Joran Interpreter we just created.
    saxParser.parse(args[0], ji);

    // The file has been parsed and interpreted. We now print any errors that
    // might have occured.
    List errorList = ji.getExecutionContext().getErrorList();
    if(errorList.size() > 0) {
      System.out.println("The following errors occured:");
      for(int i = 0; i < errorList.size(); i++) {
        System.out.println("\t"+errorList.get(i));
      }
View Full Code Here

TOP

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

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.