Save This Page
Home » mojarra-1.2_09-b02-FCS-source » javax.faces.lifecycle » [javadoc | source]
    1   /*
    2    * $Id: Lifecycle.java,v 1.32 2007/04/27 22:00:09 ofung Exp $
    3    */
    4   
    5   /*
    6    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    7    * 
    8    * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
    9    * 
   10    * The contents of this file are subject to the terms of either the GNU
   11    * General Public License Version 2 only ("GPL") or the Common Development
   12    * and Distribution License("CDDL") (collectively, the "License").  You
   13    * may not use this file except in compliance with the License. You can obtain
   14    * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
   15    * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
   16    * language governing permissions and limitations under the License.
   17    * 
   18    * When distributing the software, include this License Header Notice in each
   19    * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
   20    * Sun designates this particular file as subject to the "Classpath" exception
   21    * as provided by Sun in the GPL Version 2 section of the License file that
   22    * accompanied this code.  If applicable, add the following below the License
   23    * Header, with the fields enclosed by brackets [] replaced by your own
   24    * identifying information: "Portions Copyrighted [year]
   25    * [name of copyright owner]"
   26    * 
   27    * Contributor(s):
   28    * 
   29    * If you wish your version of this file to be governed by only the CDDL or
   30    * only the GPL Version 2, indicate your decision by adding "[Contributor]
   31    * elects to include this software in this distribution under the [CDDL or GPL
   32    * Version 2] license."  If you don't indicate a single choice of license, a
   33    * recipient has the option to distribute your version of this file under
   34    * either the CDDL, the GPL Version 2 or to extend the choice of license to
   35    * its licensees as provided above.  However, if you add GPL Version 2 code
   36    * and therefore, elected the GPL Version 2 license, then the option applies
   37    * only if the new code is made subject to such option by the copyright
   38    * holder.
   39    */
   40   
   41   package javax.faces.lifecycle;
   42   
   43   import javax.faces.FacesException;
   44   import javax.faces.context.FacesContext;
   45   import javax.faces.event.PhaseListener;
   46   
   47   
   48   /**
   49    * <p><strong>Lifecycle</strong> manages the
   50    * processing of the entire lifecycle of a particular JavaServer Faces
   51    * request.  It is responsible for executing all of the phases that have
   52    * been defined by the JavaServer Faces Specification, in the specified
   53    * order, unless otherwise directed by activities that occurred during
   54    * the execution of each phase.</p>
   55    *
   56    * <p>An instance of <code>Lifecycle</code> is created by calling the
   57    * <code>getLifecycle()</code> method of {@link LifecycleFactory}, for
   58    * a specified lifecycle identifier.  Because this instance is
   59    * shared across multiple simultaneous requests, it must be implemented
   60    * in a thread-safe manner.</p>
   61    */
   62   
   63   public abstract class Lifecycle {
   64   
   65   
   66       // ---------------------------------------------------------- Public Methods
   67   
   68   
   69       /**
   70        * <p>Register a new {@link PhaseListener} instance that is interested in
   71        * being notified before and after the processing for standard phases of
   72        * the request processing lifecycle.</p>
   73        *
   74        * @param listener The {@link PhaseListener} to be registered
   75        *
   76        * @throws NullPointerException if <code>listener</code>
   77        *  is <code>null</code>
   78        */
   79       public abstract void addPhaseListener(PhaseListener listener);
   80   
   81   
   82       /**
   83        * <p>Execute all of the phases of the request processing lifecycle,
   84        * up to but not including the <em>Render Response</em> phase,
   85        * as described in the JavaServer Faces Specification, in the specified
   86        * order.  The processing flow can be affected (by the application,
   87        * by components, or by event listeners) by calls to the
   88        * <code>renderResponse()</code> or <code>responseComplete()</code>
   89        * methods of the {@link FacesContext} instance associated with
   90        * the current request.</p>
   91        *
   92        * @param context FacesContext for the request to be processed
   93        *
   94        * @throws FacesException if thrown during the execution of the
   95        *  request processing lifecycle
   96        * @throws NullPointerException if <code>context</code>
   97        *  is <code>null</code>
   98        */
   99       public abstract void execute(FacesContext context) throws FacesException;
  100   
  101   
  102       /**
  103        * <p>Return the set of registered {@link PhaseListener}s for this
  104        * {@link Lifecycle} instance.  If there are no registered listeners,
  105        * a zero-length array is returned.</p>
  106        */
  107       public abstract PhaseListener[] getPhaseListeners();
  108   
  109   
  110       /**
  111        * <p>Deregister an existing {@link PhaseListener} instance that is no
  112        * longer interested in being notified before and after the processing
  113        * for standard phases of the request processing lifecycle.  If no such
  114        * listener instance has been registered, no action is taken.</p>
  115        *
  116        * @param listener The {@link PhaseListener} to be deregistered
  117        * @throws NullPointerException if <code>listener</code>
  118        *  is <code>null</code>
  119        */
  120       public abstract void removePhaseListener(PhaseListener listener);
  121   
  122   
  123       /**
  124        * <p>Execute the <em>Render Response</em> phase of the request
  125        * processing lifecycle, unless the <code>responseComplete()</code>
  126        * method has been called on the {@link FacesContext} instance
  127        * associated with the current request.</p>
  128        *
  129        * @param context FacesContext for the request being processed
  130        *
  131        * @throws FacesException if an exception is thrown during the execution
  132        *  of the request processing lifecycle
  133        * @throws NullPointerException if <code>context</code>
  134        *  is <code>null</code>
  135        */
  136       public abstract void render(FacesContext context) throws FacesException;
  137   
  138   
  139   }

Save This Page
Home » mojarra-1.2_09-b02-FCS-source » javax.faces.lifecycle » [javadoc | source]