Coverage Report - org.seasar.teeda.core.config.faces.assembler.impl.DefaultFactoryAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultFactoryAssembler
100%
22/22
100%
2/2
1.1
DefaultFactoryAssembler$1
100%
2/2
N/A
1.1
DefaultFactoryAssembler$2
100%
2/2
N/A
1.1
DefaultFactoryAssembler$3
100%
2/2
N/A
1.1
DefaultFactoryAssembler$4
100%
2/2
N/A
1.1
 
 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.config.faces.assembler.impl;
 17  
 
 18  
 import java.util.Iterator;
 19  
 import java.util.List;
 20  
 
 21  
 import javax.faces.FactoryFinder;
 22  
 
 23  
 import org.seasar.teeda.core.config.faces.assembler.FactoryAssembler;
 24  
 import org.seasar.teeda.core.config.faces.assembler.FactoryChildAssembler;
 25  
 import org.seasar.teeda.core.config.faces.element.FactoryElement;
 26  
 import org.seasar.teeda.core.util.IteratorUtil;
 27  
 
 28  
 /**
 29  
  * @author shot
 30  
  */
 31  
 public class DefaultFactoryAssembler extends FactoryAssembler {
 32  
 
 33  
     private FactoryChildAssembler applicationFactory_;
 34  
 
 35  
     private FactoryChildAssembler facesContextFactory_;
 36  
 
 37  
     private FactoryChildAssembler lifecycleFactory_;
 38  
 
 39  
     private FactoryChildAssembler renderKitFactory_;
 40  
 
 41  
     public DefaultFactoryAssembler(List factories) {
 42  4
         super(factories);
 43  4
     }
 44  
 
 45  
     protected void setupBeforeAssemble() {
 46  4
         applicationFactory_ = new FactoryChildAssembler() {
 47  4
             protected String getFactoryClassName() {
 48  4
                 return FactoryFinder.APPLICATION_FACTORY;
 49  
             }
 50  
         };
 51  
 
 52  4
         facesContextFactory_ = new FactoryChildAssembler() {
 53  4
             protected String getFactoryClassName() {
 54  3
                 return FactoryFinder.FACES_CONTEXT_FACTORY;
 55  
             }
 56  
         };
 57  
 
 58  4
         lifecycleFactory_ = new FactoryChildAssembler() {
 59  4
             protected String getFactoryClassName() {
 60  3
                 return FactoryFinder.LIFECYCLE_FACTORY;
 61  
             }
 62  
         };
 63  
 
 64  4
         renderKitFactory_ = new FactoryChildAssembler() {
 65  4
             protected String getFactoryClassName() {
 66  3
                 return FactoryFinder.RENDER_KIT_FACTORY;
 67  
             }
 68  
         };
 69  
 
 70  4
         for (Iterator itr = IteratorUtil.getIterator(getFactories()); itr
 71  8
                 .hasNext();) {
 72  4
             FactoryElement factory = (FactoryElement) itr.next();
 73  4
             applicationFactory_.setTargetFactories(factory
 74  
                     .getApplicationFactories());
 75  4
             facesContextFactory_.setTargetFactories(factory
 76  
                     .getFacesContextFactories());
 77  4
             lifecycleFactory_.setTargetFactories(factory
 78  
                     .getLifecycleFactories());
 79  4
             renderKitFactory_.setTargetFactories(factory
 80  
                     .getRenderKitFactories());
 81  
         }
 82  
 
 83  4
     }
 84  
 
 85  
     protected void assembleApplicationFactory() {
 86  4
         applicationFactory_.assemble();
 87  4
     }
 88  
 
 89  
     protected void assembleFacesContextFactory() {
 90  4
         facesContextFactory_.assemble();
 91  4
     }
 92  
 
 93  
     protected void assembleLifecycleFactory() {
 94  4
         lifecycleFactory_.assemble();
 95  4
     }
 96  
 
 97  
     protected void assembleRenderKitFactory() {
 98  4
         renderKitFactory_.assemble();
 99  4
     }
 100  
 
 101  
 }