# HG changeset patch # User Ed Swartz # Date 1283983930 18000 # Node ID 0dd7f79ee65d06e267c11f87e02c4fdca0ecc75e # Parent f51fb769a899a0cbe7a631f5f7c0d89a8bb284f6 Support testing package XML locally diff -r f51fb769a899 -r 0dd7f79ee65d connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/installpackages/InstallPackages.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/installpackages/InstallPackages.java Wed Sep 08 17:11:16 2010 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/installpackages/InstallPackages.java Wed Sep 08 17:12:10 2010 -0500 @@ -182,6 +182,11 @@ if (o1.equals(o2)) return 0; + // EJS HACK: I tried using the ';' separator in the sdkFamily but it + // sorted to the bottom and also showed up in the UI...? + if (o1.equals("Symbian")) + return -1; + for (String orderString : orderList) { if (o1.equals(orderString)) return -1; @@ -216,8 +221,19 @@ return packages; } - private PackagesType getAvailablePackagesFromServer() throws Exception { - GetMethod getMethod = new GetMethod(getMasterFilePath()); + + private URL getAvailablePackagesURL() throws Exception { + URL url = null; + + // see if the file is local (Ed's hack for testing...) + String masterFilePathStr = getMasterFilePath(); + url = new URL(masterFilePathStr); + if (url.getProtocol().equals("file")) { + return url; + } + + // else, read the file to a local temporary location + GetMethod getMethod = new GetMethod(masterFilePathStr); HttpClient client = new HttpClient(); setProxyData(client, getMethod); client.getHttpConnectionManager().getParams() @@ -255,12 +271,21 @@ } out.close(); in.close(); - URL url = masterFile.toURI().toURL(); - return loadPackages(url); + url = masterFile.toURI().toURL(); + + return url; } - return null; } + + private PackagesType getAvailablePackagesFromServer() throws Exception { + URL url = getAvailablePackagesURL(); + + if (url == null) + return null; + + return loadPackages(url); + } private static java.net.URI getURI(GetMethod getMethod) { try { diff -r f51fb769a899 -r 0dd7f79ee65d connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractPackageInstallerProvider.java --- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractPackageInstallerProvider.java Wed Sep 08 17:11:16 2010 -0500 +++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/interfaces/AbstractPackageInstallerProvider.java Wed Sep 08 17:12:10 2010 -0500 @@ -19,6 +19,7 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; +import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -117,7 +118,7 @@ installFileUrl = getInstallFileUrl(runnableContext); inputStream = getInstallFile(installFileUrl, runnableContext); } catch (Exception e) { - RemoteConnectionsActivator.logError(e); + RemoteConnectionsActivator.log("Failed to find package URL " + installFileUrl, e); } String defaultFileName = null; if (installFileUrl != null) @@ -125,7 +126,16 @@ return new PackageContents(defaultFileName, inputStream); } - private ByteArrayInputStream getInstallFile(String installFileUrl, IRunnableContext runnableContext) throws Exception { + private InputStream getInstallFile(String installFileUrl, IRunnableContext runnableContext) throws Exception { + + URL url = null; + + // see if the file is local (Ed's hack for testing...) + url = new URL(installFileUrl); + if (url.getProtocol().equals("file")) { + return url.openStream(); + } + GetMethod getMethod = new GetMethod(installFileUrl); HttpClient client = new HttpClient(); InstallPackages.setProxyData(client, getMethod);