Coverage Report - org.seasar.teeda.core.context.FacesContextFactoryImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
FacesContextFactoryImpl
100%
11/11
100%
2/2
2
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.teeda.core.context;
 17  
 
 18  
 import javax.faces.FacesException;
 19  
 import javax.faces.context.FacesContext;
 20  
 import javax.faces.context.FacesContextFactory;
 21  
 import javax.faces.lifecycle.Lifecycle;
 22  
 
 23  
 import org.seasar.framework.util.AssertionUtil;
 24  
 import org.seasar.teeda.core.context.creator.DispatchableFacesContextCreator;
 25  
 import org.seasar.teeda.core.context.creator.FacesContextCreator;
 26  
 import org.seasar.teeda.core.exception.FacesContextNotFoundRuntimeException;
 27  
 
 28  
 /**
 29  
  * @author shot
 30  
  */
 31  
 public class FacesContextFactoryImpl extends FacesContextFactory {
 32  
 
 33  
     private FacesContextCreator contextCreator;
 34  
 
 35  2
     public FacesContextFactoryImpl() {
 36  2
         contextCreator = new DispatchableFacesContextCreator();
 37  2
     }
 38  
 
 39  
     public FacesContext getFacesContext(Object context, Object request,
 40  
             Object response, Lifecycle lifecycle) throws FacesException {
 41  4
         AssertionUtil.assertNotNull("Context", context);
 42  4
         AssertionUtil.assertNotNull("Request", request);
 43  4
         AssertionUtil.assertNotNull("Response", response);
 44  4
         AssertionUtil.assertNotNull("Lifecycle", lifecycle);
 45  4
         FacesContext facesContext = contextCreator.create(context, request,
 46  
                 response, lifecycle);
 47  4
         if (facesContext == null) {
 48  3
             throw new FacesContextNotFoundRuntimeException();
 49  
         }
 50  1
         return facesContext;
 51  
     }
 52  
 
 53  
 }