Coverage report

  %line %branch
org.apache.jetspeed.container.url.impl.BasePortalURLImpl
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.url.impl;
 18  
 
 19  
 import org.apache.commons.configuration.Configuration;
 20  
 import org.apache.commons.configuration.ConfigurationException;
 21  
 import org.apache.commons.configuration.PropertiesConfiguration;
 22  
 import org.apache.jetspeed.container.url.BasePortalURL;
 23  
 
 24  
 /**
 25  
  * <p>
 26  
  * BasePortalURL defines the interface for manipulating Base URLs in a portal.
 27  
  * Base URLs contain the isSecure flag, server name, server port, and server scheme.
 28  
  * This abstraction was necessary for wiring the entire portal's base URL via another
 29  
  * mechanism than retrieving from the servlet request.
 30  
  * </p>
 31  
  * 
 32  
  * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
 33  
  * @version $Id: $
 34  
  *
 35  
  */
 36  
 public class BasePortalURLImpl implements BasePortalURL
 37  
 {
 38  
     private String serverName;    
 39  
     private String serverScheme;
 40  
     private int serverPort;    
 41  
     private boolean secure;
 42  
     
 43  
     public BasePortalURLImpl()
 44  0
     {        
 45  0
     }
 46  
     
 47  
     /**
 48  
      * This constructor takes a string that represents the name of an
 49  
      * environment variable.  The environment variable will be the full
 50  
      * path of a properties file to be loaded.  Information from the
 51  
      * properties file will populate this object
 52  
      */
 53  
     public BasePortalURLImpl(String environmentPath) throws ConfigurationException 
 54  0
     {
 55  0
         String propertyFilePath = null;
 56  0
         if (environmentPath != null) 
 57  
         {
 58  0
             propertyFilePath = System.getProperty(environmentPath);
 59  
         }
 60  
         
 61  0
         PropertiesConfiguration config = null;
 62  
         
 63  
         // Load the file if the path is provided
 64  0
         if (propertyFilePath != null) 
 65  
         {
 66  0
             config = new PropertiesConfiguration(propertyFilePath);
 67  
         }
 68  
 
 69  0
         if (config != null) 
 70  
         {
 71  0
             this.serverName = config.getString("portal.url.name");
 72  0
             this.serverScheme = config.getString("portal.url.scheme");
 73  0
             this.serverPort = config.getInt("portal.url.port");
 74  0
             this.secure = config.getBoolean("portal.url.secure");            
 75  
         }
 76  0
     }
 77  
     
 78  
     
 79  
     public BasePortalURLImpl(Configuration config)
 80  0
     {
 81  0
         this.serverName = config.getString("portal.url.name");
 82  0
         this.serverScheme = config.getString("portal.url.scheme");
 83  0
         this.serverPort = config.getInt("portal.url.port");
 84  0
         this.secure = config.getBoolean("portal.url.secure");
 85  0
     }
 86  
     
 87  
     public BasePortalURLImpl(String serverScheme, String serverName, int serverPort, boolean secure)
 88  0
     {
 89  0
         this.serverName = serverName;
 90  0
         this.serverScheme = serverScheme;
 91  0
         this.serverPort = serverPort;
 92  0
         this.secure = secure;
 93  0
     }
 94  
     
 95  
     public boolean isSecure()
 96  
     {
 97  0
         return secure;
 98  
     }
 99  
     
 100  
     public void setSecure(boolean secure)
 101  
     {
 102  0
         this.secure = secure;
 103  0
     }
 104  
     
 105  
     public String getServerName()
 106  
     {
 107  0
         return serverName;
 108  
     }
 109  
     
 110  
     public void setServerName(String serverName)
 111  
     {
 112  0
         this.serverName = serverName;
 113  0
     }
 114  
     
 115  
     public int getServerPort()
 116  
     {
 117  0
         return serverPort;
 118  
     }
 119  
     
 120  
     public void setServerPort(int serverPort)
 121  
     {
 122  0
         this.serverPort = serverPort;
 123  0
     }
 124  
     
 125  
     public String getServerScheme()
 126  
     {
 127  0
         return serverScheme;
 128  
     }
 129  
     
 130  
     public void setServerScheme(String serverScheme)
 131  
     {
 132  0
         this.serverScheme = serverScheme;
 133  0
     }
 134  
 
 135  
 }

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