Coverage report

  %line %branch
org.apache.jetspeed.components.portletregistry.PortletRegistryHelper
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.components.portletregistry;
 18  
 
 19  
 
 20  
 /**
 21  
  * <p>Helper class for the portlet registry.</p>
 22  
  * @author <a href="dlestrat@apache.org">David Le Strat</a>
 23  
  */
 24  0
 public class PortletRegistryHelper
 25  
 {
 26  
 
 27  
     /**
 28  
      * <p>Parses the portlet application name from the portlet
 29  
      * unique name.</p>
 30  
      * @param uniqueName The portlet unique name.
 31  
      */
 32  
     public static String parseAppName(String uniqueName)
 33  
     {
 34  0
         int split = splitUniqueName(uniqueName);
 35  0
         return uniqueName.substring(0, split);
 36  
     }
 37  
 
 38  
     /**
 39  
      * <p>Parses the portlet name from the portlet
 40  
      * unique name.</p>
 41  
      * @param uniqueName The portlet unique name.
 42  
      */
 43  
     public static String parsePortletName(String uniqueName)
 44  
     {
 45  0
         int split = splitUniqueName(uniqueName);
 46  0
         return uniqueName.substring((split + 2), uniqueName.length());
 47  
     }
 48  
 
 49  
     /**
 50  
      * <p>Utility method to split the unique name given the
 51  
      * PORTLET_UNIQUE_NAME_SEPARATOR.</p>
 52  
      * @param uniqueName
 53  
      * @return
 54  
      */
 55  
     private static int splitUniqueName(String uniqueName)
 56  
     {
 57  0
         int split = 0;
 58  0
         if (null != uniqueName)
 59  
         {
 60  0
             split = uniqueName.indexOf(PersistenceBrokerPortletRegistry.PORTLET_UNIQUE_NAME_SEPARATOR);
 61  
         }
 62  0
         if (split < 1)
 63  
         {
 64  0
             throw new IllegalArgumentException(
 65  
                 "The unique portlet name, \""
 66  
                     + uniqueName
 67  
                     + "\"  is not well formed.  No "
 68  
                     + PersistenceBrokerPortletRegistry.PORTLET_UNIQUE_NAME_SEPARATOR
 69  
                     + " delimiter was found.");
 70  
         }
 71  0
         return split;
 72  
     }
 73  
 
 74  
 }

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