cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject cvs commit: xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types Attribute.java BooleanConverter.java BooleanResult.java NumericConverter.java NumericResult.java Validator.java
Date Wed, 26 Feb 2003 22:52:41 GMT
stefano     2003/02/26 14:52:41

  Added:       src/blocks/poi/java/org/apache/cocoon/components/elementprocessor
                        CannotCreateElementProcessorException.java
                        ElementProcessor.java ElementProcessorFactory.java
                        LocaleAware.java
               src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types
                        Attribute.java BooleanConverter.java
                        BooleanResult.java NumericConverter.java
                        NumericResult.java Validator.java
  Log:
  moved to poi block
  
  Revision  Changes    Path
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/CannotCreateElementProcessorException.java
  
  Index: CannotCreateElementProcessorException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor;
  
  
  
      /**
       * Exception to be thrown when an ElementProcessor cannot be created.
       *
       * @author Marc Johnson (marc_johnson27591@hotmail.com)
       */
  
      public class CannotCreateElementProcessorException
          extends Exception
      {
          private String _element_name;
          private String _reason;
  
          /**
           * Constructor
           *
           * @param reason a simple explanation why the specified
           *               ElementProcessor could not be created.
           */
  
          public CannotCreateElementProcessorException(final String reason)
          {
              _element_name = null;
              _reason       = (reason == null) ? ""
                                               : reason;
          }
  
          public void setElementName(final String name)
          {
              _element_name = name;
          }
  
          /**
           * override of Throwable's getMessage; allows us to format it
           * with the element name
           *
           * @return a succinct but useful message describing the
           *         problem and which element name we couldn't handle.
           */
  
          public String getMessage()
          {
              StringBuffer buffer = new StringBuffer();
  
              buffer.append("Could not create ElementProcessor for element ");
              buffer.append(_element_name);
              buffer.append(" ");
              if (_reason.length() != 0)
              {
                  buffer.append("(").append(_reason).append(")");
              }
              return buffer.toString();
          }
      }   // end public class CannotCreateElementProcessorExcepti
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/ElementProcessor.java
  
  Index: ElementProcessor.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor;
  
  import org.apache.cocoon.components.elementprocessor.types.Attribute;
  
  import java.io.IOException;
  
  /**
   * The ElementProcessor interface defines behavior for classes that
   * can handle a particular XML element's content.
   * <br>
   * The life cycle of an ElementProcessor instance is:
   * <ol>
   *     <li>Creation
   *     <li>Initialization via a call to initialize
   *     <li>Acquisition of element data via calls to acceptCharacters
   *         and acceptWhitespaceCharacters
   *     <li>Completion of processing via a call to endProcessing
   * </ol>
   * In response to a startElement event, the POIFSSerializer creates an
   * ElementProcessor, delegating the act of creation to an
   * ElementProcessorFactory, and then initializes the
   * ElementProcessor. In response to subsequent characters and
   * ignorableWhitespace events, the POIFSSerializer will pass data to
   * the ElementProcessor via the acceptCharacters or
   * acceptWhitespaceCharacters methods. Finally, in response to an
   * endElement event, the POIFSSerializer calls the ElementProcessor's
   * endProcessing method.
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public interface ElementProcessor 
                      extends org.apache.avalon.framework.component.Component
  {
  
      String ROLE = ElementProcessor.class.getName();
      
      /**
       * The implementation should walk the array of attributes and
       * perform appropriate actions based on that data. The array of
       * attributes is guaranteed never to be null, but it can be
       * empty. An implementation can expect code like this to work
       * without throwing runtime exceptions:
       * <br>
       * <code>
       * for (int k = 0; k < attributes.length; k++)<br>
       * {<br>
       * &nbsp;&nbsp;&nbsp;&nbsp;Attribute attr = attributes[ k ];<br>
       * &nbsp;&nbsp;&nbsp;&nbsp;// process attribute</br>
       * }</br>
       * </code>
       * <br>
       * <b>NOTE: if the XML DTD or schema includes <i>IMPLIED</i>
       * attributes for an element, those attributes are not included in
       * the Attribute array - they're not in the data provided in the
       * startElement call. The constructor for the ElementProcessor
       * should set those implied attributes itself, and allow them to
       * be overridden if the XML source provided <i>explicit</i> values
       * for them.</b>
       * <br>
       * The parent ElementProcessor is a reference to the
       * ElementProcessor whose corresponding XML element contains this
       * ElementProcessor's corresponding XML element. It will not be
       * null unless this ElementProcessor's corresponding XML element
       * is the top-level element in the XML document. Whether this
       * ElementProcessor needs to establish a containment relationship
       * with its parent or not, and whether it needs to do so at the
       * beginning, middle, or end of its life cycle, are private
       * matters left to the discretion of the individual
       * ElementProcessor implementation. If the ElementProcessor needs
       * to interact with its parent ElementProcessor, but is not ready
       * to do so when the initialize method is called, it must cache
       * the reference to its parent.
       * <br>
       *
       * @param attributes the array of Attribute instances; may be
       *                   empty, will never be null
       * @param parent the parent ElementProcessor; may be null
       *
       * @exception IOException if anything goes wrong
       */
  
      public void initialize(Attribute [] attributes, ElementProcessor parent)
          throws IOException;
  
      /**
       * The data provided in this method call comes from the
       * corresponding XML element's contents. The array is guaranteed
       * not to be null and will never be empty.
       * <br>
       * The POIFSSerializer will make 0 to many calls to this method;
       * all such calls will occur after the initialize method is called
       * and before the endProcessing method is called.
       * <br>
       * Calls to this method may be interleaved with calls to
       * acceptWhitespaceCharacters. All calls to acceptCharacters and
       * acceptWhitespaceCharacters are guaranteed to be in the same
       * order as their data is in the element.
       *
       * @param data the character data
       */
  
      public void acceptCharacters(char [] data);
  
      /**
       * The data provided in this method call comes from the
       * corresponding XML element's contents. The array is guaranteed
       * not to be null and will never be empty.
       * <br>
       * The POIFSSerializer will make 0 to many calls to this method;
       * all such calls will occur after the initialize method is called
       * and before the endProcessing method is called.
       * <br>
       * Calls to this method may be interleaved with calls to
       * acceptCharacters. All calls to acceptCharacters and
       * acceptWhitespaceCharacters are guaranteed to be in the same
       * order as their data is in the element.
       *
       * @param data the whitespace characters
       */
  
      public void acceptWhitespaceCharacters(char [] data);
  
      /**
       * This is the last method call executed by the
       * POIFSSerializer. When this method is called, the
       * ElementProcessor should finish its work and perform its final
       * interactions with its parent ElementProcessor.
       * <br>
       * If the implementation cached the parent ElementProcessor
       * reference, when the initialize method was called, it should
       * null out that reference.
       *
       * @exception IOException
       */
  
      public void endProcessing()
          throws IOException;
  }   // end public interface ElementProcessor
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/ElementProcessorFactory.java
  
  Index: ElementProcessorFactory.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor;
  
  
  
  /**
   * Create instances of specific ElementProcessor implementations to
   * handle specific XML elements and their content.
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public interface ElementProcessorFactory
                      extends org.apache.avalon.framework.component.Component
  {
  
      String ROLE = ElementProcessorFactory.class.getName();
  
      /**
       * Given an XML element name, create and return an appropriate
       * ElementProcessor.
       *
       * @param name element name
       *
       * @return the specified ElementProcessor
       *
       * @exception CannotCreateElementProcessorException if there is no
       *            ElementProcessor available for the specified name
       */
  
      public ElementProcessor createElementProcessor(final String name)
          throws CannotCreateElementProcessorException;
  
  }       // end public interface ElementProcessorFactory
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/LocaleAware.java
  
  Index: LocaleAware.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor;
  
  /**
   * The LocaleAware interface is for element processors whom require the locale
   * configuration string to control their behavior.  For HSSF this is somewhat
   * of a kludge to get past the fact the Gnumeric XML format does not allow
   * numbers formatted according to different locales in the &lt;Cell&gt; tags.
   * However, the ESQL generator for instance will generate them no other way.
   * 
   * @author Andrew C. Oliver (acoliver@apache.org)
   */
  public interface LocaleAware
  {
      /**
       * Set the locale for a given element processor.
       */
      public void setLocale(String locale);
  }   // end public interface LocaleAware
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/Attribute.java
  
  Index: Attribute.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor.types;
  
  /**
   * Encapsulation of a single XML element attribute in a way that
   * shields the consumer from the data's XML origins.
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public class Attribute
  {
      private String _name;
      private String _value;
  
      /**
       * Constructor
       *
       * @param name the name of the Attribute, the left hand side of
       *             the '=' of an XML element's attribute.
       * @param value the value of the Attribute, the right hand side of
       *              the '=' of an XML element's attribute.
       *
       * @exception IllegalArgumentException is thrown if name is null
       *            or empty, or if value is null.
       */
  
      public Attribute(final String name, final String value)
      {
          if ((name == null) || (name.length() == 0))
          {
              throw new IllegalArgumentException(
                  "Attribute name is null or empty");
          }
          if (value == null)
          {
              throw new IllegalArgumentException("Attribute value is null");
          }
          _name  = name;
          _value = value;
      }
  
      /**
       * Get the name of the Attribute.
       *
       * @return the name of the Attribute
       */
  
      public String getName()
      {
          return _name;
      }
  
      /**
       *  Get the value of the Attribute as a String.
       *
       * @return the value of the Attribute as a String
       */
  
      public String getValue()
      {
          return _value;
      }
  
      /**
       * A convenience method to get the value of the Attribute as an
       * int.
       *
       * @return the value of the Attribute as an int
       *
       * @exception NumberFormatException if the value is not an int
       */
  
      public int getValueAsInt()
      {
          return Integer.parseInt(_value);
      }
  
      /**
       * A convenience method to get the value of the Attribute as a
       * short.
       *
       * @return the value of the Attribute as a short
       *
       * @exception NumberFormatException if the value is not a short
       */
  
      public short getValueAsShort()
      {
          return Short.parseShort(_value);
      }
  
      /**
       * A convenience method to get the value of the Attribute as a long.
       *
       * @return the value of the Attribute as a long
       *
       * @exception NumberFormatException if the value is not a long
       */
  
      public long getValueAsLong()
      {
          return Long.parseLong(_value);
      }
  
      /**
       * A convenience method to get the value of the attribute as a
       * boolean. Understands these value strings in a case-insensitive
       * fashion:
       * <ul>
       *     <li>t/f
       *     <li>true/false
       *     <li>y/n
       *     <li>yes/no
       * </ul>
       *
       * @return the value of the Attribute as a boolean
       *
       * @exception IllegalArgumentException if the value does not
       *            represent a boolean
       */
  
      public boolean getValueAsBoolean()
      {
          boolean rvalue = false;
  
          if (_value.equalsIgnoreCase("t") || _value.equalsIgnoreCase("y")
                  || _value.equalsIgnoreCase("yes")
                  || _value.equalsIgnoreCase("true"))
          {
              rvalue = true;
          }
          else if (_value.equalsIgnoreCase("f") || _value.equalsIgnoreCase("n")
                   || _value.equalsIgnoreCase("no")
                   || _value.equalsIgnoreCase("false"))
          {
              rvalue = false;
          }
          else
          {
              throw new IllegalArgumentException(
                  "Value [" + _value + "] does not represent a boolean value");
          }
          return rvalue;
      }
  }   // end public class Attribute
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/BooleanConverter.java
  
  Index: BooleanConverter.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor.types;
  
  import java.io.IOException;
  
  /**
   * This class knows how to convert strings into numbers, and also
   * knows how to check the results against certain criteria
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public class BooleanConverter
  {
      private static final String        _true_values[]  =
      {
          "1", "true"
      };
      private static final String        _false_values[] =
      {
          "0", "false"
      };
      private static final BooleanResult _true_result    =
          new BooleanResult(true);
      private static final BooleanResult _false_result   =
          new BooleanResult(false);
  
      private BooleanConverter()
      {
      }
  
      /**
       * Given a string that is expected to hold a boolean, get the
       * boolean value.
       *
       * @param value the string holding the boolean
       *
       * @return a BooleanResult object containing either the boolean
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static BooleanResult extractBoolean(final String value)
      {
          String        input  = (value == null) ? ""
                                                 : value.trim();
          BooleanResult result = null;
  
          for (int k = 0; k < _true_values.length; k++)
          {
              if (_true_values[ k ].equalsIgnoreCase(input))
              {
                  result = _true_result;
                  break;
              }
          }
          if (result == null)
          {
              for (int k = 0; k < _false_values.length; k++)
              {
                  if (_false_values[ k ].equalsIgnoreCase(input))
                  {
                      result = _false_result;
                      break;
                  }
              }
          }
          if (result == null)
          {
              result = new BooleanResult(
                  new IOException("\"" + input + "\" is not a boolean value"));
          }
          return result;
      }
  }   // end public class BooleanConverter
  
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/BooleanResult.java
  
  Index: BooleanResult.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  package org.apache.cocoon.components.elementprocessor.types;
  
  import java.io.IOException;
  
  /**
   * This class holds the result of a boolean conversion. The result is
   * either a valid value, or an IOException that was created by the
   * boolean converter
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public class BooleanResult
  {
      private boolean     _value;
      private IOException _exception;
  
      /**
       * Constructor; package scope, as only a boolean converter should
       * generate one of these
       *
       * @param value the boolean value
       */
  
      BooleanResult(final boolean value)
      {
          this();
          _value = value;
      }
  
      /**
       * Constructor; package scope, as only a boolean converter should
       * generate one of these
       *
       * @param exception the exception to be thrown
       */
  
      BooleanResult(final IOException exception)
      {
          this();
          _exception = exception;
      }
  
      private BooleanResult()
      {
          _value     = false;
          _exception = null;
      }
  
      /**
       * Get the value as a boolean
       *
       * @return the value as a boolean
       *
       * @exception IOException if there was a problem converting the
       *            value
       */
  
      public boolean booleanValue()
          throws IOException
      {
          if (_exception != null)
          {
              throw _exception;
          }
          return _value;
      }
  }   // end public class BooleanResult
  
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/NumericConverter.java
  
  Index: NumericConverter.java
  ===================================================================
  
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components.elementprocessor.types;
  
  import org.apache.cocoon.CascadingIOException;
  
  import java.io.IOException;
  
  /**
   * This class knows how to convert strings into numbers, and also
   * knows how to check the results against certain criteria
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public class NumericConverter
  {
      private static final Validator _non_negative_validator = new Validator()
      {
          public IOException validate(final Number number)
          {
              IOException e = null;
  
              if (number.intValue() < 0)
              {
                  e = new IOException("\"" + number.intValue()
                                      + "\" is not a non-negative integer");
              }
              return e;
          }
      };
      private static final Validator _positive_validator = new Validator()
      {
          public IOException validate(final Number number)
          {
              IOException e = null;
  
              if (number.intValue() < 1)
              {
                  e = new IOException("\"" + number.intValue()
                                      + "\" is not a positive integer");
              }
              return e;
          }
      };
  
      private NumericConverter()
      {
      }
  
      /**
       * Shortcut for extractDouble without a Validator
       *
       * @param value the string holding the double
       * @param validator a Validator object; if null, no additional
       *                  validation will be performed
       *
       * @return a NumericResult object containing either the double
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static NumericResult extractDouble(final String value)
      {
          return extractDouble(value, null);
      }
  
      /**
       * Given a string that is expected to hold a double, get the double value.
       *
       * @param value the string holding the double
       * @param validator a Validator object; if null, no additional
       *                  validation will be performed
       *
       * @return a NumericResult object containing either the double
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static NumericResult extractDouble(final String value,
                                                final Validator validator)
      {
          String        input  = (value == null) ? ""
                                                 : value.trim();
          NumericResult result = null;
  
          try
          {
              Number      number    = new Double(input);
              IOException exception = null;
  
              if (validator != null)
              {
                  exception = validator.validate(number);
              }
              if (exception == null)
              {
                  result = new NumericResult(number);
              }
              else
              {
                  result = new NumericResult(exception);
              }
          }
          catch (NumberFormatException ignored)
          {
              result = new NumericResult(
                  new CascadingIOException(
                      "\"" + input + "\" does not represent a double value", ignored));
          }
          return result;
      }
  
      /**
       * Shortcut for extractInteger without a Validator
       *
       * @param value the string holding the integer
       * @param validator a Validator object; if null, no additional
       *                  validation will be performed
       *
       * @return a NumericResult object containing either the integer
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static NumericResult extractInteger(final String value)
      {
          return extractInteger(value, null);
      }
  
      /**
       * Given a string that is expected to hold a integer, get the integer value.
       *
       * @param value the string holding the integer
       * @param validator a Validator object; if null, no additional
       *                  validation will be performed
       *
       * @return a NumericResult object containing either the integer
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static NumericResult extractInteger(final String value,
                                                 final Validator validator)
      {
          String        input  = (value == null) ? ""
                                                 : value.trim();
          NumericResult result = null;
  
          try
          {
              Number      number    = new Integer(input);
              IOException exception = null;
  
              if (validator != null)
              {
                  exception = validator.validate(number);
              }
              if (exception == null)
              {
                  result = new NumericResult(number);
              }
              else
              {
                  result = new NumericResult(exception);
              }
          }
          catch (NumberFormatException ignored)
          {
              result = new NumericResult(
                  new CascadingIOException(
                      "\"" + input + "\" does not represent an integer value", ignored));
          }
          return result;
      }
  
      /**
       * extract a positive integer (i.e., an integer with a range of 1
       * ... MAX_VALUE)
       *
       * @param value the string holding the value
       *
       * @return a NumericResult object containing either the integer
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static NumericResult extractPositiveInteger(final String value)
      {
          return extractInteger(value, _positive_validator);
      }
  
      /**
       * extract a non-negative integer (i.e., an integer with a range
       * of 1 ... MAX_VALUE)
       *
       * @param value the string holding the value
       *
       * @return a NumericResult object containing either the integer
       *         value or an exception generated if there was a problem
       *         with the value;
       */
  
      public static NumericResult extractNonNegativeInteger(final String value)
      {
          return extractInteger(value, _non_negative_validator);
      }
  }   // end public class NumericConverter
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/NumericResult.java
  
  Index: NumericResult.java
  ===================================================================
  
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components.elementprocessor.types;
  
  import java.io.IOException;
  
  /**
   * This class holds the result of a numeric conversion. The result is
   * either a valid value, or an IOException that was created by the
   * numeric converter
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public class NumericResult
  {
      private Number      _value;
      private IOException _exception;
  
      /**
       * Constructor
       *
       * @param value the numeric value
       */
  
      public NumericResult(final Number value)
      {
          this();
          _value = value;
      }
  
      /**
       * Constructor
       *
       * @param exception the exception to be thrown
       */
  
      public NumericResult(final IOException exception)
      {
          this();
          _exception = exception;
      }
  
      private NumericResult()
      {
          _value     = null;
          _exception = null;
      }
  
      /**
       * Get the value, if possible, as an int
       *
       * @return the value, as an int
       *
       * @exception IOException if there was a problem converting the
       *            number
       */
  
      public int intValue()
          throws IOException
      {
          return value().intValue();
      }
  
      /**
       * Get the value, if possible, as a double
       *
       * @return the value, as a double
       *
       * @exception IOException if there was a problem converting the
       *            number
       */
  
      public double doubleValue()
          throws IOException
      {
          return value().doubleValue();
      }
  
      private Number value()
          throws IOException
      {
          if (_exception != null)
          {
              throw _exception;
          }
          return _value;
      }
  }   // end public class NumericResult
  
  
  
  1.1                  xml-cocoon2/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/Validator.java
  
  Index: Validator.java
  ===================================================================
  
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <stefano@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.components.elementprocessor.types;
  
  import java.io.IOException;
  
  /**
   * This interface allows a client of NumericConverter to apply more
   * restrictive rules to the number that the NumericConverter obtained.
   *
   * @author Marc Johnson (marc_johnson27591@hotmail.com)
   */
  
  public interface Validator
  {
  
      /**
       * Is this number valid? If so, return a null
       * IOException. Otherwise, return an IOException whose message
       * explains why the number is not valid.
       *
       * @param number the Number holding the value. Guaranteed non-null
       *
       * @return a null IOException if the value is ok, else a real
       *         IOException
       */
  
      public IOException validate(final Number number);
  }   // end public interface Validator
  
  
  

Mime
View raw message