From: <tho...@us...> - 2013-11-22 19:17:20
|
Revision: 7584 http://bigdata.svn.sourceforge.net/bigdata/?rev=7584&view=rev Author: thompsonbry Date: 2013-11-22 19:17:14 +0000 (Fri, 22 Nov 2013) Log Message: ----------- Modified the HAJournal.config script to use a new getProperty() method that returns the default if the value for the property is an empty string (after trimming whitespace). Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/jini/util/ConfigMath.java branches/BIGDATA_RELEASE_1_3_0/src/resources/HAJournal/HAJournal.config Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/jini/util/ConfigMath.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/jini/util/ConfigMath.java 2013-11-22 19:09:13 UTC (rev 7583) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/java/com/bigdata/jini/util/ConfigMath.java 2013-11-22 19:17:14 UTC (rev 7584) @@ -427,4 +427,30 @@ } + /** + * Return the value for the named property -or- the default value if the + * property name is not defined or evaluates to an empty string after + * trimming any whitespace. + * + * @param key + * The property name. + * @param def + * The default value. + * @return The value for the named property -or- the default value if the + * property name is not defined or evaluates to an empty string + * after trimming any whitespace. + */ + public static String getProperty(final String key, final String def) { + + String tmp = System.getProperty(key); + + if (tmp == null || tmp.trim().length() == 0) { + + return def; + } + + return tmp; + + } + } Modified: branches/BIGDATA_RELEASE_1_3_0/src/resources/HAJournal/HAJournal.config =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/src/resources/HAJournal/HAJournal.config 2013-11-22 19:09:13 UTC (rev 7583) +++ branches/BIGDATA_RELEASE_1_3_0/src/resources/HAJournal/HAJournal.config 2013-11-22 19:17:14 UTC (rev 7584) @@ -60,25 +60,25 @@ /* The name of the federation (also constrains the discovery groups and * provides a zk namespace). This can be overridden from the environment. */ - private static fedname = System.getProperty("FEDNAME","benchmark"); + private static fedname = ConfigMath.getProperty("FEDNAME","benchmark"); // NanoSparqlServer (http) port. - private static nssPort = Integer.parseInt(System.getProperty("NSS_PORT","8090")); + private static nssPort = Integer.parseInt(ConfigMath.getProperty("NSS_PORT","8090")); // write replication pipeline port (listener). - private static haPort = Integer.parseInt(System.getProperty("HA_PORT","9090")); + private static haPort = Integer.parseInt(ConfigMath.getProperty("HA_PORT","9090")); // The #of services in the write pipeline. - private static replicationFactor = Integer.parseInt(System.getProperty("REPLICATION_FACTOR","3")); + private static replicationFactor = Integer.parseInt(ConfigMath.getProperty("REPLICATION_FACTOR","3")); // The logical service identifier shared by all members of the quorum. - private static logicalServiceId = System.getProperty("LOGICAL_SERVICE_ID","HAJournal-1"); + private static logicalServiceId = ConfigMath.getProperty("LOGICAL_SERVICE_ID","HAJournal-1"); // The ServiceID for *this* service -or- null to assign it dynamically. private static serviceId = null; // The base directory for the federation. - private static fedDir = new File(System.getProperty("FED_DIR","."),fedname); + private static fedDir = new File(ConfigMath.getProperty("FED_DIR","."),fedname); // The service directory (if serviceId is null, then you must override). // private static serviceDir = new File(fedname,""+serviceId); @@ -116,7 +116,7 @@ //static private groups = LookupDiscovery.ALL_GROUPS; // unicast discovery or multiple setups, MUST specify groups. - static private groups = ConfigMath.getGroups(System.getProperty("GROUPS",bigdata.fedname)); + static private groups = ConfigMath.getGroups(ConfigMath.getProperty("GROUPS",bigdata.fedname)); /** * One or more unicast URIs of the form <code>jini://host/</code> @@ -126,7 +126,7 @@ * discovery <strong>and</strong> you have specified the groups as * LookupDiscovery.ALL_GROUPS (a <code>null</code>). */ - static private locators = ConfigMath.getLocators(System.getProperty("LOCATORS","jini://bigdata15/,jini://bigdata16/,jini://bigdata17/")); + static private locators = ConfigMath.getLocators(ConfigMath.getProperty("LOCATORS","jini://bigdata15/,jini://bigdata16/,jini://bigdata17/")); /** * A common point to set the Zookeeper client's requested @@ -232,7 +232,7 @@ * the CLIENT port for the zookeeper server instance. */ // ensemble - servers = System.getProperty("ZK_SERVERS","bigdata15:2081,bigdata16:2081,bigdata17:2081"); + servers = ConfigMath.getProperty("ZK_SERVERS","bigdata15:2081,bigdata16:2081,bigdata17:2081"); /* Session timeout (optional). */ sessionTimeout = bigdata.sessionTimeout; @@ -347,19 +347,19 @@ // performance counters for internal queues. new NV(Journal.Options.COLLECT_QUEUE_STATISTICS, - System.getProperty("COLLECT_QUEUE_STATISTICS","false")), + ConfigMath.getProperty("COLLECT_QUEUE_STATISTICS","false")), // platform and process performance counters (requires external s/w on some platforms) new NV(Journal.Options.COLLECT_PLATFORM_STATISTICS, - System.getProperty("COLLECT_PLATFORM_STATISTICS","false")), + ConfigMath.getProperty("COLLECT_PLATFORM_STATISTICS","false")), // uses bigdata-ganglia module to report service metrics to ganglia. new NV(com.bigdata.journal.GangliaPlugIn.Options.GANGLIA_REPORT, - System.getProperty("GANGLIA_REPORT","false")), + ConfigMath.getProperty("GANGLIA_REPORT","false")), // uses bigdata-ganglia module to build internal model of cluster load. new NV(com.bigdata.journal.GangliaPlugIn.Options.GANGLIA_LISTEN, - System.getProperty("GANGLIA_LISTENER","false")), + ConfigMath.getProperty("GANGLIA_LISTENER","false")), }, bigdata.kb); @@ -374,7 +374,7 @@ create = true; - queryThreadPoolSize = Integer.parseInt(System.getProperty("QUERY_THREAD_POOL_SIZE","16")); + queryThreadPoolSize = Integer.parseInt(ConfigMath.getProperty("QUERY_THREAD_POOL_SIZE","16")); describeEachNamedGraph = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |