From 208ee4e7803846181a547d886d90c5329080bf41 Mon Sep 17 00:00:00 2001 From: Simon Kaegi Date: Mon, 7 Dec 2009 18:56:02 +0000 Subject: Bug 293344 [api][engine] review of the engine package Moving phases to an internal package --- .../META-INF/MANIFEST.MF | 11 +- .../internal/p2/engine/phases/CheckTrust.java | 83 +++++++++++ .../equinox/internal/p2/engine/phases/Collect.java | 87 +++++++++++ .../internal/p2/engine/phases/Configure.java | 56 ++++++++ .../equinox/internal/p2/engine/phases/Install.java | 128 +++++++++++++++++ .../internal/p2/engine/phases/Messages.java | 37 +++++ .../internal/p2/engine/phases/Property.java | 160 +++++++++++++++++++++ .../equinox/internal/p2/engine/phases/Sizing.java | 138 ++++++++++++++++++ .../internal/p2/engine/phases/Unconfigure.java | 61 ++++++++ .../internal/p2/engine/phases/Uninstall.java | 125 ++++++++++++++++ .../internal/p2/engine/phases/messages.properties | 20 +++ .../provisional/p2/engine/DefaultPhaseSet.java | 3 +- .../internal/provisional/p2/engine/PhaseSet.java | 3 +- .../provisional/p2/engine/phases/CheckTrust.java | 83 ----------- .../provisional/p2/engine/phases/Collect.java | 87 ----------- .../provisional/p2/engine/phases/Configure.java | 56 -------- .../provisional/p2/engine/phases/Install.java | 128 ----------------- .../provisional/p2/engine/phases/Messages.java | 37 ----- .../provisional/p2/engine/phases/Property.java | 160 --------------------- .../provisional/p2/engine/phases/Sizing.java | 138 ------------------ .../provisional/p2/engine/phases/Unconfigure.java | 61 -------- .../provisional/p2/engine/phases/Uninstall.java | 125 ---------------- .../p2/engine/phases/messages.properties | 20 --- .../META-INF/MANIFEST.MF | 2 +- .../internal/p2/operations/DownloadPhaseSet.java | 3 +- .../internal/p2/operations/SizingPhaseSet.java | 3 +- .../META-INF/MANIFEST.MF | 2 +- .../internal/repository/tools/Repo2Runnable.java | 3 +- .../ArtifactRepositoryMissingSizeData.java | 3 +- .../equinox/p2/tests/engine/EngineTest.java | 3 +- .../p2/tests/engine/PhaseApplicabilityTest.java | 3 +- .../touchpoint/eclipse/CheckTrustActionTest.java | 3 +- .../touchpoint/eclipse/CollectActionTest.java | 3 +- .../touchpoint/natives/CollectActionTest.java | 3 +- .../META-INF/MANIFEST.MF | 2 +- .../p2/ui/sdk/scheduler/DownloadPhaseSet.java | 3 +- .../org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF | 1 - 37 files changed, 927 insertions(+), 917 deletions(-) create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Messages.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java create mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/messages.properties delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/CheckTrust.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Collect.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Configure.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Install.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Messages.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Property.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Unconfigure.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Uninstall.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/messages.properties 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 559fa6986..c9e57c4a8 100644 --- a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF @@ -6,6 +6,11 @@ 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,org.eclipse.equinox.p2.touchpoint.natives", + org.eclipse.equinox.internal.p2.engine.phases; + x-friends:="org.eclipse.equinox.p2.operations, + org.eclipse.equinox.p2.ui.sdk.scheduler, + org.eclipse.equinox.p2.repository.tools, + org.eclipse.equinox.p2.director.app", org.eclipse.equinox.internal.provisional.p2.engine; x-friends:="org.eclipse.equinox.p2.common, org.eclipse.equinox.p2.console, @@ -26,12 +31,6 @@ Export-Package: org.eclipse.equinox.internal.p2.engine;x-friends:="org.eclipse.e org.eclipse.pde.ui, org.eclipse.equinox.p2.repository.tools, org.eclipse.pde.core", - org.eclipse.equinox.internal.provisional.p2.engine.phases; - x-friends:="org.eclipse.equinox.p2.ui, - org.eclipse.equinox.p2.operations, - org.eclipse.equinox.p2.ui.sdk.scheduler, - org.eclipse.equinox.p2.repository.tools, - org.eclipse.equinox.p2.director.app", org.eclipse.equinox.p2.engine, org.eclipse.equinox.p2.engine.query, org.eclipse.equinox.p2.engine.spi 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 new file mode 100644 index 000000000..99340c783 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import java.util.*; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; + +/** + * An install phase that checks if the certificates used to sign the artifacts + * being installed are from a trusted source. + */ +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); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.second() != null); + } + + protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { + Collection artifactRequests = (Collection) parameters.get(PARM_ARTIFACT_FILES); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + + // Instantiate a check trust manager + CertificateChecker certificateChecker = new CertificateChecker(agent); + certificateChecker.add(artifactRequests.toArray()); + IStatus status = certificateChecker.start(); + + return status; + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand operand) { + IInstallableUnit unit = operand.second(); + ProvisioningAction[] parsedActions = getActions(unit, phaseId); + if (parsedActions != null) + return parsedActions; + + ITouchpointType type = unit.getTouchpointType(); + if (type == null || type == ITouchpointType.NONE) + return null; + + String actionId = getActionManager().getTouchpointQualifiedActionId(phaseId, type); + ProvisioningAction action = getActionManager().getAction(actionId, null); + if (action == null) { + return null; + } + return new ProvisioningAction[] {action}; + } + + protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { + IInstallableUnit iu = operand.second(); + parameters.put(PARM_IU, iu); + + return super.initializeOperand(profile, operand, parameters, monitor); + } + + protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { + parameters.put(PARM_ARTIFACT_FILES, new ArrayList()); + return super.initializePhase(monitor, profile, parameters); + } + +} 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 new file mode 100644 index 000000000..988e9251f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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 + * WindRiver - https://bugs.eclipse.org/bugs/show_bug.cgi?id=227372 + *******************************************************************************/ +package org.eclipse.equinox.internal.p2.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import java.util.*; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.engine.DownloadManager; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; +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 Collect(int weight) { + super(PHASE_ID, weight); + //re-balance work since postPerform will do almost all the time-consuming work + prePerformWork = 0; + mainPerformWork = 100; + postPerformWork = 1000; + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.second() != null && !op.second().equals(op.first())); + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand operand) { + IInstallableUnit unit = operand.second(); + ProvisioningAction[] parsedActions = getActions(unit, phaseId); + if (parsedActions != null) + return parsedActions; + + ITouchpointType type = unit.getTouchpointType(); + if (type == null || type == ITouchpointType.NONE) + return null; + + String actionId = getActionManager().getTouchpointQualifiedActionId(phaseId, type); + ProvisioningAction action = getActionManager().getAction(actionId, null); + if (action == null) { + return null; + } + return new ProvisioningAction[] {action}; + } + + protected String getProblemMessage() { + return Messages.Phase_Collect_Error; + } + + protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { + List artifactRequests = (List) parameters.get(PARM_ARTIFACT_REQUESTS); + ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + IArtifactRepositoryManager repositoryManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); + + DownloadManager dm = new DownloadManager(context, repositoryManager); + for (Iterator it = artifactRequests.iterator(); it.hasNext();) { + IArtifactRequest[] requests = (IArtifactRequest[]) it.next(); + dm.add(requests); + } + return dm.start(monitor); + } + + protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { + parameters.put(PARM_ARTIFACT_REQUESTS, new ArrayList()); + return null; + } +} 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 new file mode 100644 index 000000000..003038535 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import org.eclipse.equinox.p2.metadata.IArtifactKey; + +import java.util.Map; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; +import org.eclipse.osgi.util.NLS; + +public class Configure extends InstallableUnitPhase { + + public Configure(int weight) { + super(IPhaseSet.PHASE_CONFIGURE, weight); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.second() != null); + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { + IInstallableUnit unit = currentOperand.second(); + if (unit.isFragment()) + return null; + return getActions(unit, phaseId); + } + + protected String getProblemMessage() { + return Messages.Phase_Configure_Error; + } + + protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { + IInstallableUnit iu = operand.second(); + monitor.subTask(NLS.bind(Messages.Phase_Configure_Task, iu.getId())); + parameters.put(PARM_IU, iu); + + IArtifactKey[] artifacts = iu.getArtifacts(); + if (artifacts != null && artifacts.length > 0) + parameters.put(PARM_ARTIFACT, artifacts[0]); + + return Status.OK_STATUS; + } +} 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 new file mode 100644 index 000000000..ad37fff90 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java @@ -0,0 +1,128 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import org.eclipse.equinox.p2.metadata.IArtifactKey; + +import java.util.Map; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.engine.Profile; +import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; +import org.eclipse.equinox.p2.engine.spi.Touchpoint; +import org.eclipse.osgi.util.NLS; + +public class Install extends InstallableUnitPhase { + + final static class BeforeInstallEventAction extends ProvisioningAction { + + public IStatus execute(Map parameters) { + IProfile profile = (IProfile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); + return null; + } + + public IStatus undo(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); + profile.removeInstallableUnit(iu); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); + return null; + } + } + + final static class AfterInstallEventAction extends ProvisioningAction { + + public IStatus execute(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); + profile.addInstallableUnit(iu); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); + return null; + } + + public IStatus undo(Map parameters) { + IProfile profile = (IProfile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); + return null; + } + } + + private static final String PHASE_ID = IPhaseSet.PHASE_INSTALL; + + public Install(int weight) { + super(PHASE_ID, weight); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.second() != null && !op.second().equals(op.first())); + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { + //TODO: monitor.subTask(NLS.bind(Messages.Engine_Installing_IU, unit.getId())); + + ProvisioningAction beforeAction = new BeforeInstallEventAction(); + ProvisioningAction afterAction = new AfterInstallEventAction(); + + IInstallableUnit unit = currentOperand.second(); + Touchpoint touchpoint = getActionManager().getTouchpointPoint(unit.getTouchpointType()); + if (touchpoint != null) { + beforeAction.setTouchpoint(touchpoint); + afterAction.setTouchpoint(touchpoint); + } + + if (unit.isFragment()) + return new ProvisioningAction[] {beforeAction, afterAction}; + + ProvisioningAction[] parsedActions = getActions(unit, phaseId); + if (parsedActions == null) + return new ProvisioningAction[] {beforeAction, afterAction}; + + ProvisioningAction[] actions = new ProvisioningAction[parsedActions.length + 2]; + actions[0] = beforeAction; + System.arraycopy(parsedActions, 0, actions, 1, parsedActions.length); + actions[actions.length - 1] = afterAction; + return actions; + } + + protected String getProblemMessage() { + return Messages.Phase_Install_Error; + } + + protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { + IInstallableUnit iu = operand.second(); + monitor.subTask(NLS.bind(Messages.Phase_Install_Task, iu.getId())); + parameters.put(PARM_IU, iu); + + IArtifactKey[] artifacts = iu.getArtifacts(); + if (artifacts != null && artifacts.length > 0) + parameters.put(PARM_ARTIFACT, artifacts[0]); + + return Status.OK_STATUS; + } +} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Messages.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Messages.java new file mode 100644 index 000000000..5892e1836 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Messages.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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.engine.phases; + +import org.eclipse.osgi.util.NLS; + +//TODO Shouldn't have messages class in API package +class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.provisional.p2.engine.phases.messages"; //$NON-NLS-1$ + public static String Phase_Collect_Error; + public static String Phase_Install_Error; + public static String Phase_Configure_Error; + public static String Phase_Configure_Task; + public static String Phase_Install_Task; + public static String Phase_Sizing_Error; + public static String Phase_Sizing_Warning; + public static String Phase_Unconfigure_Error; + public static String Phase_Uninstall_Error; + + static { + // initialize resource bundles + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + // Do not instantiate + } + +} 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 new file mode 100644 index 000000000..49eff51c7 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2008, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import java.util.Map; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.engine.Profile; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; + +public class Property extends Phase { + + public class ProfilePropertyAction extends ProvisioningAction { + + public IStatus execute(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND); + + if (propertyOperand.second() == null) + removeProfileProperty(profile, propertyOperand); + else + setProfileProperty(profile, propertyOperand, false); + + return null; + } + + public IStatus undo(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND); + + if (propertyOperand.first() == null) + removeProfileProperty(profile, propertyOperand); + else + setProfileProperty(profile, propertyOperand, true); + + return null; + } + + private void setProfileProperty(Profile profile, PropertyOperand propertyOperand, boolean undo) { + + String value = (String) (undo ? propertyOperand.first() : propertyOperand.second()); + + if (propertyOperand instanceof InstallableUnitPropertyOperand) { + InstallableUnitPropertyOperand iuPropertyOperand = (InstallableUnitPropertyOperand) propertyOperand; + profile.setInstallableUnitProperty(iuPropertyOperand.getInstallableUnit(), iuPropertyOperand.getKey(), value); + } else { + profile.setProperty(propertyOperand.getKey(), value); + } + } + + private void removeProfileProperty(Profile profile, PropertyOperand propertyOperand) { + if (propertyOperand instanceof InstallableUnitPropertyOperand) { + InstallableUnitPropertyOperand iuPropertyOperand = (InstallableUnitPropertyOperand) propertyOperand; + profile.removeInstallableUnitProperty(iuPropertyOperand.getInstallableUnit(), iuPropertyOperand.getKey()); + } else { + profile.removeProperty(propertyOperand.getKey()); + } + } + } + + public class UpdateInstallableUnitProfilePropertiesAction extends ProvisioningAction { + + // we do not need to use a memento here since the profile is not persisted unless the operation is successful + Map originalSourceProperties; + Map originalTargetProperties; + + public IStatus execute(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + + IInstallableUnit source = iuOperand.first(); + originalSourceProperties = profile.getInstallableUnitProperties(source); + + IInstallableUnit target = iuOperand.second(); + originalTargetProperties = profile.getInstallableUnitProperties(target); + + profile.addInstallableUnitProperties(target, originalSourceProperties); + profile.clearInstallableUnitProperties(source); + + return null; + } + + public IStatus undo(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + + IInstallableUnit source = iuOperand.first(); + profile.clearInstallableUnitProperties(source); + profile.addInstallableUnitProperties(source, originalSourceProperties); + + IInstallableUnit target = iuOperand.second(); + profile.clearInstallableUnitProperties(target); + profile.addInstallableUnitProperties(target, originalTargetProperties); + + return null; + } + } + + public class RemoveInstallableUnitProfilePropertiesAction extends ProvisioningAction { + + // we do not need to use a memento here since the profile is not persisted unless the operation is successful + Map originalSourceProperties; + Map originalTargetProperties; + + public IStatus execute(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + + IInstallableUnit source = iuOperand.first(); + originalSourceProperties = profile.getInstallableUnitProperties(source); + profile.clearInstallableUnitProperties(source); + + return null; + } + + public IStatus undo(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + + IInstallableUnit source = iuOperand.first(); + profile.clearInstallableUnitProperties(source); + profile.addInstallableUnitProperties(source, originalSourceProperties); + + return null; + } + } + + private static final String PHASE_ID = IPhaseSet.PHASE_PROPERTY; + + public Property(int weight) { + super(PHASE_ID, weight); + } + + protected ProvisioningAction[] getActions(Operand operand) { + if (operand instanceof PropertyOperand) + return new ProvisioningAction[] {new ProfilePropertyAction()}; + + if (operand instanceof InstallableUnitOperand) { + InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; + if (iuOperand.first() != null) { + if (iuOperand.second() != null) { + return new ProvisioningAction[] {new UpdateInstallableUnitProfilePropertiesAction()}; + } + return new ProvisioningAction[] {new RemoveInstallableUnitProfilePropertiesAction()}; + } + } + return null; + } +} 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 new file mode 100644 index 000000000..c2e07377d --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java @@ -0,0 +1,138 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import java.net.URI; +import java.util.*; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.engine.EngineActivator; +import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; +import org.eclipse.equinox.p2.repository.IRepositoryManager; +import org.eclipse.equinox.p2.repository.artifact.*; + +public class Sizing extends InstallableUnitPhase { + private static final String PHASE_ID = "sizing"; //$NON-NLS-1$ + private static final String COLLECT_PHASE_ID = "collect"; //$NON-NLS-1$ + + private long sizeOnDisk; + private long dlSize; + + public Sizing(int weight, String phaseName) { + super(PHASE_ID, weight); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.second() != null && !op.second().equals(op.first())); + } + + public long getDiskSize() { + return sizeOnDisk; + } + + public long getDlSize() { + return dlSize; + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand operand) { + IInstallableUnit unit = operand.second(); + ProvisioningAction[] parsedActions = getActions(unit, COLLECT_PHASE_ID); + if (parsedActions != null) + return parsedActions; + + ITouchpointType type = unit.getTouchpointType(); + if (type == null || type == ITouchpointType.NONE) + return null; + + String actionId = getActionManager().getTouchpointQualifiedActionId(COLLECT_PHASE_ID, type); + ProvisioningAction action = getActionManager().getAction(actionId, null); + if (action == null) { + return null; + } + return new ProvisioningAction[] {action}; + } + + protected String getProblemMessage() { + return Messages.Phase_Sizing_Error; + } + + protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { + List artifactRequests = (List) parameters.get(Collect.PARM_ARTIFACT_REQUESTS); + ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + int statusCode = 0; + + Set artifactsToObtain = new HashSet(artifactRequests.size()); + + for (Iterator it = artifactRequests.iterator(); it.hasNext();) { + IArtifactRequest[] requests = (IArtifactRequest[]) it.next(); + if (requests == null) + continue; + for (int i = 0; i < requests.length; i++) { + artifactsToObtain.add(requests[i]); + } + } + + if (monitor.isCanceled()) + return Status.CANCEL_STATUS; + + IArtifactRepositoryManager repoMgr = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); + URI[] repositories = null; + if (context == null || context.getArtifactRepositories() == null) + repositories = repoMgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL); + else + repositories = context.getArtifactRepositories(); + + for (Iterator iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) { + IArtifactRequest artifactRequest = (IArtifactRequest) iterator.next(); + boolean found = false; + for (int i = 0; i < repositories.length; i++) { + IArtifactRepository repo; + try { + repo = repoMgr.loadRepository(repositories[i], monitor); + } catch (ProvisionException e) { + continue;//skip unresponsive repositories + } + if (monitor.isCanceled()) + return Status.CANCEL_STATUS; + IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(artifactRequest.getArtifactKey()); + if (descriptors.length > 0) { + if (descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE) != null) + sizeOnDisk += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE)); + else + statusCode = ProvisionException.ARTIFACT_INCOMPLETE_SIZING; + if (descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE) != null) + dlSize += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE)); + else + statusCode = ProvisionException.ARTIFACT_INCOMPLETE_SIZING; + found = true; + break; + } + } + if (!found) + // The artifact wasn't present in any repository + return new Status(IStatus.ERROR, EngineActivator.ID, ProvisionException.ARTIFACT_NOT_FOUND, Messages.Phase_Sizing_Error, null); + } + if (statusCode != 0) + return new Status(IStatus.WARNING, EngineActivator.ID, statusCode, Messages.Phase_Sizing_Warning, null); + return null; + } + + protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { + parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList()); + return null; + } +} 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 new file mode 100644 index 000000000..c4e5ee4a6 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import org.eclipse.equinox.p2.metadata.IArtifactKey; + +import java.util.Map; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; + +public class Unconfigure extends InstallableUnitPhase { + + public Unconfigure(int weight, boolean forced) { + super(IPhaseSet.PHASE_UNCONFIGURE, weight, forced); + } + + public Unconfigure(int weight) { + this(weight, false); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.first() != null); + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { + //TODO: monitor.subTask(NLS.bind(Messages.Engine_Unconfiguring_IU, unit.getId())); + + IInstallableUnit unit = currentOperand.first(); + if (unit.isFragment()) + return null; + + return getActions(unit, phaseId); + } + + protected String getProblemMessage() { + return Messages.Phase_Unconfigure_Error; + } + + protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { + IInstallableUnit iu = operand.first(); + parameters.put(PARM_IU, iu); + + IArtifactKey[] artifacts = iu.getArtifacts(); + if (artifacts != null && artifacts.length > 0) + parameters.put(PARM_ARTIFACT, artifacts[0]); + + return Status.OK_STATUS; + } +} 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 new file mode 100644 index 000000000..f998ace86 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2007, 2009 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.engine.phases; + +import org.eclipse.equinox.p2.metadata.IInstallableUnit; + +import org.eclipse.equinox.p2.metadata.IArtifactKey; + +import java.util.Map; +import org.eclipse.core.runtime.*; +import org.eclipse.equinox.internal.p2.engine.Profile; +import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; +import org.eclipse.equinox.internal.provisional.p2.engine.*; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IPhaseSet; +import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; +import org.eclipse.equinox.p2.engine.spi.Touchpoint; + +public class Uninstall extends InstallableUnitPhase { + + final static class BeforeUninstallEventAction extends ProvisioningAction { + public IStatus execute(Map parameters) { + IProfile profile = (IProfile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); + return null; + } + + public IStatus undo(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); + profile.addInstallableUnit(iu); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); + return null; + } + } + + final static class AfterUninstallEventAction extends ProvisioningAction { + public IStatus execute(Map parameters) { + Profile profile = (Profile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); + profile.removeInstallableUnit(iu); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); + return null; + } + + public IStatus undo(Map parameters) { + IProfile profile = (IProfile) parameters.get(PARM_PROFILE); + String phaseId = (String) parameters.get(PARM_PHASE_ID); + InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); + IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); + ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); + return null; + } + } + + public Uninstall(int weight, boolean forced) { + super(IPhaseSet.PHASE_UNINSTALL, weight, forced); + } + + public Uninstall(int weight) { + this(weight, false); + } + + protected boolean isApplicable(InstallableUnitOperand op) { + return (op.first() != null && !op.first().equals(op.second())); + } + + protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { + //TODO: monitor.subTask(NLS.bind(Messages.Engine_Uninstalling_IU, unit.getId())); + + ProvisioningAction beforeAction = new BeforeUninstallEventAction(); + ProvisioningAction afterAction = new AfterUninstallEventAction(); + + IInstallableUnit unit = currentOperand.first(); + Touchpoint touchpoint = getActionManager().getTouchpointPoint(unit.getTouchpointType()); + if (touchpoint != null) { + beforeAction.setTouchpoint(touchpoint); + afterAction.setTouchpoint(touchpoint); + } + + if (unit.isFragment()) + return new ProvisioningAction[] {beforeAction, afterAction}; + ProvisioningAction[] parsedActions = getActions(unit, phaseId); + if (parsedActions == null) + return new ProvisioningAction[] {beforeAction, afterAction}; + + ProvisioningAction[] actions = new ProvisioningAction[parsedActions.length + 2]; + actions[0] = beforeAction; + System.arraycopy(parsedActions, 0, actions, 1, parsedActions.length); + actions[actions.length - 1] = afterAction; + return actions; + } + + protected String getProblemMessage() { + return Messages.Phase_Uninstall_Error; + } + + protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { + IInstallableUnit iu = operand.first(); + parameters.put(PARM_IU, iu); + + IArtifactKey[] artifacts = iu.getArtifacts(); + if (artifacts != null && artifacts.length > 0) + parameters.put(PARM_ARTIFACT, artifacts[0]); + + return Status.OK_STATUS; + } +} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/messages.properties b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/messages.properties new file mode 100644 index 000000000..58a0dd1e5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/messages.properties @@ -0,0 +1,20 @@ +############################################################################### +# Copyright (c) 2007, 2009 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 +############################################################################### + +Phase_Collect_Error=An error occurred while collecting items to be installed +Phase_Configure_Error=An error occurred while configuring the installed items +Phase_Configure_Task=Configuring {0} +Phase_Install_Error=An error occurred while installing the items +Phase_Install_Task=Installing {0} +Phase_Sizing_Error=Error computing the size. Some of the items to be installed could not be found. +Phase_Sizing_Warning=The size may not be accurate. Some of the items did not report a size. +Phase_Unconfigure_Error=An error occurred while unconfiguring the items to uninstall +Phase_Uninstall_Error=An error occurred while uninstalling diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java index 0f5142ca6..6b378351d 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java @@ -10,9 +10,10 @@ *******************************************************************************/ package org.eclipse.equinox.internal.provisional.p2.engine; +import org.eclipse.equinox.internal.p2.engine.phases.*; + import java.util.ArrayList; import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.*; public class DefaultPhaseSet extends PhaseSet { diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java index 277603edd..5beaf878e 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java @@ -10,11 +10,12 @@ *******************************************************************************/ package org.eclipse.equinox.internal.provisional.p2.engine; +import org.eclipse.equinox.internal.p2.engine.phases.*; + import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.p2.engine.ActionManager; import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.*; import org.eclipse.equinox.p2.engine.IPhaseSet; import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; import org.eclipse.osgi.util.NLS; diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/CheckTrust.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/CheckTrust.java deleted file mode 100644 index 89290c7dc..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/CheckTrust.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import java.util.*; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; - -/** - * An install phase that checks if the certificates used to sign the artifacts - * being installed are from a trusted source. - */ -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); - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.second() != null); - } - - protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - Collection artifactRequests = (Collection) parameters.get(PARM_ARTIFACT_FILES); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - - // Instantiate a check trust manager - CertificateChecker certificateChecker = new CertificateChecker(agent); - certificateChecker.add(artifactRequests.toArray()); - IStatus status = certificateChecker.start(); - - return status; - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand operand) { - IInstallableUnit unit = operand.second(); - ProvisioningAction[] parsedActions = getActions(unit, phaseId); - if (parsedActions != null) - return parsedActions; - - ITouchpointType type = unit.getTouchpointType(); - if (type == null || type == ITouchpointType.NONE) - return null; - - String actionId = getActionManager().getTouchpointQualifiedActionId(phaseId, type); - ProvisioningAction action = getActionManager().getAction(actionId, null); - if (action == null) { - return null; - } - return new ProvisioningAction[] {action}; - } - - protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - IInstallableUnit iu = operand.second(); - parameters.put(PARM_IU, iu); - - return super.initializeOperand(profile, operand, parameters, monitor); - } - - protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - parameters.put(PARM_ARTIFACT_FILES, new ArrayList()); - return super.initializePhase(monitor, profile, parameters); - } - -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Collect.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Collect.java deleted file mode 100644 index b5e653b71..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Collect.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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 - * WindRiver - https://bugs.eclipse.org/bugs/show_bug.cgi?id=227372 - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import java.util.*; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.equinox.internal.p2.engine.DownloadManager; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; -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 Collect(int weight) { - super(PHASE_ID, weight); - //re-balance work since postPerform will do almost all the time-consuming work - prePerformWork = 0; - mainPerformWork = 100; - postPerformWork = 1000; - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.second() != null && !op.second().equals(op.first())); - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand operand) { - IInstallableUnit unit = operand.second(); - ProvisioningAction[] parsedActions = getActions(unit, phaseId); - if (parsedActions != null) - return parsedActions; - - ITouchpointType type = unit.getTouchpointType(); - if (type == null || type == ITouchpointType.NONE) - return null; - - String actionId = getActionManager().getTouchpointQualifiedActionId(phaseId, type); - ProvisioningAction action = getActionManager().getAction(actionId, null); - if (action == null) { - return null; - } - return new ProvisioningAction[] {action}; - } - - protected String getProblemMessage() { - return Messages.Phase_Collect_Error; - } - - protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - List artifactRequests = (List) parameters.get(PARM_ARTIFACT_REQUESTS); - ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - IArtifactRepositoryManager repositoryManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); - - DownloadManager dm = new DownloadManager(context, repositoryManager); - for (Iterator it = artifactRequests.iterator(); it.hasNext();) { - IArtifactRequest[] requests = (IArtifactRequest[]) it.next(); - dm.add(requests); - } - return dm.start(monitor); - } - - protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - parameters.put(PARM_ARTIFACT_REQUESTS, new ArrayList()); - return null; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Configure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Configure.java deleted file mode 100644 index 597d1c11a..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Configure.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import org.eclipse.equinox.p2.metadata.IArtifactKey; - -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.osgi.util.NLS; - -public class Configure extends InstallableUnitPhase { - - public Configure(int weight) { - super(IPhaseSet.PHASE_CONFIGURE, weight); - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.second() != null); - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { - IInstallableUnit unit = currentOperand.second(); - if (unit.isFragment()) - return null; - return getActions(unit, phaseId); - } - - protected String getProblemMessage() { - return Messages.Phase_Configure_Error; - } - - protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - IInstallableUnit iu = operand.second(); - monitor.subTask(NLS.bind(Messages.Phase_Configure_Task, iu.getId())); - parameters.put(PARM_IU, iu); - - IArtifactKey[] artifacts = iu.getArtifacts(); - if (artifacts != null && artifacts.length > 0) - parameters.put(PARM_ARTIFACT, artifacts[0]); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Install.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Install.java deleted file mode 100644 index ca4e4bd65..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Install.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import org.eclipse.equinox.p2.metadata.IArtifactKey; - -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.engine.spi.Touchpoint; -import org.eclipse.osgi.util.NLS; - -public class Install extends InstallableUnitPhase { - - final static class BeforeInstallEventAction extends ProvisioningAction { - - public IStatus execute(Map parameters) { - IProfile profile = (IProfile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); - return null; - } - - public IStatus undo(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); - profile.removeInstallableUnit(iu); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); - return null; - } - } - - final static class AfterInstallEventAction extends ProvisioningAction { - - public IStatus execute(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); - profile.addInstallableUnit(iu); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); - return null; - } - - public IStatus undo(Map parameters) { - IProfile profile = (IProfile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); - return null; - } - } - - private static final String PHASE_ID = IPhaseSet.PHASE_INSTALL; - - public Install(int weight) { - super(PHASE_ID, weight); - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.second() != null && !op.second().equals(op.first())); - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { - //TODO: monitor.subTask(NLS.bind(Messages.Engine_Installing_IU, unit.getId())); - - ProvisioningAction beforeAction = new BeforeInstallEventAction(); - ProvisioningAction afterAction = new AfterInstallEventAction(); - - IInstallableUnit unit = currentOperand.second(); - Touchpoint touchpoint = getActionManager().getTouchpointPoint(unit.getTouchpointType()); - if (touchpoint != null) { - beforeAction.setTouchpoint(touchpoint); - afterAction.setTouchpoint(touchpoint); - } - - if (unit.isFragment()) - return new ProvisioningAction[] {beforeAction, afterAction}; - - ProvisioningAction[] parsedActions = getActions(unit, phaseId); - if (parsedActions == null) - return new ProvisioningAction[] {beforeAction, afterAction}; - - ProvisioningAction[] actions = new ProvisioningAction[parsedActions.length + 2]; - actions[0] = beforeAction; - System.arraycopy(parsedActions, 0, actions, 1, parsedActions.length); - actions[actions.length - 1] = afterAction; - return actions; - } - - protected String getProblemMessage() { - return Messages.Phase_Install_Error; - } - - protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - IInstallableUnit iu = operand.second(); - monitor.subTask(NLS.bind(Messages.Phase_Install_Task, iu.getId())); - parameters.put(PARM_IU, iu); - - IArtifactKey[] artifacts = iu.getArtifacts(); - if (artifacts != null && artifacts.length > 0) - parameters.put(PARM_ARTIFACT, artifacts[0]); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Messages.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Messages.java deleted file mode 100644 index 081b6f233..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Messages.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.osgi.util.NLS; - -//TODO Shouldn't have messages class in API package -class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.provisional.p2.engine.phases.messages"; //$NON-NLS-1$ - public static String Phase_Collect_Error; - public static String Phase_Install_Error; - public static String Phase_Configure_Error; - public static String Phase_Configure_Task; - public static String Phase_Install_Task; - public static String Phase_Sizing_Error; - public static String Phase_Sizing_Warning; - public static String Phase_Unconfigure_Error; - public static String Phase_Uninstall_Error; - - static { - // initialize resource bundles - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - // Do not instantiate - } - -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Property.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Property.java deleted file mode 100644 index d4dde1788..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Property.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; - -public class Property extends Phase { - - public class ProfilePropertyAction extends ProvisioningAction { - - public IStatus execute(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND); - - if (propertyOperand.second() == null) - removeProfileProperty(profile, propertyOperand); - else - setProfileProperty(profile, propertyOperand, false); - - return null; - } - - public IStatus undo(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND); - - if (propertyOperand.first() == null) - removeProfileProperty(profile, propertyOperand); - else - setProfileProperty(profile, propertyOperand, true); - - return null; - } - - private void setProfileProperty(Profile profile, PropertyOperand propertyOperand, boolean undo) { - - String value = (String) (undo ? propertyOperand.first() : propertyOperand.second()); - - if (propertyOperand instanceof InstallableUnitPropertyOperand) { - InstallableUnitPropertyOperand iuPropertyOperand = (InstallableUnitPropertyOperand) propertyOperand; - profile.setInstallableUnitProperty(iuPropertyOperand.getInstallableUnit(), iuPropertyOperand.getKey(), value); - } else { - profile.setProperty(propertyOperand.getKey(), value); - } - } - - private void removeProfileProperty(Profile profile, PropertyOperand propertyOperand) { - if (propertyOperand instanceof InstallableUnitPropertyOperand) { - InstallableUnitPropertyOperand iuPropertyOperand = (InstallableUnitPropertyOperand) propertyOperand; - profile.removeInstallableUnitProperty(iuPropertyOperand.getInstallableUnit(), iuPropertyOperand.getKey()); - } else { - profile.removeProperty(propertyOperand.getKey()); - } - } - } - - public class UpdateInstallableUnitProfilePropertiesAction extends ProvisioningAction { - - // we do not need to use a memento here since the profile is not persisted unless the operation is successful - Map originalSourceProperties; - Map originalTargetProperties; - - public IStatus execute(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - - IInstallableUnit source = iuOperand.first(); - originalSourceProperties = profile.getInstallableUnitProperties(source); - - IInstallableUnit target = iuOperand.second(); - originalTargetProperties = profile.getInstallableUnitProperties(target); - - profile.addInstallableUnitProperties(target, originalSourceProperties); - profile.clearInstallableUnitProperties(source); - - return null; - } - - public IStatus undo(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - - IInstallableUnit source = iuOperand.first(); - profile.clearInstallableUnitProperties(source); - profile.addInstallableUnitProperties(source, originalSourceProperties); - - IInstallableUnit target = iuOperand.second(); - profile.clearInstallableUnitProperties(target); - profile.addInstallableUnitProperties(target, originalTargetProperties); - - return null; - } - } - - public class RemoveInstallableUnitProfilePropertiesAction extends ProvisioningAction { - - // we do not need to use a memento here since the profile is not persisted unless the operation is successful - Map originalSourceProperties; - Map originalTargetProperties; - - public IStatus execute(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - - IInstallableUnit source = iuOperand.first(); - originalSourceProperties = profile.getInstallableUnitProperties(source); - profile.clearInstallableUnitProperties(source); - - return null; - } - - public IStatus undo(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - - IInstallableUnit source = iuOperand.first(); - profile.clearInstallableUnitProperties(source); - profile.addInstallableUnitProperties(source, originalSourceProperties); - - return null; - } - } - - private static final String PHASE_ID = IPhaseSet.PHASE_PROPERTY; - - public Property(int weight) { - super(PHASE_ID, weight); - } - - protected ProvisioningAction[] getActions(Operand operand) { - if (operand instanceof PropertyOperand) - return new ProvisioningAction[] {new ProfilePropertyAction()}; - - if (operand instanceof InstallableUnitOperand) { - InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; - if (iuOperand.first() != null) { - if (iuOperand.second() != null) { - return new ProvisioningAction[] {new UpdateInstallableUnitProfilePropertiesAction()}; - } - return new ProvisioningAction[] {new RemoveInstallableUnitProfilePropertiesAction()}; - } - } - return null; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java deleted file mode 100644 index 85d91eda0..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import java.net.URI; -import java.util.*; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.repository.IRepositoryManager; -import org.eclipse.equinox.p2.repository.artifact.*; - -public class Sizing extends InstallableUnitPhase { - private static final String PHASE_ID = "sizing"; //$NON-NLS-1$ - private static final String COLLECT_PHASE_ID = "collect"; //$NON-NLS-1$ - - private long sizeOnDisk; - private long dlSize; - - public Sizing(int weight, String phaseName) { - super(PHASE_ID, weight); - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.second() != null && !op.second().equals(op.first())); - } - - public long getDiskSize() { - return sizeOnDisk; - } - - public long getDlSize() { - return dlSize; - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand operand) { - IInstallableUnit unit = operand.second(); - ProvisioningAction[] parsedActions = getActions(unit, COLLECT_PHASE_ID); - if (parsedActions != null) - return parsedActions; - - ITouchpointType type = unit.getTouchpointType(); - if (type == null || type == ITouchpointType.NONE) - return null; - - String actionId = getActionManager().getTouchpointQualifiedActionId(COLLECT_PHASE_ID, type); - ProvisioningAction action = getActionManager().getAction(actionId, null); - if (action == null) { - return null; - } - return new ProvisioningAction[] {action}; - } - - protected String getProblemMessage() { - return Messages.Phase_Sizing_Error; - } - - protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - List artifactRequests = (List) parameters.get(Collect.PARM_ARTIFACT_REQUESTS); - ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - int statusCode = 0; - - Set artifactsToObtain = new HashSet(artifactRequests.size()); - - for (Iterator it = artifactRequests.iterator(); it.hasNext();) { - IArtifactRequest[] requests = (IArtifactRequest[]) it.next(); - if (requests == null) - continue; - for (int i = 0; i < requests.length; i++) { - artifactsToObtain.add(requests[i]); - } - } - - if (monitor.isCanceled()) - return Status.CANCEL_STATUS; - - IArtifactRepositoryManager repoMgr = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME); - URI[] repositories = null; - if (context == null || context.getArtifactRepositories() == null) - repositories = repoMgr.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL); - else - repositories = context.getArtifactRepositories(); - - for (Iterator iterator = artifactsToObtain.iterator(); iterator.hasNext() && !monitor.isCanceled();) { - IArtifactRequest artifactRequest = (IArtifactRequest) iterator.next(); - boolean found = false; - for (int i = 0; i < repositories.length; i++) { - IArtifactRepository repo; - try { - repo = repoMgr.loadRepository(repositories[i], monitor); - } catch (ProvisionException e) { - continue;//skip unresponsive repositories - } - if (monitor.isCanceled()) - return Status.CANCEL_STATUS; - IArtifactDescriptor[] descriptors = repo.getArtifactDescriptors(artifactRequest.getArtifactKey()); - if (descriptors.length > 0) { - if (descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE) != null) - sizeOnDisk += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.ARTIFACT_SIZE)); - else - statusCode = ProvisionException.ARTIFACT_INCOMPLETE_SIZING; - if (descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE) != null) - dlSize += Long.parseLong(descriptors[0].getProperty(IArtifactDescriptor.DOWNLOAD_SIZE)); - else - statusCode = ProvisionException.ARTIFACT_INCOMPLETE_SIZING; - found = true; - break; - } - } - if (!found) - // The artifact wasn't present in any repository - return new Status(IStatus.ERROR, EngineActivator.ID, ProvisionException.ARTIFACT_NOT_FOUND, Messages.Phase_Sizing_Error, null); - } - if (statusCode != 0) - return new Status(IStatus.WARNING, EngineActivator.ID, statusCode, Messages.Phase_Sizing_Warning, null); - return null; - } - - protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList()); - return null; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Unconfigure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Unconfigure.java deleted file mode 100644 index 1a34ea690..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Unconfigure.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import org.eclipse.equinox.p2.metadata.IArtifactKey; - -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; - -public class Unconfigure extends InstallableUnitPhase { - - public Unconfigure(int weight, boolean forced) { - super(IPhaseSet.PHASE_UNCONFIGURE, weight, forced); - } - - public Unconfigure(int weight) { - this(weight, false); - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.first() != null); - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { - //TODO: monitor.subTask(NLS.bind(Messages.Engine_Unconfiguring_IU, unit.getId())); - - IInstallableUnit unit = currentOperand.first(); - if (unit.isFragment()) - return null; - - return getActions(unit, phaseId); - } - - protected String getProblemMessage() { - return Messages.Phase_Unconfigure_Error; - } - - protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - IInstallableUnit iu = operand.first(); - parameters.put(PARM_IU, iu); - - IArtifactKey[] artifacts = iu.getArtifacts(); - if (artifacts != null && artifacts.length > 0) - parameters.put(PARM_ARTIFACT, artifacts[0]); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Uninstall.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Uninstall.java deleted file mode 100644 index 88436a8b3..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Uninstall.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 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.provisional.p2.engine.phases; - -import org.eclipse.equinox.p2.metadata.IInstallableUnit; - -import org.eclipse.equinox.p2.metadata.IArtifactKey; - -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.Profile; -import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.p2.core.IProvisioningAgent; -import org.eclipse.equinox.p2.engine.IPhaseSet; -import org.eclipse.equinox.p2.engine.spi.ProvisioningAction; -import org.eclipse.equinox.p2.engine.spi.Touchpoint; - -public class Uninstall extends InstallableUnitPhase { - - final static class BeforeUninstallEventAction extends ProvisioningAction { - public IStatus execute(Map parameters) { - IProfile profile = (IProfile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); - return null; - } - - public IStatus undo(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); - profile.addInstallableUnit(iu); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); - return null; - } - } - - final static class AfterUninstallEventAction extends ProvisioningAction { - public IStatus execute(Map parameters) { - Profile profile = (Profile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU); - profile.removeInstallableUnit(iu); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); - return null; - } - - public IStatus undo(Map parameters) { - IProfile profile = (IProfile) parameters.get(PARM_PROFILE); - String phaseId = (String) parameters.get(PARM_PHASE_ID); - InstallableUnitOperand operand = (InstallableUnitOperand) parameters.get(PARM_OPERAND); - IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT); - ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); - return null; - } - } - - public Uninstall(int weight, boolean forced) { - super(IPhaseSet.PHASE_UNINSTALL, weight, forced); - } - - public Uninstall(int weight) { - this(weight, false); - } - - protected boolean isApplicable(InstallableUnitOperand op) { - return (op.first() != null && !op.first().equals(op.second())); - } - - protected ProvisioningAction[] getActions(InstallableUnitOperand currentOperand) { - //TODO: monitor.subTask(NLS.bind(Messages.Engine_Uninstalling_IU, unit.getId())); - - ProvisioningAction beforeAction = new BeforeUninstallEventAction(); - ProvisioningAction afterAction = new AfterUninstallEventAction(); - - IInstallableUnit unit = currentOperand.first(); - Touchpoint touchpoint = getActionManager().getTouchpointPoint(unit.getTouchpointType()); - if (touchpoint != null) { - beforeAction.setTouchpoint(touchpoint); - afterAction.setTouchpoint(touchpoint); - } - - if (unit.isFragment()) - return new ProvisioningAction[] {beforeAction, afterAction}; - ProvisioningAction[] parsedActions = getActions(unit, phaseId); - if (parsedActions == null) - return new ProvisioningAction[] {beforeAction, afterAction}; - - ProvisioningAction[] actions = new ProvisioningAction[parsedActions.length + 2]; - actions[0] = beforeAction; - System.arraycopy(parsedActions, 0, actions, 1, parsedActions.length); - actions[actions.length - 1] = afterAction; - return actions; - } - - protected String getProblemMessage() { - return Messages.Phase_Uninstall_Error; - } - - protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - IInstallableUnit iu = operand.first(); - parameters.put(PARM_IU, iu); - - IArtifactKey[] artifacts = iu.getArtifacts(); - if (artifacts != null && artifacts.length > 0) - parameters.put(PARM_ARTIFACT, artifacts[0]); - - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/messages.properties b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/messages.properties deleted file mode 100644 index 58a0dd1e5..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/messages.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 2009 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 -############################################################################### - -Phase_Collect_Error=An error occurred while collecting items to be installed -Phase_Configure_Error=An error occurred while configuring the installed items -Phase_Configure_Task=Configuring {0} -Phase_Install_Error=An error occurred while installing the items -Phase_Install_Task=Installing {0} -Phase_Sizing_Error=Error computing the size. Some of the items to be installed could not be found. -Phase_Sizing_Warning=The size may not be accurate. Some of the items did not report a size. -Phase_Unconfigure_Error=An error occurred while unconfiguring the items to uninstall -Phase_Uninstall_Error=An error occurred while uninstalling 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 e45912a24..065751b8b 100644 --- a/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.operations/META-INF/MANIFEST.MF @@ -7,6 +7,7 @@ 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.phases, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.repository.helpers, org.eclipse.equinox.internal.provisional.configurator, @@ -14,7 +15,6 @@ Import-Package: org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.provisional.p2.core.eventbus, org.eclipse.equinox.internal.provisional.p2.director, org.eclipse.equinox.internal.provisional.p2.engine, - org.eclipse.equinox.internal.provisional.p2.engine.phases, org.eclipse.equinox.internal.provisional.p2.metadata, org.eclipse.equinox.internal.provisional.p2.metadata.query, org.eclipse.equinox.p2.common, 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 index 4cb512d29..f85b3dfa8 100644 --- 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 @@ -13,9 +13,10 @@ */ package org.eclipse.equinox.internal.p2.operations; +import org.eclipse.equinox.internal.p2.engine.phases.Collect; + import org.eclipse.equinox.internal.provisional.p2.engine.Phase; import org.eclipse.equinox.internal.provisional.p2.engine.PhaseSet; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect; public class DownloadPhaseSet extends PhaseSet { public DownloadPhaseSet() { diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SizingPhaseSet.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SizingPhaseSet.java index 95573f95b..c740e3bc1 100644 --- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SizingPhaseSet.java +++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/internal/p2/operations/SizingPhaseSet.java @@ -13,9 +13,10 @@ */ package org.eclipse.equinox.internal.p2.operations; +import org.eclipse.equinox.internal.p2.engine.phases.Sizing; + import org.eclipse.equinox.internal.provisional.p2.engine.Phase; import org.eclipse.equinox.internal.provisional.p2.engine.PhaseSet; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Sizing; public class SizingPhaseSet extends PhaseSet { diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF index 54519735f..c6bf768fe 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.repository.tools/META-INF/MANIFEST.MF @@ -15,6 +15,7 @@ Import-Package: org.eclipse.core.runtime;version="3.4.0", org.eclipse.equinox.internal.p2.core.helpers, org.eclipse.equinox.internal.p2.director, org.eclipse.equinox.internal.p2.engine, + org.eclipse.equinox.internal.p2.engine.phases, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.metadata.repository, org.eclipse.equinox.internal.p2.repository.helpers, @@ -23,7 +24,6 @@ Import-Package: org.eclipse.core.runtime;version="3.4.0", org.eclipse.equinox.internal.provisional.p2.core, org.eclipse.equinox.internal.provisional.p2.director, org.eclipse.equinox.internal.provisional.p2.engine, - org.eclipse.equinox.internal.provisional.p2.engine.phases, org.eclipse.equinox.internal.provisional.p2.metadata, org.eclipse.equinox.internal.provisional.p2.metadata.query, org.eclipse.equinox.internal.provisional.p2.repository, diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java index 33be9a0b3..2bb897eb0 100644 --- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java +++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/Repo2Runnable.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.internal.repository.tools; +import org.eclipse.equinox.internal.p2.engine.phases.Collect; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IArtifactKey; @@ -23,7 +25,6 @@ import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.engine.DownloadManager; import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect; import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector; import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery; import org.eclipse.equinox.p2.core.IProvisioningAgent; 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 1a904cca9..a3d6b2fcb 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 @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.artifact.repository; +import org.eclipse.equinox.internal.p2.engine.phases.Sizing; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.core.runtime.IStatus; @@ -18,7 +20,6 @@ import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; import org.eclipse.equinox.internal.provisional.p2.director.PlannerHelper; import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest; import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Sizing; import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange; import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector; import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery; 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 cc79019e3..70a98d2de 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,14 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.engine; +import org.eclipse.equinox.internal.p2.engine.phases.*; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import java.io.File; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.*; import org.eclipse.equinox.internal.provisional.p2.metadata.*; import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription; 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 d5547ba10..9a455081a 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 @@ -10,10 +10,11 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.engine; +import org.eclipse.equinox.internal.p2.engine.phases.*; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.internal.provisional.p2.engine.InstallableUnitOperand; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.*; import org.eclipse.equinox.internal.provisional.p2.metadata.Version; import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java index 4e8f4dd40..b7bf9b521 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CheckTrustActionTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.touchpoint.eclipse; +import org.eclipse.equinox.internal.p2.engine.phases.CheckTrust; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import java.io.File; @@ -20,7 +22,6 @@ import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.ActionConstant import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.CheckTrustAction; import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; import org.eclipse.equinox.internal.provisional.p2.engine.InstallableUnitOperand; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.CheckTrust; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java index c8389b3c5..51a9160bf 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/eclipse/CollectActionTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.touchpoint.eclipse; +import org.eclipse.equinox.internal.p2.engine.phases.Collect; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import java.io.File; @@ -20,7 +22,6 @@ import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.ActionConstant import org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.CollectAction; import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; import org.eclipse.equinox.internal.provisional.p2.engine.InstallableUnitOperand; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.publisher.eclipse.BundlesAction; import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java index 65dacd23f..7af379db9 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/touchpoint/natives/CollectActionTest.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.equinox.p2.tests.touchpoint.natives; +import org.eclipse.equinox.internal.p2.engine.phases.Collect; + import org.eclipse.equinox.p2.metadata.IInstallableUnit; import java.io.File; @@ -19,7 +21,6 @@ import org.eclipse.equinox.internal.p2.touchpoint.natives.actions.ActionConstant import org.eclipse.equinox.internal.p2.touchpoint.natives.actions.CollectAction; import org.eclipse.equinox.internal.provisional.p2.engine.IProfile; import org.eclipse.equinox.internal.provisional.p2.engine.InstallableUnitOperand; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect; import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory; import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory.InstallableUnitDescription; import org.eclipse.equinox.p2.metadata.IArtifactKey; diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF index f9e674a07..8e0a2756c 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/META-INF/MANIFEST.MF @@ -8,6 +8,7 @@ Bundle-Version: 1.0.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin Import-Package: com.ibm.icu.util;version="4.0.1", org.eclipse.equinox.internal.p2.core.helpers, + org.eclipse.equinox.internal.p2.engine.phases, org.eclipse.equinox.internal.p2.ui.actions, org.eclipse.equinox.internal.p2.ui.query, org.eclipse.equinox.internal.provisional.p2.artifact.repository, @@ -15,7 +16,6 @@ Import-Package: com.ibm.icu.util;version="4.0.1", org.eclipse.equinox.internal.provisional.p2.core.eventbus, org.eclipse.equinox.internal.provisional.p2.director, org.eclipse.equinox.internal.provisional.p2.engine, - org.eclipse.equinox.internal.provisional.p2.engine.phases, org.eclipse.equinox.internal.provisional.p2.metadata, org.eclipse.equinox.internal.provisional.p2.metadata.query, org.eclipse.equinox.internal.provisional.p2.repository, 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 index 0e122c798..287293ffc 100644 --- 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 @@ -13,9 +13,10 @@ */ package org.eclipse.equinox.internal.p2.ui.sdk.scheduler; +import org.eclipse.equinox.internal.p2.engine.phases.Collect; + import org.eclipse.equinox.internal.provisional.p2.engine.Phase; import org.eclipse.equinox.internal.provisional.p2.engine.PhaseSet; -import org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect; public class DownloadPhaseSet extends PhaseSet { public DownloadPhaseSet() { diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF index d11314436..517998065 100644 --- a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF @@ -21,7 +21,6 @@ Import-Package: com.ibm.icu.text, org.eclipse.equinox.internal.provisional.p2.core.eventbus, org.eclipse.equinox.internal.provisional.p2.director, org.eclipse.equinox.internal.provisional.p2.engine, - org.eclipse.equinox.internal.provisional.p2.engine.phases, org.eclipse.equinox.internal.provisional.p2.metadata, org.eclipse.equinox.internal.provisional.p2.metadata.query, org.eclipse.equinox.internal.provisional.p2.repository, -- cgit v1.2.1