1   /**
2    * Logback: the generic, reliable, fast and flexible logging framework for Java.
3    * 
4    * Copyright (C) 2000-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  
11  package ch.qos.logback.core.joran.event;
12  
13  import java.util.ArrayList;
14  import java.util.List;
15  
16  import org.xml.sax.Attributes;
17  
18  import ch.qos.logback.core.joran.action.Action;
19  import ch.qos.logback.core.joran.spi.ActionException;
20  import ch.qos.logback.core.joran.spi.InterpretationContext;
21  
22  public class ListenAction extends Action implements InPlayListener {
23  
24    List<SaxEvent> seList = new ArrayList<SaxEvent>();
25  
26    @Override
27    public void begin(InterpretationContext ec, String name, Attributes attributes)
28        throws ActionException {
29      ec.addInPlayListener(this);
30    }
31  
32    @Override
33    public void end(InterpretationContext ec, String name) throws ActionException {
34      ec.removeInPlayListener(this);
35  
36    }
37  
38    public void inPlay(SaxEvent event) {
39      seList.add(event);
40    }
41  
42    public List<SaxEvent> getSeList() {
43      return seList;
44    }
45  
46  }