1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework.
3    * 
4    * Copyright (C) 1999-2006, QOS.ch
5    * 
6    * This library is free software, you can redistribute it and/or modify it under
7    * the terms of the GNU Lesser General Public License as published by the Free
8    * Software Foundation.
9    */
10  package ch.qos.logback.core.joran.action.ext;
11  
12  import org.xml.sax.Attributes;
13  
14  import ch.qos.logback.core.joran.action.Action;
15  import ch.qos.logback.core.joran.spi.InterpretationContext;
16  
17  
18  
19  public class HelloAction extends Action {
20  
21  
22    static final public String PROPERTY_KEY = "name";
23    
24    public HelloAction() {
25    }
26    /**
27     * Instantiates an layout of the given class and sets its name.
28     *
29     */
30    public void begin(InterpretationContext ec, String name, Attributes attributes) {
31      String str = "Hello "+attributes.getValue("name")+".";
32      ec.getContext().putProperty(PROPERTY_KEY, str);
33    }
34  
35    /**
36     * Once the children elements are also parsed, now is the time to activate
37     * the appender options.
38     */
39    public void end(InterpretationContext ec, String name) {
40    }
41  }