From: <ble...@us...> - 2010-09-17 14:44:31
|
Revision: 3581 http://bigdata.svn.sourceforge.net/bigdata/?rev=3581&view=rev Author: blevine218 Date: 2010-09-17 14:44:23 +0000 (Fri, 17 Sep 2010) Log Message: ----------- changes paths in certain config files Modified Paths: -------------- branches/maven_scaleout/bigdata-core/src/main/deploy/var/config/deploy/default-deploy.properties branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/jini/util/LookupStarter.java branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/config/ConfigDeployUtil.java branches/maven_scaleout/bigdata-core/src/test/deploy/testing/conf/bigdataStandaloneTesting.config branches/maven_scaleout/bigdata-core/src/test/deploy/testing/test.xml Property Changed: ---------------- branches/maven_scaleout/bigdata-core/ Property changes on: branches/maven_scaleout/bigdata-core ___________________________________________________________________ Added: svn:ignore + target .settings .classpath .project Modified: branches/maven_scaleout/bigdata-core/src/main/deploy/var/config/deploy/default-deploy.properties =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/deploy/var/config/deploy/default-deploy.properties 2010-09-17 14:39:31 UTC (rev 3580) +++ branches/maven_scaleout/bigdata-core/src/main/deploy/var/config/deploy/default-deploy.properties 2010-09-17 14:44:23 UTC (rev 3581) @@ -8,7 +8,7 @@ # Federation properties federation.name.description=Name of the federation to discover -federation.name.default=@FED@ +federation.name.default= federation.name.type=string federation.minNodes.description=Minimum number of nodes in the federation Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/jini/util/LookupStarter.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/jini/util/LookupStarter.java 2010-09-17 14:39:31 UTC (rev 3580) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/service/jini/util/LookupStarter.java 2010-09-17 14:44:23 UTC (rev 3581) @@ -25,6 +25,7 @@ package com.bigdata.service.jini.util; +import com.bigdata.util.config.ConfigDeployUtil; import com.bigdata.util.config.ConfigurationUtil; import com.bigdata.util.config.LogUtil; import com.bigdata.util.config.NicUtil; @@ -75,10 +76,10 @@ private static String defaultGroup = null; static { try { - thisHost = NicUtil.getIpAddress("default.nic", "default", true); - defaultGroup = - System.getProperty("federation.name", - "bigdata.test.group-"+thisHost); + thisHost = NicUtil.getIpAddress("default.nic", "default", false); + //defaultGroup = System.getProperty("federation.name","bigdata.test.group-"+thisHost); + defaultGroup = ConfigDeployUtil.getFederationName(); + } catch (Throwable t) { /* swallow */ } } private static String defaultCodebasePort = "23333"; Modified: branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/config/ConfigDeployUtil.java =================================================================== --- branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/config/ConfigDeployUtil.java 2010-09-17 14:39:31 UTC (rev 3580) +++ branches/maven_scaleout/bigdata-core/src/main/java/com/bigdata/util/config/ConfigDeployUtil.java 2010-09-17 14:44:23 UTC (rev 3581) @@ -55,6 +55,9 @@ private static final String MIN = ".min"; private static final String DESCRIPTION = ".description"; private static final String TYPE = ".type"; + + private static final String FALLBACK_FEDNAME_FORMAT = "bigdata.test.group-%s"; + private static final String TEMPLATE_TOKEN_PATTERN = "@.*@"; public static String getString(String parameter) throws ConfigurationException @@ -156,12 +159,49 @@ */ public static String[] getGroupsToDiscover() throws ConfigurationException { - String fedNameStr = System.getProperty("federation.name"); - if(fedNameStr == null) { - fedNameStr = getString("federation.name"); - } + String fedNameStr = getFederationName(); return fedNameStr.split(","); } + + /** + * Retrieve the federation name (also used as Jini group name) via this pecking pecking order: + * <ol> + * <li>From the Java system property: <code>federation.name</code></li> + * <li>From the deployment properties file. Note that a value from the deployment + * properties file that has not gone through token replacement is considered + * invalid. In this case, the next value in the pecking order is used.</li> + * <li>Using the fallback convention: <code>bigdata.test.group-<ipaddress></code></li> + * </ol> + * + * @return String the federation name + * + * @throws ConfigurationException + */ + public static String getFederationName() throws ConfigurationException + { + // If we have a system property override, use that. + String fedName = System.getProperty("federation.name"); + + // If not, look in the deploy properties + if(fedName == null) { + fedName = getString("federation.name"); + } + + // If not set in the deploy properties, then use the fallback name of + // "bigdata.test.group-<ipaddress>". This is primarily to support test + // environments and we should never get this far in production. + if (fedName == null || fedName.length() == 0) { + try { + String ipAddress = NicUtil.getIpAddress("default.nic", "default", true); + fedName = String.format(FALLBACK_FEDNAME_FORMAT, ipAddress); + } + catch (Exception e) { + throw new ConfigurationException("Error retrieving IP address while constructing fallback federation name.", e); + } + } + + return fedName; + } /** * Returns an array of <code>LookupLocator</code> instances that can Modified: branches/maven_scaleout/bigdata-core/src/test/deploy/testing/conf/bigdataStandaloneTesting.config =================================================================== --- branches/maven_scaleout/bigdata-core/src/test/deploy/testing/conf/bigdataStandaloneTesting.config 2010-09-17 14:39:31 UTC (rev 3580) +++ branches/maven_scaleout/bigdata-core/src/test/deploy/testing/conf/bigdataStandaloneTesting.config 2010-09-17 14:44:23 UTC (rev 3581) @@ -77,7 +77,8 @@ * MUST use unicast discovery and specify the federation name in * the [groups]. */ - static fedname = System.getProperty("federation.name","testBigdataStandalone"); + //static fedname = System.getProperty("federation.name","testBigdataStandalone"); + static fedname = ConfigDeployUtil.getFederationName(); static zrootname = System.getProperty("bigdata.zrootname","testBigdataStandaloneZroot"); private static appHome = System.getProperty("app.home", ConfigMath.getAbsolutePath(new File(".")) ); Modified: branches/maven_scaleout/bigdata-core/src/test/deploy/testing/test.xml =================================================================== --- branches/maven_scaleout/bigdata-core/src/test/deploy/testing/test.xml 2010-09-17 14:39:31 UTC (rev 3580) +++ branches/maven_scaleout/bigdata-core/src/test/deploy/testing/test.xml 2010-09-17 14:44:23 UTC (rev 3581) @@ -32,7 +32,7 @@ <target name="setup" > <exec executable="hostname" outputproperty="this.hostname" /> <property name="test.codebase" value="http://${this.hostname}:${test.codebase.port}/jsk-dl.jar" /> - <property name="federation.name" value="bigdata.test.group-${this.hostname}" /> + <!-- <property name="federation.name" value="bigdata.test.group-${this.hostname}" /> --> </target> <target name="junit" description="starts http class server, lookup service, runs junit tests, stops lookup service, stops http class server." @@ -100,7 +100,9 @@ <sysproperty key="log4j.configuration" value="${log4j.configuration}" /> <sysproperty key="codebase.port" value="${test.codebase.port}" /> <sysproperty key="java.net.preferIPv4Stack" value="${java.net.preferIPv4Stack}" /> + <!-- <sysproperty key="federation.name" value="${federation.name}" /> + --> <sysproperty key="default.nic" value="${default.nic}" /> </java> </target> @@ -120,7 +122,9 @@ <sysproperty key="java.security.policy" value="${java.security.policy}" /> <sysproperty key="log4j.configuration" value="${log4j.configuration}" /> <sysproperty key="java.net.preferIPv4Stack" value="${java.net.preferIPv4Stack}" /> + <!-- <sysproperty key="federation.name" value="${federation.name}" /> + --> <sysproperty key="default.nic" value="${default.nic}" /> <arg value="-stop" /> </java> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |