Home » Mojarra-2.0.1 » javax » faces » lifecycle » [javadoc | source]

    1   /*
    2    * $Id: LifecycleFactory.java,v 1.18 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 java.util.Iterator;
   44   import javax.faces.FacesWrapper;
   45   
   46   
   47   /**
   48    * <p><strong class="changed_modified_2_0">LifecycleFactory</strong> is
   49    * a factory object that creates (if needed) and returns {@link
   50    * Lifecycle} instances.  Implementations of JavaServer Faces must
   51    * provide at least a default implementation of {@link Lifecycle}.
   52    * Advanced implementations (or external third party libraries) MAY
   53    * provide additional {@link Lifecycle} implementations (keyed by
   54    * lifecycle identifiers) for performing different types of request
   55    * processing on a per-request basis.</p>
   56    *
   57    * <p>There must be one <code>LifecycleFactory</code> instance per web
   58    * application that is utilizing JavaServer Faces.  This instance can be
   59    * acquired, in a portable manner, by calling:</p>
   60    * <pre>
   61    *   LifecycleFactory factory = (LifecycleFactory)
   62    *    FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
   63    * </pre>
   64    */
   65   
   66   public abstract class LifecycleFactory implements FacesWrapper<LifecycleFactory> {
   67       
   68       
   69       /**
   70        * <p class="changed_added_2_0">If this factory has been decorated, the 
   71        * implementation doing the decorating may override this method to provide
   72        * access to the implementation being wrapped.  A default implementation
   73        * is provided that returns <code>null</code>.</p>
   74        * 
   75        * @since 2.0
   76        */
   77   
   78       public LifecycleFactory getWrapped() {
   79           return null;
   80       }
   81       
   82   
   83   
   84       /**
   85        * <p>The lifecycle identifier for the default {@link Lifecycle} instance
   86        * for this JavaServer Faces implementation.</p>
   87        */
   88       public static final String DEFAULT_LIFECYCLE = "DEFAULT";
   89   
   90   
   91       /**
   92        * <p>Register a new {@link Lifecycle} instance, associated with
   93        * the specified <code>lifecycleId</code>, to be supported by this
   94        * <code>LifecycleFactory</code>.  This method may be called at
   95        * any time, and makes the corresponding {@link Lifecycle} instance
   96        * available throughout the remaining lifetime of this web application.
   97        * </p>
   98        *
   99        * @param lifecycleId Identifier of the new {@link Lifecycle}
  100        * @param lifecycle {@link Lifecycle} instance that we are registering
  101        *
  102        * @throws IllegalArgumentException if a {@link Lifecycle} with the
  103        *  specified <code>lifecycleId</code> has already been registered
  104        * @throws NullPointerException if <code>lifecycleId</code>
  105        *  or <code>lifecycle</code> is <code>null</code>
  106        */
  107       public abstract void addLifecycle(String lifecycleId,
  108                                         Lifecycle lifecycle);
  109   
  110   
  111       /**
  112        * <p>Create (if needed) and return a {@link Lifecycle} instance
  113        * for the specified lifecycle identifier.  The set of available
  114        * lifecycle identifiers is available via the
  115        * <code>getLifecycleIds()</code> method.</p>
  116        *
  117        * <p>Each call to <code>getLifecycle()</code> for the same
  118        * <code>lifecycleId</code>, from within the same web application,
  119        * must return the same {@link Lifecycle} instance.</p>
  120        *
  121        * @param lifecycleId Lifecycle identifier of the requested
  122        *  {@link Lifecycle} instance
  123        *
  124        * @throws IllegalArgumentException if no {@link Lifecycle} instance
  125        *  can be returned for the specified identifier
  126        * @throws NullPointerException if <code>lifecycleId</code>
  127        *  is <code>null</code>
  128        */
  129       public abstract Lifecycle getLifecycle(String lifecycleId);
  130   
  131   
  132       /**
  133        * <p>Return an <code>Iterator</code> over the set of lifecycle
  134        * identifiers supported by this factory.  This set must include
  135        * the value specified by <code>LifecycleFactory.DEFAULT_LIFECYCLE</code>.
  136        * </p>
  137        */
  138       public abstract Iterator<String> getLifecycleIds();
  139   
  140   
  141   }

Home » Mojarra-2.0.1 » javax » faces » lifecycle » [javadoc | source]