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

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