Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-02-11 15:44:28 +0000
committerPascal Rapicault2010-02-11 15:44:28 +0000
commit6cea88679a7f7c0f44a98f299db25ad4059a0327 (patch)
treec2eb9e6c512424b7f6a86791c8cc2b6fdaef4571 /bundles/org.eclipse.equinox.p2.updatechecker
parentdbcb0f62a616280180e7714169fe5e86fb743d4a (diff)
downloadrt.equinox.p2-6cea88679a7f7c0f44a98f299db25ad4059a0327.tar.gz
rt.equinox.p2-6cea88679a7f7c0f44a98f299db25ad4059a0327.tar.xz
rt.equinox.p2-6cea88679a7f7c0f44a98f299db25ad4059a0327.zip
Initial release of the planner API
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.updatechecker')
-rw-r--r--bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF1
-rw-r--r--bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java13
-rw-r--r--bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/provisional/p2/updatechecker/UpdateEvent.java8
3 files changed, 13 insertions, 9 deletions
diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF
index 63480f100..5a2850d66 100644
--- a/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.updatechecker/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Import-Package: org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.p2.engine,
org.eclipse.equinox.p2.metadata,
org.eclipse.equinox.p2.metadata.query,
+ org.eclipse.equinox.p2.planner,
org.eclipse.equinox.p2.query,
org.eclipse.equinox.p2.repository,
org.eclipse.equinox.p2.repository.metadata,
diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java b/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java
index 39d854a92..8128659e1 100644
--- a/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java
+++ b/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/p2/updatechecker/UpdateChecker.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sonatype, Inc. - ongoing development
*******************************************************************************/
package org.eclipse.equinox.internal.p2.updatechecker;
@@ -17,13 +18,13 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
-import org.eclipse.equinox.internal.provisional.p2.director.IPlanner;
import org.eclipse.equinox.internal.provisional.p2.updatechecker.*;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.repository.IRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -70,8 +71,8 @@ public class UpdateChecker implements IUpdateChecker {
while (!done) {
trace("Checking for updates for " + profileId + " at " + getTimeStamp()); //$NON-NLS-1$ //$NON-NLS-2$
- IInstallableUnit[] iusWithUpdates = checkForUpdates(profileId, query);
- if (iusWithUpdates.length > 0) {
+ Collection<IInstallableUnit> iusWithUpdates = checkForUpdates(profileId, query);
+ if (iusWithUpdates.size() > 0) {
trace("Notifying listener of available updates"); //$NON-NLS-1$
UpdateEvent event = new UpdateEvent(profileId, iusWithUpdates);
if (!done)
@@ -120,11 +121,11 @@ public class UpdateChecker implements IUpdateChecker {
* Return the array of ius in the profile that have updates
* available.
*/
- IInstallableUnit[] checkForUpdates(String profileId, IQuery<IInstallableUnit> query) {
+ Collection<IInstallableUnit> checkForUpdates(String profileId, IQuery<IInstallableUnit> query) {
IProfile profile = getProfileRegistry().getProfile(profileId);
ArrayList<IInstallableUnit> iusWithUpdates = new ArrayList<IInstallableUnit>();
if (profile == null)
- return new IInstallableUnit[0];
+ return Collections.emptyList();
ProvisioningContext context = new ProvisioningContext(getAvailableRepositories());
if (query == null)
query = InstallableUnitQuery.ANY;
@@ -135,7 +136,7 @@ public class UpdateChecker implements IUpdateChecker {
if (replacements.length > 0)
iusWithUpdates.add(iu);
}
- return iusWithUpdates.toArray(new IInstallableUnit[iusWithUpdates.size()]);
+ return iusWithUpdates;
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/provisional/p2/updatechecker/UpdateEvent.java b/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/provisional/p2/updatechecker/UpdateEvent.java
index 6a6297852..7c4a38890 100644
--- a/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/provisional/p2/updatechecker/UpdateEvent.java
+++ b/bundles/org.eclipse.equinox.p2.updatechecker/src/org/eclipse/equinox/internal/provisional/p2/updatechecker/UpdateEvent.java
@@ -7,9 +7,11 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sonatype, Inc. - ongoing development
*******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.updatechecker;
+import java.util.Collection;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
/**
@@ -18,14 +20,14 @@ import org.eclipse.equinox.p2.metadata.IInstallableUnit;
public class UpdateEvent {
String profileId;
- IInstallableUnit[] iusWithUpdates;
+ Collection<IInstallableUnit> iusWithUpdates;
- public UpdateEvent(String profileId, IInstallableUnit[] iusWithUpdates) {
+ public UpdateEvent(String profileId, Collection<IInstallableUnit> iusWithUpdates) {
this.profileId = profileId;
this.iusWithUpdates = iusWithUpdates;
}
- public IInstallableUnit[] getIUs() {
+ public Collection<IInstallableUnit> getIUs() {
return iusWithUpdates;
}

Back to the top