Coverage Report - org.apache.myfaces.el.ResolverForJSPInitializer
 
Classes in this File Line Coverage Branch Coverage Complexity
ResolverForJSPInitializer
0%
0/16
0%
0/6
1.75
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.el;
 20  
 
 21  
 import java.util.Iterator;
 22  
 
 23  
 import javax.faces.FactoryFinder;
 24  
 import javax.faces.event.PhaseEvent;
 25  
 import javax.faces.event.PhaseId;
 26  
 import javax.faces.event.PhaseListener;
 27  
 import javax.faces.lifecycle.LifecycleFactory;
 28  
 
 29  
 import org.apache.myfaces.el.unified.ELResolverBuilder;
 30  
 
 31  
 /**
 32  
  * The class will initialize the resolver for JSP
 33  
  * 
 34  
  * @author Mathias Broekelmann (latest modification by $Author$)
 35  
  * @version $Revision$ $Date$
 36  
  */
 37  
 public final class ResolverForJSPInitializer implements PhaseListener
 38  
 {
 39  
     private final ELResolverBuilder _resolverBuilder;
 40  
     private volatile boolean initialized;
 41  
     private final javax.el.CompositeELResolver _resolverForJSP;
 42  
 
 43  
     public ResolverForJSPInitializer(final ELResolverBuilder resolverBuilder,
 44  
                                      final javax.el.CompositeELResolver resolverForJSP)
 45  0
     {
 46  0
         _resolverBuilder = resolverBuilder;
 47  0
         _resolverForJSP = resolverForJSP;
 48  0
     }
 49  
 
 50  
     public void beforePhase(final PhaseEvent event)
 51  
     {
 52  0
         if (!initialized)
 53  
         {
 54  0
             synchronized(this)
 55  
             {
 56  0
                 if (!initialized)
 57  
                 {
 58  0
                     _resolverBuilder.build(_resolverForJSP);
 59  
 
 60  0
                     LifecycleFactory factory = (LifecycleFactory) 
 61  
                             FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
 62  0
                     for (Iterator<String> iter = factory.getLifecycleIds(); iter.hasNext();)
 63  
                     {
 64  0
                         factory.getLifecycle(iter.next()).removePhaseListener(this);
 65  
                     }
 66  
                     
 67  0
                     initialized = true;
 68  
                 }
 69  0
             }
 70  
         }
 71  0
     }
 72  
 
 73  
     public void afterPhase(final PhaseEvent event)
 74  
     {
 75  0
     }
 76  
 
 77  
     public PhaseId getPhaseId()
 78  
     {
 79  0
         return PhaseId.ANY_PHASE;
 80  
     }
 81  
 
 82  
 }