You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2006/01/22 07:09:10 UTC

svn commit: r371214 - /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java

Author: taylor
Date: Sat Jan 21 22:09:08 2006
New Revision: 371214

URL: http://svn.apache.org/viewcvs?rev=371214&view=rev
Log:
another constructor for BasePortalURLImpl using an environment var

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java?rev=371214&r1=371213&r2=371214&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java (original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/url/impl/BasePortalURLImpl.java Sat Jan 21 22:09:08 2006
@@ -16,6 +16,8 @@
 package org.apache.jetspeed.container.url.impl;
 
 import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.jetspeed.container.url.BasePortalURL;
 
 /**
@@ -40,6 +42,38 @@
     public BasePortalURLImpl()
     {        
     }
+    
+    /**
+     * This constructor takes a string that represents the name of an
+     * environment variable.  The environment variable will be the full
+     * path of a properties file to be loaded.  Information from the
+     * properties file will populate this object
+     */
+    public BasePortalURLImpl(String environmentPath) throws ConfigurationException 
+    {
+        String propertyFilePath = null;
+        if (environmentPath != null) 
+        {
+            propertyFilePath = System.getProperty(environmentPath);
+        }
+        
+        PropertiesConfiguration config = null;
+        
+        // Load the file if the path is provided
+        if (propertyFilePath != null) 
+        {
+            config = new PropertiesConfiguration(propertyFilePath);
+        }
+
+        if (config != null) 
+        {
+            this.serverName = config.getString("portal.url.name");
+            this.serverScheme = config.getString("portal.url.scheme");
+            this.serverPort = config.getInt("portal.url.port");
+            this.secure = config.getBoolean("portal.url.secure");            
+        }
+    }
+    
     
     public BasePortalURLImpl(Configuration config)
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org