Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-10-09 03:22:47 +0000
committerJohn Arthorne2008-10-09 03:22:47 +0000
commit773624727040c3a294359169f0f8d4aa22a7071d (patch)
treef51675a1f16deb759720dc7c3a4daa379935fdbd /bundles/org.eclipse.equinox.p2.console/src
parentdfe94e43cf371e39d46b07c9f0e6c6b28eeb000e (diff)
downloadrt.equinox.p2-773624727040c3a294359169f0f8d4aa22a7071d.tar.gz
rt.equinox.p2-773624727040c3a294359169f0f8d4aa22a7071d.tar.xz
rt.equinox.p2-773624727040c3a294359169f0f8d4aa22a7071d.zip
Bug 237776 Replace URL by URI
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.console/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java28
2 files changed, 32 insertions, 32 deletions
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
index 7826ee343..d7ed6bd5b 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvCommandProvider.java
@@ -10,8 +10,8 @@
package org.eclipse.equinox.internal.p2.console;
import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -65,7 +65,7 @@ public class ProvCommandProvider implements CommandProvider {
interpreter.println();
return;
}
- URL repoURL = toURL(interpreter, urlString);
+ URI repoURL = toURI(interpreter, urlString);
if (repoURL == null)
return;
if (ProvisioningHelper.addMetadataRepository(repoURL) == null)
@@ -79,7 +79,7 @@ public class ProvCommandProvider implements CommandProvider {
interpreter.println();
return;
}
- URL repoURL = toURL(interpreter, urlString);
+ URI repoURL = toURI(interpreter, urlString);
if (repoURL == null)
return;
ProvisioningHelper.removeMetadataRepository(repoURL);
@@ -92,7 +92,7 @@ public class ProvCommandProvider implements CommandProvider {
interpreter.println();
return;
}
- URL repoURL = toURL(interpreter, urlString);
+ URI repoURL = toURI(interpreter, urlString);
if (repoURL == null)
return;
if (ProvisioningHelper.addArtifactRepository(repoURL) == null)
@@ -106,7 +106,7 @@ public class ProvCommandProvider implements CommandProvider {
interpreter.println();
return;
}
- URL repoURL = toURL(interpreter, urlString);
+ URI repoURL = toURI(interpreter, urlString);
if (repoURL == null)
return;
ProvisioningHelper.removeArtifactRepository(repoURL);
@@ -185,9 +185,9 @@ public class ProvCommandProvider implements CommandProvider {
String urlString = processArgument(interpreter.nextArgument());
String id = processArgument(interpreter.nextArgument());
String version = processArgument(interpreter.nextArgument());
- URL repoURL = null;
+ URI repoURL = null;
if (urlString != null && !urlString.equals(WILDCARD_ANY))
- repoURL = toURL(interpreter, urlString);
+ repoURL = toURI(interpreter, urlString);
IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(repoURL, new InstallableUnitQuery(id, new VersionRange(version)), null));
for (int i = 0; i < units.length; i++)
println(interpreter, units[i]);
@@ -204,16 +204,16 @@ public class ProvCommandProvider implements CommandProvider {
String id = processArgument(interpreter.nextArgument());
String version = processArgument(interpreter.nextArgument());
if (urlString == null) {
- URL[] repositories = ProvisioningHelper.getMetadataRepositories();
+ URI[] repositories = ProvisioningHelper.getMetadataRepositories();
if (repositories != null)
for (int i = 0; i < repositories.length; i++)
interpreter.println(repositories[i]);
return;
}
- URL repoURL = toURL(interpreter, urlString);
- if (repoURL == null)
+ URI repoLocation = toURI(interpreter, urlString);
+ if (repoLocation == null)
return;
- IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(repoURL, new InstallableUnitQuery(id, new VersionRange(version)), null));
+ IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(repoLocation, new InstallableUnitQuery(id, new VersionRange(version)), null));
for (int i = 0; i < units.length; i++)
println(interpreter, units[i]);
}
@@ -232,7 +232,7 @@ public class ProvCommandProvider implements CommandProvider {
if (queryable == null)
return;
} else {
- URL repoURL = toURL(interpreter, urlString);
+ URI repoURL = toURI(interpreter, urlString);
if (repoURL == null)
return;
queryable = ProvisioningHelper.getMetadataRepository(repoURL);
@@ -254,14 +254,14 @@ public class ProvCommandProvider implements CommandProvider {
public void _provlar(CommandInterpreter interpreter) {
String urlString = processArgument(interpreter.nextArgument());
if (urlString == null) {
- URL[] repositories = ProvisioningHelper.getArtifactRepositories();
+ URI[] repositories = ProvisioningHelper.getArtifactRepositories();
if (repositories == null)
return;
for (int i = 0; i < repositories.length; i++)
interpreter.println(repositories[i]);
return;
}
- URL repoURL = toURL(interpreter, urlString);
+ URI repoURL = toURI(interpreter, urlString);
if (repoURL == null)
return;
IArtifactRepository repo = ProvisioningHelper.getArtifactRepository(repoURL);
@@ -294,10 +294,10 @@ public class ProvCommandProvider implements CommandProvider {
* Returns the given string as an URL, or <code>null</code> if the string
* could not be interpreted as an URL.
*/
- private URL toURL(CommandInterpreter interpreter, String urlString) {
+ private URI toURI(CommandInterpreter interpreter, String urlString) {
try {
- return new URL(urlString);
- } catch (MalformedURLException e) {
+ return new URI(urlString);
+ } catch (URISyntaxException e) {
interpreter.print(e.getMessage());
interpreter.println();
return null;
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
index b814b3ee1..6704898f2 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
@@ -11,7 +11,7 @@
package org.eclipse.equinox.internal.p2.console;
import java.io.IOException;
-import java.net.URL;
+import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -32,7 +32,7 @@ import org.osgi.framework.Version;
public class ProvisioningHelper {
- public static IMetadataRepository addMetadataRepository(URL location) {
+ public static IMetadataRepository addMetadataRepository(URI location) {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
if (manager == null)
throw new IllegalStateException("No metadata repository manager found"); //$NON-NLS-1$
@@ -51,7 +51,7 @@ public class ProvisioningHelper {
}
}
- public static IMetadataRepository getMetadataRepository(URL location) {
+ public static IMetadataRepository getMetadataRepository(URI location) {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
if (manager == null)
throw new IllegalStateException("No metadata repository manager found");
@@ -62,14 +62,14 @@ public class ProvisioningHelper {
}
}
- public static void removeMetadataRepository(URL location) {
+ public static void removeMetadataRepository(URI location) {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
if (manager == null)
throw new IllegalStateException("No metadata repository manager found");
manager.removeRepository(location);
}
- public static IArtifactRepository addArtifactRepository(URL location) {
+ public static IArtifactRepository addArtifactRepository(URI location) {
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
if (manager == null)
// TODO log here
@@ -88,7 +88,7 @@ public class ProvisioningHelper {
}
}
- public static void removeArtifactRepository(URL location) {
+ public static void removeArtifactRepository(URI location) {
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
if (manager == null)
// TODO log here
@@ -153,11 +153,11 @@ public class ProvisioningHelper {
* @param monitor A progress monitor, or <code>null</code>
* @return The IUs that match the query
*/
- public static Collector getInstallableUnits(URL location, Query query, IProgressMonitor monitor) {
+ public static Collector getInstallableUnits(URI location, Query query, IProgressMonitor monitor) {
return getInstallableUnits(location, query, new Collector(), monitor);
}
- public static Collector getInstallableUnits(URL location, Query query, Collector collector, IProgressMonitor monitor) {
+ public static Collector getInstallableUnits(URI location, Query query, Collector collector, IProgressMonitor monitor) {
IQueryable queryable = null;
if (location == null) {
queryable = (IQueryable) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
@@ -167,12 +167,12 @@ public class ProvisioningHelper {
return queryable.query(query, collector, monitor);
}
- public static URL[] getMetadataRepositories() {
+ public static URI[] getMetadataRepositories() {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(Activator.getContext(), IMetadataRepositoryManager.class.getName());
if (manager == null)
// TODO log here
return null;
- URL[] repos = manager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL);
+ URI[] repos = manager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL);
if (repos.length > 0)
return repos;
return null;
@@ -189,7 +189,7 @@ public class ProvisioningHelper {
StringBuffer error = new StringBuffer();
error.append("Installable unit not found: " + unitId + ' ' + version + '\n');
error.append("Repositories searched:\n");
- URL[] repos = getMetadataRepositories();
+ URI[] repos = getMetadataRepositories();
if (repos != null) {
for (int i = 0; i < repos.length; i++)
error.append(repos[i] + "\n");
@@ -245,18 +245,18 @@ public class ProvisioningHelper {
}
}
- public static URL[] getArtifactRepositories() {
+ public static URI[] getArtifactRepositories() {
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
if (manager == null)
// TODO log here
return null;
- URL[] repos = manager.getKnownRepositories(IArtifactRepositoryManager.REPOSITORIES_ALL);
+ URI[] repos = manager.getKnownRepositories(IArtifactRepositoryManager.REPOSITORIES_ALL);
if (repos.length > 0)
return repos;
return null;
}
- public static IArtifactRepository getArtifactRepository(URL repoURL) {
+ public static IArtifactRepository getArtifactRepository(URI repoURL) {
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName());
try {
if (manager != null)

Back to the top