dion        02/05/14 18:48:20

  Added:       src/java/org/apache/maven/j2ee ValidationStatusListener.java
  Log:
  Help class for validation that allows querying of the state
  
  Revision  Changes    Path
  1.1                  
jakarta-turbine-maven/src/java/org/apache/maven/j2ee/ValidationStatusListener.java
  
  Index: ValidationStatusListener.java
  ===================================================================
  package org.apache.maven.j2ee;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, 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" and "Apache Software Foundation" and
   *    "Apache Maven" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Maven", 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 (INCLUDING, 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.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * A {@link ValidationListener} that tracks events and will provide a true/false
   * response about the status of the validation
   * @author <a href="mailto:[EMAIL PROTECTED]";>dIon Gillard</a>
   * @version $Id: ValidationStatusListener.java,v 1.1 2002/05/15 01:48:20 dion Exp $
   */
  public class ValidationStatusListener implements ValidationListener
  {
      /** Whether the validation has started */
      private boolean started = false;
      /** Whether the validation has ended */
      private boolean ended = false;
      /** Whether the validation has had 1 or more errors */
      private boolean error = false;
      /** Whether the validation has had 1 or more warnings */
      private boolean warning = false;
      
      /** Creates a new instance of ValidationStatusListener */
      public ValidationStatusListener()
      {
      }
      
      /** Called when a validation error occurs. That is, the subject being
       * validated has a serious (fatal) problem. Sets the <code>error</code>
       * property to <code>true</code>.
       * @param event a {@link ValidationEvent}
       */
      public void validationError(ValidationEvent event)
      {
          setError(true);
      }
      
      /** Called when a validation warning occurs. That is, the subject being
       * validated has a problem which may not be fatal. Sets the 
       * <code>warning</code> property to <code>true</true>.
       * @param event a {@link ValidationEvent}
       */
      public void validationWarning(ValidationEvent event)
      {
          setWarning(true);
      }
      
      /**
       * Called when validation starts. Sets the <code>started</code> property to 
       * <code>true</code>
       * @param event a {@link ValidationEvent}
       */
      public void validationStarted(ValidationEvent event)
      {
          setStarted(true);
      }
      
      /**
       * Called when validation ends. Sets the <code>ended</code> property to
       * <code>true</code>
       * @param event a {@link ValidationEvent}
       */
      public void validationEnded(ValidationEvent event)
      {
          setEnded(true);
      }
      
      /** Has validation ended?
       * @return Value of property ended.
       */
      public boolean isEnded()
      {
          return ended;
      }
      
      /** Sets whether validation has ended.
       * @param ended New value of property ended.
       */
      private void setEnded(boolean ended) 
      {
          this.ended = ended;
      }
      
      /** Has a validation error occurred?
       * @return Value of property error.
       */
      public boolean isError()
      {
          return error;
      }
      
      /** Sets whether a validation error has occurred.
       * @param error New value of property error.
       */
      private void setError(boolean error)
      {
          this.error = error;
      }
      
      /** Has validation started?
       * @return Value of property started.
       */
      public boolean isStarted() 
      {
          return started;
      }
      
      /** Sets whether validation has started
       * @param started New value of property started.
       */
      private void setStarted(boolean started)
      {
          this.started = started;
      }
      
      /** Has a validation warning occurred?
       * @return Value of property warning.
       */
      public boolean isWarning()
      {
          return warning;
      }
      
      /** Sets whether a validation warning has occurred.
       * @param warning New value of property warning.
       */
      private void setWarning(boolean warning)
      {
          this.warning = warning;
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to