[jbosstools-commits] JBoss Tools SVN: r44120 - in trunk: runtime/plugins/org.jboss.tools.runtime.core and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 28 14:39:23 EDT 2012


Author: snjeza
Date: 2012-09-28 14:39:23 -0400 (Fri, 28 Sep 2012)
New Revision: 44120

Added:
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/ExternalRuntimeDownload.java
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/runtime.properties
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/IJBossCentralConfigurator.java
   trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
   trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml
   trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java
Log:
JBIDE-12757 - implement maven override flag for download runtime urls

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-09-28 17:13:37 UTC (rev 44119)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/DefaultJBossCentralConfigurator.java	2012-09-28 18:39:23 UTC (rev 44120)
@@ -47,12 +47,6 @@
 	// 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/jbosstools/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$
@@ -62,13 +56,6 @@
 		} 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$
@@ -125,14 +112,4 @@
 		return headerImage;
 	}
 
-	@Override
-	public String getDownloadRuntimesURL() {
-		// 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: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java	2012-09-28 17:13:37 UTC (rev 44119)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/IJBossCentralConfigurator.java	2012-09-28 18:39:23 UTC (rev 44120)
@@ -26,7 +26,6 @@
 	String getTwitterLink();
 	String getBlogsUrl();
 	String getNewsUrl();
-	String getDownloadRuntimesURL();
 	List<String> getWizardIds();
 	Image getHeaderImage();
 

Modified: trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties
===================================================================
--- trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties	2012-09-28 17:13:37 UTC (rev 44119)
+++ trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/configurators/discovery.properties	2012-09-28 18:39:23 UTC (rev 44120)
@@ -1,2 +1 @@
 discovery.url=${jboss.discovery.directory.url}
-runtime.url=${jboss.runtime.directory.url}
\ No newline at end of file

Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml	2012-09-28 17:13:37 UTC (rev 44119)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/pom.xml	2012-09-28 18:39:23 UTC (rev 44120)
@@ -11,4 +11,60 @@
 	<artifactId>org.jboss.tools.runtime.core</artifactId>
 	
 	<packaging>eclipse-plugin</packaging>
+	
+	<properties>
+		<jboss.runtime.directory.url>http://download.jboss.org/jbosstools/examples/download_runtimes.xml</jboss.runtime.directory.url>
+	</properties>
+
+    <!-- 
+	<profiles>
+		<profile>
+			<id>4.0.juno</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+			</activation>
+			<properties>
+				<jboss.runtime.directory.url>http://download.jboss.org/jbosstools/updates/nightly/core/4.0.juno/jbosstools-runtime.xml</jboss.runtime.directory.url>
+			</properties>
+		</profile>
+		<profile>
+			<id>trunk</id>
+			<activation>
+				<activeByDefault>false</activeByDefault>
+			</activation>
+			<properties>
+				<jboss.runtime.directory.url>http://download.jboss.org/jbosstools/updates/nightly/core/trunk/jbosstools-runtime.xml</jboss.runtime.directory.url>
+			</properties>
+		</profile>
+	</profiles>
+	 -->
+	<build>
+		<resources>
+			<resource>
+				<directory>src</directory>
+				<includes>
+					<include>**/runtime.properties</include>
+				</includes>
+				<filtering>true</filtering>
+			</resource>
+		</resources>
+		<plugins>
+			<plugin>
+				<artifactId>maven-resources-plugin</artifactId>
+				<version>2.5</version>
+				<executions>
+					<execution>
+						<id>resource-filtering</id>
+						<!-- Need to execute resource filtering AFTER tycho-compiler-plugin 
+							is executed -->
+						<phase>process-classes</phase>
+						<goals>
+							<goal>resources</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+	
 </project>
\ No newline at end of file

Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/ExternalRuntimeDownload.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/ExternalRuntimeDownload.java	                        (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/ExternalRuntimeDownload.java	2012-09-28 18:39:23 UTC (rev 44120)
@@ -0,0 +1,32 @@
+package org.jboss.tools.runtime.core.internal;
+
+import java.util.ResourceBundle;
+
+public class ExternalRuntimeDownload {
+
+	private static final String JBOSS_RUNTIME_URL_DEFAULT = "http://download.jboss.org/jbosstools/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.runtime.core.internal.runtime"); //$NON-NLS-1$
+		String 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;
+		}
+	}
+	
+	public static String getURL() {
+		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: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java	2012-09-28 17:13:37 UTC (rev 44119)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/RuntimeExtensionManager.java	2012-09-28 18:39:23 UTC (rev 44120)
@@ -43,8 +43,6 @@
 	
 	// JBoss Runtime files
 	private static final String DOWNLOAD_RUNTIMES_FILE = "download_runtime.xml"; //$NON-NLS-1$
-	private static final String JBOSS_RUNTIME_URL_DEFAULT = "http://download.jboss.org/jbosstools/examples/download_runtimes.xml"; //$NON-NLS-1$
-	private static final String JBOSS_RUNTIME_DIRECTORY = "jboss.runtime.directory.url"; //$NON-NLS-1$
 	
 	// Extension point property keys
 	
@@ -153,29 +151,8 @@
 		loadExtensionDownloadableRuntimes(tmp);
 		loadExternalDownloadableRuntimes(tmp);
 		return tmp;
-	}
+	}	
 	
-
-	public String getDownloadRuntimesURL() {
-		// 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)
-//			ResourceBundle rb = ResourceBundle.getBundle("org.jboss.tools.project.examples.configurators.discovery"); //$NON-NLS-1$
-//			String 		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
-//				return JBOSS_RUNTIME_URL_DEFAULT;
-//			} else {
-//				return url;
-//			}
-			// Above code removed when trying to move this downloadable
-			// runtime stuff into the runtime component instead of examples / central
-			return JBOSS_RUNTIME_URL_DEFAULT;
-		}
-		return directory;		
-	}
-	
 	private File getCacheFile() {
 		IPath location = RuntimeCoreActivator.getDefault().getStateLocation();
 		File cacheFile = new File(location.toFile(), DOWNLOAD_RUNTIMES_FILE);
@@ -264,7 +241,7 @@
 	}
 	private void loadExternalDownloadableRuntimes(HashMap<String, DownloadRuntime> map) {
 		try {
-			String urlString = getDownloadRuntimesURL();
+			String urlString = ExternalRuntimeDownload.getURL();
 			if (getCacheModified() == 0 || getRemoteModified(urlString) != getCacheModified()) {
 				downloadRemoteRuntimeFile(urlString);
 			}

Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/runtime.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/runtime.properties	                        (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/internal/runtime.properties	2012-09-28 18:39:23 UTC (rev 44120)
@@ -0,0 +1 @@
+runtime.url=${jboss.runtime.directory.url}



More information about the jbosstools-commits mailing list