Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2009-12-30 07:26:58 +0000
committerThomas Hallgren2009-12-30 07:26:58 +0000
commit1bcec196ee052b51ba9da8c98a2de849b34221a2 (patch)
treeaef4ee1b75c1ffafde1f17eed22872b4ee26b453
parentc56044369644942c078fd272fa15c8c1c7c06548 (diff)
downloadrt.equinox.p2-1bcec196ee052b51ba9da8c98a2de849b34221a2.tar.gz
rt.equinox.p2-1bcec196ee052b51ba9da8c98a2de849b34221a2.tar.xz
rt.equinox.p2-1bcec196ee052b51ba9da8c98a2de849b34221a2.zip
298458: Add Java 5 Generics to the p2 code base
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java34
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Application.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Optimizer.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF5
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/build.properties2
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java40
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java115
20 files changed, 231 insertions, 223 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath
index 7cdeb7319..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <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"/>
</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs
index d1e9ee398..c79afe464 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Mon Nov 05 16:53:31 EST 2007
+#Wed Dec 30 08:04:56 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=1.5
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.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -83,7 +83,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enab
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
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
@@ -155,7 +155,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF
index 38e6657ad..4129c68fa 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF
@@ -26,8 +26,9 @@ Import-Package: ie.wombat.jbdiff,
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.equinox.common,
org.eclipse.equinox.p2.artifact.repository
-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.artifact.optimizers;x-friends:="org.eclipse.equinox.p2.artifact.processors",
org.eclipse.equinox.internal.p2.artifact.optimizers.jardelta;x-internal:=true,
org.eclipse.equinox.internal.p2.artifact.optimizers.jbdiff;x-internal:=true,
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/build.properties b/bundles/org.eclipse.equinox.p2.artifact.optimizers/build.properties
index 48a852fb1..d72e993c0 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/build.properties
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/build.properties
@@ -14,3 +14,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
plugin.properties
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java
index 00ec5283f..7f5b35af5 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java
@@ -29,7 +29,7 @@ public class Application implements IApplication {
private int depth = 1;
public Object start(IApplicationContext context) throws Exception {
- Map args = context.getArguments();
+ Map<?, ?> args = context.getArguments();
initializeFromArguments((String[]) args.get("application.args")); //$NON-NLS-1$
IArtifactRepository repository = setupRepository(artifactRepositoryLocation);
new Optimizer(repository, width, depth).run();
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java
index 099283bd5..62955636f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java
@@ -20,9 +20,9 @@ public class DeltaComputer {
private File destination;
private ZipFile baseJar;
private ZipFile targetJar;
- private Set baseEntries;
- private ArrayList additions;
- private ArrayList changes;
+ private Set<String> baseEntries;
+ private ArrayList<ZipEntry> additions;
+ private ArrayList<ZipEntry> changes;
private ZipFile manifestJar = null;
public DeltaComputer(File base, File target, File destination) {
@@ -53,14 +53,14 @@ public class DeltaComputer {
// write out the removals. These are all the entries left in the baseEntries
// since they were not seen in the targetJar. Here just write out an empty
// entry with a name that signals the delta processor to delete.
- for (Iterator i = baseEntries.iterator(); i.hasNext();)
- writeEntry(result, new ZipEntry(((String) i.next()) + ".delete"), null, false);
+ for (String baseEntry : baseEntries)
+ writeEntry(result, new ZipEntry(baseEntry + ".delete"), null, false);
// write out the additions.
- for (Iterator i = additions.iterator(); i.hasNext();)
- writeEntry(result, (ZipEntry) i.next(), targetJar, false);
+ for (ZipEntry entry : additions)
+ writeEntry(result, entry, targetJar, false);
// write out the changes.
- for (Iterator i = changes.iterator(); i.hasNext();)
- writeEntry(result, (ZipEntry) i.next(), targetJar, false);
+ for (ZipEntry entry : changes)
+ writeEntry(result, entry, targetJar, false);
} finally {
if (result != null)
result.close();
@@ -116,12 +116,12 @@ public class DeltaComputer {
}
private void computeDelta() throws IOException {
- changes = new ArrayList();
- additions = new ArrayList();
+ changes = new ArrayList<ZipEntry>();
+ additions = new ArrayList<ZipEntry>();
// start out assuming that all the base entries are being removed
baseEntries = getEntries(baseJar);
- for (Enumeration e = targetJar.entries(); e.hasMoreElements();)
- check((ZipEntry) e.nextElement(), targetJar);
+ for (Enumeration<? extends ZipEntry> e = targetJar.entries(); e.hasMoreElements();)
+ check(e.nextElement(), targetJar);
}
private boolean openJars() {
@@ -188,10 +188,10 @@ public class DeltaComputer {
return true;
}
- private Set getEntries(ZipFile jar) {
- HashSet result = new HashSet(jar.size());
- for (Enumeration e = jar.entries(); e.hasMoreElements();) {
- ZipEntry entry = (ZipEntry) e.nextElement();
+ private Set<String> getEntries(ZipFile jar) {
+ HashSet<String> result = new HashSet<String>(jar.size());
+ for (Enumeration<? extends ZipEntry> e = jar.entries(); e.hasMoreElements();) {
+ ZipEntry entry = e.nextElement();
checkForManifest(entry, jar);
result.add(entry.getName());
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java
index a5edc6de6..b83736c58 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java
@@ -35,8 +35,8 @@ public class Optimizer {
private static final String JAR_DELTA_FORMAT = "jarDelta"; //$NON-NLS-1$
private static final String JAR_DELTA_PATCH_STEP = "org.eclipse.equinox.p2.processing.JarDeltaPatchStep"; //$NON-NLS-1$
- private static final Comparator ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR = new ArtifactDescriptorVersionComparator();
- private static final Comparator ARTIFACT_KEY_VERSION_COMPARATOR = new ArtifactKeyVersionComparator();
+ private static final Comparator<IArtifactDescriptor> ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR = new ArtifactDescriptorVersionComparator();
+ private static final Comparator<IArtifactKey> ARTIFACT_KEY_VERSION_COMPARATOR = new ArtifactKeyVersionComparator();
/**
* This optimizer performs delta generation based on (currently) jbdiff.
@@ -75,8 +75,8 @@ public class Optimizer {
public void run() {
System.out.println("Starting delta (jardelta) optimizations (width=" + width + ", depth=" + depth + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- IQueryResult queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
- IArtifactKey[][] keys = getSortedRelatedArtifactKeys((IArtifactKey[]) queryResult.toArray(IArtifactKey.class));
+ IQueryResult<IArtifactKey> queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IArtifactKey[][] keys = getSortedRelatedArtifactKeys(queryResult);
for (int i = 0; i < keys.length; i++) {
if (keys[i].length < 2)
// Nothing to diff here!
@@ -128,22 +128,22 @@ public class Optimizer {
* @param artifactKeys
* @return the sorted artifact keys
*/
- private IArtifactKey[][] getSortedRelatedArtifactKeys(IArtifactKey[] artifactKeys) {
- Map map = new HashMap();
- for (int i = 0; i < artifactKeys.length; i++) {
- IArtifactKey freeKey = getVersionlessKey(artifactKeys[i]);
- List values = (List) map.get(freeKey);
+ private IArtifactKey[][] getSortedRelatedArtifactKeys(IQueryResult<IArtifactKey> artifactKeys) {
+ Map<IArtifactKey, List<IArtifactKey>> map = new HashMap<IArtifactKey, List<IArtifactKey>>();
+ for (Iterator<IArtifactKey> iter = artifactKeys.iterator(); iter.hasNext();) {
+ IArtifactKey nxt = iter.next();
+ IArtifactKey freeKey = getVersionlessKey(nxt);
+ List<IArtifactKey> values = map.get(freeKey);
if (values == null) {
- values = new ArrayList();
+ values = new ArrayList<IArtifactKey>();
map.put(freeKey, values);
}
- values.add(artifactKeys[i]);
+ values.add(nxt);
}
IArtifactKey[][] lists = new IArtifactKey[map.size()][];
int i = 0;
- for (Iterator iterator = map.values().iterator(); iterator.hasNext();) {
- List artifactKeyList = (List) iterator.next();
- IArtifactKey[] relatedArtifactKeys = (IArtifactKey[]) artifactKeyList.toArray(new IArtifactKey[artifactKeyList.size()]);
+ for (List<IArtifactKey> artifactKeyList : map.values()) {
+ IArtifactKey[] relatedArtifactKeys = artifactKeyList.toArray(new IArtifactKey[artifactKeyList.size()]);
Arrays.sort(relatedArtifactKeys, ARTIFACT_KEY_VERSION_COMPARATOR);
lists[i++] = relatedArtifactKeys;
}
@@ -214,7 +214,7 @@ public class Optimizer {
private IArtifactDescriptor[] getSortedCompletePredecessors(IArtifactKey artifactKey, IArtifactKey[] relatedArtifactKeys) {
// get all artifact keys
- List completeDescriptors = new ArrayList(relatedArtifactKeys.length);
+ List<IArtifactDescriptor> completeDescriptors = new ArrayList<IArtifactDescriptor>(relatedArtifactKeys.length);
for (int i = 0; i < relatedArtifactKeys.length; i++) {
// if we find ´our self´ skip
if (relatedArtifactKeys[i].equals(artifactKey))
@@ -229,7 +229,7 @@ public class Optimizer {
}
}
- IArtifactDescriptor[] completeSortedDescriptors = (IArtifactDescriptor[]) completeDescriptors.toArray(new IArtifactDescriptor[completeDescriptors.size()]);
+ IArtifactDescriptor[] completeSortedDescriptors = completeDescriptors.toArray(new IArtifactDescriptor[completeDescriptors.size()]);
// Sort, so to allow a depth lookup!
Arrays.sort(completeSortedDescriptors, ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR);
return completeSortedDescriptors;
@@ -246,15 +246,15 @@ public class Optimizer {
return descriptor.getProcessingSteps().length == 0;
}
- static final class ArtifactDescriptorVersionComparator implements Comparator {
- public int compare(Object artifactDescriptor0, Object artifactDescriptor1) {
- return -1 * ((IArtifactDescriptor) artifactDescriptor0).getArtifactKey().getVersion().compareTo(((IArtifactDescriptor) artifactDescriptor1).getArtifactKey().getVersion());
+ static final class ArtifactDescriptorVersionComparator implements Comparator<IArtifactDescriptor> {
+ public int compare(IArtifactDescriptor artifactDescriptor0, IArtifactDescriptor artifactDescriptor1) {
+ return -1 * artifactDescriptor0.getArtifactKey().getVersion().compareTo(artifactDescriptor1.getArtifactKey().getVersion());
}
}
- static final class ArtifactKeyVersionComparator implements Comparator {
- public int compare(Object artifactKey0, Object artifactKey1) {
- return -1 * ((IArtifactKey) artifactKey0).getVersion().compareTo(((IArtifactKey) artifactKey1).getVersion());
+ static final class ArtifactKeyVersionComparator implements Comparator<IArtifactKey> {
+ public int compare(IArtifactKey artifactKey0, IArtifactKey artifactKey1) {
+ return -1 * artifactKey0.getVersion().compareTo(artifactKey1.getVersion());
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Application.java
index 45496da7e..9745f305a 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Application.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Application.java
@@ -30,7 +30,7 @@ public class Application implements IApplication {
private boolean nosar;
public Object start(IApplicationContext context) throws Exception {
- Map args = context.getArguments();
+ Map<?, ?> args = context.getArguments();
initializeFromArguments((String[]) args.get("application.args")); //$NON-NLS-1$
IArtifactRepository repository = setupRepository(artifactRepositoryLocation);
new Optimizer(repository, width, depth, nosar).run();
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Optimizer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Optimizer.java
index e4b0a4fc6..167b33f7b 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Optimizer.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jbdiff/Optimizer.java
@@ -35,8 +35,8 @@ public class Optimizer {
private static final String JBPATCH_STEP_ID = "org.eclipse.equinox.p2.repository.JBPatchStep"; //$NON-NLS-1$
private static final String JBPATCH_STEP_ZIP_ID = "org.eclipse.equinox.p2.repository.JBPatchZipStep"; //$NON-NLS-1$
- private static final Comparator ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR = new ArtifactDescriptorVersionComparator();
- private static final Comparator ARTIFACT_KEY_VERSION_COMPARATOR = new ArtifactKeyVersionComparator();
+ private static final Comparator<IArtifactDescriptor> ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR = new ArtifactDescriptorVersionComparator();
+ private static final Comparator<IArtifactKey> ARTIFACT_KEY_VERSION_COMPARATOR = new ArtifactKeyVersionComparator();
/**
* This optimizer performs delta generation based on (currently) jbdiff.
@@ -77,8 +77,8 @@ public class Optimizer {
public void run() {
System.out.println("Starting delta (jbdiff) optimizations (width=" + width + ", depth=" + depth + ", nosar=" + nosar + ")");
- IQueryResult queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
- IArtifactKey[][] keys = getSortedRelatedArtifactKeys((IArtifactKey[]) queryResult.toArray(IArtifactKey.class));
+ IQueryResult<IArtifactKey> queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
+ IArtifactKey[][] keys = getSortedRelatedArtifactKeys(queryResult);
for (int i = 0; i < keys.length; i++) {
if (keys[i].length < 2)
// Nothing to diff here!
@@ -140,22 +140,22 @@ public class Optimizer {
* @param artifactKeys
* @return the sorted artifact keys
*/
- private IArtifactKey[][] getSortedRelatedArtifactKeys(IArtifactKey[] artifactKeys) {
- Map map = new HashMap();
- for (int i = 0; i < artifactKeys.length; i++) {
- IArtifactKey freeKey = new VersionlessArtifactKey(artifactKeys[i]);
- List values = (List) map.get(freeKey);
+ private IArtifactKey[][] getSortedRelatedArtifactKeys(IQueryResult<IArtifactKey> artifactKeys) {
+ Map<IArtifactKey, List<IArtifactKey>> map = new HashMap<IArtifactKey, List<IArtifactKey>>();
+ for (Iterator<IArtifactKey> iter = artifactKeys.iterator(); iter.hasNext();) {
+ IArtifactKey nxt = iter.next();
+ IArtifactKey freeKey = new VersionlessArtifactKey(nxt);
+ List<IArtifactKey> values = map.get(freeKey);
if (values == null) {
- values = new ArrayList();
+ values = new ArrayList<IArtifactKey>();
map.put(freeKey, values);
}
- values.add(artifactKeys[i]);
+ values.add(nxt);
}
IArtifactKey[][] lists = new IArtifactKey[map.size()][];
int i = 0;
- for (Iterator iterator = map.values().iterator(); iterator.hasNext();) {
- List artifactKeyList = (List) iterator.next();
- IArtifactKey[] relatedArtifactKeys = (IArtifactKey[]) artifactKeyList.toArray(new IArtifactKey[artifactKeyList.size()]);
+ for (List<IArtifactKey> artifactKeyList : map.values()) {
+ IArtifactKey[] relatedArtifactKeys = artifactKeyList.toArray(new IArtifactKey[artifactKeyList.size()]);
Arrays.sort(relatedArtifactKeys, ARTIFACT_KEY_VERSION_COMPARATOR);
lists[i++] = relatedArtifactKeys;
}
@@ -233,7 +233,7 @@ public class Optimizer {
private IArtifactDescriptor[] getSortedCompletePredecessors(IArtifactKey artifactKey, IArtifactKey[] relatedArtifactKeys) {
// get all artifact keys
- List completeDescriptors = new ArrayList(relatedArtifactKeys.length);
+ List<IArtifactDescriptor> completeDescriptors = new ArrayList<IArtifactDescriptor>(relatedArtifactKeys.length);
for (int i = 0; i < relatedArtifactKeys.length; i++) {
// if we find ´our self´ skip
if (relatedArtifactKeys[i].equals(artifactKey))
@@ -248,7 +248,7 @@ public class Optimizer {
}
}
- IArtifactDescriptor[] completeSortedDescriptors = (IArtifactDescriptor[]) completeDescriptors.toArray(new IArtifactDescriptor[completeDescriptors.size()]);
+ IArtifactDescriptor[] completeSortedDescriptors = completeDescriptors.toArray(new IArtifactDescriptor[completeDescriptors.size()]);
// Sort, so to allow a depth lookup!
Arrays.sort(completeSortedDescriptors, ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR);
return completeSortedDescriptors;
@@ -265,15 +265,15 @@ public class Optimizer {
return descriptor.getProcessingSteps().length == 0;
}
- static final class ArtifactDescriptorVersionComparator implements Comparator {
- public int compare(Object artifactDescriptor0, Object artifactDescriptor1) {
- return -1 * ((IArtifactDescriptor) artifactDescriptor0).getArtifactKey().getVersion().compareTo(((IArtifactDescriptor) artifactDescriptor1).getArtifactKey().getVersion());
+ static final class ArtifactDescriptorVersionComparator implements Comparator<IArtifactDescriptor> {
+ public int compare(IArtifactDescriptor artifactDescriptor0, IArtifactDescriptor artifactDescriptor1) {
+ return -1 * artifactDescriptor0.getArtifactKey().getVersion().compareTo(artifactDescriptor1.getArtifactKey().getVersion());
}
}
- static final class ArtifactKeyVersionComparator implements Comparator {
- public int compare(Object artifactKey0, Object artifactKey1) {
- return -1 * ((IArtifactKey) artifactKey0).getVersion().compareTo(((IArtifactKey) artifactKey1).getVersion());
+ static final class ArtifactKeyVersionComparator implements Comparator<IArtifactKey> {
+ public int compare(IArtifactKey artifactKey0, IArtifactKey artifactKey1) {
+ return -1 * artifactKey0.getVersion().compareTo(artifactKey1.getVersion());
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java
index c67ae68db..9ef0adb54 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java
@@ -30,7 +30,7 @@ public class Application implements IApplication {
private URI artifactRepositoryLocation;
public Object start(IApplicationContext context) throws Exception {
- Map args = context.getArguments();
+ Map<?, ?> args = context.getArguments();
initializeFromArguments((String[]) args.get("application.args")); //$NON-NLS-1$
IArtifactRepository repository = setupRepository(artifactRepositoryLocation);
if (!repository.isModifiable())
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java
index c209c319b..77657db0c 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java
@@ -32,9 +32,9 @@ public class Optimizer {
}
public void run() {
- IQueryResult keys = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- IArtifactKey key = (IArtifactKey) iterator.next();
+ IQueryResult<IArtifactKey> keys = repository.query(ArtifactKeyQuery.ALL_KEYS, null);
+ for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) {
+ IArtifactKey key = iterator.next();
if (!key.getClassifier().equals("plugin")) //$NON-NLS-1$
continue;
IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key);
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
index 48797a222..470c5cbe3 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/helpers/CollectionUtils.java
@@ -10,8 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.core.helpers;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
@@ -229,4 +228,17 @@ public class CollectionUtils {
result.put(key, properties.getProperty(key));
}
}
+
+ /**
+ * Stores the properties using {@link Properties#store(OutputStream, String)} on the given <code>stream</code>.
+ * @param properties The properties to store
+ * @param stream The stream to store to
+ * @param comment The comment to use
+ * @throws IOException
+ */
+ public static void storeProperties(Map<String, String> properties, OutputStream stream, String comment) throws IOException {
+ Properties props = new Properties();
+ props.putAll(properties);
+ props.store(stream, comment);
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath
index 6f3b481ac..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.classpath
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.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.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs
index b8283102b..90a232b7d 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Thu Nov 20 12:56:54 PST 2008
+#Wed Dec 30 07:30:16 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=1.5
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.reconciler.dropins/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF
index b340267aa..d4bc98087 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/META-INF/MANIFEST.MF
@@ -6,8 +6,9 @@ Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Version: 1.0.100.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.reconciler.dropins.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
Import-Package: org.eclipse.equinox.app;version="1.0.0",
org.eclipse.equinox.internal.p2.artifact.repository,
org.eclipse.equinox.internal.p2.core.helpers,
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/build.properties b/bundles/org.eclipse.equinox.p2.reconciler.dropins/build.properties
index 6861747e4..3552dc9d2 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/build.properties
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/build.properties
@@ -18,3 +18,5 @@ bin.includes = META-INF/,\
Bootstrap.product,\
config.ini
src.includes = about.html
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
index 38640166b..6f0f2a8d2 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/Activator.java
@@ -51,9 +51,9 @@ public class Activator implements BundleActivator {
private static PackageAdmin packageAdmin;
private static BundleContext bundleContext;
private ServiceReference packageAdminRef;
- private List watchers = new ArrayList();
- private final static Set repositories = new HashSet();
- private Collection filesToCheck = null;
+ private List<DirectoryWatcher> watchers = new ArrayList<DirectoryWatcher>();
+ private final static Set<IMetadataRepository> repositories = new HashSet<IMetadataRepository>();
+ private Collection<File> filesToCheck = null;
/**
* Helper method to create an extension location metadata repository at the given URI.
@@ -64,7 +64,7 @@ public class Activator implements BundleActivator {
* @throws IllegalStateException
* @throws ProvisionException
*/
- public static IMetadataRepository createExtensionLocationMetadataRepository(URI location, String name, Map properties) throws ProvisionException {
+ public static IMetadataRepository createExtensionLocationMetadataRepository(URI location, String name, Map<String, String> properties) throws ProvisionException {
IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(getContext(), IProvisioningAgent.SERVICE_NAME);
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
ExtensionLocationMetadataRepositoryFactory factory = new ExtensionLocationMetadataRepositoryFactory();
@@ -100,7 +100,7 @@ public class Activator implements BundleActivator {
* @throws IllegalStateException
* @throws ProvisionException
*/
- public static IArtifactRepository createExtensionLocationArtifactRepository(URI location, String name, Map properties) throws ProvisionException {
+ public static IArtifactRepository createExtensionLocationArtifactRepository(URI location, String name, Map<String, String> properties) throws ProvisionException {
IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(getContext(), IProvisioningAgent.SERVICE_NAME);
IArtifactRepositoryManager manager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
if (manager == null)
@@ -133,7 +133,7 @@ public class Activator implements BundleActivator {
* Return the set of metadata repositories known to this bundle. It is constructed from the repos
* for the drop-ins as well as the ones in the configuration.
*/
- public static Set getRepositories() {
+ public static Set<IMetadataRepository> getRepositories() {
return repositories;
}
@@ -220,9 +220,9 @@ public class Activator implements BundleActivator {
return false;
// gather the list of files/folders that we need to check
- Collection files = getFilesToCheck();
- for (Iterator iter = files.iterator(); iter.hasNext();) {
- File file = (File) iter.next();
+ Collection<File> files = getFilesToCheck();
+ for (Iterator<File> iter = files.iterator(); iter.hasNext();) {
+ File file = iter.next();
String key = file.getAbsolutePath();
String timestamp = timestamps.getProperty(key);
if (timestamp == null)
@@ -266,11 +266,11 @@ public class Activator implements BundleActivator {
* Return a collection of files which are interesting to us when we want to record timestamps
* to figure out if something has changed and perhaps avoid an unnecessary reconcilation.
*/
- private Collection getFilesToCheck() {
+ private Collection<File> getFilesToCheck() {
if (filesToCheck != null)
return filesToCheck;
- Set result = new HashSet();
+ Set<File> result = new HashSet<File>();
// configuration/org.eclipse.update/platform.xml, configuration/../plugins, configuration/../features
File configuration = getConfigurationLocation();
@@ -314,8 +314,8 @@ public class Activator implements BundleActivator {
* Iterate over the given collection of files (could be dropins or links folders) and
* return a collection of files that might be interesting to check the timestamps of.
*/
- private Collection getDropinsToCheck(File[] files) {
- Collection result = new HashSet();
+ private Collection<File> getDropinsToCheck(File[] files) {
+ Collection<File> result = new HashSet<File>();
for (int outer = 0; outer < files.length; outer++) {
// add top-level file/folder
result.add(files[outer]);
@@ -372,9 +372,9 @@ public class Activator implements BundleActivator {
*/
private void writeTimestamps() {
Properties timestamps = new Properties();
- Collection files = getFilesToCheck();
- for (Iterator iter = files.iterator(); iter.hasNext();) {
- File file = (File) iter.next();
+ Collection<File> files = getFilesToCheck();
+ for (Iterator<File> iter = files.iterator(); iter.hasNext();) {
+ File file = iter.next();
timestamps.put(file.getAbsolutePath(), Long.toString(file.lastModified()));
}
@@ -465,6 +465,7 @@ public class Activator implements BundleActivator {
PlatformXmlListener listener = new PlatformXmlListener(configFile);
watcher.addListener(listener);
watcher.poll();
+ watchers.add(watcher);
repositories.addAll(listener.getMetadataRepositories());
}
@@ -472,7 +473,7 @@ public class Activator implements BundleActivator {
* Create a new directory watcher with a repository listener on the drop-ins folder.
*/
private void watchDropins() {
- List directories = new ArrayList();
+ List<File> directories = new ArrayList<File>();
File[] dropinsDirectories = getDropinsDirectories();
directories.addAll(Arrays.asList(dropinsDirectories));
File[] linksDirectories = getLinksDirectories();
@@ -481,9 +482,10 @@ public class Activator implements BundleActivator {
return;
DropinsRepositoryListener listener = new DropinsRepositoryListener(DROPINS);
- DirectoryWatcher watcher = new DirectoryWatcher((File[]) directories.toArray(new File[directories.size()]));
+ DirectoryWatcher watcher = new DirectoryWatcher(directories.toArray(new File[directories.size()]));
watcher.addListener(listener);
watcher.poll();
+ watchers.add(watcher);
repositories.addAll(listener.getMetadataRepositories());
}
@@ -491,10 +493,8 @@ public class Activator implements BundleActivator {
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
- for (Iterator iter = watchers.iterator(); iter.hasNext();) {
- DirectoryWatcher watcher = (DirectoryWatcher) iter.next();
+ for (DirectoryWatcher watcher : watchers)
watcher.stop();
- }
bundleContext = null;
setPackageAdmin(null);
context.ungetService(packageAdminRef);
@@ -571,7 +571,7 @@ public class Activator implements BundleActivator {
* more than one to be returned here if we are running in shared mode.
*/
private static File[] getLinksDirectories() {
- List linksDirectories = new ArrayList();
+ List<File> linksDirectories = new ArrayList<File>();
File root = getEclipseHome();
if (root != null)
linksDirectories.add(new File(root, LINKS));
@@ -584,7 +584,7 @@ public class Activator implements BundleActivator {
if (configuration != null && configuration.getParentFile() != null)
linksDirectories.add(new File(configuration.getParentFile(), LINKS));
}
- return (File[]) linksDirectories.toArray(new File[linksDirectories.size()]);
+ return linksDirectories.toArray(new File[linksDirectories.size()]);
}
/*
@@ -594,7 +594,7 @@ public class Activator implements BundleActivator {
* local dropins directory.
*/
private static File[] getDropinsDirectories() {
- List dropinsDirectories = new ArrayList();
+ List<File> dropinsDirectories = new ArrayList<File>();
// did the user specify one via System properties?
String watchedDirectoryProperty = bundleContext.getProperty(DROPINS_DIRECTORY);
if (watchedDirectoryProperty != null)
@@ -613,7 +613,7 @@ public class Activator implements BundleActivator {
if (configuration != null && configuration.getParentFile() != null)
dropinsDirectories.add(new File(configuration.getParentFile(), DROPINS));
}
- return (File[]) dropinsDirectories.toArray(new File[dropinsDirectories.size()]);
+ return dropinsDirectories.toArray(new File[dropinsDirectories.size()]);
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
index 06d6a88d7..5a6b1bc18 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/DropinsRepositoryListener.java
@@ -40,8 +40,8 @@ public class DropinsRepositoryListener extends RepositoryListener {
private static final String DROPIN_ARTIFACT_REPOSITORIES = "dropin.artifactRepositories"; //$NON-NLS-1$
private static final String DROPIN_METADATA_REPOSITORIES = "dropin.metadataRepositories"; //$NON-NLS-1$
private static final String PIPE = "|"; //$NON-NLS-1$
- private List metadataRepositories = new ArrayList();
- private List artifactRepositories = new ArrayList();
+ private List<IMetadataRepository> metadataRepositories = new ArrayList<IMetadataRepository>();
+ private List<IArtifactRepository> artifactRepositories = new ArrayList<IArtifactRepository>();
public DropinsRepositoryListener(String repositoryName) {
super(repositoryName, true);
@@ -67,7 +67,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
private void addRepository(File file) {
URI repoLocation = createRepositoryLocation(file);
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<String, String>();
// if the file pointed to a link file, keep track of the attribute
// so we can add it to the repo later
if (file.isFile() && file.getName().endsWith(LINK)) {
@@ -174,7 +174,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
return repo.toURI();
}
- public void getMetadataRepository(URI repoURL, Properties properties) {
+ public void getMetadataRepository(URI repoURL, Map<String, String> properties) {
try {
IMetadataRepository repository = null;
try {
@@ -189,7 +189,7 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
}
- public void getArtifactRepository(URI repoURL, Properties properties) {
+ public void getArtifactRepository(URI repoURL, Map<String, String> properties) {
try {
IArtifactRepository repository = null;
try {
@@ -212,14 +212,14 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
private void synchronizeDropinMetadataRepositories() {
- List currentRepositories = new ArrayList();
- for (Iterator it = metadataRepositories.iterator(); it.hasNext();) {
- IMetadataRepository repository = (IMetadataRepository) it.next();
+ List<String> currentRepositories = new ArrayList<String>();
+ for (Iterator<IMetadataRepository> it = metadataRepositories.iterator(); it.hasNext();) {
+ IMetadataRepository repository = it.next();
currentRepositories.add(repository.getLocation().toString());
}
- List previousRepositories = getListRepositoryProperty(getMetadataRepository(), DROPIN_METADATA_REPOSITORIES);
- for (Iterator iterator = previousRepositories.iterator(); iterator.hasNext();) {
- String repository = (String) iterator.next();
+ List<String> previousRepositories = getListRepositoryProperty(getMetadataRepository(), DROPIN_METADATA_REPOSITORIES);
+ for (Iterator<String> iterator = previousRepositories.iterator(); iterator.hasNext();) {
+ String repository = iterator.next();
if (!currentRepositories.contains(repository))
removeMetadataRepository(repository);
}
@@ -238,14 +238,14 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
private void synchronizeDropinArtifactRepositories() {
- List currentRepositories = new ArrayList();
- for (Iterator it = artifactRepositories.iterator(); it.hasNext();) {
- IArtifactRepository repository = (IArtifactRepository) it.next();
+ List<String> currentRepositories = new ArrayList<String>();
+ for (Iterator<IArtifactRepository> it = artifactRepositories.iterator(); it.hasNext();) {
+ IArtifactRepository repository = it.next();
currentRepositories.add(repository.getLocation().toString());
}
- List previousRepositories = getListRepositoryProperty(getArtifactRepository(), DROPIN_ARTIFACT_REPOSITORIES);
- for (Iterator iterator = previousRepositories.iterator(); iterator.hasNext();) {
- String repository = (String) iterator.next();
+ List<String> previousRepositories = getListRepositoryProperty(getArtifactRepository(), DROPIN_ARTIFACT_REPOSITORIES);
+ for (Iterator<String> iterator = previousRepositories.iterator(); iterator.hasNext();) {
+ String repository = iterator.next();
if (!currentRepositories.contains(repository))
removeArtifactRepository(repository);
}
@@ -263,9 +263,9 @@ public class DropinsRepositoryListener extends RepositoryListener {
}
}
- private List getListRepositoryProperty(IRepository repository, String key) {
- List listProperty = new ArrayList();
- String dropinRepositories = (String) repository.getProperties().get(key);
+ private List<String> getListRepositoryProperty(IRepository<?> repository, String key) {
+ List<String> listProperty = new ArrayList<String>();
+ String dropinRepositories = repository.getProperties().get(key);
if (dropinRepositories != null) {
StringTokenizer tokenizer = new StringTokenizer(dropinRepositories, PIPE);
while (tokenizer.hasMoreTokens()) {
@@ -275,10 +275,10 @@ public class DropinsRepositoryListener extends RepositoryListener {
return listProperty;
}
- private void setListRepositoryProperty(IRepository repository, String key, List listProperty) {
+ private void setListRepositoryProperty(IRepository<?> repository, String key, List<String> listProperty) {
StringBuffer buffer = new StringBuffer();
- for (Iterator it = listProperty.iterator(); it.hasNext();) {
- String repositoryString = (String) it.next();
+ for (Iterator<String> it = listProperty.iterator(); it.hasNext();) {
+ String repositoryString = it.next();
buffer.append(repositoryString);
if (it.hasNext())
buffer.append(PIPE);
@@ -287,8 +287,8 @@ public class DropinsRepositoryListener extends RepositoryListener {
repository.setProperty(key, value);
}
- public Collection getMetadataRepositories() {
- List result = new ArrayList(metadataRepositories);
+ public Collection<IMetadataRepository> getMetadataRepositories() {
+ List<IMetadataRepository> result = new ArrayList<IMetadataRepository>(metadataRepositories);
result.add(getMetadataRepository());
return result;
}
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
index ffa9687eb..7ca666d02 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
@@ -14,7 +14,9 @@ import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
+import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.extensionlocation.*;
import org.eclipse.equinox.internal.p2.update.*;
@@ -38,7 +40,7 @@ public class PlatformXmlListener extends DirectoryChangeListener {
private boolean changed = false;
private File root;
private long lastModified = -1l;
- private Set configRepositories;
+ private Set<IMetadataRepository> configRepositories;
private String toString(Feature[] features, String[] list) {
StringBuffer buffer = new StringBuffer();
@@ -136,9 +138,9 @@ public class PlatformXmlListener extends DirectoryChangeListener {
changed = false;
}
- public Collection getMetadataRepositories() {
+ public Collection<IMetadataRepository> getMetadataRepositories() {
if (configRepositories == null)
- return Collections.EMPTY_SET;
+ return CollectionUtils.emptySet();
return configRepositories;
}
@@ -147,12 +149,11 @@ public class PlatformXmlListener extends DirectoryChangeListener {
* currently associated with the given url string. Return null if one could not
* be found.
*/
- private IMetadataRepository getMatchingRepo(Collection repositoryList, String urlString) {
+ private IMetadataRepository getMatchingRepo(Collection<IMetadataRepository> repositoryList, String urlString) {
if (repositoryList == null)
return null;
IPath urlPath = new Path(urlString).makeAbsolute();
- for (Iterator iter = repositoryList.iterator(); iter.hasNext();) {
- IMetadataRepository repo = (IMetadataRepository) iter.next();
+ for (IMetadataRepository repo : repositoryList) {
Path repoPath = new Path(URIUtil.toFile(repo.getLocation()).getAbsolutePath());
if (repoPath.makeAbsolute().equals(urlPath))
return repo;
@@ -179,11 +180,10 @@ public class PlatformXmlListener extends DirectoryChangeListener {
* Ensure that we have a repository for each site in the given configuration.
*/
protected void synchronizeConfiguration(Configuration config) {
- List sites = config.getSites();
- Set newRepos = new LinkedHashSet();
- Set toBeRemoved = new HashSet();
- for (Iterator iter = sites.iterator(); iter.hasNext();) {
- Site site = (Site) iter.next();
+ List<Site> sites = config.getSites();
+ Set<IMetadataRepository> newRepos = new LinkedHashSet<IMetadataRepository>();
+ Set<Site> toBeRemoved = new HashSet<Site>();
+ for (Site site : sites) {
String siteURL = site.getUrl();
IMetadataRepository match = getMatchingRepo(Activator.getRepositories(), siteURL);
if (match == null) {
@@ -202,7 +202,7 @@ public class PlatformXmlListener extends DirectoryChangeListener {
}
String eclipseExtensionURL = siteURL + Constants.EXTENSION_LOCATION;
URI location = URIUtil.fromString(eclipseExtensionURL);
- Map properties = new HashMap();
+ Map<String, String> properties = new HashMap<String, String>();
properties.put(SiteListener.SITE_POLICY, site.getPolicy());
// In a "USER-INCLUDE" we add the site's features to the list
@@ -232,10 +232,8 @@ public class PlatformXmlListener extends DirectoryChangeListener {
throw inner;
}
// set the repository properties here in case they have changed since the last time we loaded
- for (Iterator inner = properties.keySet().iterator(); inner.hasNext();) {
- String key = (String) inner.next();
- String value = (String) properties.get(key);
- metadataRepository.setProperty(key, value);
+ for (Entry<String, String> entry : properties.entrySet()) {
+ metadataRepository.setProperty(entry.getKey(), entry.getValue());
}
}
newRepos.add(metadataRepository);
@@ -246,9 +244,9 @@ public class PlatformXmlListener extends DirectoryChangeListener {
} catch (ProvisionException ex) {
IArtifactRepository artifactRepository = Activator.loadArtifactRepository(location, null);
// set the repository properties here in case they have changed since the last time we loaded
- for (Iterator inner = properties.keySet().iterator(); inner.hasNext();) {
- String key = (String) inner.next();
- String value = (String) properties.get(key);
+ for (Iterator<String> inner = properties.keySet().iterator(); inner.hasNext();) {
+ String key = inner.next();
+ String value = properties.get(key);
artifactRepository.setProperty(key, value);
}
}
@@ -264,8 +262,8 @@ public class PlatformXmlListener extends DirectoryChangeListener {
}
}
if (!toBeRemoved.isEmpty()) {
- for (Iterator iter = toBeRemoved.iterator(); iter.hasNext();)
- config.removeSite((Site) iter.next());
+ for (Iterator<Site> iter = toBeRemoved.iterator(); iter.hasNext();)
+ config.removeSite(iter.next());
try {
config.save(root, Activator.getOSGiInstallArea());
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
index b79c95f4a..d3614b1f7 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java
@@ -15,8 +15,7 @@ import java.net.URISyntaxException;
import java.util.*;
import java.util.Map.Entry;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
+import org.eclipse.equinox.internal.p2.core.helpers.*;
import org.eclipse.equinox.internal.p2.extensionlocation.Constants;
import org.eclipse.equinox.internal.provisional.configurator.Configurator;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
@@ -51,17 +50,16 @@ public class ProfileSynchronizer {
private static final String EXPLANATION = "org.eclipse.equinox.p2.director.explain"; //$NON-NLS-1$
final IProfile profile;
- final Map repositoryMap;
- private Properties timestamps;
+ final Map<String, IMetadataRepository> repositoryMap;
+ private Map<String, String> timestamps;
/*
* Constructor for the class.
*/
- public ProfileSynchronizer(IProfile profile, Collection repositories) {
+ public ProfileSynchronizer(IProfile profile, Collection<IMetadataRepository> repositories) {
this.profile = profile;
- this.repositoryMap = new HashMap();
- for (Iterator it = repositories.iterator(); it.hasNext();) {
- IMetadataRepository repository = (IMetadataRepository) it.next();
+ this.repositoryMap = new HashMap<String, IMetadataRepository>();
+ for (IMetadataRepository repository : repositories) {
repositoryMap.put(repository.getLocation().toString(), repository);
}
}
@@ -120,13 +118,12 @@ public class ProfileSynchronizer {
private void writeTimestamps() {
timestamps.clear();
timestamps.put(PROFILE_TIMESTAMP, Long.toString(profile.getTimestamp()));
- for (Iterator it = repositoryMap.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- IMetadataRepository repository = (IMetadataRepository) entry.getValue();
- Map props = repository.getProperties();
+ for (Entry<String, IMetadataRepository> entry : repositoryMap.entrySet()) {
+ IMetadataRepository repository = entry.getValue();
+ Map<String, String> props = repository.getProperties();
String timestamp = null;
if (props != null)
- timestamp = (String) props.get(IRepository.PROP_TIMESTAMP);
+ timestamp = props.get(IRepository.PROP_TIMESTAMP);
if (timestamp == null)
timestamp = NO_TIMESTAMP;
@@ -138,7 +135,7 @@ public class ProfileSynchronizer {
File file = Activator.getContext().getDataFile(TIMESTAMPS_FILE_PREFIX + profile.getProfileId().hashCode());
OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
try {
- timestamps.store(os, "Timestamps for " + profile.getProfileId()); //$NON-NLS-1$
+ CollectionUtils.storeProperties(timestamps, os, "Timestamps for " + profile.getProfileId()); //$NON-NLS-1$
} finally {
if (os != null)
os.close();
@@ -155,26 +152,25 @@ public class ProfileSynchronizer {
if ("true".equals(Activator.getContext().getProperty("osgi.checkConfiguration"))) //$NON-NLS-1$//$NON-NLS-2$
return false;
- String lastKnownProfileTimeStamp = (String) timestamps.remove(PROFILE_TIMESTAMP);
+ String lastKnownProfileTimeStamp = timestamps.remove(PROFILE_TIMESTAMP);
if (lastKnownProfileTimeStamp == null)
return false;
if (!lastKnownProfileTimeStamp.equals(Long.toString(profile.getTimestamp())))
return false;
//When we get here the timestamps map only contains information related to repos
- for (Iterator it = repositoryMap.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- IMetadataRepository repository = (IMetadataRepository) entry.getValue();
+ for (Entry<String, IMetadataRepository> entry : repositoryMap.entrySet()) {
+ IMetadataRepository repository = entry.getValue();
- Map props = repository.getProperties();
+ Map<String, String> props = repository.getProperties();
String currentTimestamp = null;
if (props != null)
- currentTimestamp = (String) props.get(IRepository.PROP_TIMESTAMP);
+ currentTimestamp = props.get(IRepository.PROP_TIMESTAMP);
if (currentTimestamp == null)
currentTimestamp = NO_TIMESTAMP;
- String lastKnownTimestamp = (String) timestamps.remove(entry.getKey());
+ String lastKnownTimestamp = timestamps.remove(entry.getKey());
//A repo has been added
if (lastKnownTimestamp == null)
return false;
@@ -191,53 +187,54 @@ public class ProfileSynchronizer {
private void readTimestamps() {
File file = Activator.getContext().getDataFile(TIMESTAMPS_FILE_PREFIX + profile.getProfileId().hashCode());
- timestamps = new Properties();
try {
InputStream is = new BufferedInputStream(new FileInputStream(file));
try {
- timestamps.load(is);
+ timestamps = CollectionUtils.loadProperties(is);
} finally {
if (is != null)
is.close();
}
} catch (FileNotFoundException e) {
+ timestamps = new HashMap<String, String>();
//Ignore
} catch (IOException e) {
//Ignore
+ timestamps = new HashMap<String, String>();
}
}
private ProvisioningContext getContext() {
- ArrayList repoURLs = new ArrayList();
- for (Iterator iterator = repositoryMap.keySet().iterator(); iterator.hasNext();) {
+ ArrayList<URI> repoURLs = new ArrayList<URI>();
+ for (Iterator<String> iterator = repositoryMap.keySet().iterator(); iterator.hasNext();) {
try {
- repoURLs.add(new URI((String) iterator.next()));
+ repoURLs.add(new URI(iterator.next()));
} catch (URISyntaxException e) {
//ignore
}
}
- ProvisioningContext result = new ProvisioningContext((URI[]) repoURLs.toArray(new URI[repoURLs.size()]));
+ ProvisioningContext result = new ProvisioningContext(repoURLs.toArray(new URI[repoURLs.size()]));
result.setArtifactRepositories(new URI[0]);
return result;
}
private String synchronizeCacheExtensions() {
- List currentExtensions = new ArrayList();
+ List<String> currentExtensions = new ArrayList<String>();
StringBuffer buffer = new StringBuffer();
- List repositories = new ArrayList(repositoryMap.keySet());
+ List<String> repositories = new ArrayList<String>(repositoryMap.keySet());
final String OSGiInstallArea = Activator.getOSGiInstallArea().toExternalForm() + Constants.EXTENSION_LOCATION;
- Collections.sort(repositories, new Comparator() {
- public int compare(Object left, Object right) {
+ Collections.sort(repositories, new Comparator<String>() {
+ public int compare(String left, String right) {
if (OSGiInstallArea.equals(left))
return -1;
if (OSGiInstallArea.equals(right))
return 1;
- return ((String) left).compareTo((String) right);
+ return left.compareTo(right);
}
});
- for (Iterator it = repositories.iterator(); it.hasNext();) {
- String repositoryId = (String) it.next();
+ for (Iterator<String> it = repositories.iterator(); it.hasNext();) {
+ String repositoryId = it.next();
try {
IArtifactRepository repository = Activator.loadArtifactRepository(new URI(repositoryId), null);
@@ -256,7 +253,7 @@ public class ProfileSynchronizer {
}
String currentExtensionsProperty = (buffer.length() == 0) ? null : buffer.toString();
- List previousExtensions = new ArrayList();
+ List<String> previousExtensions = new ArrayList<String>();
String previousExtensionsProperty = profile.getProperty(CACHE_EXTENSIONS);
if (previousExtensionsProperty != null) {
StringTokenizer tokenizer = new StringTokenizer(previousExtensionsProperty, PIPE);
@@ -291,19 +288,19 @@ public class ProfileSynchronizer {
if (resolve)
request.removeProfileProperty("org.eclipse.equinox.p2.resolve"); //$NON-NLS-1$
- List toAdd = new ArrayList();
- List toRemove = new ArrayList();
+ List<IInstallableUnit> toAdd = new ArrayList<IInstallableUnit>();
+ List<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>();
boolean foundIUsToAdd = false;
- Set profileIUs = profile.query(InstallableUnitQuery.ANY, null).unmodifiableSet();
+ Set<IInstallableUnit> profileIUs = profile.query(InstallableUnitQuery.ANY, null).unmodifiableSet();
// we use IProfile.available(...) here so that we also gather any shared IUs
- Set availableProfileIUs = profile.available(InstallableUnitQuery.ANY, null).unmodifiableSet();
+ Set<IInstallableUnit> availableProfileIUs = profile.available(InstallableUnitQuery.ANY, null).unmodifiableSet();
// get all IUs from all our repos (toAdd)
- Collector allIUs = getAllIUsFromRepos();
- for (Iterator iter = allIUs.iterator(); iter.hasNext();) {
- final IInstallableUnit iu = (IInstallableUnit) iter.next();
+ IQueryResult<IInstallableUnit> allIUs = getAllIUsFromRepos();
+ for (Iterator<IInstallableUnit> iter = allIUs.iterator(); iter.hasNext();) {
+ final IInstallableUnit iu = iter.next();
// if the IU is already installed in the profile then skip it
if (!profileIUs.contains(iu)) {
if (GroupQuery.isGroup(iu))
@@ -323,10 +320,10 @@ public class ProfileSynchronizer {
}
// get all IUs from profile with marked property (existing)
- IQueryResult dropinIUs = profile.query(new IUProfilePropertyQuery(PROP_FROM_DROPINS, Boolean.toString(true)), null);
- Set all = allIUs.unmodifiableSet();
- for (Iterator iter = dropinIUs.iterator(); iter.hasNext();) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
+ IQueryResult<IInstallableUnit> dropinIUs = profile.query(new IUProfilePropertyQuery(PROP_FROM_DROPINS, Boolean.toString(true)), null);
+ Set<IInstallableUnit> all = allIUs.unmodifiableSet();
+ for (Iterator<IInstallableUnit> iter = dropinIUs.iterator(); iter.hasNext();) {
+ IInstallableUnit iu = iter.next();
// the STRICT policy is set when we install things via the UI, we use it to differentiate between IUs installed
// via the dropins and the UI. (dropins are considered optional) If an IU has both properties set it means that
// it was initially installed via the dropins but then upgraded via the UI. (properties are copied from the old IU
@@ -351,8 +348,8 @@ public class ProfileSynchronizer {
}
context.setExtraIUs(toAdd);
- request.addInstallableUnits((IInstallableUnit[]) toAdd.toArray(new IInstallableUnit[toAdd.size()]));
- request.removeInstallableUnits((IInstallableUnit[]) toRemove.toArray(new IInstallableUnit[toRemove.size()]));
+ request.addInstallableUnits(toAdd.toArray(new IInstallableUnit[toAdd.size()]));
+ request.removeInstallableUnits(toRemove.toArray(new IInstallableUnit[toRemove.size()]));
debug(request);
return request;
}
@@ -372,13 +369,12 @@ public class ProfileSynchronizer {
Tracing.debug(PREFIX + "Adding IU: " + toAdd[i].getId() + ' ' + toAdd[i].getVersion()); //$NON-NLS-1$
}
}
- Map propsToAdd = request.getInstallableUnitProfilePropertiesToAdd();
+ Map<IInstallableUnit, Map<String, String>> propsToAdd = request.getInstallableUnitProfilePropertiesToAdd();
if (propsToAdd == null || propsToAdd.isEmpty()) {
Tracing.debug(PREFIX + "No IU properties to add."); //$NON-NLS-1$
} else {
- for (Iterator iter = propsToAdd.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
- Tracing.debug(PREFIX + "Adding IU property: " + key + "->" + propsToAdd.get(key)); //$NON-NLS-1$ //$NON-NLS-2$
+ for (Entry<IInstallableUnit, Map<String, String>> entry : propsToAdd.entrySet()) {
+ Tracing.debug(PREFIX + "Adding IU property: " + entry.getKey() + "->" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -390,23 +386,20 @@ public class ProfileSynchronizer {
Tracing.debug(PREFIX + "Removing IU: " + toRemove[i].getId() + ' ' + toRemove[i].getVersion()); //$NON-NLS-1$
}
}
- Map propsToRemove = request.getInstallableUnitProfilePropertiesToRemove();
+ Map<IInstallableUnit, List<String>> propsToRemove = request.getInstallableUnitProfilePropertiesToRemove();
if (propsToRemove == null || propsToRemove.isEmpty()) {
Tracing.debug(PREFIX + "No IU properties to remove."); //$NON-NLS-1$
} else {
- for (Iterator iter = propsToRemove.keySet().iterator(); iter.hasNext();) {
- Object key = iter.next();
- Tracing.debug(PREFIX + "Removing IU property: " + key + "->" + propsToRemove.get(key)); //$NON-NLS-1$ //$NON-NLS-2$
+ for (Entry<IInstallableUnit, List<String>> entry : propsToRemove.entrySet()) {
+ Tracing.debug(PREFIX + "Removing IU property: " + entry.getKey() + "->" + entry.getValue()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
- private Collector getAllIUsFromRepos() {
+ private IQueryResult<IInstallableUnit> getAllIUsFromRepos() {
// TODO: Should consider using a sequenced iterator here instead of collecting
- Collector allRepos = new Collector();
- for (Iterator it = repositoryMap.entrySet().iterator(); it.hasNext();) {
- Entry entry = (Entry) it.next();
- IMetadataRepository repository = (IMetadataRepository) entry.getValue();
+ Collector<IInstallableUnit> allRepos = new Collector<IInstallableUnit>();
+ for (IMetadataRepository repository : repositoryMap.values()) {
allRepos.addAll(repository.query(InstallableUnitQuery.ANY, null));
}
return allRepos;

Back to the top