diff options
author | Simon Kaegi | 2010-02-22 16:28:27 +0000 |
---|---|---|
committer | Simon Kaegi | 2010-02-22 16:28:27 +0000 |
commit | 25e0f9d0f76437b5be2bb7f7df7f3142d7d9001b (patch) | |
tree | 2e707f6969dc214e4d7271f9b31c8fb1a9f93ecb /bundles | |
parent | 4fdc796a4cfa93f73d628343b9f1fd4ea6043eb5 (diff) | |
download | rt.equinox.p2-25e0f9d0f76437b5be2bb7f7df7f3142d7d9001b.tar.gz rt.equinox.p2-25e0f9d0f76437b5be2bb7f7df7f3142d7d9001b.tar.xz rt.equinox.p2-25e0f9d0f76437b5be2bb7f7df7f3142d7d9001b.zip |
Bug 297253 - [Engine][API] Remove direct use of PhaseSet and Phases
Diffstat (limited to 'bundles')
33 files changed, 158 insertions, 291 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF index 065f54cda..8a3d1008b 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.director.app/META-INF/MANIFEST.MF @@ -8,7 +8,6 @@ Bundle-Version: 1.0.200.qualifier Import-Package: org.eclipse.equinox.app, org.eclipse.equinox.internal.p2.console, org.eclipse.equinox.internal.p2.core.helpers, - org.eclipse.equinox.internal.p2.engine.phases, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.metadata.query, org.eclipse.equinox.internal.provisional.p2.core, diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java index c460f6cff..99ac9a5e6 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java @@ -22,7 +22,6 @@ import org.eclipse.core.runtime.*; import org.eclipse.equinox.app.IApplication; import org.eclipse.equinox.app.IApplicationContext; import org.eclipse.equinox.internal.p2.core.helpers.*; -import org.eclipse.equinox.internal.p2.engine.phases.Collect; import org.eclipse.equinox.internal.p2.metadata.VersionedId; import org.eclipse.equinox.internal.p2.metadata.query.LatestIUVersionQuery; import org.eclipse.equinox.internal.provisional.p2.director.*; @@ -121,6 +120,7 @@ public class DirectorApplication implements IApplication { private static final Integer EXIT_ERROR = new Integer(13); static private final String FLAVOR_DEFAULT = "tooling"; //$NON-NLS-1$ static private final String PROP_P2_PROFILE = "eclipse.p2.profile"; //$NON-NLS-1$ + static private final String NO_ARTIFACT_REPOSITORIES_AVAILABLE = "noArtifactRepositoriesAvailable"; //$NON-NLS-1$ public static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$ @@ -546,7 +546,7 @@ public class DirectorApplication implements IApplication { } private boolean hasNoRepositoryFound(IStatus status) { - if (status.getException() != null && Collect.NO_ARTIFACT_REPOSITORIES_AVAILABLE.equals(status.getException().getMessage())) + if (status.getException() != null && NO_ARTIFACT_REPOSITORIES_AVAILABLE.equals(status.getException().getMessage())) return true; if (status.isMultiStatus()) { for (IStatus child : status.getChildren()) { diff --git a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF index fe6ec87ce..f607bf55c 100644 --- a/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.director/META-INF/MANIFEST.MF @@ -6,7 +6,6 @@ Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-Version: 1.1.0.qualifier Import-Package: org.eclipse.equinox.internal.p2.core.helpers, - org.eclipse.equinox.internal.p2.engine, org.eclipse.equinox.internal.provisional.configurator, org.eclipse.equinox.internal.provisional.p2.core, org.eclipse.equinox.internal.provisional.p2.metadata, diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java index 0ebf674d8..568860ce2 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java @@ -15,7 +15,6 @@ import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.director.DirectorActivator; import org.eclipse.equinox.internal.p2.director.Messages; -import org.eclipse.equinox.internal.p2.engine.PhaseSet; import org.eclipse.equinox.internal.provisional.configurator.Configurator; import org.eclipse.equinox.p2.engine.*; @@ -24,7 +23,7 @@ public class PlanExecutionHelper { return executePlan(result, engine, new DefaultPhaseSet(), context, progress); } - public static IStatus executePlan(IProvisioningPlan result, IEngine engine, PhaseSet phaseSet, ProvisioningContext context, IProgressMonitor progress) { + public static IStatus executePlan(IProvisioningPlan result, IEngine engine, IPhaseSet phaseSet, ProvisioningContext context, IProgressMonitor progress) { if (!result.getStatus().isOK()) return result.getStatus(); diff --git a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF index 70289f52a..a90221814 100644 --- a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF @@ -6,16 +6,12 @@ Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-Version: 2.0.0.qualifier Export-Package: org.eclipse.equinox.internal.p2.engine; - x-friends:="org.eclipse.equinox.p2.touchpoint.eclipse, + x-friends:="org.eclipse.equinox.p2.touchpoint.eclipse, org.eclipse.equinox.p2.touchpoint.natives, - org.eclipse.equinox.p2.operations, - org.eclipse.equinox.p2.director, org.eclipse.equinox.p2.ui.sdk.scheduler, - org.eclipse.pde.build, - org.eclipse.pde.core", + org.eclipse.pde.build", org.eclipse.equinox.internal.p2.engine.phases; - x-friends:="org.eclipse.equinox.p2.operations, - org.eclipse.equinox.p2.ui.sdk.scheduler, + x-friends:="org.eclipse.equinox.p2.ui.sdk.scheduler, org.eclipse.equinox.p2.repository.tools, org.eclipse.equinox.p2.director.app", org.eclipse.equinox.p2.engine, diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java index b2e50637d..f1f4e3457 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java @@ -115,14 +115,6 @@ public class Engine implements IEngine { return phaseSet.validate(actionManager, iprofile, operands, context, monitor); } - public IPhaseSet createPhaseSetExcluding(String[] excludes) { - return PhaseSet.createPhaseSetExcluding(excludes); - } - - public IPhaseSet createPhaseSetIncluding(String[] includes) { - return PhaseSet.createPhaseSetIncluding(includes); - } - public IProvisioningPlan createPlan(IProfile profile, ProvisioningContext context) { return new ProvisioningPlan(profile, null, context); } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java index e215cc820..0f7ec63aa 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java @@ -12,51 +12,14 @@ package org.eclipse.equinox.internal.p2.engine; import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.phases.*; import org.eclipse.equinox.p2.engine.*; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.osgi.util.NLS; public class PhaseSet implements IPhaseSet { - public static final List<String> DEFAULT_PHASES = Arrays.asList(new String[] {IPhaseSet.PHASE_COLLECT, IPhaseSet.PHASE_UNCONFIGURE, IPhaseSet.PHASE_UNINSTALL, IPhaseSet.PHASE_PROPERTY, IPhaseSet.PHASE_CHECK_TRUST, IPhaseSet.PHASE_INSTALL, IPhaseSet.PHASE_CONFIGURE}); - - public static final boolean forcedUninstall = Boolean.valueOf(EngineActivator.getContext().getProperty("org.eclipse.equinox.p2.engine.forcedUninstall")).booleanValue(); //$NON-NLS-1$ - private final Phase[] phases; - public static IPhaseSet createPhaseSetExcluding(String[] excludes) { - ArrayList<String> phases = new ArrayList<String>(DEFAULT_PHASES); - if (excludes != null) { - for (int i = 0; i < excludes.length; i++) { - phases.remove(excludes[i]); - } - } - return createPhaseSetIncluding(phases.toArray(new String[phases.size()])); - } - - public static IPhaseSet createPhaseSetIncluding(String[] includes) { - ArrayList<Phase> phases = new ArrayList<Phase>(); - for (int i = 0; i < includes.length; i++) { - String current = includes[i]; - if (current.equals(IPhaseSet.PHASE_CONFIGURE)) - phases.add(new Configure(10)); - else if (current.equals(IPhaseSet.PHASE_CHECK_TRUST)) - phases.add(new CheckTrust(10)); - else if (current.equals(IPhaseSet.PHASE_COLLECT)) - phases.add(new Collect(100)); - else if (current.equals(IPhaseSet.PHASE_INSTALL)) - phases.add(new Install(50)); - else if (current.equals(IPhaseSet.PHASE_PROPERTY)) - phases.add(new Property(1)); - else if (current.equals(IPhaseSet.PHASE_UNCONFIGURE)) - phases.add(new Unconfigure(10, forcedUninstall)); - else if (current.equals(IPhaseSet.PHASE_UNINSTALL)) - phases.add(new Uninstall(50, forcedUninstall)); - } - return new PhaseSet(phases.toArray(new Phase[phases.size()])); - } - public PhaseSet(Phase[] phases) { if (phases == null) throw new IllegalArgumentException(Messages.null_phases); diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java index b0f7206fc..6b18a1550 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java @@ -10,15 +10,15 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.io.File; import java.util.*; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase; import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.p2.engine.DefaultPhaseSet; +import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.ITouchpointType; @@ -29,11 +29,10 @@ import org.eclipse.equinox.p2.metadata.ITouchpointType; */ public class CheckTrust extends InstallableUnitPhase { - private static final String PHASE_ID = IPhaseSet.PHASE_CHECK_TRUST; public static final String PARM_ARTIFACT_FILES = "artifactFiles"; //$NON-NLS-1$ public CheckTrust(int weight) { - super(PHASE_ID, weight); + super(DefaultPhaseSet.PHASE_CHECK_TRUST, weight); } protected boolean isApplicable(InstallableUnitOperand op) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java index 2709771fb..aa43a00a3 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java @@ -11,8 +11,6 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.util.*; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -29,12 +27,11 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest; * The goal of the collect phase is to ask the touchpoints if the artifacts associated with an IU need to be downloaded. */ public class Collect extends InstallableUnitPhase { - private static final String PHASE_ID = IPhaseSet.PHASE_COLLECT; public static final String PARM_ARTIFACT_REQUESTS = "artifactRequests"; //$NON-NLS-1$ public static final String NO_ARTIFACT_REPOSITORIES_AVAILABLE = "noArtifactRepositoriesAvailable"; //$NON-NLS-1$ public Collect(int weight) { - super(PHASE_ID, weight); + super(DefaultPhaseSet.PHASE_COLLECT, weight); //re-balance work since postPerform will do almost all the time-consuming work prePerformWork = 0; mainPerformWork = 100; diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java index c8974fa8b..9a535be81 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java @@ -10,13 +10,11 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase; -import org.eclipse.equinox.internal.p2.engine.Messages; -import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.internal.p2.engine.*; +import org.eclipse.equinox.p2.engine.DefaultPhaseSet; +import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -26,7 +24,7 @@ import org.eclipse.osgi.util.NLS; public class Configure extends InstallableUnitPhase { public Configure(int weight) { - super(IPhaseSet.PHASE_CONFIGURE, weight); + super(DefaultPhaseSet.PHASE_CONFIGURE, weight); } protected boolean isApplicable(InstallableUnitOperand op) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java index 184ee3108..c48f275fd 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.engine.*; @@ -71,10 +69,8 @@ public class Install extends InstallableUnitPhase { } } - private static final String PHASE_ID = IPhaseSet.PHASE_INSTALL; - public Install(int weight) { - super(PHASE_ID, weight); + super(DefaultPhaseSet.PHASE_INSTALL, weight); } protected boolean isApplicable(InstallableUnitOperand op) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java index 37abf66c0..c603497ab 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java @@ -10,13 +10,10 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.*; - import java.util.*; import org.eclipse.core.runtime.IStatus; -import org.eclipse.equinox.internal.p2.engine.Phase; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.internal.p2.engine.*; +import org.eclipse.equinox.p2.engine.DefaultPhaseSet; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -137,10 +134,8 @@ public class Property extends Phase { } } - private static final String PHASE_ID = IPhaseSet.PHASE_PROPERTY; - public Property(int weight) { - super(PHASE_ID, weight); + super(DefaultPhaseSet.PHASE_PROPERTY, weight); } protected List<ProvisioningAction> getActions(Operand operand) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java index 96660fde3..fd1c3c893 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java @@ -10,15 +10,14 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.net.URI; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.engine.*; 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.engine.IProfile; +import org.eclipse.equinox.p2.engine.ProvisioningContext; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.ITouchpointType; @@ -32,7 +31,7 @@ public class Sizing extends InstallableUnitPhase { private long sizeOnDisk; private long dlSize; - public Sizing(int weight, String phaseName) { + public Sizing(int weight) { super(PHASE_ID, weight); } @@ -44,7 +43,7 @@ public class Sizing extends InstallableUnitPhase { return sizeOnDisk; } - public long getDlSize() { + public long getDownloadSize() { return dlSize; } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java index 666a1e6d2..6378c22d2 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java @@ -10,13 +10,11 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase; -import org.eclipse.equinox.internal.p2.engine.Messages; -import org.eclipse.equinox.p2.engine.*; +import org.eclipse.equinox.internal.p2.engine.*; +import org.eclipse.equinox.p2.engine.DefaultPhaseSet; +import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -25,7 +23,7 @@ import org.eclipse.equinox.p2.metadata.query.FragmentQuery; public class Unconfigure extends InstallableUnitPhase { public Unconfigure(int weight, boolean forced) { - super(IPhaseSet.PHASE_UNCONFIGURE, weight, forced); + super(DefaultPhaseSet.PHASE_UNCONFIGURE, weight, forced); } public Unconfigure(int weight) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java index 45d3fffdd..b8c8949ff 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.engine.phases; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.engine.*; @@ -69,7 +67,7 @@ public class Uninstall extends InstallableUnitPhase { } public Uninstall(int weight, boolean forced) { - super(IPhaseSet.PHASE_UNINSTALL, weight, forced); + super(DefaultPhaseSet.PHASE_UNINSTALL, weight, forced); } public Uninstall(int weight) { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java index c6fe87bdf..0b3629cf5 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/DefaultPhaseSet.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.equinox.p2.engine; -import java.util.ArrayList; +import java.util.*; import org.eclipse.equinox.internal.p2.engine.*; import org.eclipse.equinox.internal.p2.engine.phases.*; @@ -21,13 +21,51 @@ public class DefaultPhaseSet extends PhaseSet { private static final boolean forcedUninstall = Boolean.valueOf(EngineActivator.getContext().getProperty("org.eclipse.equinox.p2.engine.forcedUninstall")).booleanValue(); //$NON-NLS-1$ - public static int PHASE_COLLECT = 0x02; - public static int PHASE_UNCONFIGURE = 0x20; - public static int PHASE_UNINSTALL = 0x40; - public static int PHASE_PROPERTY = 0x10; - public static int PHASE_CHECK_TRUST = 0x01; - public static int PHASE_INSTALL = 0x08; - public static int PHASE_CONFIGURE = 0x04; + /** + * A phase id (value "checkTrust") describing the certificate trust check phase. + * This phase examines the code signing certificates of the artifacts being installed + * to ensure they are signed and trusted by the running system. + */ + public static String PHASE_CHECK_TRUST = "checkTrust"; //$NON-NLS-1$ + /** + * A phase id (value "collect") describing the collect phase. + * This phase gathers all the artifacts to be installed, typically by copying them + * from some repository into a suitable local location for the application being installed. + */ + public static String PHASE_COLLECT = "collect"; //$NON-NLS-1$ + /** + * A phase id (value "configure") describing the configuration phase. + * This phase writes configuration data related to the software being provisioned. + * Until configuration occurs the end user of the software will be have access to + * the installed functionality. + */ + public static String PHASE_CONFIGURE = "configure"; //$NON-NLS-1$ + /** + * A phase id (value "install") describing the install phase. + * This phase performs any necessary transformations on the downloaded + * artifacts to put them in the correct shape for the running application, such + * as decompressing or moving content, setting file permissions, etc). + */ + public static String PHASE_INSTALL = "install"; //$NON-NLS-1$ + /** + * A phase id (value "property") describing the property modification phase. + * This phase performs changes to profile properties. + */ + public static String PHASE_PROPERTY = "property"; //$NON-NLS-1$ + /** + * A phase id (value "unconfigure") describing the unconfigure phase. + * This phase removes configuration data related to the software being removed. + * This phase is the inverse of the changes performed in the configure phase. + */ + public static String PHASE_UNCONFIGURE = "unconfigure"; //$NON-NLS-1$ + /** + * A phase id (value "uninstall") describing the uninstall phase. + * This phase removes artifacts from the system being provisioned that are + * no longer required in the new profile. + */ + public static String PHASE_UNINSTALL = "uninstall"; //$NON-NLS-1$ + + private static final List<String> ALL_PHASES_LIST = Arrays.asList(new String[] {PHASE_COLLECT, PHASE_UNCONFIGURE, PHASE_UNINSTALL, PHASE_PROPERTY, PHASE_CHECK_TRUST, PHASE_INSTALL, PHASE_CONFIGURE}); public DefaultPhaseSet() { this(new Phase[] {new Collect(100), new Unconfigure(10, forcedUninstall), new Uninstall(50, forcedUninstall), new Property(1), new CheckTrust(10), new Install(50), new Configure(10)}); @@ -45,21 +83,41 @@ public class DefaultPhaseSet extends PhaseSet { * See {@link DefaultPhaseSet} for possible options * @return the {@link PhaseSet} */ - public static final PhaseSet createDefaultPhaseSet(int exclude) { + public static final IPhaseSet createExcluding(String[] exclude) { + if (exclude == null || exclude.length == 0) + return new DefaultPhaseSet(); + List<String> excludeList = Arrays.asList(exclude); + List<String> includeList = new ArrayList<String>(ALL_PHASES_LIST); + includeList.removeAll(excludeList); + return createIncluding(includeList.toArray(new String[includeList.size()])); + } + + /** + * Creates a default phase set that covers all the provisioning operations. + * Phases can be specified for inclusion. + * + * @param exclude - A set of bit options that specify the phases to include. + * See {@link DefaultPhaseSet} for possible options + * @return the {@link PhaseSet} + */ + public static final IPhaseSet createIncluding(String[] include) { + if (include == null || include.length == 0) + return new DefaultPhaseSet(new Phase[0]); + List<String> includeList = Arrays.asList(include); ArrayList<Phase> phases = new ArrayList<Phase>(); - if ((PHASE_COLLECT & exclude) != PHASE_COLLECT) + if (includeList.contains(PHASE_COLLECT)) phases.add(new Collect(100)); - if ((PHASE_UNCONFIGURE & exclude) != PHASE_UNCONFIGURE) + if (includeList.contains(PHASE_UNCONFIGURE)) phases.add(new Unconfigure(10, forcedUninstall)); - if ((PHASE_UNINSTALL & exclude) != PHASE_UNINSTALL) + if (includeList.contains(PHASE_UNINSTALL)) phases.add(new Uninstall(50, forcedUninstall)); - if ((PHASE_PROPERTY & exclude) != PHASE_PROPERTY) + if (includeList.contains(PHASE_PROPERTY)) phases.add(new Property(1)); - if ((PHASE_CHECK_TRUST & exclude) != PHASE_CHECK_TRUST) + if (includeList.contains(PHASE_CHECK_TRUST)) phases.add(new CheckTrust(10)); - if ((PHASE_INSTALL & exclude) != PHASE_INSTALL) + if (includeList.contains(PHASE_INSTALL)) phases.add(new Install(50)); - if ((PHASE_CONFIGURE & exclude) != PHASE_CONFIGURE) + if (includeList.contains(PHASE_CONFIGURE)) phases.add(new Configure(10)); return new DefaultPhaseSet(phases.toArray(new Phase[phases.size()])); } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java index b87f381f8..efc33d38e 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java @@ -48,22 +48,6 @@ public interface IEngine { public IProvisioningPlan createPlan(IProfile profile, ProvisioningContext context); /** - * Creates a phase set with a default set of phases, excluding the specified phases. - * @param excludes The phases to exclude, or <code>null</code> to include - * all default phases. - * - * @return A new phase set - */ - public IPhaseSet createPhaseSetExcluding(String[] excludes); - - /** - * Creates and returns a phase set including only the specified phases. - * @param includes The phases to include - * @return A new phase set - */ - public IPhaseSet createPhaseSetIncluding(String[] includes); - - /** * Executes a provisioning plan. * * @param plan The plan describing the changes to be made diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IPhaseSet.java index 4344c61d8..0d315e10f 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IPhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IPhaseSet.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.equinox.p2.engine; - /** * Describes a set of provisioning phases to be performed by an {@link IEngine}. * @@ -21,50 +20,6 @@ package org.eclipse.equinox.p2.engine; public interface IPhaseSet { /** - * A phase id (value "checkTrust") describing the certificate trust check phase. - * This phase examines the code signing certificates of the artifacts being installed - * to ensure they are signed and trusted by the running system. - */ - public static String PHASE_CHECK_TRUST = "checkTrust"; //$NON-NLS-1$ - /** - * A phase id (value "collect") describing the collect phase. - * This phase gathers all the artifacts to be installed, typically by copying them - * from some repository into a suitable local location for the application being installed. - */ - public static String PHASE_COLLECT = "collect"; //$NON-NLS-1$ - /** - * A phase id (value "configure") describing the configuration phase. - * This phase writes configuration data related to the software being provisioned. - * Until configuration occurs the end user of the software will be have access to - * the installed functionality. - */ - public static String PHASE_CONFIGURE = "configure"; //$NON-NLS-1$ - /** - * A phase id (value "install") describing the install phase. - * This phase performs any necessary transformations on the downloaded - * artifacts to put them in the correct shape for the running application, such - * as decompressing or moving content, setting file permissions, etc). - */ - public static String PHASE_INSTALL = "install"; //$NON-NLS-1$ - /** - * A phase id (value "property") describing the property modification phase. - * This phase performs changes to profile properties. - */ - public static String PHASE_PROPERTY = "property"; //$NON-NLS-1$ - /** - * A phase id (value "unconfigure") describing the unconfigure phase. - * This phase removes configuration data related to the software being removed. - * This phase is the inverse of the changes performed in the configure phase. - */ - public static String PHASE_UNCONFIGURE = "unconfigure"; //$NON-NLS-1$ - /** - * A phase id (value "uninstall") describing the uninstall phase. - * This phase removes artifacts from the system being provisioned that are - * no longer required in the new profile. - */ - public static String PHASE_UNINSTALL = "uninstall"; //$NON-NLS-1$ - - /** * Returns the ids of the phases to be performed by this phase set. The order * of the returned ids indicates the order in which the phases will be run. * @return The phase ids. diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SizingPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/SizingPhaseSet.java index 1b433695b..99a5a7132 100644 --- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SizingPhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/SizingPhaseSet.java @@ -11,22 +11,25 @@ /** * */ -package org.eclipse.equinox.internal.p2.operations; +package org.eclipse.equinox.p2.engine; import org.eclipse.equinox.internal.p2.engine.Phase; import org.eclipse.equinox.internal.p2.engine.PhaseSet; import org.eclipse.equinox.internal.p2.engine.phases.Sizing; - public class SizingPhaseSet extends PhaseSet { private static Sizing sizing; public SizingPhaseSet() { - super(new Phase[] {sizing = new Sizing(100, Messages.SizingPhaseSet_PhaseSetName)}); + super(new Phase[] {sizing = new Sizing(100)}); + } + + public long getDiskSize() { + return sizing.getDiskSize(); } - public Sizing getSizing() { - return sizing; + public long getDownloadSize() { + return sizing.getDownloadSize(); } } diff --git a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF index 3dd60d0f4..0e4ba20ad 100644 --- a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF @@ -7,8 +7,6 @@ Bundle-Localization: plugin Bundle-Version: 2.0.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.operations.Activator Import-Package: org.eclipse.equinox.internal.p2.core.helpers, - org.eclipse.equinox.internal.p2.engine, - org.eclipse.equinox.internal.p2.engine.phases, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.repository.helpers, org.eclipse.equinox.internal.provisional.configurator, diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/DownloadPhaseSet.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/DownloadPhaseSet.java deleted file mode 100644 index bd0f4a5d1..000000000 --- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/DownloadPhaseSet.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.equinox.internal.p2.operations; - -import org.eclipse.equinox.internal.p2.engine.Phase; -import org.eclipse.equinox.internal.p2.engine.PhaseSet; -import org.eclipse.equinox.internal.p2.engine.phases.Collect; - - -public class DownloadPhaseSet extends PhaseSet { - public DownloadPhaseSet() { - super(new Phase[] {new Collect(10)}); - } -} diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java index 4dcc0b184..3bffccf05 100644 --- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java +++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/ProvisioningSession.java @@ -18,7 +18,6 @@ import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.*; import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; -import org.eclipse.equinox.internal.p2.engine.PhaseSet; import org.eclipse.equinox.internal.p2.operations.*; import org.eclipse.equinox.internal.provisional.configurator.Configurator; import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; @@ -169,17 +168,17 @@ public class ProvisioningSession { long installPlanSize = 0; SubMonitor mon = SubMonitor.convert(monitor, 300); if (plan.getInstallerPlan() != null) { - SizingPhaseSet set = new SizingPhaseSet(); - IStatus status = getEngine().perform(plan.getInstallerPlan(), set, mon.newChild(100)); + SizingPhaseSet sizingPhaseSet = new SizingPhaseSet(); + IStatus status = getEngine().perform(plan.getInstallerPlan(), sizingPhaseSet, mon.newChild(100)); if (status.isOK()) - installPlanSize = set.getSizing().getDiskSize(); + installPlanSize = sizingPhaseSet.getDiskSize(); } else { mon.worked(100); } - SizingPhaseSet set = new SizingPhaseSet(); - IStatus status = getEngine().perform(plan, set, mon.newChild(200)); + SizingPhaseSet sizingPhaseSet = new SizingPhaseSet(); + IStatus status = getEngine().perform(plan, sizingPhaseSet, mon.newChild(200)); if (status.isOK()) - return installPlanSize + set.getSizing().getDiskSize(); + return installPlanSize + sizingPhaseSet.getDiskSize(); return SIZE_UNAVAILABLE; } @@ -221,7 +220,7 @@ public class ProvisioningSession { downloadRequest.setAbsoluteMode(true); downloadRequest.addAll(new CompoundQueryable<IInstallableUnit>(plan.getAdditions(), plan.getInstallerPlan().getAdditions()).query(InstallableUnitQuery.ANY, null).unmodifiableSet()); - PhaseSet download = new DownloadPhaseSet(); + IPhaseSet download = DefaultPhaseSet.createIncluding(new String[] {DefaultPhaseSet.PHASE_COLLECT}); IProvisioningPlan downloadPlan = getPlanner().getProvisioningPlan(downloadRequest, context, mon.newChild(100)); IStatus downloadStatus = getEngine().perform(downloadPlan, download, mon.newChild(300)); if (!downloadStatus.isOK()) { 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 d5c9ee1bb..5cf44a773 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 @@ -456,13 +456,13 @@ public class ProfileSynchronizer { ProfileChangeRequest addPropertyRequest = new ProfileChangeRequest(profile); addPropertyRequest.setProfileProperty(key, value); IProvisioningPlan plan = planner.getProvisioningPlan(addPropertyRequest, provisioningContext, monitor); - IPhaseSet phaseSet = engine.createPhaseSetExcluding(new String[] {IPhaseSet.PHASE_COLLECT, IPhaseSet.PHASE_CHECK_TRUST}); + IPhaseSet phaseSet = DefaultPhaseSet.createExcluding(new String[] {DefaultPhaseSet.PHASE_COLLECT, DefaultPhaseSet.PHASE_CHECK_TRUST}); return engine.perform(plan, phaseSet, monitor); } private IStatus executePlan(IProvisioningPlan plan, ProvisioningContext provisioningContext, IProgressMonitor monitor) { IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME); - IPhaseSet phaseSet = engine.createPhaseSetExcluding(new String[] {IPhaseSet.PHASE_COLLECT, IPhaseSet.PHASE_CHECK_TRUST}); + IPhaseSet phaseSet = DefaultPhaseSet.createExcluding(new String[] {DefaultPhaseSet.PHASE_COLLECT, DefaultPhaseSet.PHASE_CHECK_TRUST}); if (plan.getInstallerPlan() != null) { IStatus installerPlanStatus = engine.perform(plan.getInstallerPlan(), phaseSet, monitor); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java index 1433988a1..aac4bca55 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/ArtifactRepositoryMissingSizeData.java @@ -58,7 +58,7 @@ public class ArtifactRepositoryMissingSizeData extends AbstractProvisioningTest IProvisioningPlan plan = createPlanner().getProvisioningPlan(req, null, null); assertEquals(IStatus.OK, plan.getStatus().getSeverity()); - Sizing sizing = new Sizing(100, ""); + Sizing sizing = new Sizing(100); PhaseSet set = new SPhaseSet(sizing); IStatus status = engine.perform(plan, set, new NullProgressMonitor()); @@ -76,7 +76,7 @@ public class ArtifactRepositoryMissingSizeData extends AbstractProvisioningTest IProvisioningPlan plan = createPlanner().getProvisioningPlan(req, null, null); assertEquals(IStatus.OK, plan.getStatus().getSeverity()); - Sizing sizing = new Sizing(100, ""); + Sizing sizing = new Sizing(100); PhaseSet set = new SPhaseSet(sizing); IStatus status = engine.perform(plan, set, new NullProgressMonitor()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java index e30acf8a3..980065ba7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/EngineTest.java @@ -10,13 +10,10 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.engine; -import org.eclipse.equinox.internal.p2.engine.Operand; - import java.io.File; import java.util.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.Phase; -import org.eclipse.equinox.internal.p2.engine.PhaseSet; +import org.eclipse.equinox.internal.p2.engine.*; import org.eclipse.equinox.internal.p2.engine.phases.*; import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory; import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription; @@ -203,23 +200,23 @@ public class EngineTest extends AbstractProvisioningTest { */ public void testCreatePhaseSetExcluding() { //null argument - IPhaseSet set = engine.createPhaseSetExcluding(null); + IPhaseSet set = DefaultPhaseSet.createExcluding(null); assertEquals("1.0", 7, set.getPhaseIds().length); //empty argument - set = engine.createPhaseSetExcluding(new String[0]); + set = DefaultPhaseSet.createExcluding(new String[0]); assertEquals("2.0", 7, set.getPhaseIds().length); //bogus argument - set = engine.createPhaseSetExcluding(new String[] {"blort"}); + set = DefaultPhaseSet.createExcluding(new String[] {"blort"}); assertEquals("3.0", 7, set.getPhaseIds().length); //valid argument - set = engine.createPhaseSetExcluding(new String[] {IPhaseSet.PHASE_CHECK_TRUST}); + set = DefaultPhaseSet.createExcluding(new String[] {DefaultPhaseSet.PHASE_CHECK_TRUST}); final String[] phases = set.getPhaseIds(); assertEquals("4.0", 6, phases.length); for (int i = 0; i < phases.length; i++) - if (phases[i].equals(IPhaseSet.PHASE_CHECK_TRUST)) + if (phases[i].equals(DefaultPhaseSet.PHASE_CHECK_TRUST)) fail("4.1." + i); } @@ -229,33 +226,31 @@ public class EngineTest extends AbstractProvisioningTest { */ public void testCreatePhaseSetIncluding() { //null argument - try { - engine.createPhaseSetIncluding(null); - fail("1.0"); - } catch (RuntimeException e) { - //expected - } + IPhaseSet set = DefaultPhaseSet.createIncluding(null); + assertNotNull("1.0", set); + assertEquals("1.1", 0, set.getPhaseIds().length); + //expected //empty argument - IPhaseSet set = engine.createPhaseSetIncluding(new String[0]); + set = DefaultPhaseSet.createIncluding(new String[0]); assertNotNull("2.0", set); assertEquals("2.1", 0, set.getPhaseIds().length); //unknown argument - set = engine.createPhaseSetIncluding(new String[] {"blort", "not a phase", "bad input"}); + set = DefaultPhaseSet.createIncluding(new String[] {"blort", "not a phase", "bad input"}); assertNotNull("3.0", set); assertEquals("3.1", 0, set.getPhaseIds().length); //one valid phase - set = engine.createPhaseSetIncluding(new String[] {IPhaseSet.PHASE_COLLECT}); + set = DefaultPhaseSet.createIncluding(new String[] {DefaultPhaseSet.PHASE_COLLECT}); assertNotNull("4.0", set); assertEquals("4.1", 1, set.getPhaseIds().length); - assertEquals("4.2", IPhaseSet.PHASE_COLLECT, set.getPhaseIds()[0]); + assertEquals("4.2", DefaultPhaseSet.PHASE_COLLECT, set.getPhaseIds()[0]); //one valid phase and one bogus - set = engine.createPhaseSetIncluding(new String[] {IPhaseSet.PHASE_COLLECT, "bogus"}); + set = DefaultPhaseSet.createIncluding(new String[] {DefaultPhaseSet.PHASE_COLLECT, "bogus"}); assertNotNull("4.0", set); assertEquals("4.1", 1, set.getPhaseIds().length); - assertEquals("4.2", IPhaseSet.PHASE_COLLECT, set.getPhaseIds()[0]); + assertEquals("4.2", DefaultPhaseSet.PHASE_COLLECT, set.getPhaseIds()[0]); } @@ -328,7 +323,7 @@ public class EngineTest extends AbstractProvisioningTest { plan.removeInstallableUnit(doomed); engine.perform(plan, new NullProgressMonitor()); } - final Sizing sizingPhase = new Sizing(100, "sizing"); + final Sizing sizingPhase = new Sizing(100); PhaseSet phaseSet = new PhaseSet(new Phase[] {sizingPhase}); IProvisioningPlan plan = engine.createPlan(profile, null); @@ -336,7 +331,7 @@ public class EngineTest extends AbstractProvisioningTest { IStatus result = engine.perform(plan, phaseSet, new NullProgressMonitor()); assertTrue(result.isOK()); assertTrue(sizingPhase.getDiskSize() == 0); - assertTrue(sizingPhase.getDlSize() == 0); + assertTrue(sizingPhase.getDownloadSize() == 0); } // removing validate from engine api diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java index 1c7c171d3..407e7afc6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseApplicabilityTest.java @@ -11,7 +11,6 @@ package org.eclipse.equinox.p2.tests.engine; import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import org.eclipse.equinox.internal.p2.engine.phases.*; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.Version; @@ -51,7 +50,7 @@ public class PhaseApplicabilityTest extends AbstractProvisioningTest { IInstallableUnit iuXv1 = createIU("iuX", Version.create("1.0.0")); IInstallableUnit iuXv2 = createIU("iuX", Version.create("2.0.0")); - Sizing sizingPhase = new Sizing(1, "collect") { + Sizing sizingPhase = new Sizing(1) { protected boolean isApplicable(InstallableUnitOperand op) { return super.isApplicable(op); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java index c718ec4c9..6ff9d9562 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/engine/PhaseSetTest.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.engine; -import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.p2.engine.*; @@ -42,8 +40,8 @@ public class PhaseSetTest extends AbstractProvisioningTest { } public void testNoTrustCheck() { - PhaseSet set1 = new DefaultPhaseSet(); - PhaseSet set2 = DefaultPhaseSet.createDefaultPhaseSet(DefaultPhaseSet.PHASE_CHECK_TRUST); + IPhaseSet set1 = new DefaultPhaseSet(); + IPhaseSet set2 = DefaultPhaseSet.createExcluding(new String[] {DefaultPhaseSet.PHASE_CHECK_TRUST}); assertTrue("1.0", !set1.equals(set2)); } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java index b86ff5dd2..03d624dc8 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/AddRepositoryAction.java @@ -12,10 +12,10 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions; import java.util.Map; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.Profile; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.IAgentLocation; import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProfileRegistry; /** @@ -30,7 +30,7 @@ public class AddRepositoryAction extends RepositoryAction { IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); IAgentLocation agentLocation = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME); final RepositoryEvent event = createEvent(parameters); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); if (profile != null) addRepositoryToProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryNickname(), event.getRepositoryType(), event.isRepositoryEnabled()); //if provisioning into the current profile, broadcast an event to add this repository directly to the current repository managers. @@ -52,7 +52,7 @@ public class AddRepositoryAction extends RepositoryAction { IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); IAgentLocation agentLocation = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME); final RepositoryEvent event = createEvent(parameters); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); if (profile != null) removeRepositoryFromProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryType()); //if provisioning into the current profile, broadcast an event to add this repository directly to the current repository managers. diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java index e15474e47..0d63482a9 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RemoveRepositoryAction.java @@ -12,10 +12,10 @@ package org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions; import java.util.Map; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.Profile; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.IAgentLocation; import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.IProfileRegistry; /** @@ -30,7 +30,7 @@ public class RemoveRepositoryAction extends RepositoryAction { IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); IAgentLocation agentLocation = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME); RepositoryEvent event = createEvent(parameters); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); if (profile != null) removeRepositoryFromProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryType()); //if we are provisioning into the self profile, update the current set of repositories in this configuration @@ -48,7 +48,7 @@ public class RemoveRepositoryAction extends RepositoryAction { IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); IAgentLocation agentLocation = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME); RepositoryEvent event = createEvent(parameters); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); if (profile != null) addRepositoryToProfile(agentLocation, profile, event.getRepositoryLocation(), event.getRepositoryNickname(), event.getRepositoryType(), event.isRepositoryEnabled()); //if we are provisioning into the self profile, update the current set of repositories in this configuration diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java index 35379ca37..2ded7cfa3 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/RepositoryAction.java @@ -14,7 +14,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Map; import org.eclipse.core.runtime.CoreException; -import org.eclipse.equinox.internal.p2.engine.Profile; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util; import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent; import org.eclipse.equinox.p2.core.IAgentLocation; @@ -64,7 +63,7 @@ abstract class RepositoryAction extends ProvisioningAction { * Associates the repository described by the given event with the given profile. * Has no effect if the repository is already associated with this profile. */ - protected void addRepositoryToProfile(IAgentLocation agentLocation, Profile profile, URI location, String nickname, int type, boolean enabled) { + protected void addRepositoryToProfile(IAgentLocation agentLocation, IProfile profile, URI location, String nickname, int type, boolean enabled) { Preferences node = getRepositoryPreferenceNode(agentLocation, profile, location, type); int count = 0; @@ -150,7 +149,7 @@ abstract class RepositoryAction extends ProvisioningAction { * Return <code>true</code> if the given profile is the currently running profile, * and <code>false</code> otherwise. */ - protected boolean isSelfProfile(IProfileRegistry registry, Profile profile) { + protected boolean isSelfProfile(IProfileRegistry registry, IProfile profile) { //if we can't determine the current profile, assume we are running on self if (profile == null) return true; @@ -180,7 +179,7 @@ abstract class RepositoryAction extends ProvisioningAction { * and the given profile. Has no effect if the location is not already associated with * this profile. */ - protected void removeRepositoryFromProfile(IAgentLocation agentLocation, Profile profile, URI location, int type) { + protected void removeRepositoryFromProfile(IAgentLocation agentLocation, IProfile profile, URI location, int type) { Preferences node = getRepositoryPreferenceNode(agentLocation, profile, location, type); int count = getRepositoryCount(node); @@ -234,7 +233,7 @@ abstract class RepositoryAction extends ProvisioningAction { /* * Get the preference node associated with profile & location */ - protected Preferences getRepositoryPreferenceNode(IAgentLocation agentLocation, Profile profile, URI location, int type) { + protected Preferences getRepositoryPreferenceNode(IAgentLocation agentLocation, IProfile profile, URI location, int type) { String key = type == IRepository.TYPE_METADATA ? METADATA_REPOSITORY : ARTIFACT_REPOSITORY; String profileId = profile == null ? IProfileRegistry.SELF : profile.getProfileId(); return new ProfileScope(agentLocation, profileId).getNode(key + '/' + NODE_REPOSITORIES + '/' + getKey(location)); diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java index 6fadd2397..01220b8ea 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.eclipse/src/org/eclipse/equinox/internal/p2/touchpoint/eclipse/actions/SetLauncherNameAction.java @@ -16,6 +16,7 @@ import org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint; import org.eclipse.equinox.internal.p2.touchpoint.eclipse.Util; import org.eclipse.equinox.internal.provisional.frameworkadmin.LauncherData; import org.eclipse.equinox.internal.provisional.frameworkadmin.Manipulator; +import org.eclipse.equinox.p2.engine.IProfile; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; public class SetLauncherNameAction extends ProvisioningAction { @@ -23,7 +24,7 @@ public class SetLauncherNameAction extends ProvisioningAction { public IStatus execute(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); getMemento().put(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, profile.getProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME)); String launcherName = (String) parameters.get(ActionConstants.PARM_LAUNCHERNAME); setLauncher(manipulator, profile, launcherName); @@ -32,16 +33,16 @@ public class SetLauncherNameAction extends ProvisioningAction { public IStatus undo(Map<String, Object> parameters) { Manipulator manipulator = (Manipulator) parameters.get(EclipseTouchpoint.PARM_MANIPULATOR); - Profile profile = (Profile) parameters.get(ActionConstants.PARM_PROFILE); + IProfile profile = (IProfile) parameters.get(ActionConstants.PARM_PROFILE); String previousLauncherName = (String) getMemento().get(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME); setLauncher(manipulator, profile, previousLauncherName); return Status.OK_STATUS; } - private static void setLauncher(Manipulator manipulator, Profile profile, String launcherName) { + private static void setLauncher(Manipulator manipulator, IProfile profile, String launcherName) { //Get the launcherData before changing the name so we don't lose anything from the old launcher.ini LauncherData launcherData = manipulator.getLauncherData(); - profile.setProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, launcherName); + ((Profile) profile).setProperty(EclipseTouchpoint.PROFILE_PROP_LAUNCHER_NAME, launcherName); launcherData.setLauncher(Util.getLauncherPath(profile)); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java index 0ab4608d8..6633c28d1 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/AutomaticUpdater.java @@ -113,7 +113,7 @@ public class AutomaticUpdater implements IUpdateListener { if (download) { ProfileModificationJob job = new ProfileModificationJob(AutomaticUpdateMessages.AutomaticUpdater_AutomaticDownloadOperationName, getSession(), event.getProfileId(), operation.getProvisioningPlan(), new ProvisioningContext()); - job.setPhaseSet(new DownloadPhaseSet()); + job.setPhaseSet(DefaultPhaseSet.createIncluding(new String[] {DefaultPhaseSet.PHASE_COLLECT})); job.setUser(false); job.setSystem(true); job.addJobChangeListener(new JobChangeAdapter() { diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/DownloadPhaseSet.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/DownloadPhaseSet.java deleted file mode 100644 index 07f1b911a..000000000 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/DownloadPhaseSet.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -/** - * - */ -package org.eclipse.equinox.internal.p2.ui.sdk.scheduler; - -import org.eclipse.equinox.internal.p2.engine.Phase; -import org.eclipse.equinox.internal.p2.engine.PhaseSet; -import org.eclipse.equinox.internal.p2.engine.phases.Collect; - - -public class DownloadPhaseSet extends PhaseSet { - public DownloadPhaseSet() { - super(new Phase[] {new Collect(10)}); - } -} |