Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oberlies2012-04-12 13:55:29 +0000
committerTobias Oberlies2012-04-12 15:04:01 +0000
commitd104b01da65aa65a7b8cfa43287cef8dbebbe168 (patch)
treeb4d6217480d71c679876ae14f65e873e5cbef510 /bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
parent4e22e50e855a886d2d3b2e662f17d1d50d0808d1 (diff)
downloadrt.equinox.p2-d104b01da65aa65a7b8cfa43287cef8dbebbe168.tar.gz
rt.equinox.p2-d104b01da65aa65a7b8cfa43287cef8dbebbe168.tar.xz
rt.equinox.p2-d104b01da65aa65a7b8cfa43287cef8dbebbe168.zip
347319 Allow repository factories which load repositories by URNsv20120412-1504
- Fix the response of the artifact/metadata repository factories in case that the location to be loaded is not a URL: the factories must return null or throw a ProvisionException with status REPOSITORY_NOT_FOUND in order to make sure that the manager continues to ask other factories. This allows to register a custom factory which for example looks up instances from a registry by uniform resource *identifiers* which are not uniform resource *locators*. - Added a test for loading from a custom, registry based repository factory. Bug: 347319 - [repository] SimpleArtifactRepositoryFactory prevents loading repositories from non-URL URIs
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
index 01b260288..207eebcee 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/AbstractRepositoryManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -689,8 +689,8 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
*/
private LocationProperties loadIndexFile(URI location, IProgressMonitor monitor) {
LocationProperties locationProperties = LocationProperties.createEmptyIndexFile();
- //Handle the case of local repos
- if ("memory".equals(location.getScheme())) //$NON-NLS-1$
+ //Handle the case of in-memory repos
+ if (!isURL(location))
return locationProperties;
if ("file".equals(location.getScheme())) { //$NON-NLS-1$
@@ -740,6 +740,15 @@ public abstract class AbstractRepositoryManager<T> implements IRepositoryManager
return location;
}
+ private static boolean isURL(URI location) {
+ try {
+ new URL(location.toASCIIString());
+ } catch (MalformedURLException e) {
+ return false;
+ }
+ return true;
+ }
+
private IRepository<T> loadRepository(URI location, String suffix, String type, int flags, SubMonitor monitor) throws ProvisionException {
IExtension[] providers = findMatchingRepositoryExtensions(suffix, type);
// Loop over the candidates and return the first one that successfully loads

Back to the top