diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine')
41 files changed, 0 insertions, 3445 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/BeginOperationEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/BeginOperationEvent.java deleted file mode 100644 index d9de82c07..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/BeginOperationEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -public class BeginOperationEvent extends TransactionEvent { - - private static final long serialVersionUID = 6389318375739324865L; - - public BeginOperationEvent(IProfile profile, PhaseSet phaseSet, Operand[] operands, IEngine engine) { - super(profile, phaseSet, operands, engine); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/CertificateChecker.java deleted file mode 100644 index 8d049b9f9..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/CertificateChecker.java +++ /dev/null @@ -1,173 +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; - -import java.io.File; -import java.io.IOException; -import java.security.GeneralSecurityException; -import java.security.cert.Certificate; -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI; -import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI.TrustInfo; -import org.eclipse.osgi.service.security.TrustEngine; -import org.eclipse.osgi.signedcontent.*; -import org.eclipse.osgi.util.NLS; -import org.osgi.util.tracker.ServiceTracker; - -public class CertificateChecker { - private ArrayList artifacts; - private ServiceTracker trustEngineTracker; - - public CertificateChecker() { - artifacts = new ArrayList(); - trustEngineTracker = new ServiceTracker(EngineActivator.getContext(), TrustEngine.class.getName(), null); - trustEngineTracker.open(); - } - - public IStatus start() { - return checkCertificates(); - } - - private IStatus checkCertificates() { - SignedContentFactory verifierFactory = (SignedContentFactory) ServiceHelper.getService(EngineActivator.getContext(), SignedContentFactory.class.getName()); - IServiceUI serviceUI = (IServiceUI) ServiceHelper.getService(EngineActivator.getContext(), IServiceUI.class.getName()); - SignedContent content = null; - SignerInfo[] signerInfo = null; - ArrayList untrusted = new ArrayList(); - ArrayList unsigned = new ArrayList(); - ArrayList untrustedChain = new ArrayList(); - IStatus status = Status.OK_STATUS; - if (artifacts.size() == 0 || serviceUI == null) - return status; - TrustEngine trustEngine = (TrustEngine) trustEngineTracker.getService(); - for (Iterator it = artifacts.iterator(); it.hasNext();) { - File artifact = (File) it.next(); - try { - content = verifierFactory.getSignedContent(artifact); - if (!content.isSigned()) { - unsigned.add(artifact); - continue; - } - signerInfo = content.getSignerInfos(); - } catch (GeneralSecurityException e) { - return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentError, e); - } catch (IOException e) { - return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentIOError, e); - } - for (int i = 0; i < signerInfo.length; i++) { - Certificate[] certificateChain = signerInfo[i].getCertificateChain(); - try { - Certificate trustAnchor = trustEngine.findTrustAnchor(certificateChain); - if (trustAnchor == null) { - if (!untrusted.contains(certificateChain[0])) { - untrusted.add(certificateChain[0]); - untrustedChain.add(certificateChain); - } - } - } catch (IOException e) { - return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_KeystoreConnectionError, e); - } - } - } - String policy = getUnsignedContentPolicy(); - //if there is unsigned content and we should never allow it, then fail without further checking certificates - if (!unsigned.isEmpty() && EngineActivator.UNSIGNED_FAIL.equals(policy)) - return new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.CertificateChecker_UnsignedNotAllowed, unsigned)); - - String[] details; - // If we always allow unsigned content, or we don't have any, we don't prompt the user about it - if (EngineActivator.UNSIGNED_ALLOW.equals(policy) || unsigned.isEmpty()) - details = null; - else { - details = new String[unsigned.size()]; - for (int i = 0; i < details.length; i++) { - details[i] = unsigned.get(i).toString(); - } - } - Certificate[][] unTrustedCertificateChains; - if (untrusted.isEmpty()) { - unTrustedCertificateChains = null; - } else { - unTrustedCertificateChains = new Certificate[untrustedChain.size()][]; - for (int i = 0; i < untrustedChain.size(); i++) { - unTrustedCertificateChains[i] = (Certificate[]) untrustedChain.get(i); - } - } - - // If there was no unsigned content, and nothing untrusted, no need to prompt. - if (details == null && unTrustedCertificateChains == null) - return status; - - TrustInfo trustInfo = serviceUI.getTrustInfo(unTrustedCertificateChains, details); - - // If user doesn't trust unsigned content, cancel the operation - if (!trustInfo.trustUnsignedContent()) - return Status.CANCEL_STATUS; - - Certificate[] trustedCertificates = trustInfo.getTrustedCertificates(); - // If we had untrusted chains and nothing was trusted, cancel the operation - if (unTrustedCertificateChains != null && trustedCertificates == null) { - return new Status(IStatus.CANCEL, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); - } - // Anything that was trusted should be removed from the untrusted list - if (trustedCertificates != null) { - for (int i = 0; i < trustedCertificates.length; i++) { - untrusted.remove(trustedCertificates[i]); - } - } - - // If there is still untrusted content, cancel the operation - if (untrusted.size() > 0) - return new Status(IStatus.CANCEL, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected); - // If we should persist the trusted certificates, add them to the trust engine - if (trustInfo.persistTrust()) { - for (int i = 0; i < trustedCertificates.length; i++) { - try { - trustEngine.addTrustAnchor(trustedCertificates[i], trustedCertificates[i].toString()); - } catch (IOException e) { - //just return an INFO so the user can proceed with the install - return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_KeystoreConnectionError, e); - } catch (GeneralSecurityException e) { - return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_CertificateError, e); - } - } - } - - return status; - } - - /** - * Return the policy on unsigned content. - */ - private String getUnsignedContentPolicy() { - String policy = EngineActivator.getContext().getProperty(EngineActivator.PROP_UNSIGNED_POLICY); - if (policy == null) - policy = EngineActivator.UNSIGNED_PROMPT; - return policy; - - } - - public void add(File toAdd) { - artifacts.add(toAdd); - } - - public void add(Object[] toAdd) { - for (int i = 0; i < toAdd.length; i++) { - if (toAdd[i] instanceof File) - add((File) toAdd[i]); - } - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/CommitOperationEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/CommitOperationEvent.java deleted file mode 100644 index 00f89a13d..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/CommitOperationEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -public class CommitOperationEvent extends TransactionEvent { - private static final long serialVersionUID = -523967775426133720L; - - public CommitOperationEvent(IProfile profile, PhaseSet phaseSet, Operand[] operands, IEngine engine) { - super(profile, phaseSet, operands, engine); - } - -} 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 deleted file mode 100644 index 4842ad1f1..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/DefaultPhaseSet.java +++ /dev/null @@ -1,63 +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; - -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 { - - private static final boolean forcedUninstall = Boolean.valueOf(EngineActivator.getContext().getProperty("org.eclipse.equinox.p2.engine.forcedUninstall")).booleanValue(); //$NON-NLS-1$ - - public static int PHASE_CHECK_TRUST = 0x01; - public static int PHASE_COLLECT = 0x02; - public static int PHASE_CONFIGURE = 0x04; - public static int PHASE_INSTALL = 0x08; - public static int PHASE_PROPERTY = 0x10; - public static int PHASE_UNCONFIGURE = 0x20; - public static int PHASE_UNINSTALL = 0x40; - - public DefaultPhaseSet() { - this(new Phase[] {new Collect(100), new Unconfigure(10, forcedUninstall), new Uninstall(50, forcedUninstall), new Property(1), new CheckTrust(10), new Install(50), new Configure(10)}); - } - - private DefaultPhaseSet(Phase[] phases) { - super(phases); - } - - /** - * Creates a default phase set that covers all the provisioning operations. - * Phases can be specified for exclusion. - * - * @param exclude - A set of bit options that specify the phases to exclude. - * See {@link DefaultPhaseSet} for possible options - * @return the {@link PhaseSet} - */ - public static final PhaseSet createDefaultPhaseSet(int exclude) { - ArrayList phases = new ArrayList(); - if ((PHASE_COLLECT & exclude) != PHASE_COLLECT) - phases.add(new Collect(100)); - if ((PHASE_UNCONFIGURE & exclude) != PHASE_UNCONFIGURE) - phases.add(new Unconfigure(10, forcedUninstall)); - if ((PHASE_UNINSTALL & exclude) != PHASE_UNINSTALL) - phases.add(new Uninstall(50, forcedUninstall)); - if ((PHASE_PROPERTY & exclude) != PHASE_PROPERTY) - phases.add(new Property(1)); - if ((PHASE_CHECK_TRUST & exclude) != PHASE_CHECK_TRUST) - phases.add(new CheckTrust(10)); - if ((PHASE_INSTALL & exclude) != PHASE_INSTALL) - phases.add(new Install(50)); - if ((PHASE_CONFIGURE & exclude) != PHASE_CONFIGURE) - phases.add(new Configure(10)); - return new DefaultPhaseSet((Phase[]) phases.toArray(new Phase[phases.size()])); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java deleted file mode 100644 index 0ff2d0f12..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Engine.java +++ /dev/null @@ -1,121 +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; - -import java.io.File; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.equinox.internal.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; - -/** - * TODO Move concrete class to non-API package - */ -public class Engine implements IEngine { - private static final String ENGINE = "engine"; //$NON-NLS-1$ - - private ActionManager actionManager; - private final IProvisioningEventBus eventBus; - - private SimpleProfileRegistry profileRegistry; - - public Engine(IProvisioningEventBus eventBus) { - this.eventBus = eventBus; - this.actionManager = new ActionManager(); - } - - private void checkArguments(IProfile iprofile, PhaseSet phaseSet, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) { - if (iprofile == null) - throw new IllegalArgumentException(Messages.null_profile); - - if (phaseSet == null) - throw new IllegalArgumentException(Messages.null_phaseset); - - if (operands == null) - throw new IllegalArgumentException(Messages.null_operands); - } - - public IStatus perform(IProfile iprofile, PhaseSet phaseSet, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) { - checkArguments(iprofile, phaseSet, operands, context, monitor); - - if (context == null) - context = new ProvisioningContext(); - - if (monitor == null) - monitor = new NullProgressMonitor(); - - Profile profile = profileRegistry.validate(iprofile); - - profileRegistry.lockProfile(profile); - try { - eventBus.publishEvent(new BeginOperationEvent(profile, phaseSet, operands, this)); - if (DebugHelper.DEBUG_ENGINE) - DebugHelper.debug(ENGINE, "Beginning engine operation for profile=" + profile.getProfileId() + " [" + profile.getTimestamp() + "]:" + DebugHelper.LINE_SEPARATOR + DebugHelper.formatOperation(phaseSet, operands, context)); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - - File profileDataDirectory = profileRegistry.getProfileDataDirectory(profile.getProfileId()); - - EngineSession session = new EngineSession(profile, profileDataDirectory, context); - - MultiStatus result = phaseSet.perform(actionManager, session, profile, operands, context, monitor); - if (result.isOK() || result.matches(IStatus.INFO | IStatus.WARNING)) { - if (DebugHelper.DEBUG_ENGINE) - DebugHelper.debug(ENGINE, "Preparing to commit engine operation for profile=" + profile.getProfileId()); //$NON-NLS-1$ - result.merge(session.prepare(monitor)); - } - if (result.matches(IStatus.ERROR | IStatus.CANCEL)) { - if (DebugHelper.DEBUG_ENGINE) - DebugHelper.debug(ENGINE, "Rolling back engine operation for profile=" + profile.getProfileId() + ". Reason was: " + result.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - IStatus status = session.rollback(actionManager, monitor, result.getSeverity()); - if (status.matches(IStatus.ERROR)) - LogHelper.log(status); - eventBus.publishEvent(new RollbackOperationEvent(profile, phaseSet, operands, this, result)); - } else { - if (DebugHelper.DEBUG_ENGINE) - DebugHelper.debug(ENGINE, "Committing engine operation for profile=" + profile.getProfileId()); //$NON-NLS-1$ - if (profile.isChanged()) - profileRegistry.updateProfile(profile); - IStatus status = session.commit(monitor); - if (status.matches(IStatus.ERROR)) - LogHelper.log(status); - eventBus.publishEvent(new CommitOperationEvent(profile, phaseSet, operands, this)); - } - //if there is only one child status, return that status instead because it will have more context - IStatus[] children = result.getChildren(); - return children.length == 1 ? children[0] : result; - } finally { - profileRegistry.unlockProfile(profile); - profile.setChanged(false); - } - } - - public void setProfileRegistry(IProfileRegistry registry) { - //we can only work with our own registry implementation - if (registry instanceof SimpleProfileRegistry) - this.profileRegistry = (SimpleProfileRegistry) registry; - } - - public void unsetProfileRegistry(IProfileRegistry registry) { - if (this.profileRegistry == registry) - this.profileRegistry = null; - } - - public IStatus validate(IProfile iprofile, PhaseSet phaseSet, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) { - checkArguments(iprofile, phaseSet, operands, context, monitor); - - if (context == null) - context = new ProvisioningContext(); - - if (monitor == null) - monitor = new NullProgressMonitor(); - - return phaseSet.validate(actionManager, iprofile, operands, context, monitor); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/EngineSession.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/EngineSession.java deleted file mode 100644 index cfc97cb88..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/EngineSession.java +++ /dev/null @@ -1,367 +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; - -import java.io.File; -import java.util.*; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.*; -import org.eclipse.osgi.util.NLS; - -public class EngineSession { - private static final String ENGINE_SESSION = "enginesession"; //$NON-NLS-1$ - - private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - private static class ActionsRecord { - Operand operand; - List actions = new ArrayList(); - - ActionsRecord(Operand operand) { - this.operand = operand; - } - } - - private List phaseActionRecordsPairs = new ArrayList(); - - private Phase currentPhase; - boolean currentPhaseActive; - - private List currentActionRecords; - private ActionsRecord currentRecord; - - private IProfile profile; - - private File profileDataDirectory; - - private ProvisioningContext context; - - private Set touchpoints = new HashSet(); - - public EngineSession(IProfile profile, File profileDataDirectory, ProvisioningContext context) { - this.profile = profile; - this.profileDataDirectory = profileDataDirectory; - this.context = context; - } - - public File getProfileDataDirectory() { - return profileDataDirectory; - } - - IStatus prepare(IProgressMonitor monitor) { - monitor.subTask(Messages.preparing); - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - for (Iterator iterator = touchpoints.iterator(); iterator.hasNext();) { - Touchpoint touchpoint = (Touchpoint) iterator.next(); - try { - status.add(touchpoint.prepare(profile)); - } catch (RuntimeException e) { - // "touchpoint.prepare" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.touchpoint_prepare_error, touchpoint.getClass().getName()), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.touchpoint_prepare_error, touchpoint.getClass().getName()), e)); - } - } - - if (status.matches(IStatus.ERROR)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, NLS.bind(Messages.session_prepare_error, profile.getProfileId()), null); - result.merge(status); - return result; - } - return status; - } - - IStatus commit(IProgressMonitor monitor) { - monitor.subTask(Messages.committing); - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - phaseActionRecordsPairs.clear(); - for (Iterator iterator = touchpoints.iterator(); iterator.hasNext();) { - Touchpoint touchpoint = (Touchpoint) iterator.next(); - try { - IStatus result = touchpoint.commit(profile); - if (!result.isOK()) - status.add(result); - } catch (RuntimeException e) { - // "touchpoint.commit" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.touchpoint_commit_error, touchpoint.getClass().getName()), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.touchpoint_commit_error, touchpoint.getClass().getName()), e)); - } - } - - if (status.matches(IStatus.ERROR)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, NLS.bind(Messages.session_commit_error, profile.getProfileId()), null); - result.merge(status); - return result; - } - return status; - } - - IStatus rollback(ActionManager actionManager, IProgressMonitor monitor, int severity) { - if (severity == IStatus.CANCEL) - monitor.subTask(Messages.rollingback_cancel); - - if (severity == IStatus.ERROR) - monitor.subTask(Messages.rollingback_error); - - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - - if (currentPhaseActive) { - try { - IStatus result = rollBackPhase(currentPhase, currentActionRecords, actionManager); - if (!result.isOK()) - status.add(result); - } catch (RuntimeException e) { - // "phase.prePerform and phase.postPerform" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.phase_undo_error, currentPhase.getClass().getName()), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.phase_undo_error, currentPhase.getClass().getName()), e)); - } - currentPhaseActive = false; - currentActionRecords = null; - currentRecord = null; - } - currentPhase = null; - - for (ListIterator it = phaseActionRecordsPairs.listIterator(phaseActionRecordsPairs.size()); it.hasPrevious();) { - Object[] pair = (Object[]) it.previous(); - Phase phase = (Phase) pair[0]; - List actionRecords = (List) pair[1]; - try { - final IStatus result = rollBackPhase(phase, actionRecords, actionManager); - if (!result.isOK()) - status.add(result); - } catch (RuntimeException e) { - // "phase.prePerform and phase.postPerform" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.phase_undo_error, phase.getClass().getName()), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.phase_undo_error, phase.getClass().getName()), e)); - } - } - - phaseActionRecordsPairs.clear(); - for (Iterator iterator = touchpoints.iterator(); iterator.hasNext();) { - Touchpoint touchpoint = (Touchpoint) iterator.next(); - try { - IStatus result = touchpoint.rollback(profile); - if (!result.isOK()) - status.add(result); - } catch (RuntimeException e) { - // "touchpoint.rollback" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.touchpoint_rollback_error, touchpoint.getClass().getName()), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - status.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.touchpoint_rollback_error, touchpoint.getClass().getName()), e)); - } - } - - if (status.matches(IStatus.ERROR)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, NLS.bind(Messages.session_commit_error, profile.getProfileId()), null); - result.merge(status); - return result; - } - return status; - } - - private IStatus rollBackPhase(Phase phase, List actionRecords, ActionManager actionManager) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - try { - phase.actionManager = actionManager; - - if (!currentPhaseActive) - phase.prePerform(result, this, profile, context, new NullProgressMonitor()); - - for (ListIterator it = actionRecords.listIterator(actionRecords.size()); it.hasPrevious();) { - ActionsRecord record = (ActionsRecord) it.previous(); - ProvisioningAction[] actions = (ProvisioningAction[]) record.actions.toArray(new ProvisioningAction[record.actions.size()]); - try { - phase.undo(result, this, profile, record.operand, actions, context); - } catch (RuntimeException e) { - // "phase.undo" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - result.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.phase_undo_operand_error, phase.getClass().getName(), record.operand), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - result.add(new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.phase_undo_operand_error, phase.getClass().getName(), record.operand), e)); - } - } - phase.postPerform(result, profile, context, new NullProgressMonitor()); - } finally { - phase.actionManager = null; - } - return result; - } - - void recordPhaseEnter(Phase phase) { - if (phase == null) - throw new IllegalArgumentException(Messages.null_phase); - - if (currentPhase != null) - throw new IllegalStateException(Messages.phase_started); - - currentPhase = phase; - - if (DebugHelper.DEBUG_ENGINE_SESSION) - debugPhaseEnter(phase); - } - - void recordPhaseStart(Phase phase) { - if (phase == null) - throw new IllegalArgumentException(Messages.null_phase); - - if (currentPhase != phase) - throw new IllegalArgumentException(Messages.not_current_phase); - - currentPhaseActive = true; - currentActionRecords = new ArrayList(); - } - - void recordPhaseEnd(Phase phase) { - if (currentPhase == null) - throw new IllegalStateException(Messages.phase_not_started); - - if (currentPhase != phase) - throw new IllegalArgumentException(Messages.not_current_phase); - - phaseActionRecordsPairs.add(new Object[] {currentPhase, currentActionRecords}); - currentActionRecords = null; - currentPhaseActive = false; - } - - void recordPhaseExit(Phase phase) { - if (currentPhase == null) - throw new IllegalStateException(Messages.phase_not_started); - - if (currentPhase != phase) - throw new IllegalArgumentException(Messages.not_current_phase); - - currentPhase = null; - if (DebugHelper.DEBUG_ENGINE_SESSION) - debugPhaseExit(phase); - } - - void recordOperandStart(Operand operand) { - if (operand == null) - throw new IllegalArgumentException(Messages.null_operand); - - if (currentRecord != null) - throw new IllegalStateException(Messages.operand_started); - - currentRecord = new ActionsRecord(operand); - currentActionRecords.add(currentRecord); - - if (DebugHelper.DEBUG_ENGINE_SESSION) - debugOperandStart(operand); - } - - void recordOperandEnd(Operand operand) { - if (currentRecord == null) - throw new IllegalStateException(Messages.operand_not_started); - - if (currentRecord.operand != operand) - throw new IllegalArgumentException(Messages.not_current_operand); - - currentRecord = null; - - if (DebugHelper.DEBUG_ENGINE_SESSION) - debugOperandEnd(operand); - } - - void recordActionExecute(ProvisioningAction action, Map parameters) { - if (action == null) - throw new IllegalArgumentException(Messages.null_action); - - currentRecord.actions.add(action); - - Touchpoint touchpoint = action.getTouchpoint(); - if (touchpoint != null) - touchpoints.add(touchpoint); - - if (DebugHelper.DEBUG_ENGINE_SESSION) - debugActionExecute(action, parameters); - } - - public void recordActionUndo(ProvisioningAction action, Map parameters) { - if (DebugHelper.DEBUG_ENGINE_SESSION) - debugActionUndo(action, parameters); - } - - public String getContextString(Phase phase, Operand operand, ProvisioningAction action) { - if (action instanceof ParameterizedProvisioningAction) { - ParameterizedProvisioningAction parameterizedAction = (ParameterizedProvisioningAction) action; - action = parameterizedAction.getAction(); - } - String message = NLS.bind(Messages.session_context, new Object[] {profile.getProfileId(), phase.getClass().getName(), operand.toString(), getCurrentActionId()}); - return message; - } - - public String getContextString() { - String message = NLS.bind(Messages.session_context, new Object[] {profile.getProfileId(), getCurrentPhaseId(), getCurrentOperandId(), getCurrentActionId()}); - return message; - } - - private Object getCurrentActionId() { - if (currentRecord == null || currentRecord.actions.isEmpty()) - return EMPTY_STRING; - - Object currentAction = currentRecord.actions.get(currentRecord.actions.size() - 1); - if (currentAction instanceof ParameterizedProvisioningAction) { - ParameterizedProvisioningAction parameterizedAction = (ParameterizedProvisioningAction) currentAction; - currentAction = parameterizedAction.getAction(); - } - return currentAction.getClass().getName(); - } - - private String getCurrentPhaseId() { - if (currentPhase == null) - return EMPTY_STRING; - return currentPhase.getClass().getName(); - } - - private String getCurrentOperandId() { - if (currentRecord == null) - return EMPTY_STRING; - return currentRecord.operand.toString(); - } - - private static void debugPhaseEnter(Phase phase) { - DebugHelper.debug(ENGINE_SESSION, "Entering phase: " + phase.getClass().getName()); //$NON-NLS-1$ - } - - private static void debugPhaseExit(Phase phase) { - DebugHelper.debug(ENGINE_SESSION, "Exiting phase: " + phase.getClass().getName()); //$NON-NLS-1$ - } - - private static void debugOperandStart(Operand operand) { - DebugHelper.debug(ENGINE_SESSION, "Starting processing of operand: " + operand.toString()); //$NON-NLS-1$ - } - - private static void debugOperandEnd(Operand operand) { - DebugHelper.debug(ENGINE_SESSION, "Ending processing of operand: " + operand.toString()); //$NON-NLS-1$ - } - - private static void debugActionExecute(ProvisioningAction action, Map parameters) { - DebugHelper.debug(ENGINE_SESSION, "Executing action: " + DebugHelper.formatAction(action, parameters)); //$NON-NLS-1$ - } - - private static void debugActionUndo(ProvisioningAction action, Map parameters) { - DebugHelper.debug(ENGINE_SESSION, "Undoing action: " + DebugHelper.formatAction(action, parameters)); //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IEngine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IEngine.java deleted file mode 100644 index 16db9b281..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IEngine.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Band XI International, LLC 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: - * Band XI - initial API and implementation - * IBM - ongoing development - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; - -public interface IEngine { - /** - * Service name constant for the engine service. - */ - public static final String SERVICE_NAME = IEngine.class.getName(); - - public IStatus perform(IProfile profile, PhaseSet phaseSet, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor); - - public IStatus validate(IProfile iprofile, PhaseSet phaseSet, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor); -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IProfile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IProfile.java deleted file mode 100644 index 686f36ac5..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IProfile.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 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; - -import java.util.Map; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.internal.provisional.p2.metadata.query.*; - -public interface IProfile extends IQueryable { - - /** - * Profile property constant indicating the flavor for the profile. - */ - public static final String PROP_FLAVOR = "org.eclipse.equinox.p2.flavor"; //$NON-NLS-1$ - /** - * Profile property constant indicating the install folder for the profile. - */ - public static final String PROP_INSTALL_FOLDER = "org.eclipse.equinox.p2.installFolder"; //$NON-NLS-1$ - /** - * Profile property constant indicating the configuration folder for the profile. - */ - public static final String PROP_CONFIGURATION_FOLDER = "org.eclipse.equinox.p2.configurationFolder"; //$NON-NLS-1$ - /** - * Profile property constant indicating the location of the launcher configuration file for the profile. - */ - public static final String PROP_LAUNCHER_CONFIGURATION = "org.eclipse.equinox.p2.launcherConfiguration"; //$NON-NLS-1$ - - /** - * Profile property constant indicating the installed language(s) for the profile. - */ - public static final String PROP_NL = "org.eclipse.equinox.p2.nl"; //$NON-NLS-1$ - /** - * Profile property constant for a string property indicating a user visible short - * textual description of this profile. May be empty or <code>null</code>, and - * generally will be for non-top level install contexts. - */ - public static final String PROP_DESCRIPTION = "org.eclipse.equinox.p2.description"; //$NON-NLS-1$ - /** - * Profile property constant for a string property indicating a user visible name of this profile. - * May be empty or <code>null</code>, and generally will be for non-top level - * install contexts. - */ - public static final String PROP_NAME = "org.eclipse.equinox.p2.name"; //$NON-NLS-1$ - /** - * Profile property constant indicating the list of environments - * (e.g., OS, WS, ...) in which a profile can operate. The value of the property - * is a comma-delimited string of key/value pairs. - */ - public static final String PROP_ENVIRONMENTS = "org.eclipse.equinox.p2.environments"; //$NON-NLS-1$ - /** - * Profile property constant for a boolean property indicating if the profiling - * is roaming. A roaming profile is one whose physical install location varies - * and is updated whenever it runs. - */ - public static final String PROP_ROAMING = "org.eclipse.equinox.p2.roaming"; //$NON-NLS-1$ - /** - * Profile property constant indicating the bundle pool cache location. - */ - public static final String PROP_CACHE = "org.eclipse.equinox.p2.cache"; //$NON-NLS-1$ - - /** - * Profile property constant indicating a shared read-only bundle pool cache location. - */ - public static final String PROP_SHARED_CACHE = "org.eclipse.equinox.p2.cache.shared"; //$NON-NLS-1$ - - /** - * Profile property constant for a boolean property indicating if update features should - * be installed in this profile - */ - public static final String PROP_INSTALL_FEATURES = "org.eclipse.update.install.features"; //$NON-NLS-1$ - - public String getProfileId(); - - public IProfile getParentProfile(); - - /* - * A profile is a root profile if it is not a sub-profile - * of another profile. - */ - public boolean isRootProfile(); - - public boolean hasSubProfiles(); - - public String[] getSubProfileIds(); - - /** - * Get the stored value associated with the given key. - * If the profile is a sub-profile and there is no value - * locally associated with the key, then the chain - * of parent profiles will be traversed to get an associated - * value from the nearest ancestor. - * - * <code>null</code> is return if none of this profile - * or its ancestors associates a value with the key. - */ - public String getProperty(String key); - - /** - * Get the stored value associated with the given key in this profile. - * No traversal of the ancestor hierarchy is done for sub-profiles. - */ - public String getLocalProperty(String key); - - public String getInstallableUnitProperty(IInstallableUnit iu, String key); - - /** - * Get an <i>unmodifiable copy</i> of the local properties - * associated with the profile. - * - * @return an <i>unmodifiable copy</i> of the Profile properties. - */ - public Map getLocalProperties(); - - public Map getProperties(); - - public Map getInstallableUnitProperties(IInstallableUnit iu); - - public long getTimestamp(); - - public Collector available(Query query, Collector collector, IProgressMonitor monitor); - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IProfileRegistry.java deleted file mode 100644 index 2b7cace00..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IProfileRegistry.java +++ /dev/null @@ -1,132 +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; - -import java.util.Map; -import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; - -/** - * This encapsulates the access to the profile registry. - * It deals with persistence in a transparent way. - */ -public interface IProfileRegistry { - public static final String SELF = "_SELF_"; //$NON-NLS-1$ - /** - * Service name constant for the profile registry service. - */ - public static final String SERVICE_NAME = IProfileRegistry.class.getName(); - - /** - * Return the profile in the registry that has the given id. If it does not exist, - * then return <code>null</code>. - * - * @param id the profile identifier - * @return the profile or <code>null</code> - */ - IProfile getProfile(String id); - - /** - * Return the profile in the registry that has the given id and timestamp. If it does not exist, - * then return <code>null</code>. - * - * @param id the profile identifier - * @param timestamp the profile's timestamp - - * @return the profile or <code>null</code> - */ - IProfile getProfile(String id, long timestamp); - - /** - * Return an array of timestamps in ascending order for the profile in question. If there are none, then - * return an empty array. - * - * @return the array of timestamps - */ - long[] listProfileTimestamps(String id); - - /** - * Return an array of profiles known to this registry. If there are none, then - * return an empty array. - * - * @return the array of profiles - */ - IProfile[] getProfiles(); - - /** - * Add the given profile to this profile registry. - * - * @param id the profile id - * - * @throws ProvisionException if a profile - * with the same id is already present in the registry. - */ - IProfile addProfile(String id) throws ProvisionException; - - /** - * Add the given profile to this profile registry. - * - * @param id the profile id - * @param properties the profile properties - * - * @throws ProvisionException if a profile - * with the same id is already present in the registry. - */ - IProfile addProfile(String id, Map properties) throws ProvisionException; - - /** - * Add the given profile to this profile registry. - * - * @param id the profile id - * @param properties the profile properties - * @param parentId the id of a parent profile - * - * @throws ProvisionException if a profile - * with the same id is already present in the registry or the parentId is not a registered Profile. - */ - IProfile addProfile(String id, Map properties, String parentId) throws ProvisionException; - - /** - * Returns whether this profile registry contains a profile with the given id. - * - * @param profileId The id of the profile to search for - * @return <code>true</code> if this registry contains a profile with the given id, - * and <code>false</code> otherwise. - */ - public boolean containsProfile(String profileId); - - /** - * Remove the given profile snapshot from this profile registry. This method has no effect - * if this registry does not contain a profile with the given id and timestamp. - * The current profile cannot be removed using this method. - * - * @param id the profile to remove - * @param timestamp the timestamp of the profile to remove - * - * @throws ProvisionException if the profile with the specified id and timestamp is the current profile. - */ - void removeProfile(String id, long timestamp) throws ProvisionException; - - /** - * Remove the given profile from this profile registry. This method has no effect - * if this registry does not contain a profile with the given id. - * - * @param id the profile to remove - */ - void removeProfile(String id); - - /** - * Check if the given profile from this profile registry is up-to-date. - * - * @param profile the profile to check - * @return boolean true if the profile is current; false otherwise. - */ - public boolean isCurrent(IProfile profile); -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java deleted file mode 100644 index 55f79aa71..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ISurrogateProfileHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector; -import org.eclipse.equinox.internal.provisional.p2.metadata.query.Query; - -public interface ISurrogateProfileHandler { - - public abstract IProfile createProfile(String id); - - public abstract boolean isSurrogate(IProfile profile); - - public abstract Collector queryProfile(IProfile profile, Query query, Collector collector, IProgressMonitor monitor); - - public abstract boolean updateProfile(IProfile selfProfile); - -}
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IUProfilePropertyQuery.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IUProfilePropertyQuery.java deleted file mode 100644 index 22afdac26..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/IUProfilePropertyQuery.java +++ /dev/null @@ -1,42 +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; - -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.internal.provisional.p2.metadata.query.IUPropertyQuery; - -/** - * A query that searches for {@link IInstallableUnit} instances that have - * a property associated with the specified profile, whose value matches the provided value. - */ -public class IUProfilePropertyQuery extends IUPropertyQuery { - private IProfile profile; - - public void setProfile(IProfile profile) { - this.profile = profile; - } - - /** - * Creates a new query on the given property name and value. - * Because the queryable for this query is typically the profile - * instance, we use a reference to the profile rather than the - * profile id for performance reasons. - */ - public IUProfilePropertyQuery(String propertyName, String propertyValue) { - super(propertyName, propertyValue); - } - - protected String getProperty(IInstallableUnit iu, String name) { - if (profile == null) - return null; - return profile.getInstallableUnitProperty(iu, name); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitEvent.java deleted file mode 100644 index 13f988922..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitEvent.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import java.util.EventObject; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -public class InstallableUnitEvent extends EventObject { - public static final int UNINSTALL = 0; - public static final int INSTALL = 1; - private static final long serialVersionUID = 3318712818811459886L; - - private String phaseId; - private boolean prePhase; - - private IProfile profile; - private InstallableUnitOperand operand; - private Touchpoint touchpoint; - private IStatus result; - private int type; - - public InstallableUnitEvent(String phaseId, boolean prePhase, IProfile profile, InstallableUnitOperand operand, int type, Touchpoint touchpoint) { - this(phaseId, prePhase, profile, operand, type, touchpoint, null); - } - - public InstallableUnitEvent(String phaseId, boolean prePhase, IProfile profile, InstallableUnitOperand operand, int type, Touchpoint touchpoint, IStatus result) { - super(profile); - this.phaseId = phaseId; - this.prePhase = prePhase; - this.profile = profile; - this.operand = operand; - if (type != UNINSTALL && type != INSTALL) - throw new IllegalArgumentException(Messages.InstallableUnitEvent_type_not_install_or_uninstall); - this.type = type; - this.result = result; - this.touchpoint = touchpoint; - - } - - public Touchpoint getTouchpoint() { - return touchpoint; - } - - public IProfile getProfile() { - return profile; - } - - public InstallableUnitOperand getOperand() { - return operand; - } - - public String getPhase() { - return phaseId; - } - - public boolean isPre() { - return prePhase; - } - - public boolean isPost() { - return !prePhase; - } - - public IStatus getResult() { - return (result != null ? result : Status.OK_STATUS); - } - - public boolean isInstall() { - return type == INSTALL; - } - - public boolean isUninstall() { - return type == UNINSTALL; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitOperand.java deleted file mode 100644 index f469d4810..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitOperand.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; - -public class InstallableUnitOperand extends Operand { - private final IInstallableUnit first; - private final IInstallableUnit second; - - /** - * Creates a new operand that represents replacing an installable unit - * with another. At least one of the provided installable units must be - * non-null. - * - * @param first The installable unit being removed, or <code>null</code> - * @param second The installable unit being added, or <code>null</code> - */ - public InstallableUnitOperand(IInstallableUnit first, IInstallableUnit second) { - //the operand must have at least one non-null units - Assert.isTrue(first != null || second != null); - this.first = first; - this.second = second; - } - - public IInstallableUnit first() { - return first; - } - - public IInstallableUnit second() { - return second; - } - - public String toString() { - return first + " --> " + second; //$NON-NLS-1$ - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitPhase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitPhase.java deleted file mode 100644 index 8766ffdc0..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitPhase.java +++ /dev/null @@ -1,120 +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; - -import java.util.*; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.equinox.internal.p2.engine.InstructionParser; -import org.eclipse.equinox.internal.provisional.p2.metadata.*; - -public abstract class InstallableUnitPhase extends Phase { - public static final String PARM_ARTIFACT = "artifact"; //$NON-NLS-1$ - public static final String PARM_IU = "iu"; //$NON-NLS-1$ - public static final String PARM_INSTALL_FOLDER = "installFolder"; //$NON-NLS-1$ - - protected InstallableUnitPhase(String phaseId, int weight, boolean forced) { - super(phaseId, weight, forced); - } - - protected InstallableUnitPhase(String phaseId, int weight) { - this(phaseId, weight, false); - } - - protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - parameters.put(PARM_INSTALL_FOLDER, profile.getProperty(IProfile.PROP_INSTALL_FOLDER)); - return super.initializePhase(monitor, profile, parameters); - } - - protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { - InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - mergeStatus(status, initializeOperand(profile, iuOperand, parameters, monitor)); - IInstallableUnit unit = (IInstallableUnit) parameters.get(PARM_IU); - if (unit != null) { - Touchpoint touchpoint = getActionManager().getTouchpointPoint(unit.getTouchpointType()); - if (touchpoint != null) { - parameters.put(PARM_TOUCHPOINT, touchpoint); - } - } - mergeStatus(status, super.initializeOperand(profile, operand, parameters, monitor)); - return status; - } - - protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - return Status.OK_STATUS; - } - - protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { - InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; - - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - mergeStatus(status, super.completeOperand(profile, iuOperand, parameters, monitor)); - mergeStatus(status, completeOperand(profile, iuOperand, parameters, monitor)); - return status; - } - - protected IStatus completeOperand(IProfile profile, InstallableUnitOperand operand, Map parameters, IProgressMonitor monitor) { - return Status.OK_STATUS; - } - - final protected ProvisioningAction[] getActions(Operand operand) { - if (!(operand instanceof InstallableUnitOperand)) - return null; - - InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; - return getActions(iuOperand); - } - - protected abstract ProvisioningAction[] getActions(InstallableUnitOperand operand); - - final public boolean isApplicable(Operand operand) { - if (!(operand instanceof InstallableUnitOperand)) - return false; - - InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand; - return isApplicable(iuOperand); - } - - protected boolean isApplicable(InstallableUnitOperand operand) { - return true; - } - - protected final ProvisioningAction[] getActions(IInstallableUnit unit, String key) { - ITouchpointInstruction[] instructions = getInstructions(unit, key); - if (instructions == null || instructions.length == 0) - return null; - - List actions = new ArrayList(); - InstructionParser instructionParser = new InstructionParser(getActionManager()); - for (int i = 0; i < instructions.length; i++) { - actions.addAll(Arrays.asList(instructionParser.parseActions(instructions[i], unit.getTouchpointType()))); - } - return (ProvisioningAction[]) actions.toArray(new ProvisioningAction[actions.size()]); - } - - private final static ITouchpointInstruction[] getInstructions(IInstallableUnit unit, String key) { - ITouchpointData[] data = unit.getTouchpointData(); - if (data == null) - return null; - - ArrayList matches = new ArrayList(data.length); - for (int i = 0; i < data.length; i++) { - ITouchpointInstruction instructions = data[i].getInstruction(key); - if (instructions != null) - matches.add(instructions); - } - - ITouchpointInstruction[] result = (ITouchpointInstruction[]) matches.toArray(new ITouchpointInstruction[matches.size()]); - return result; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitPropertyOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitPropertyOperand.java deleted file mode 100644 index 0e299f187..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/InstallableUnitPropertyOperand.java +++ /dev/null @@ -1,43 +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; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; - -public class InstallableUnitPropertyOperand extends PropertyOperand { - private final IInstallableUnit iu; - - /** - * Creates a new operand that represents replacing a property value associated - * with an IU with another. At least one of the provided property values must be - * non-null. - * - * @param iu The IInstallableUnit with which the property is associated - * @param key The key of the property being modified - * @param first The property value being removed, or <code>null</code> - * @param second The property value being added, or <code>null</code> - */ - public InstallableUnitPropertyOperand(IInstallableUnit iu, String key, Object first, Object second) { - super(key, first, second); - //the iu must be specified. - Assert.isTrue(iu != null); - this.iu = iu; - } - - public IInstallableUnit getInstallableUnit() { - return iu; - } - - public String toString() { - return "[IInstallableUnit property for " + iu.toString() + "] " + super.toString(); //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Memento.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Memento.java deleted file mode 100644 index eb4c15330..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Memento.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import java.util.*; - -public class Memento { - private static final long serialVersionUID = 3257399736837461585L; - private static final Collection simples = Arrays.asList(new Class[] {String.class, Integer.class, Long.class, Float.class, Double.class, Byte.class, Short.class, Character.class, Boolean.class}); - private static final Collection simpleArrays = Arrays.asList(new Class[] {String[].class, Integer[].class, Long[].class, Float[].class, Double[].class, Byte[].class, Short[].class, Character[].class, Boolean[].class}); - private static final Collection primitiveArrays = Arrays.asList(new Class[] {long[].class, int[].class, short[].class, char[].class, byte[].class, double[].class, float[].class, boolean[].class}); - - Map mementoMap = new HashMap(); - - public Object remove(String key) { - if (key == null) - throw new NullPointerException(); - - // TODO: persist change - return mementoMap.remove(key); - } - - public Object put(String key, Object value) { - if (key == null) - throw new NullPointerException(); - - validateValue(value); - - // TODO: persist change - return mementoMap.put(key, value); - } - - public Object get(String key) { - if (key == null) - throw new NullPointerException(); - - return mementoMap.get(key); - } - - public Enumeration getKeys() { - return new Enumeration() { - Iterator keysIterator = mementoMap.keySet().iterator(); - - public boolean hasMoreElements() { - return keysIterator.hasNext(); - } - - public Object nextElement() { - return keysIterator.next(); - } - }; - } - - private static void validateValue(Object value) { - if (value == null) - return; - - Class clazz = value.getClass(); - - if (simples.contains(clazz)) - return; - - if (simpleArrays.contains(clazz) || primitiveArrays.contains(clazz)) - return; - - throw new IllegalArgumentException(clazz.getName()); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Messages.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Messages.java deleted file mode 100644 index b4aef5af8..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Messages.java +++ /dev/null @@ -1,67 +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; - -import org.eclipse.osgi.util.NLS; - -//TODO Shouldn't have messages class in API package -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.provisional.p2.engine.messages"; //$NON-NLS-1$ - public static String CertificateChecker_CertificateError; - public static String CertificateChecker_CertificateRejected; - public static String CertificateChecker_KeystoreConnectionError; - public static String CertificateChecker_SignedContentIOError; - public static String CertificateChecker_SignedContentError; - public static String CertificateChecker_UnsignedNotAllowed; - public static String not_current_phase; - public static String null_operands; - public static String null_phase; - public static String null_phases; - public static String null_phaseset; - public static String null_profile; - public static String phase_error; - public static String phase_not_started; - public static String phase_started; - public static String phaseid_not_positive; - public static String phaseid_not_set; - public static String Engine_Operation_Canceled_By_User; - public static String InstallableUnitEvent_type_not_install_or_uninstall; - public static String touchpoint_prepare_error; - public static String touchpoint_commit_error; - public static String touchpoint_rollback_error; - public static String phase_undo_error; - public static String phase_undo_operand_error; - public static String session_prepare_error; - public static String session_commit_error; - public static String null_operand; - public static String operand_started; - public static String operand_not_started; - public static String not_current_operand; - public static String null_action; - public static String session_context; - public static String action_not_found; - public static String actions_not_found; - public static String preparing; - public static String committing; - public static String rollingback_cancel; - public static String rollingback_error; - public static String action_undo_error; - public static String forced_action_execute_error; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - // - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/MissingAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/MissingAction.java deleted file mode 100644 index b8bfe06b9..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/MissingAction.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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; - -import org.eclipse.equinox.internal.provisional.p2.metadata.VersionRange; - -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; - -public class MissingAction extends ProvisioningAction { - - private String actionId; - private VersionRange versionRange; - - public MissingAction(String actionId, VersionRange versionRange) { - this.actionId = actionId; - this.versionRange = versionRange; - } - - public String getActionId() { - return actionId; - } - - public VersionRange getVersionRange() { - return versionRange; - } - - public IStatus execute(Map parameters) { - throw new IllegalArgumentException(NLS.bind(Messages.action_not_found, actionId + (versionRange == null ? "" : "/" + versionRange.toString()))); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public IStatus undo(Map parameters) { - // do nothing as we want this action to undo successfully - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/MissingActionsException.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/MissingActionsException.java deleted file mode 100644 index 0c68603df..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/MissingActionsException.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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; - -import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; -import org.eclipse.osgi.util.NLS; - -public class MissingActionsException extends ProvisionException { - - private static final long serialVersionUID = 8617693596359747490L; - private final MissingAction[] missingActions; - - public MissingActionsException(MissingAction[] missingActions) { - super(getMissingActionsMessage(missingActions)); - this.missingActions = missingActions; - } - - private static String getMissingActionsMessage(MissingAction[] missingActions) { - - if (missingActions.length == 0) - throw new IllegalArgumentException("Bad exception: No missing actions"); //$NON-NLS-1$ - - StringBuffer buffer = new StringBuffer(); - for (int i = 0; i < missingActions.length; i++) { - MissingAction missingAction = missingActions[i]; - buffer.append(missingAction.getActionId()); - if (missingAction.getVersionRange() != null) { - buffer.append("/"); //$NON-NLS-1$ - buffer.append(missingAction.getVersionRange().toString()); - } - if (i + 1 != missingActions.length) - buffer.append(", "); //$NON-NLS-1$ - } - - return NLS.bind(Messages.actions_not_found, buffer.toString()); - } - - public MissingAction[] getMissingActions() { - return missingActions; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Operand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Operand.java deleted file mode 100644 index fa7b27807..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Operand.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -/** - * The common base class for engine operands. - * - * @see IEngine#perform(IProfile, PhaseSet, Operand[], ProvisioningContext, org.eclipse.core.runtime.IProgressMonitor) - */ -public class Operand { - // marker class -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Phase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Phase.java deleted file mode 100644 index 1262df290..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Phase.java +++ /dev/null @@ -1,318 +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; - -import java.util.*; -import java.util.Map.Entry; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.helpers.LogHelper; -import org.eclipse.equinox.internal.p2.engine.ActionManager; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.osgi.util.NLS; - -public abstract class Phase { - protected static final String PARM_OPERAND = "operand"; //$NON-NLS-1$ - protected static final String PARM_PHASE_ID = "phaseId"; //$NON-NLS-1$ - protected static final String PARM_PROFILE = "profile"; //$NON-NLS-1$ - protected static final String PARM_PROFILE_DATA_DIRECTORY = "profileDataDirectory"; //$NON-NLS-1$ - protected static final String PARM_CONTEXT = "context"; //$NON-NLS-1$ - protected static final String PARM_FORCED = "forced"; //$NON-NLS-1$ - protected static final String PARM_TOUCHPOINT = "touchpoint"; //$NON-NLS-1$ - - protected final String phaseId; - protected final int weight; - protected final boolean forced; - protected int prePerformWork = 1000; - protected int mainPerformWork = 10000; - protected int postPerformWork = 1000; - private Map operandParameters = null; - private Map phaseParameters = new HashMap(); - private Map touchpointToTouchpointPhaseParameters = new HashMap(); - private Map touchpointToTouchpointOperandParameters = new HashMap(); - ActionManager actionManager; // injected from phaseset - - protected Phase(String phaseId, int weight, boolean forced) { - if (phaseId == null || phaseId.length() == 0) - throw new IllegalArgumentException(Messages.phaseid_not_set); - if (weight <= 0) - throw new IllegalArgumentException(Messages.phaseid_not_positive); - this.weight = weight; - this.phaseId = phaseId; - this.forced = forced; - } - - protected Phase(String phaseId, int weight) { - this(phaseId, weight, false); - } - - final protected ActionManager getActionManager() { - return actionManager; - } - - public String toString() { - return getClass().getName() + " - " + this.weight; //$NON-NLS-1$ - } - - public final void perform(MultiStatus status, EngineSession session, IProfile profile, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) { - SubMonitor subMonitor = SubMonitor.convert(monitor, prePerformWork + mainPerformWork + postPerformWork); - session.recordPhaseEnter(this); - prePerform(status, session, profile, context, subMonitor.newChild(prePerformWork)); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - session.recordPhaseStart(this); - - subMonitor.setWorkRemaining(mainPerformWork + postPerformWork); - mainPerform(status, session, profile, operands, context, subMonitor.newChild(mainPerformWork)); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - - session.recordPhaseEnd(this); - subMonitor.setWorkRemaining(postPerformWork); - postPerform(status, profile, context, subMonitor.newChild(postPerformWork)); - phaseParameters.clear(); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - session.recordPhaseExit(this); - subMonitor.done(); - } - - void prePerform(MultiStatus status, EngineSession session, IProfile profile, ProvisioningContext context, IProgressMonitor monitor) { - phaseParameters.put(PARM_PROFILE, profile); - phaseParameters.put(PARM_PROFILE_DATA_DIRECTORY, session.getProfileDataDirectory()); - phaseParameters.put(PARM_CONTEXT, context); - phaseParameters.put(PARM_PHASE_ID, phaseId); - phaseParameters.put(PARM_FORCED, Boolean.toString(forced)); - mergeStatus(status, initializePhase(monitor, profile, phaseParameters)); - } - - private void mainPerform(MultiStatus status, EngineSession session, IProfile profile, Operand[] operands, ProvisioningContext context, SubMonitor subMonitor) { - subMonitor.beginTask("", operands.length); //$NON-NLS-1$ - for (int i = 0; i < operands.length; i++) { - subMonitor.setWorkRemaining(operands.length - i); - if (subMonitor.isCanceled()) - throw new OperationCanceledException(); - Operand operand = operands[i]; - if (!isApplicable(operand)) - continue; - - session.recordOperandStart(operand); - ProvisioningAction[] actions = getActions(operand); - operandParameters = new HashMap(phaseParameters); - operandParameters.put(PARM_OPERAND, operand); - mergeStatus(status, initializeOperand(profile, operand, operandParameters, subMonitor)); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) { - operandParameters = null; - return; - } - - Touchpoint operandTouchpoint = (Touchpoint) operandParameters.get(PARM_TOUCHPOINT); - if (operandTouchpoint != null) { - mergeStatus(status, initializeTouchpointParameters(profile, operand, operandTouchpoint, subMonitor)); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - - operandParameters = (Map) touchpointToTouchpointOperandParameters.get(operandTouchpoint); - } - - operandParameters = Collections.unmodifiableMap(operandParameters); - if (actions != null) { - for (int j = 0; j < actions.length; j++) { - ProvisioningAction action = actions[j]; - Map parameters = operandParameters; - Touchpoint touchpoint = action.getTouchpoint(); - if (touchpoint != null) { - mergeStatus(status, initializeTouchpointParameters(profile, operand, touchpoint, subMonitor)); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - - parameters = (Map) touchpointToTouchpointOperandParameters.get(touchpoint); - } - IStatus actionStatus = null; - try { - session.recordActionExecute(action, parameters); - actionStatus = action.execute(parameters); - } catch (RuntimeException e) { - if (!forced) - throw e; - // "action.execute" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - actionStatus = new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.forced_action_execute_error, action.getClass().getName()), e); - } catch (LinkageError e) { - if (!forced) - throw e; - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - actionStatus = new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.forced_action_execute_error, action.getClass().getName()), e); - } - if (forced && actionStatus != null && actionStatus.matches(IStatus.ERROR)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, getProblemMessage(), null); - result.add(new Status(IStatus.ERROR, EngineActivator.ID, session.getContextString(this, operand, action), null)); - LogHelper.log(result); - actionStatus = Status.OK_STATUS; - } - mergeStatus(status, actionStatus); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - } - } - mergeStatus(status, touchpointCompleteOperand(profile, operand, operandParameters, subMonitor)); - mergeStatus(status, completeOperand(profile, operand, operandParameters, subMonitor)); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - operandParameters = null; - session.recordOperandEnd(operand); - subMonitor.worked(1); - } - } - - private IStatus initializeTouchpointParameters(IProfile profile, Operand operand, Touchpoint touchpoint, IProgressMonitor monitor) { - if (touchpointToTouchpointOperandParameters.containsKey(touchpoint)) - return Status.OK_STATUS; - - Map touchpointPhaseParameters = (Map) touchpointToTouchpointPhaseParameters.get(touchpoint); - if (touchpointPhaseParameters == null) { - touchpointPhaseParameters = new HashMap(phaseParameters); - IStatus status = touchpoint.initializePhase(monitor, profile, phaseId, touchpointPhaseParameters); - if (status != null && status.matches(IStatus.ERROR | IStatus.CANCEL)) - return status; - touchpointToTouchpointPhaseParameters.put(touchpoint, touchpointPhaseParameters); - } - - Map touchpointOperandParameters = new HashMap(touchpointPhaseParameters); - touchpointOperandParameters.putAll(operandParameters); - IStatus status = touchpoint.initializeOperand(profile, operand, touchpointOperandParameters); - if (status != null && status.matches(IStatus.ERROR | IStatus.CANCEL)) - return status; - touchpointToTouchpointOperandParameters.put(touchpoint, touchpointOperandParameters); - return Status.OK_STATUS; - } - - /** - * Merges a given IStatus into a MultiStatus - */ - protected static void mergeStatus(MultiStatus multi, IStatus status) { - if (status != null && !status.isOK()) - multi.merge(status); - } - - void postPerform(MultiStatus status, IProfile profile, ProvisioningContext context, IProgressMonitor monitor) { - mergeStatus(status, touchpointCompletePhase(monitor, profile, phaseParameters)); - mergeStatus(status, completePhase(monitor, profile, phaseParameters)); - } - - void undo(MultiStatus status, EngineSession session, IProfile profile, Operand operand, ProvisioningAction[] actions, ProvisioningContext context) { - if (operandParameters == null) { - operandParameters = new HashMap(phaseParameters); - operandParameters.put(PARM_OPERAND, operand); - mergeStatus(status, initializeOperand(profile, operand, operandParameters, new NullProgressMonitor())); - Touchpoint operandTouchpoint = (Touchpoint) operandParameters.get(PARM_TOUCHPOINT); - if (operandTouchpoint != null) { - mergeStatus(status, initializeTouchpointParameters(profile, operand, operandTouchpoint, new NullProgressMonitor())); - if (status.matches(IStatus.ERROR | IStatus.CANCEL)) - return; - - operandParameters = (Map) touchpointToTouchpointOperandParameters.get(operandTouchpoint); - } - operandParameters = Collections.unmodifiableMap(operandParameters); - } - for (int j = 0; j < actions.length; j++) { - ProvisioningAction action = actions[j]; - Map parameters = operandParameters; - Touchpoint touchpoint = action.getTouchpoint(); - if (touchpoint != null) { - mergeStatus(status, initializeTouchpointParameters(profile, operand, touchpoint, new NullProgressMonitor())); - if (status.matches(IStatus.ERROR)) - return; - - parameters = (Map) touchpointToTouchpointOperandParameters.get(touchpoint); - } - IStatus actionStatus = null; - try { - session.recordActionUndo(action, parameters); - actionStatus = action.undo(parameters); - } catch (RuntimeException e) { - // "action.undo" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - actionStatus = new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.action_undo_error, action.getClass().getName()), e); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - actionStatus = new Status(IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.action_undo_error, action.getClass().getName()), e); - } - if (actionStatus != null && actionStatus.matches(IStatus.ERROR)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, getProblemMessage(), null); - result.add(new Status(IStatus.ERROR, EngineActivator.ID, session.getContextString(this, operand, action), null)); - result.merge(actionStatus); - } - } - mergeStatus(status, touchpointCompleteOperand(profile, operand, operandParameters, new NullProgressMonitor())); - mergeStatus(status, completeOperand(profile, operand, operandParameters, new NullProgressMonitor())); - operandParameters = null; - } - - public boolean isApplicable(Operand operand) { - return true; - } - - protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - return Status.OK_STATUS; - } - - protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - return Status.OK_STATUS; - } - - IStatus touchpointCompletePhase(IProgressMonitor monitor, IProfile profile, Map parameters) { - if (touchpointToTouchpointPhaseParameters.isEmpty()) - return Status.OK_STATUS; - - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - for (Iterator it = touchpointToTouchpointPhaseParameters.entrySet().iterator(); it.hasNext();) { - Entry entry = (Entry) it.next(); - Touchpoint touchpoint = (Touchpoint) entry.getKey(); - Map touchpointParameters = (Map) entry.getValue(); - mergeStatus(status, touchpoint.completePhase(monitor, profile, phaseId, touchpointParameters)); - } - touchpointToTouchpointPhaseParameters.clear(); - return status; - } - - protected IStatus completeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { - return Status.OK_STATUS; - } - - IStatus touchpointCompleteOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { - if (touchpointToTouchpointOperandParameters.isEmpty()) - return Status.OK_STATUS; - - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - for (Iterator it = touchpointToTouchpointOperandParameters.entrySet().iterator(); it.hasNext();) { - Entry entry = (Entry) it.next(); - Touchpoint touchpoint = (Touchpoint) entry.getKey(); - Map touchpointParameters = (Map) entry.getValue(); - mergeStatus(status, touchpoint.completeOperand(profile, operand, touchpointParameters)); - } - touchpointToTouchpointOperandParameters.clear(); - return status; - } - - protected IStatus initializeOperand(IProfile profile, Operand operand, Map parameters, IProgressMonitor monitor) { - return Status.OK_STATUS; - } - - protected abstract ProvisioningAction[] getActions(Operand operand); - - /** - * Returns a human-readable message to be displayed in case of an error performing - * this phase. Subclasses should override. - */ - protected String getProblemMessage() { - return NLS.bind(Messages.phase_error, getClass().getName()); - } -} 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 deleted file mode 100644 index 2c24a2fb0..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PhaseSet.java +++ /dev/null @@ -1,151 +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; - -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.engine.ActionManager; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.osgi.util.NLS; - -public abstract class PhaseSet { - private final Phase[] phases; - - public PhaseSet(Phase[] phases) { - if (phases == null) - throw new IllegalArgumentException(Messages.null_phases); - - this.phases = phases; - } - - public final MultiStatus perform(ActionManager actionManager, EngineSession session, IProfile profile, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) { - MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null); - int[] weights = getProgressWeights(operands); - int totalWork = getTotalWork(weights); - SubMonitor pm = SubMonitor.convert(monitor, totalWork); - try { - for (int i = 0; i < phases.length; i++) { - if (pm.isCanceled()) { - status.add(Status.CANCEL_STATUS); - return status; - } - Phase phase = phases[i]; - phase.actionManager = actionManager; - try { - phase.perform(status, session, profile, operands, context, pm.newChild(weights[i])); - } catch (OperationCanceledException e) { - // propagate operation cancellation - status.add(new Status(IStatus.CANCEL, EngineActivator.ID, e.getMessage(), e)); - } catch (RuntimeException e) { - // "perform" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - status.add(new Status(IStatus.ERROR, EngineActivator.ID, e.getMessage(), e)); - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - status.add(new Status(IStatus.ERROR, EngineActivator.ID, e.getMessage(), e)); - } finally { - phase.actionManager = null; - } - if (status.matches(IStatus.CANCEL)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.CANCEL, Messages.Engine_Operation_Canceled_By_User, null); - result.merge(status); - return result; - } else if (status.matches(IStatus.ERROR)) { - MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, phase.getProblemMessage(), null); - result.add(new Status(IStatus.ERROR, EngineActivator.ID, session.getContextString(), null)); - result.merge(status); - return result; - } - } - } finally { - pm.done(); - } - return status; - } - - public final IStatus validate(ActionManager actionManager, IProfile profile, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) { - Set missingActions = new HashSet(); - for (int i = 0; i < phases.length; i++) { - Phase phase = phases[i]; - phase.actionManager = actionManager; - try { - for (int j = 0; j < operands.length; j++) { - Operand operand = operands[j]; - try { - if (!phase.isApplicable(operand)) - continue; - - ProvisioningAction[] actions = phase.getActions(operand); - if (actions == null) - continue; - for (int k = 0; k < actions.length; k++) { - ProvisioningAction action = actions[k]; - if (action instanceof MissingAction) - missingActions.add(action); - } - } catch (RuntimeException e) { - // "perform" calls user code and might throw an unchecked exception - // we catch the error here to gather information on where the problem occurred. - return new Status(IStatus.ERROR, EngineActivator.ID, e.getMessage() + " " + getContextString(profile, phase, operand), e); //$NON-NLS-1$ - } catch (LinkageError e) { - // Catch linkage errors as these are generally recoverable but let other Errors propagate (see bug 222001) - return new Status(IStatus.ERROR, EngineActivator.ID, e.getMessage() + " " + getContextString(profile, phase, operand), e); //$NON-NLS-1$ - } - } - } finally { - phase.actionManager = null; - } - } - if (!missingActions.isEmpty()) { - MissingAction[] missingActionsArray = (MissingAction[]) missingActions.toArray(new MissingAction[missingActions.size()]); - MissingActionsException exception = new MissingActionsException(missingActionsArray); - return (new Status(IStatus.ERROR, EngineActivator.ID, exception.getMessage(), exception)); - } - return Status.OK_STATUS; - } - - private String getContextString(IProfile profile, Phase phase, Operand operand) { - return NLS.bind(Messages.session_context, new Object[] {profile.getProfileId(), phase.getClass().getName(), operand.toString(), ""}); //$NON-NLS-1$ - } - - private int getTotalWork(int[] weights) { - int sum = 0; - for (int i = 0; i < weights.length; i++) - sum += weights[i]; - return sum; - } - - private int[] getProgressWeights(Operand[] operands) { - int[] weights = new int[phases.length]; - for (int i = 0; i < phases.length; i += 1) { - if (operands.length > 0) - //alter weights according to the number of operands applicable to that phase - weights[i] = (phases[i].weight * countApplicable(phases[i], operands) / operands.length); - else - weights[i] = phases[i].weight; - } - return weights; - } - - private int countApplicable(Phase phase, Operand[] operands) { - int count = 0; - for (int i = 0; i < operands.length; i++) { - if (phase.isApplicable(operands[i])) - count++; - } - return count; - } - - public Phase[] getPhases() { - return phases; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProfileEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProfileEvent.java deleted file mode 100644 index d96796f2f..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProfileEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import java.util.EventObject; - -/** - * @noextend This class is not intended to be subclassed by clients. - */ -public class ProfileEvent extends EventObject { - private static final long serialVersionUID = 3082402920617281765L; - - public static final byte ADDED = 0; - public static final byte REMOVED = 1; - public static final byte CHANGED = 2; - - private byte reason; - - public ProfileEvent(String profileId, byte reason) { - super(profileId); - this.reason = reason; - } - - public byte getReason() { - return reason; - } - - public String getProfileId() { - return (String) getSource(); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProfileScope.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProfileScope.java deleted file mode 100644 index 70d72d639..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProfileScope.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 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; - -import org.eclipse.core.internal.preferences.PreferencesService; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.IScopeContext; - -public final class ProfileScope implements IScopeContext { - - /* - * String constant (value of <code>"profile"</code>) used for the - * scope name for this preference scope. - */ - public static final String SCOPE = "profile"; //$NON-NLS-1$ - - private String profileId; - - /* - * Create and return a new profile scope for the given profile. The given - * profile must not be null. - */ - public ProfileScope(String profileId) { - super(); - if (profileId == null) - throw new IllegalArgumentException(); - this.profileId = profileId; - } - - public IPath getLocation() { - // Null returned as the location should only be used when the profile is locked - return null; - } - - public String getName() { - return SCOPE; - } - - /* - * Default path hierarchy for profile nodes is /profile/<profileId>/<qualifier>. - * - * @see org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String) - */ - public IEclipsePreferences getNode(String qualifier) { - if (qualifier == null) - throw new IllegalArgumentException(); - return (IEclipsePreferences) PreferencesService.getDefault().getRootNode().node(getName()).node(profileId).node(qualifier); - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (!(obj instanceof ProfileScope)) - return false; - ProfileScope other = (ProfileScope) obj; - return profileId.equals(other.profileId); - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return super.hashCode() + profileId.hashCode(); - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PropertyOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PropertyOperand.java deleted file mode 100644 index 24c536e66..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/PropertyOperand.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import org.eclipse.core.runtime.Assert; - -public class PropertyOperand extends Operand { - private final Object first; - private final Object second; - private final String key; - - /** - * Creates a new operand that represents replacing a property value - * with another. At least one of the provided property values must be - * non-null. - * - * @param key The key of the property being modified - * @param first The property value being removed, or <code>null</code> - * @param second The property value being added, or <code>null</code> - */ - public PropertyOperand(String key, Object first, Object second) { - //the operand must specify have a key and have at least one non-null value - Assert.isTrue(key != null && (first != null || second != null)); - this.first = first; - this.second = second; - this.key = key; - } - - public Object first() { - return first; - } - - public Object second() { - return second; - } - - public String getKey() { - return key; - } - - public String toString() { - return key + " = " + first + " --> " + second; //$NON-NLS-1$ //$NON-NLS-2$ - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProvisioningAction.java deleted file mode 100644 index dc1b05224..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProvisioningAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import java.util.Map; -import org.eclipse.core.runtime.IStatus; - -public abstract class ProvisioningAction { - - private Memento memento = new Memento(); - private Touchpoint touchpoint; - - protected Memento getMemento() { - return memento; - } - - public abstract IStatus execute(Map parameters); - - public abstract IStatus undo(Map parameters); - - // TODO: these probably should not be visible - public void setTouchpoint(Touchpoint touchpoint) { - this.touchpoint = touchpoint; - } - - public Touchpoint getTouchpoint() { - return touchpoint; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProvisioningContext.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProvisioningContext.java deleted file mode 100644 index 5e021c3d6..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/ProvisioningContext.java +++ /dev/null @@ -1,77 +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 - * WindRiver - https://bugs.eclipse.org/bugs/show_bug.cgi?id=227372 - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import java.net.URI; -import java.util.*; - -public class ProvisioningContext { - private URI[] metadataRepositories; //metadata repositories to consult - private URI[] artifactRepositories; //artifact repositories to consult - private Properties properties = new Properties(); - private List extraIUs = new ArrayList(); - private Collection additionalRequirements; - - public ProvisioningContext() { - // null repos means look at them all - metadataRepositories = null; - artifactRepositories = null; - } - - public ProvisioningContext(URI[] metadataRepositories) { - this.metadataRepositories = metadataRepositories; - } - - /** - * Artifact repositories to consult when performing an operation. - * @param artifactRepositories array of URLs - */ - public void setArtifactRepositories(URI[] artifactRepositories) { - this.artifactRepositories = artifactRepositories; - } - - public URI[] getMetadataRepositories() { - return metadataRepositories; - } - - public URI[] getArtifactRepositories() { - return artifactRepositories; - } - - public String getProperty(String key) { - return properties.getProperty(key); - } - - public void setProperty(String key, String value) { - properties.setProperty(key, value); - } - - public Properties getProperties() { - return properties; - } - - public List getExtraIUs() { - return extraIUs; - } - - public void setExtraIUs(List extraIUs) { - this.extraIUs = extraIUs; - } - - public void setAdditionalRequirements(Collection requirements) { - additionalRequirements = requirements; - } - - public Collection getAdditionalRequirements() { - return additionalRequirements; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/RollbackOperationEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/RollbackOperationEvent.java deleted file mode 100644 index 4d0032cba..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/RollbackOperationEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import org.eclipse.core.runtime.IStatus; - -public class RollbackOperationEvent extends TransactionEvent { - - private static final long serialVersionUID = -2076492953949691215L; - private IStatus cause; - - public RollbackOperationEvent(IProfile profile, PhaseSet phaseSet, Operand[] operands, IEngine engine, IStatus cause) { - super(profile, phaseSet, operands, engine); - this.cause = cause; - } - - public IStatus getStatus() { - return cause; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Touchpoint.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Touchpoint.java deleted file mode 100644 index 4cc43fbd7..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/Touchpoint.java +++ /dev/null @@ -1,54 +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; - -import java.util.Map; -import org.eclipse.core.runtime.*; - -/** - * A touchpoint is responsible for executing a given phase for a given - * targeted system (eclipse, native). The order of phases is defined in the {@link PhaseSet}. - */ -public abstract class Touchpoint { - - /** NOT API -- this is for backwards compatibility only */ - public String qualifyAction(String actionId) { - return actionId; - } - - public IStatus initializePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) { - return Status.OK_STATUS; - } - - public IStatus completePhase(IProgressMonitor monitor, IProfile profile, String phaseId, Map touchpointParameters) { - return Status.OK_STATUS; - } - - public IStatus initializeOperand(IProfile profile, Operand operand, Map parameters) { - return Status.OK_STATUS; - } - - public IStatus completeOperand(IProfile profile, Operand operand, Map parameters) { - return Status.OK_STATUS; - } - - public IStatus prepare(IProfile profile) { - return Status.OK_STATUS; - } - - public IStatus commit(IProfile profile) { - return Status.OK_STATUS; - } - - public IStatus rollback(IProfile profile) { - return Status.OK_STATUS; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/TransactionEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/TransactionEvent.java deleted file mode 100644 index efb574f7d..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/TransactionEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine; - -import java.util.EventObject; - -public abstract class TransactionEvent extends EventObject { - private static final long serialVersionUID = 6278706971855493984L; - protected IProfile profile; - protected PhaseSet phaseSet; - protected Operand[] operands; - - public TransactionEvent(IProfile profile, PhaseSet phaseSet, Operand[] operands, IEngine engine) { - super(engine); - this.profile = profile; - this.phaseSet = phaseSet; - this.operands = operands; - } - - public IProfile getProfile() { - return profile; - } -} diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/messages.properties b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/messages.properties deleted file mode 100644 index 364307adc..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/messages.properties +++ /dev/null @@ -1,51 +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 -############################################################################### -action_not_found=No action found for: {0}. -action_undo_error=An error occurred while rolling back the engine operation while undoing the {0} action. -forced_action_execute_error=An error occurred while performing the engine operation while executing the {0} action in forced mode. The operation will continue. -actions_not_found=No actions found for: {0}. -not_current_phase=Current phase does not match argument. -null_operands=Operands must not be null. -null_phase=Phase must not be null. -null_phases=Phases must not be null -null_phaseset=PhaseSet must not be null. -null_profile=Profile must not be null. -touchpoint_prepare_error=An error occurred while preparing the engine operation for the {0} touchpoint. -touchpoint_commit_error=An error occurred while committing the engine operation for the {0} touchpoint. -touchpoint_rollback_error=An error occurred while rolling back the engine operation for the {0} touchpoint. -phase_error=An error occurred during the {0} phase. -phase_undo_error=An error occurred while undoing the {0} phase. -phase_undo_operand_error=An error occurred while undoing the {0} phase for operand {1}. -phase_not_started=There is no phase to end. -phase_started=A phase is already started. -phaseid_not_positive=Phase weight must be positive. -phaseid_not_set=Phase id must be set. -session_prepare_error=An error occurred while preparing the engine session for profile: {0}. -session_commit_error=An error occurred while committing the engine session for profile: {0}. -null_operand=Operand must not be null. -operand_started=An operand is already started. -operand_not_started=There is no operand to end. -not_current_operand=Current operand does not match argument. -null_action=Action must not be null -session_context=session context was:(profile={0}, phase={1}, operand={2}, action={3}). -preparing=Preparing to commit the provisioning operation. -committing=Committing the provisioning operation. -rollingback_error=An error was detected while performing the engine operation and the changes are being rolled back. See the log for details. -rollingback_cancel=The engine operation was cancelled and the changes are being rolled back. - -Engine_Operation_Canceled_By_User=Operation canceled by the user. -InstallableUnitEvent_type_not_install_or_uninstall=type must be either UNINSTALL(0) or INSTALL(1) -CertificateChecker_CertificateError=An invalid certificate was found. -CertificateChecker_CertificateRejected=One or more certificates rejected. Cannot proceed with installation. -CertificateChecker_KeystoreConnectionError=Cannot connect to keystore. -CertificateChecker_SignedContentError=Error with signed content. -CertificateChecker_SignedContentIOError=Error reading signed content. -CertificateChecker_UnsignedNotAllowed=Installing unsigned artifacts is not permitted: {0} 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 28445c322..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/CheckTrust.java +++ /dev/null @@ -1,78 +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 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.IInstallableUnit; -import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; - -/** - * 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 = "checkTrust"; //$NON-NLS-1$ - 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); - - // Instantiate a check trust manager - CertificateChecker certificateChecker = new CertificateChecker(); - 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 c0fc59c5e..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Collect.java +++ /dev/null @@ -1,80 +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 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.artifact.repository.IArtifactRequest; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; - -/** - * 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 = "collect"; //$NON-NLS-1$ - 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); - - DownloadManager dm = new DownloadManager(context); - 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 78e7f2529..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Configure.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.equinox.internal.provisional.p2.engine.phases; - -import java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; -import org.eclipse.osgi.util.NLS; - -public class Configure extends InstallableUnitPhase { - - public Configure(int weight) { - super("configure", weight); //$NON-NLS-1$ - } - - 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 e0e9c0f3a..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Install.java +++ /dev/null @@ -1,120 +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 java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -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.internal.provisional.p2.metadata.IArtifactKey; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; -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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), 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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), 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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), 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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.UNINSTALL, getTouchpoint())); - return null; - } - } - - private static final String PHASE_ID = "install"; //$NON-NLS-1$ - - 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 7a2387170..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Property.java +++ /dev/null @@ -1,157 +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 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.internal.provisional.p2.metadata.IInstallableUnit; - -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 = "property"; //$NON-NLS-1$ - - 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 1145fb79a..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Sizing.java +++ /dev/null @@ -1,135 +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 java.net.URI; -import java.util.*; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*; -import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; -import org.eclipse.equinox.internal.provisional.p2.metadata.ITouchpointType; -import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager; - -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); - 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) ServiceHelper.getService(EngineActivator.getContext(), IArtifactRepositoryManager.class.getName()); - 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 2eb8eb458..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Unconfigure.java +++ /dev/null @@ -1,57 +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 java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.provisional.p2.engine.*; -import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; - -public class Unconfigure extends InstallableUnitPhase { - - public Unconfigure(int weight, boolean forced) { - super("unconfigure", weight, forced); //$NON-NLS-1$ - } - - 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 5b66522de..000000000 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/provisional/p2/engine/phases/Uninstall.java +++ /dev/null @@ -1,119 +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 java.util.Map; -import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; -import org.eclipse.equinox.internal.p2.engine.EngineActivator; -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.internal.provisional.p2.metadata.IArtifactKey; -import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit; - -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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), 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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), 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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), 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); - ((IProvisioningEventBus) ServiceHelper.getService(EngineActivator.getContext(), IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, operand, InstallableUnitEvent.INSTALL, getTouchpoint())); - return null; - } - } - - private static final String PHASE_ID = "uninstall"; //$NON-NLS-1$ - - public Uninstall(int weight, boolean forced) { - super(PHASE_ID, 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 |