You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ce...@apache.org on 2004/12/08 16:58:18 UTC

cvs commit: logging-log4j/src/java/org/apache/joran/action Action.java

ceki        2004/12/08 07:58:18

  Modified:    examples/src/joran/implicit PrintMe.java
               tests/src/java/org/apache/joran InterpreterTest.java
               src/java/org/apache/joran/action Action.java
  Added:       tests/src/java/org/apache/log4j/joran NOPAction.java
  Log:
  - Added NOPAction in /tests/
  - Resussicated NOPAction in examples
  - Removed NOP_ACTION in Action.
  
  Revision  Changes    Path
  1.5       +1 -2      logging-log4j/examples/src/joran/implicit/PrintMe.java
  
  Index: PrintMe.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/examples/src/joran/implicit/PrintMe.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PrintMe.java	5 Dec 2004 21:43:03 -0000	1.4
  +++ PrintMe.java	8 Dec 2004 15:58:18 -0000	1.5
  @@ -19,7 +19,6 @@
   import org.apache.joran.Interpreter;
   import org.apache.joran.Pattern;
   import org.apache.joran.RuleStore;
  -import org.apache.joran.action.Action;
   import org.apache.joran.helper.SimpleRuleStore;
   
   import java.util.List;
  @@ -49,7 +48,7 @@
       RuleStore ruleStore = new SimpleRuleStore();
   
       // we start with the rule for the top-most (root) element
  -    ruleStore.addRule(new Pattern("*/foo"), Action.NOP_ACTION);
  +    ruleStore.addRule(new Pattern("*/foo"), new NOPAction());
   
   
       // Create a new Joran Interpreter and hand it our simple rule store.
  
  
  
  1.1                  logging-log4j/tests/src/java/org/apache/log4j/joran/NOPAction.java
  
  Index: NOPAction.java
  ===================================================================
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.log4j.joran;
  
  import org.apache.joran.ExecutionContext;
  import org.apache.joran.action.Action;
  
  import org.xml.sax.Attributes;
  
  
  
  /**
   * No operation (NOP) action that does strictly nothing. 
   *  
   * @author Ceki Gülcü
   */
  public class NOPAction extends Action {
    
    public void begin(ExecutionContext ec, String name, Attributes attributes) {
    }
  
  
    public void end(ExecutionContext ec, String name) {
    }
  }
  
  
  
  1.12      +4 -4      logging-log4j/tests/src/java/org/apache/joran/InterpreterTest.java
  
  Index: InterpreterTest.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/tests/src/java/org/apache/joran/InterpreterTest.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- InterpreterTest.java	8 Dec 2004 15:48:25 -0000	1.11
  +++ InterpreterTest.java	8 Dec 2004 15:58:18 -0000	1.12
  @@ -26,7 +26,6 @@
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
   
  -import org.apache.joran.action.Action;
   import org.apache.joran.action.NestComponentIA;
   import org.apache.joran.action.NewRuleAction;
   import org.apache.joran.action.ParamAction;
  @@ -40,6 +39,7 @@
   import org.apache.log4j.LogManager;
   import org.apache.log4j.Logger;
   import org.apache.log4j.PatternLayout;
  +import org.apache.log4j.joran.NOPAction;
   import org.apache.log4j.joran.action.ActionConst;
   import org.apache.log4j.joran.action.AppenderAction;
   import org.apache.log4j.joran.action.AppenderRefAction;
  @@ -163,9 +163,9 @@
   
       RuleStore rs = new SimpleRuleStore();
       
  -    rs.addRule(new Pattern("log4j:configuration"), Action.NOP_ACTION);
  +    rs.addRule(new Pattern("log4j:configuration"), new NOPAction());
       rs.addRule(new Pattern("log4j:configuration/logger"), new LoggerAction());
  -    rs.addRule(new Pattern("*/appender-ref"), Action.NOP_ACTION);
  +    rs.addRule(new Pattern("*/appender-ref"), new NOPAction());
       rs.addRule(
         new Pattern("log4j:configuration/logger/level"), new LevelAction());
       rs.addRule(
  @@ -209,7 +209,7 @@
     public void testParsing2() throws Exception {
       logger.debug("Starting testLoop2");
       RuleStore rs = new SimpleRuleStore();
  -    rs.addRule(new Pattern("log4j:configuration"), Action.NOP_ACTION);
  +    rs.addRule(new Pattern("log4j:configuration"), new NOPAction());
       rs.addRule(new Pattern("log4j:configuration/logger"), new LoggerAction());
       rs.addRule(
         new Pattern("log4j:configuration/logger/level"), new LevelAction());
  
  
  
  1.19      +0 -6      logging-log4j/src/java/org/apache/joran/action/Action.java
  
  Index: Action.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/joran/action/Action.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Action.java	5 Dec 2004 21:43:03 -0000	1.18
  +++ Action.java	8 Dec 2004 15:58:18 -0000	1.19
  @@ -47,12 +47,6 @@
     public static final String PATTERN_ATTRIBUTE = "pattern";
     public static final String ACTION_CLASS_ATTRIBUTE = "actionClass";
   
  -  public static final Action NOP_ACTION = 
  -    new Action() {
  -      public void begin(ExecutionContext ec, String name, Attributes attributes) {}
  -      public void end(ExecutionContext ec, String name) {}
  -    };
  -
     /*
      * An inststance specific logger. 
      */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org