Clover coverage report - Common - 1.0.0
Coverage timestamp: sam. déc. 27 2003 15:13:46 CET
file stats: LOC: 130   Methods: 6
NCLOC: 59   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
LoadHandler.java 0% 0% 0% 0%
coverage
 1   
 /*
 2   
  * EJTools, the Enterprise Java Tools
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at www.gnu.org.
 6   
  */
 7   
 package org.ejtools.util.state;
 8   
 
 9   
 import java.util.HashMap;
 10   
 import java.util.Hashtable;
 11   
 import java.util.Map;
 12   
 
 13   
 import org.xml.sax.Attributes;
 14   
 import org.xml.sax.SAXException;
 15   
 import org.xml.sax.helpers.DefaultHandler;
 16   
 
 17   
 
 18   
 /**
 19   
  * @author    Laurent Etiemble
 20   
  * @version   $Revision: 1.2 $
 21   
  */
 22   
 public class LoadHandler extends DefaultHandler
 23   
 {
 24   
    /** Description of the Field */
 25   
    private Map context = new HashMap();
 26   
    /** Description of the Field */
 27   
    private String path = "";
 28   
    /** Description of the Field */
 29   
    private Map rules = new Hashtable();
 30   
 
 31   
    /** Description of the Field */
 32   
    public final static String ATTRIBUTES = "ATTRIBUTES";
 33   
    /** Description of the Field */
 34   
    public final static String ELEMENT = "ELEMENT";
 35   
    /** Description of the Field */
 36   
    public final static String TEXT = "TEXT";
 37   
 
 38   
 
 39   
    /**Constructor for the WorkbenchHandler object */
 40  0
    public LoadHandler() { }
 41   
 
 42   
 
 43   
    /**
 44   
     * Adds a feature to the Rule attribute of the WorkbenchHandler object
 45   
     *
 46   
     * @param path  The feature to be added to the Rule attribute
 47   
     * @param rule  The feature to be added to the Rule attribute
 48   
     */
 49  0
    public void addRule(String path, Rule rule)
 50   
    {
 51  0
       this.rules.put(path, rule);
 52   
    }
 53   
 
 54   
 
 55   
    /**
 56   
     * Description of the Method
 57   
     *
 58   
     * @param ch                Description of the Parameter
 59   
     * @param start             Description of the Parameter
 60   
     * @param length            Description of the Parameter
 61   
     * @exception SAXException  Description of the Exception
 62   
     */
 63  0
    public void characters(char[] ch, int start, int length)
 64   
       throws SAXException
 65   
    {
 66  0
       String text = new String(ch, start, length);
 67  0
       this.context.put("TEXT", text);
 68  0
       Rule rule = (Rule) this.rules.get(this.path);
 69  0
       if (rule != null)
 70   
       {
 71  0
          rule.loadBody(this.context);
 72   
       }
 73   
    }
 74   
 
 75   
 
 76   
    /**
 77   
     * Description of the Method
 78   
     *
 79   
     * @param uri               Description of the Parameter
 80   
     * @param localName         Description of the Parameter
 81   
     * @param qName             Description of the Parameter
 82   
     * @exception SAXException  Description of the Exception
 83   
     */
 84  0
    public void endElement(String uri, String localName, String qName)
 85   
       throws SAXException
 86   
    {
 87  0
       this.context.put("ELEMENT", qName);
 88  0
       Rule rule = (Rule) this.rules.get(this.path);
 89  0
       if (rule != null)
 90   
       {
 91  0
          rule.loadExit(this.context);
 92   
       }
 93  0
       this.path = this.path.substring(0, this.path.length() - qName.length() - 1);
 94   
    }
 95   
 
 96   
 
 97   
    /**
 98   
     * Gets the context attribute of the LoadHandler object
 99   
     *
 100   
     * @return   The context value
 101   
     */
 102  0
    public Map getContext()
 103   
    {
 104  0
       return this.context;
 105   
    }
 106   
 
 107   
 
 108   
    /**
 109   
     * Description of the Method
 110   
     *
 111   
     * @param uri               Description of the Parameter
 112   
     * @param localName         Description of the Parameter
 113   
     * @param qName             Description of the Parameter
 114   
     * @param attributes        Description of the Parameter
 115   
     * @exception SAXException  Description of the Exception
 116   
     */
 117  0
    public void startElement(String uri, String localName, String qName, Attributes attributes)
 118   
       throws SAXException
 119   
    {
 120  0
       this.context.put("ELEMENT", qName);
 121  0
       this.context.put("ATTRIBUTES", attributes);
 122  0
       this.path = path + "/" + qName;
 123  0
       Rule rule = (Rule) this.rules.get(this.path);
 124  0
       if (rule != null)
 125   
       {
 126  0
          rule.loadEnter(this.context);
 127   
       }
 128   
    }
 129   
 }
 130