Author: snjeza
Date: 2012-05-31 17:19:30 -0400 (Thu, 31 May 2012)
New Revision: 41596
Modified:
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
Log:
JBIDE-11683 - Enable defining runtime download using external xml file
Modified:
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java
===================================================================
---
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-05-31
21:11:48 UTC (rev 41595)
+++
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java 2012-05-31
21:19:30 UTC (rev 41596)
@@ -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_RUNTIME_URL;
+ }
+ return directory;
}
}
Modified:
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
===================================================================
---
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties 2012-05-31
21:11:48 UTC (rev 41595)
+++
branches/jbosstools-3.3.x/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties 2012-05-31
21:19:30 UTC (rev 41596)
@@ -1 +1,2 @@
-discovery.url=${jboss.discovery.directory.url}
\ No newline at end of file
+discovery.url=${jboss.discovery.directory.url}
+runtime.url=${jboss.runtime.directory.url}
\ No newline at end of file