Coverage Report - org.apache.myfaces.webapp.AbstractMyFacesListener
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractMyFacesListener
0%
0/16
0%
0/2
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.webapp;
 20  
 
 21  
 import javax.servlet.ServletContextAttributeEvent;
 22  
 import javax.servlet.ServletRequestAttributeEvent;
 23  
 import javax.servlet.http.HttpSessionBindingEvent;
 24  
 
 25  
 import org.apache.myfaces.config.annotation.LifecycleProviderFactory;
 26  
 import org.apache.commons.logging.Log;
 27  
 import org.apache.commons.logging.LogFactory;
 28  
 
 29  
 import java.lang.reflect.InvocationTargetException;
 30  
 
 31  
 /**
 32  
  * @author Dennis Byrne
 33  
  */
 34  
 
 35  0
 public abstract class AbstractMyFacesListener {
 36  0
     private static Log log = LogFactory.getLog(AbstractMyFacesListener.class);
 37  
 
 38  
     protected void doPreDestroy(ServletRequestAttributeEvent event, String scope) {
 39  0
         doPreDestroy(event.getValue(), event.getName(), scope);
 40  0
     }
 41  
 
 42  
     protected void doPreDestroy(HttpSessionBindingEvent event, String scope) {
 43  0
         doPreDestroy(event.getValue(), event.getName(), scope);
 44  0
     }
 45  
 
 46  
     protected void doPreDestroy(ServletContextAttributeEvent event, String scope) {
 47  0
         doPreDestroy(event.getValue(), event.getName(), scope);
 48  0
     }
 49  
     
 50  
     protected void doPreDestroy(Object value, String name, String scope) {
 51  
         
 52  0
         if(value != null)
 53  
         {
 54  
             //AnnotatedManagedBeanHandler handler =
 55  
             //    new AnnotatedManagedBeanHandler(value, scope, name);
 56  
 
 57  
             //handler.invokePreDestroy();
 58  
 
 59  
             try
 60  
             {
 61  0
                 LifecycleProviderFactory.getLifecycleProviderFactory().getLifecycleProvider(null).destroyInstance(value);
 62  0
             } catch (IllegalAccessException e)
 63  
             {
 64  0
                 log.error("", e);
 65  0
             } catch (InvocationTargetException e)
 66  
             {
 67  0
                 log.error("", e);
 68  0
             }
 69  
         }
 70  0
     }
 71  
 }