Author: snjeza
Date: 2012-05-30 14:59:12 -0400 (Wed, 30 May 2012)
New Revision: 41545
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
Log:
JBIDE-11683 - Enable defining runtime download using external xml file
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-05-30
18:53:15 UTC (rev 41544)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-05-30
18:59:12 UTC (rev 41545)
@@ -46,7 +46,13 @@
// see pom.xml for actual value -- this is passed it at build-time via Maven
private static final String JBOSS_DIRECTORY_URL;
+
+ private static final String JBOSS_RUNTIME_URL_DEFAULT =
"http://download.jboss.org/examples/download_runtimes.xml"; //$NON-NLS-1$
+ private static final String JBOSS_RUNTIME_DIRECTORY =
"jboss.runtime.directory.url"; //$NON-NLS-1$
+
+ private static final String JBOSS_RUNTIME_URL;
+
static {
ResourceBundle rb =
ResourceBundle.getBundle("org.jboss.tools.project.examples.configurators.discovery");
//$NON-NLS-1$
String url = rb.getString("discovery.url").trim(); //$NON-NLS-1$
@@ -56,6 +62,13 @@
} else {
JBOSS_DIRECTORY_URL = url;
}
+ url = rb.getString("runtime.url").trim(); //$NON-NLS-1$
+ if ("".equals(url) ||
"${jboss.runtime.directory.url}".equals(url)){ //$NON-NLS-1$//$NON-NLS-2$
+ //was not filtered, fallback to default value
+ JBOSS_RUNTIME_URL = JBOSS_RUNTIME_URL_DEFAULT;
+ } else {
+ JBOSS_RUNTIME_URL = url;
+ }
}
private static final String TWITTER_LINK ="http://twitter.com/#!/jbosstools";
//$NON-NLS-1$
@@ -64,7 +77,6 @@
private static final String NEWS_URL = "http://planet.jboss.org/feeds/news";
//$NON-NLS-1$
- private static final String DOWNLOAD_RUNTIMES_URL =
"http://download.jboss.org/examples/download_runtimes.xml"; //$NON-NLS-1$
private Image headerImage;
@Override
@@ -115,6 +127,12 @@
@Override
public String getDownloadRuntimesURL() {
- return DOWNLOAD_RUNTIMES_URL;
+ // use commandline override -Djboss.runtime.directory.url
+ String directory = System.getProperty(JBOSS_RUNTIME_DIRECTORY, null);
+ if (directory == null) {
+ // else use Maven-generated value (or fall back to default)
+ return JBOSS_DIRECTORY_URL;
+ }
+ return directory;
}
}
Show replies by date