Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-01-13 17:29:41 +0000
committerPascal Rapicault2010-01-13 17:29:41 +0000
commit18189f0d42f7375660762dc6c885cf31683ae562 (patch)
tree17775d847bed9a33f3c68b74db2df75a2139c0bc /bundles/org.eclipse.equinox.p2.extensionlocation
parentc363f2984a09b73c422e38f4556fd3b23eafe958 (diff)
downloadrt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.tar.gz
rt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.tar.xz
rt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.zip
Merging api branch back to HEADv20100113
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.extensionlocation')
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF24
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java42
11 files changed, 137 insertions, 107 deletions
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath b/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs
index aceba4d02..e742b02fa 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 20 12:57:22 PST 2008
+#Tue Dec 22 19:30:45 CET 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
@@ -8,24 +8,24 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=jsr14
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -72,7 +72,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF
index f553d5c19..c88a837bc 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/META-INF/MANIFEST.MF
@@ -6,24 +6,28 @@ Bundle-Localization: plugin
Bundle-Version: 1.0.100.qualifier
Bundle-SymbolicName: org.eclipse.equinox.p2.extensionlocation;singleton:=true
Bundle-Activator: org.eclipse.equinox.internal.p2.extensionlocation.Activator
-Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
- J2SE-1.4
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
+ CDC-1.1/Foundation-1.1
Export-Package: org.eclipse.equinox.internal.p2.extensionlocation;x-friends:="org.eclipse.equinox.p2.reconciler.dropins"
-Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
+Import-Package: org.eclipse.equinox.internal.p2.artifact.repository.simple,
+ org.eclipse.equinox.internal.p2.core.helpers,
+ org.eclipse.equinox.internal.p2.metadata.repository,
org.eclipse.equinox.internal.p2.publisher.eclipse,
org.eclipse.equinox.internal.p2.touchpoint.eclipse,
org.eclipse.equinox.internal.p2.update,
- org.eclipse.equinox.internal.provisional.p2.artifact.repository,
org.eclipse.equinox.internal.provisional.p2.core,
org.eclipse.equinox.internal.provisional.p2.directorywatcher,
- org.eclipse.equinox.internal.provisional.p2.engine,
org.eclipse.equinox.internal.provisional.p2.metadata,
- org.eclipse.equinox.internal.provisional.p2.metadata.repository,
- org.eclipse.equinox.internal.provisional.p2.repository,
- org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository,
- org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository,
- org.eclipse.equinox.internal.provisional.spi.p2.repository,
+ org.eclipse.equinox.p2.core,
+ org.eclipse.equinox.p2.engine,
org.eclipse.equinox.p2.publisher.eclipse,
+ org.eclipse.equinox.p2.repository,
+ org.eclipse.equinox.p2.repository.artifact,
+ org.eclipse.equinox.p2.repository.artifact.spi,
+ org.eclipse.equinox.p2.repository.metadata,
+ org.eclipse.equinox.p2.repository.metadata.spi,
+ org.eclipse.equinox.p2.repository.spi,
org.eclipse.osgi.service.datalocation;version="1.1.0",
org.eclipse.osgi.service.resolver;version="1.2.0",
org.eclipse.osgi.util,
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties b/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties
index 39459475f..668447566 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/build.properties
@@ -17,3 +17,5 @@ bin.includes = META-INF/,\
about.html
source.. = src/
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
index a6aa54387..e6011a608 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/Activator.java
@@ -17,9 +17,10 @@ import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.core.helpers.URLUtil;
import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository;
import org.eclipse.osgi.service.datalocation.Location;
import org.osgi.framework.*;
@@ -63,7 +64,7 @@ public class Activator implements BundleActivator {
}
public static IProfile getCurrentProfile() {
- ServiceReference reference = bundleContext.getServiceReference(IProfileRegistry.class.getName());
+ ServiceReference reference = bundleContext.getServiceReference(IProfileRegistry.SERVICE_NAME);
if (reference == null)
return null;
IProfileRegistry profileRegistry = (IProfileRegistry) bundleContext.getService(reference);
@@ -74,21 +75,20 @@ public class Activator implements BundleActivator {
}
}
- public static IFileArtifactRepository getBundlePoolRepository() {
- ServiceReference reference = bundleContext.getServiceReference(IProfileRegistry.class.getName());
+ public static IProvisioningAgent getCurrentAgent() {
+ ServiceReference reference = bundleContext.getServiceReference(IProvisioningAgent.class.getName());
if (reference == null)
return null;
- IProfileRegistry profileRegistry = (IProfileRegistry) bundleContext.getService(reference);
- IProfile profile = null;
- try {
- profile = profileRegistry.getProfile(IProfileRegistry.SELF);
- } finally {
- bundleContext.ungetService(reference);
- }
- if (profile == null)
+ return (IProvisioningAgent) bundleContext.getService(reference);
+ }
+
+ public static IFileArtifactRepository getBundlePoolRepository() {
+ IProfile profile = getCurrentProfile();
+ IProvisioningAgent agent = getCurrentAgent();
+ if (profile == null || agent == null)
return null;
- return Util.getAggregatedBundleRepository(profile, Util.AGGREGATE_CACHE | Util.AGGREGATE_SHARED_CACHE);
+ return Util.getAggregatedBundleRepository(agent, profile, Util.AGGREGATE_CACHE | Util.AGGREGATE_SHARED_CACHE);
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java
index 6615f0072..c109aafb3 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/BundlePoolFilteredListener.java
@@ -10,25 +10,28 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.extensionlocation;
+import org.eclipse.equinox.p2.query.IQueryResult;
+
import java.io.File;
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
+import java.util.*;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.DirectoryChangeListener;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository;
public class BundlePoolFilteredListener extends DirectoryChangeListener {
private DirectoryChangeListener delegate;
- private Set bundlePoolFiles = new HashSet();
+ private Set<File> bundlePoolFiles = new HashSet<File>();
public BundlePoolFilteredListener(DirectoryChangeListener listener) {
delegate = listener;
IFileArtifactRepository bundlePool = Activator.getBundlePoolRepository();
if (bundlePool != null) {
- IArtifactKey[] keys = bundlePool.getArtifactKeys();
- for (int i = 0; i < keys.length; i++) {
- File artifactFile = bundlePool.getArtifactFile(keys[i]);
+ IQueryResult<IArtifactKey> keys = bundlePool.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
+ File artifactFile = bundlePool.getArtifactFile(key);
if (artifactFile != null)
bundlePoolFiles.add(artifactFile);
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
index 0d67e3da8..6879cff7b 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepository.java
@@ -15,18 +15,19 @@ import java.io.*;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.spi.AbstractRepository;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext;
-public class ExtensionLocationArtifactRepository extends AbstractRepository implements IFileArtifactRepository, Constants {
+public class ExtensionLocationArtifactRepository extends AbstractRepository<IArtifactKey> implements IFileArtifactRepository, Constants {
public static final String TYPE = "org.eclipse.equinox.p2.extensionlocation.artifactRepository"; //$NON-NLS-1$
public static final Integer VERSION = new Integer(1);
- public static final List STANDARD_P2_REPOSITORY_FILE_NAMES = Arrays.asList(new Object[] {"artifacts.xml", "content.xml", "compositeArtifacts.xml", "compositeContent.xml"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ public static final List<String> STANDARD_P2_REPOSITORY_FILE_NAMES = Arrays.asList(new String[] {"artifacts.xml", "content.xml", "compositeArtifacts.xml", "compositeContent.xml"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
IFileArtifactRepository artifactRepository;
private File base;
@@ -186,11 +187,6 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository impl
return artifactRepository.getArtifactDescriptors(key);
}
- public IArtifactKey[] getArtifactKeys() {
- ensureInitialized();
- return artifactRepository.getArtifactKeys();
- }
-
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
ensureInitialized();
return artifactRepository.getArtifacts(requests, monitor);
@@ -211,7 +207,7 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository impl
return artifactRepository.getArtifactFile(descriptor);
}
- public Map getProperties() {
+ public Map<String, String> getProperties() {
ensureInitialized();
return artifactRepository.getProperties();
}
@@ -229,4 +225,18 @@ public class ExtensionLocationArtifactRepository extends AbstractRepository impl
ensureInitialized();
return oldValue;
}
+
+ public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key) {
+ return artifactRepository.createArtifactDescriptor(key);
+ }
+
+ public IQueryable<IArtifactDescriptor> descriptorQueryable() {
+ ensureInitialized();
+ return artifactRepository.descriptorQueryable();
+ }
+
+ public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
+ ensureInitialized();
+ return artifactRepository.query(query, monitor);
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
index 32a2bb9c3..9abf2f37e 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationArtifactRepositoryFactory.java
@@ -13,12 +13,12 @@ package org.eclipse.equinox.internal.p2.extensionlocation;
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IFileArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory;
-import org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.SimpleArtifactRepositoryFactory;
+import org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepositoryFactory;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactRepositoryFactory;
import org.eclipse.osgi.util.NLS;
public class ExtensionLocationArtifactRepositoryFactory extends ArtifactRepositoryFactory {
@@ -26,7 +26,7 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.spi.p2.artifact.repository.ArtifactRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- public IArtifactRepository create(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
// TODO proper progress monitoring
IStatus status = validate(location, null);
if (!status.isOK())
@@ -38,8 +38,10 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
// make sure that we aren't trying to create a repo at a location
// where one already exists
boolean failed = false;
+ final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
try {
- new SimpleArtifactRepositoryFactory().load(repoLocation, 0, null);
+ simpleFactory.load(repoLocation, 0, null);
failed = true;
} catch (ProvisionException e) {
// expected
@@ -48,7 +50,7 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
String msg = NLS.bind(Messages.repo_already_exists, location);
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_EXISTS, msg, null));
}
- IFileArtifactRepository repo = (IFileArtifactRepository) new SimpleArtifactRepositoryFactory().create(repoLocation, name, type, properties);
+ IFileArtifactRepository repo = (IFileArtifactRepository) simpleFactory.create(repoLocation, name, type, properties);
return new ExtensionLocationArtifactRepository(location, repo, null);
}
@@ -71,7 +73,9 @@ public class ExtensionLocationArtifactRepositoryFactory extends ArtifactReposito
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, Messages.failed_create_local_artifact_repository));
// TODO proper progress monitoring
try {
- IFileArtifactRepository repo = (IFileArtifactRepository) new SimpleArtifactRepositoryFactory().load(repoLocation, flags, null);
+ final SimpleArtifactRepositoryFactory simpleFactory = new SimpleArtifactRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ IFileArtifactRepository repo = (IFileArtifactRepository) simpleFactory.load(repoLocation, flags, null);
return new ExtensionLocationArtifactRepository(location, repo, monitor);
} catch (ProvisionException e) {
return create(location, Activator.getRepositoryName(location), ExtensionLocationArtifactRepository.TYPE, null);
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
index 64c7c2bb4..4db1830f2 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepository.java
@@ -16,12 +16,12 @@ import java.io.FilenameFilter;
import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Query;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.AbstractMetadataRepository;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.spi.AbstractMetadataRepository;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleContext;
@@ -96,16 +96,16 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository#removeInstallableUnits(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.core.runtime.IProgressMonitor)
*/
- public boolean removeInstallableUnits(Query query, IProgressMonitor monitor) {
+ public boolean removeInstallableUnits(IInstallableUnit[] installableUnits, IProgressMonitor monitor) {
throw new UnsupportedOperationException();
}
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.query.IQueryable#query(org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
*/
- public Collector query(Query query, Collector collector, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
ensureInitialized();
- return metadataRepository.query(query, collector, monitor);
+ return metadataRepository.query(query, monitor);
}
public static void validate(URI location, IProgressMonitor monitor) throws ProvisionException {
@@ -172,9 +172,9 @@ public class ExtensionLocationMetadataRepository extends AbstractMetadataReposit
}
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.spi.p2.repository.AbstractRepository#getProperties()
+ * @see org.eclipse.equinox.p2.repository.spi.AbstractRepository#getProperties()
*/
- public Map getProperties() {
+ public Map<String, String> getProperties() {
ensureInitialized();
return metadataRepository.getProperties();
}
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
index 06799588c..422a3a327 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/ExtensionLocationMetadataRepositoryFactory.java
@@ -10,22 +10,25 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.extensionlocation;
+import org.eclipse.equinox.internal.p2.metadata.repository.SimpleMetadataRepositoryFactory;
+
+import org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory;
+
+import org.eclipse.equinox.p2.core.ProvisionException;
+
import java.net.URI;
import java.util.Map;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory;
-import org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.SimpleMetadataRepositoryFactory;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.osgi.util.NLS;
public class ExtensionLocationMetadataRepositoryFactory extends MetadataRepositoryFactory {
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#create(java.net.URL, java.lang.String, java.lang.String, java.util.Map)
*/
- public IMetadataRepository create(URI location, String name, String type, Map properties) throws ProvisionException {
+ public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
// TODO proper progress monitoring
IStatus status = validate(location, null);
if (!status.isOK())
@@ -37,8 +40,10 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
// ensure that we aren't trying to create a repository at a location
// where one already exists
boolean failed = false;
+ final SimpleMetadataRepositoryFactory simpleFactory = new SimpleMetadataRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
try {
- new SimpleMetadataRepositoryFactory().load(repoLocation, 0, null);
+ simpleFactory.load(repoLocation, 0, null);
failed = true;
} catch (ProvisionException e) {
// expected
@@ -47,12 +52,12 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
String msg = NLS.bind(Messages.repo_already_exists, location.toString());
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_EXISTS, msg, null));
}
- IMetadataRepository repository = new SimpleMetadataRepositoryFactory().create(repoLocation, name, null, properties);
+ IMetadataRepository repository = simpleFactory.create(repoLocation, name, null, properties);
return new ExtensionLocationMetadataRepository(location, repository, null);
}
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory#load(java.net.URL, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#load(java.net.URL, org.eclipse.core.runtime.IProgressMonitor)
*/
public IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
//return null if the caller wanted a modifiable repo
@@ -70,7 +75,9 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, Messages.failed_create_local_artifact_repository));
// TODO proper progress monitoring
try {
- IMetadataRepository repository = new SimpleMetadataRepositoryFactory().load(repoLocation, flags, null);
+ final SimpleMetadataRepositoryFactory simpleFactory = new SimpleMetadataRepositoryFactory();
+ simpleFactory.setAgent(getAgent());
+ IMetadataRepository repository = simpleFactory.load(repoLocation, flags, null);
return new ExtensionLocationMetadataRepository(location, repository, monitor);
} catch (ProvisionException e) {
return create(location, Activator.getRepositoryName(location), ExtensionLocationMetadataRepository.TYPE, null);
@@ -78,7 +85,7 @@ public class ExtensionLocationMetadataRepositoryFactory extends MetadataReposito
}
/* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.spi.p2.metadata.repository.MetadataRepositoryFactory#validate(java.net.URL, org.eclipse.core.runtime.IProgressMonitor)
+ * @see org.eclipse.equinox.p2.repository.metadata.spi.MetadataRepositoryFactory#validate(java.net.URL, org.eclipse.core.runtime.IProgressMonitor)
*/
public IStatus validate(URI location, IProgressMonitor monitor) {
try {
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
index 05113e87b..4858af478 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
@@ -11,6 +11,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.extensionlocation;
+import org.eclipse.equinox.p2.core.ProvisionException;
+
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
@@ -19,7 +21,6 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.publisher.eclipse.FeatureParser;
import org.eclipse.equinox.internal.p2.update.Site;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.directorywatcher.*;
import org.eclipse.equinox.p2.publisher.eclipse.*;
import org.eclipse.osgi.service.resolver.BundleDescription;
@@ -105,16 +106,16 @@ public class SiteListener extends DirectoryChangeListener {
/*
* Create a new site listener on the given site.
*/
- public SiteListener(Map properties, String url, DirectoryChangeListener delegate) {
+ public SiteListener(Map<String, String> properties, String url, DirectoryChangeListener delegate) {
this.siteLocation = url;
this.delegate = delegate;
- this.policy = (String) properties.get(SITE_POLICY);
- Collection listCollection = new HashSet();
- String listString = (String) properties.get(SITE_LIST);
+ this.policy = properties.get(SITE_POLICY);
+ Collection<String> listCollection = new HashSet<String>();
+ String listString = properties.get(SITE_LIST);
if (listString != null)
for (StringTokenizer tokenizer = new StringTokenizer(listString, ","); tokenizer.hasMoreTokens();) //$NON-NLS-1$
listCollection.add(tokenizer.nextToken());
- this.list = (String[]) listCollection.toArray(new String[listCollection.size()]);
+ this.list = listCollection.toArray(new String[listCollection.size()]);
}
/* (non-Javadoc)
@@ -220,8 +221,8 @@ public class SiteListener extends DirectoryChangeListener {
String urlString = siteLocation;
if (urlString.endsWith(Constants.EXTENSION_LOCATION))
urlString = urlString.substring(0, urlString.length() - Constants.EXTENSION_LOCATION.length());
- List result = new ArrayList();
- for (Enumeration e = properties.elements(); e.hasMoreElements();) {
+ List<String> result = new ArrayList<String>();
+ for (Enumeration<Object> e = properties.elements(); e.hasMoreElements();) {
String line = (String) e.nextElement();
StringTokenizer tokenizer = new StringTokenizer(line, ";"); //$NON-NLS-1$
String targetSite = tokenizer.nextToken();
@@ -229,7 +230,7 @@ public class SiteListener extends DirectoryChangeListener {
continue;
result.add(tokenizer.nextToken());
}
- toBeRemoved = (String[]) result.toArray(new String[result.size()]);
+ toBeRemoved = result.toArray(new String[result.size()]);
return toBeRemoved;
}
@@ -241,7 +242,7 @@ public class SiteListener extends DirectoryChangeListener {
private String[] getManagedFiles() {
if (managedFiles != null)
return managedFiles;
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
File siteFile;
try {
siteFile = URIUtil.toFile(new URI(siteLocation));
@@ -249,24 +250,23 @@ public class SiteListener extends DirectoryChangeListener {
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Unable to create a URL from site location: " + siteLocation, e)); //$NON-NLS-1$
return new String[0];
}
- Map pluginCache = getPlugins(siteFile);
- Map featureCache = getFeatures(siteFile);
- for (Iterator iter = featureCache.keySet().iterator(); iter.hasNext();) {
- File featureFile = (File) iter.next();
+ Map<String, File> pluginCache = getPlugins(siteFile);
+ Map<File, Feature> featureCache = getFeatures(siteFile);
+ for (File featureFile : featureCache.keySet()) {
// add the feature path
result.add(featureFile.toString());
- Feature feature = (Feature) featureCache.get(featureFile);
+ Feature feature = featureCache.get(featureFile);
FeatureEntry[] entries = feature.getEntries();
for (int inner = 0; inner < entries.length; inner++) {
FeatureEntry entry = entries[inner];
// grab the right location from the plug-in cache
String key = entry.getId() + '/' + entry.getVersion();
- File pluginLocation = (File) pluginCache.get(key);
+ File pluginLocation = pluginCache.get(key);
if (pluginLocation != null)
result.add(pluginLocation.toString());
}
}
- managedFiles = (String[]) result.toArray(new String[result.size()]);
+ managedFiles = result.toArray(new String[result.size()]);
return managedFiles;
}
@@ -274,8 +274,8 @@ public class SiteListener extends DirectoryChangeListener {
* Iterate over the feature directory and return a map of
* File to Feature objects (from the generator bundle)
*/
- private Map getFeatures(File location) {
- Map result = new HashMap();
+ private Map<File, Feature> getFeatures(File location) {
+ Map<File, Feature> result = new HashMap<File, Feature>();
File featureDir = new File(location, FEATURES);
File[] children = featureDir.listFiles();
for (int i = 0; i < children.length; i++) {
@@ -294,9 +294,9 @@ public class SiteListener extends DirectoryChangeListener {
* Iterate over the plugins directory and return a map of
* plug-in id/version to File locations.
*/
- private Map getPlugins(File location) {
+ private Map<String, File> getPlugins(File location) {
File[] plugins = new File(location, PLUGINS).listFiles();
- Map result = new HashMap();
+ Map<String, File> result = new HashMap<String, File>();
for (int i = 0; plugins != null && i < plugins.length; i++) {
File bundleLocation = plugins[i];
if (bundleLocation.isDirectory() || bundleLocation.getName().endsWith(".jar")) { //$NON-NLS-1$

Back to the top