[jboss-svn-commits] JBL Code SVN: r31002 - in labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb: http and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jan 11 01:45:41 EST 2010


Author: kevin.conner at jboss.com
Date: 2010-01-11 01:45:41 -0500 (Mon, 11 Jan 2010)
New Revision: 31002

Modified:
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
Log:
move getBindAddress to Configuration: JBESB-3109

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java	2010-01-11 02:34:14 UTC (rev 31001)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/Configuration.java	2010-01-11 06:45:41 UTC (rev 31002)
@@ -22,6 +22,8 @@
 
 package org.jboss.soa.esb.common;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.Properties;
 
 import javax.jms.ConnectionFactory;
@@ -84,7 +86,8 @@
 			new KeyValuePair(Environment.MSG_STORE_DB_DATASOURCE_NAME	,getStoreDBDatasourceName()),
 			new KeyValuePair(Environment.REGISTRY_INTERCEPTORS			,getRegistryInterceptors()),
 			new KeyValuePair(Environment.REGISTRY_CACHE_MAX_SIZE		,getRegistryCacheMaxSize()),
-			new KeyValuePair(Environment.REGISTRY_CACHE_VALIDITY_PERIOD	,getRegistryCacheValidityPeriod())
+			new KeyValuePair(Environment.REGISTRY_CACHE_VALIDITY_PERIOD	,getRegistryCacheValidityPeriod()),
+			new KeyValuePair(Environment.ESB_BIND_ADDRESS ,getBindAddress())
 	};
 
 	public static String dump()
@@ -579,4 +582,26 @@
 	{
 		return ModulePropertyManager.getPropertyManager(ModulePropertyManager.SECURITY_MODULE).getProperty(Environment.SECURITY_SERVICE_CONTEXT_PROPAGATOR_CLASS);
 	}
+	
+	/**
+	 * Get the bind address.
+	 * @return the bind address.
+	 */
+	public static String getBindAddress()
+	{
+		String address = System.getProperty(Environment.ESB_BIND_ADDRESS) ;
+		if (address == null)
+		{
+			// This property is always set in the server, but may not be set if executing outside.
+			try
+			{
+				address = InetAddress.getLocalHost().getHostName();
+			}
+			catch (final UnknownHostException uhe)
+			{
+				address = "127.0.0.1" ;
+			}
+		}
+		return address ;
+	}
 }

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2010-01-11 02:34:14 UTC (rev 31001)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2010-01-11 06:45:41 UTC (rev 31002)
@@ -30,10 +30,8 @@
 import java.net.UnknownHostException;
 
 import org.jboss.internal.soa.esb.util.XMLHelper;
-import org.jboss.mx.util.MBeanProxyExt;
 import org.jboss.system.ServiceMBeanSupport;
 import org.jboss.system.server.ServerConfig;
-import org.jboss.system.server.ServerConfigImplMBean;
 
 /**
  * This MBean wraps the configuration to allow ServiceBindingManager
@@ -71,16 +69,13 @@
         this.propertyFile = propertyFile ;
     }
     
+    /**
+     * @deprecated Use {@link Configuration#getBindAddress()}.
+     */
+    @Deprecated
     public static String getBindAddress()
     {
-        String esbBindAddress = System.getProperty(Environment.ESB_BIND_ADDRESS) ;
-        if (esbBindAddress == null)
-        {
-            String serverBindAddress = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS) ;
-            esbBindAddress = JBossESBPropertyService.fixRemoteAddress(serverBindAddress) ;
-            System.setProperty(Environment.ESB_BIND_ADDRESS, esbBindAddress) ;
-        }
-        return esbBindAddress;
+        return Configuration.getBindAddress() ;
     }
     
     private static String fixRemoteAddress(final String address)
@@ -104,8 +99,13 @@
     protected void createService()
         throws Exception
     {
-    	// initialize ${jboss.esb.bind.address}
-        getBindAddress();
+        String esbBindAddress = System.getProperty(Environment.ESB_BIND_ADDRESS) ;
+        if (esbBindAddress == null)
+        {
+            String serverBindAddress = System.getProperty(ServerConfig.SERVER_BIND_ADDRESS) ;
+            esbBindAddress = fixRemoteAddress(serverBindAddress) ;
+            System.setProperty(Environment.ESB_BIND_ADDRESS, esbBindAddress) ;
+        }
         
         if (propertyFile != null)
         {

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java	2010-01-11 02:34:14 UTC (rev 31001)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/http/HttpConfiguration.java	2010-01-11 06:45:41 UTC (rev 31002)
@@ -34,7 +34,6 @@
 import org.jboss.mx.util.MBeanServerLocator;
 import org.jboss.soa.esb.common.Configuration;
 import org.jboss.soa.esb.common.Environment;
-import org.jboss.soa.esb.common.JBossESBPropertyService;
 
 /**
  * HttpConfiguration.
@@ -77,7 +76,7 @@
 		{
 			return global;
 		}
-		String bindAddress = JBossESBPropertyService.getBindAddress();
+		String bindAddress = Configuration.getBindAddress();
 		if (bindAddress != null)
 		{
 			return bindAddress;



More information about the jboss-svn-commits mailing list