Coverage report

  %line %branch
org.apache.jetspeed.container.JetspeedPortletConfig$1
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.container;
 18  
 
 19  
 import java.util.Enumeration;
 20  
 import java.util.Iterator;
 21  
 import java.util.Locale;
 22  
 import java.util.ResourceBundle;
 23  
 
 24  
 import javax.portlet.PortletConfig;
 25  
 import javax.portlet.PortletContext;
 26  
 
 27  
 import org.apache.pluto.om.common.Language;
 28  
 import org.apache.pluto.om.common.LanguageSet;
 29  
 import org.apache.pluto.om.common.Parameter;
 30  
 import org.apache.pluto.om.common.ParameterSet;
 31  
 import org.apache.pluto.om.portlet.PortletDefinition;
 32  
 
 33  
 /**
 34  
  * Implements the Portlet API Portlet Config class
 35  
  *
 36  
  * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
 37  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 38  
  * @version $Id: JetspeedPortletConfig.java 516448 2007-03-09 16:25:47Z ate $
 39  
  */
 40  
 public class JetspeedPortletConfig implements PortletConfig, InternalPortletConfig
 41  
 {
 42  
     // private static final Log log = LogFactory.getLog(JetspeedPortletConfig.class);
 43  
     
 44  
     private PortletContext portletContext;
 45  
     private PortletDefinition portletDefinition;
 46  
 
 47  
     public JetspeedPortletConfig(PortletContext portletContext, PortletDefinition portletEntity)
 48  
     {
 49  
         this.portletContext = portletContext;
 50  
         this.portletDefinition = portletEntity;
 51  
     }
 52  
 
 53  
     public String getPortletName()
 54  
     {
 55  
         return portletDefinition.getName();
 56  
     }
 57  
 
 58  
     public PortletContext getPortletContext()
 59  
     {
 60  
         return portletContext;
 61  
     }
 62  
 
 63  
     public ResourceBundle getResourceBundle(Locale locale)
 64  
     {
 65  
         LanguageSet languageSet = portletDefinition.getLanguageSet();
 66  
         
 67  
         Language lang = languageSet.get(locale);
 68  
                                                                                 
 69  
         if (lang == null)
 70  
         {
 71  
             Locale defaultLocale = languageSet.getDefaultLocale();
 72  
             lang = languageSet.get(defaultLocale);
 73  
         }
 74  
         
 75  
         return lang.getResourceBundle();
 76  
     }
 77  
 
 78  
     public String getInitParameter(java.lang.String name)
 79  
     {
 80  
         if ( name == null )
 81  
         {
 82  
             throw new IllegalArgumentException("Required parameter name is null");
 83  
         }
 84  
         //if (log.isDebugEnabled()) log.debug("Getting init parameter for: " + name);
 85  
         ParameterSet parameters = portletDefinition.getInitParameterSet();
 86  
         Parameter param = parameters.get(name);
 87  
 
 88  
         if (param != null)
 89  
         {
 90  
             // if (log.isDebugEnabled()) log.debug("Param: [[name," + name + "], [value, " + param.getValue() + "]]");
 91  
             return param.getValue();
 92  
         }
 93  
 
 94  
         return null;
 95  
     }
 96  
 
 97  
     public Enumeration getInitParameterNames()
 98  
     {
 99  
         return new java.util.Enumeration()
 100  
         {
 101  0
             private ParameterSet parameters = portletDefinition.getInitParameterSet();
 102  0
             private Iterator iterator = parameters.iterator();
 103  
 
 104  
             public boolean hasMoreElements()
 105  
             {
 106  0
                 return iterator.hasNext();
 107  
             }
 108  
 
 109  0
             public Object nextElement()
 110  
             {
 111  0
                 if (iterator.hasNext())
 112  0
                     return ((Parameter) iterator.next()).getName();
 113  
                 else
 114  0
                     return null;
 115  
             }
 116  
         };
 117  
 
 118  
     }
 119  
 
 120  
     public void setPortletDefinition(PortletDefinition pd)
 121  
     {
 122  
         this.portletDefinition = pd;        
 123  
     }
 124  
     
 125  
     //  internal portlet config implementation
 126  
     public PortletDefinition getPortletDefinition()
 127  
     {
 128  
         return portletDefinition;
 129  
     }
 130  
 
 131  
 }

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