Coverage report

  %line %branch
org.apache.jetspeed.portalsite.view.SiteViewProxy
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.portalsite.view;
 18  
 
 19  
 import java.lang.reflect.Method;
 20  
 import java.lang.reflect.Proxy;
 21  
 
 22  
 /**
 23  
  * This class is the base class for all site content
 24  
  * proxy implementations.
 25  
  * 
 26  
  * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
 27  
  * @version $Id: SiteViewProxy.java 516448 2007-03-09 16:25:47Z ate $
 28  
  */
 29  
 public abstract class SiteViewProxy
 30  
 {
 31  
     /**
 32  
      * view - site view this proxy is part of
 33  
      */
 34  
     private SiteView view;
 35  
 
 36  
     /**
 37  
      * locatorName - name of profile locator name associated
 38  
      *               with the derived delegate of this proxy
 39  
      *               in the site view
 40  
      */
 41  
     private String locatorName;
 42  
 
 43  
     /**
 44  
      * SiteViewProxy - constructor
 45  
      *
 46  
      * @param view site view owner of this proxy
 47  
      * @param locatorName profile locator name associated with
 48  
      *                    the derived delegate of this proxy in
 49  
      *                    the site view
 50  
      */
 51  
     protected SiteViewProxy(SiteView view, String locatorName)
 52  0
     {
 53  0
         this.view = view;
 54  0
         this.locatorName = locatorName;
 55  0
     }
 56  
 
 57  
     /**
 58  
      * getView - return site view for this proxy
 59  
      *
 60  
      * @return site view
 61  
      */
 62  
     public SiteView getView()
 63  
     {
 64  0
         return view;
 65  
     }
 66  
 
 67  
     /**
 68  
      * getLocatorName - return profile locator name associated
 69  
      *                  with the derived delegate of this proxy in
 70  
      *                  the site view
 71  
      *
 72  
      * @return profile locator name
 73  
      */
 74  
     public String getLocatorName()
 75  
     {
 76  0
         return locatorName;
 77  
     }
 78  
 
 79  
     /**
 80  
      * reflectMethod - trap method reflection exceptions utility function
 81  
      *
 82  
      * @param methodClass class or interface
 83  
      * @param methodName method name
 84  
      * @param methodArgs array of type, class, or interface parameter types
 85  
      */
 86  
     protected static Method reflectMethod(Class methodClass, String methodName, Class [] methodArgs)
 87  
     {
 88  
         // trap reflection exceptions
 89  
         try
 90  
         {
 91  0
             return methodClass.getMethod(methodName, methodArgs);
 92  
         }
 93  0
         catch (NoSuchMethodException nsme)
 94  
         {
 95  0
             RuntimeException rte = new RuntimeException("SiteViewProxy.reflectMethod(): unexpected reflection exception for: " + methodClass.getName() + "." + methodName);
 96  0
             rte.initCause(nsme);
 97  0
             throw rte;
 98  
         }
 99  
     }
 100  
 
 101  
     /**
 102  
      * getSiteViewProxy - utility method to access SiteViewProxy handler
 103  
      *                    from a proxy instance
 104  
      *
 105  
      * @param proxy proxy instance
 106  
      * @return site view invocation handler instance
 107  
      */
 108  
     public static SiteViewProxy getSiteViewProxy(Object proxy)
 109  
     {
 110  0
         if ((proxy != null) && Proxy.isProxyClass(proxy.getClass()))
 111  
         {
 112  0
             Object proxyHandler = Proxy.getInvocationHandler(proxy);
 113  0
             if (proxyHandler instanceof SiteViewProxy)
 114  
             {
 115  0
                 return (SiteViewProxy)proxyHandler;
 116  
             }
 117  
         }
 118  0
         return null;
 119  
     }
 120  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.