Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.director')
-rw-r--r--bundles/org.eclipse.equinox.p2.director/OSGI-INF/director.xml8
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorComponent.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimpleDirector.java63
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/IDirector.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java43
5 files changed, 0 insertions, 198 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director/OSGI-INF/director.xml b/bundles/org.eclipse.equinox.p2.director/OSGI-INF/director.xml
deleted file mode 100644
index d4b248761..000000000
--- a/bundles/org.eclipse.equinox.p2.director/OSGI-INF/director.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.director">
- <implementation class="org.eclipse.equinox.internal.p2.director.DirectorComponent"/>
- <service>
- <provide interface="org.eclipse.equinox.p2.core.spi.IAgentServiceFactory"/>
- </service>
- <property name="p2.agent.servicename" type="String" value="org.eclipse.equinox.internal.provisional.p2.director.IDirector"/>
-</scr:component> \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorComponent.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorComponent.java
deleted file mode 100644
index 08935c47a..000000000
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/DirectorComponent.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009-2010 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
- * Sonatype, Inc. - ongoing development
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.director;
-
-import org.eclipse.equinox.p2.planner.IPlanner;
-
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
-import org.eclipse.equinox.p2.engine.IEngine;
-
-public class DirectorComponent implements IAgentServiceFactory {
-
- public Object createService(IProvisioningAgent agent) {
- IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME);
- IPlanner planner = (IPlanner) agent.getService(IPlanner.SERVICE_NAME);
- return new SimpleDirector(engine, planner);
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimpleDirector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimpleDirector.java
deleted file mode 100644
index adf0fd4a6..000000000
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/SimpleDirector.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 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
- * Sonatype, Inc. - ongoing development
- ******************************************************************************/
-package org.eclipse.equinox.internal.p2.director;
-
-import java.util.Collection;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.director.IDirector;
-import org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper;
-import org.eclipse.equinox.p2.engine.*;
-import org.eclipse.equinox.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.p2.planner.IPlanner;
-import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
-import org.eclipse.osgi.util.NLS;
-
-public class SimpleDirector implements IDirector {
- static final int PlanWork = 10;
- static final int EngineWork = 100;
- private IEngine engine;
- private IPlanner planner;
-
- public SimpleDirector(IEngine engine, IPlanner planner) {
- if (engine == null)
- throw new IllegalStateException("Provisioning engine is not registered"); //$NON-NLS-1$
- this.engine = engine;
- if (planner == null)
- throw new IllegalStateException("Unable to find provisioning planner"); //$NON-NLS-1$
- this.planner = planner;
- }
-
- public IStatus revert(IProfile currentProfile, IProfile revertProfile, ProvisioningContext context, IProgressMonitor monitor) {
- SubMonitor sub = SubMonitor.convert(monitor, Messages.Director_Task_Updating, PlanWork + EngineWork);
- try {
- IProvisioningPlan plan = planner.getDiffPlan(currentProfile, revertProfile, sub.newChild(PlanWork));
- return PlanExecutionHelper.executePlan(plan, engine, context, sub.newChild(EngineWork));
- } finally {
- sub.done();
- }
- }
-
- public IStatus provision(IProfileChangeRequest request, ProvisioningContext context, IProgressMonitor monitor) {
- String taskName = NLS.bind(Messages.Director_Task_Installing, ((ProfileChangeRequest) request).getProfile().getProperty(IProfile.PROP_INSTALL_FOLDER));
- SubMonitor sub = SubMonitor.convert(monitor, taskName, PlanWork + EngineWork);
- try {
- Collection<IInstallableUnit> installRoots = request.getAdditions();
- // mark the roots as such
- for (IInstallableUnit root : installRoots) {
- request.setInstallableUnitProfileProperty(root, IProfile.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
- }
- IProvisioningPlan plan = planner.getProvisioningPlan(request, context, sub.newChild(PlanWork));
- return PlanExecutionHelper.executePlan(plan, engine, context, sub.newChild(EngineWork));
- } finally {
- sub.done();
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/IDirector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/IDirector.java
deleted file mode 100644
index aaa13735a..000000000
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/IDirector.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 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.director;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.p2.engine.IProfile;
-import org.eclipse.equinox.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
-
-/**
- * Directors are responsible for determining what should be done to a given
- * profile to reshape it as requested. That is, given the current state of a
- * profile, a description of the desired end state of that profile and metadata
- * describing the available IUs, a director produces a list of provisioning
- * operations (e.g., install, update or uninstall) to perform on the related IUs.
- * Directors are also able to validate profiles and assist in the diagnosis of
- * configuration errors. Note that directors may range in complexity from
- * very simple (e.g., reading a list of bundles from a static file) to very complex.
- */
-public interface IDirector {
-
- /**
- * Service name constant for the director service.
- */
- public static final String SERVICE_NAME = IDirector.class.getName();
-
- /**
- * performs the change request with the given context.
- *
- * @param profileChangeRequest The change request
- * @param context The provisioning context used for finding resources
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- */
- public IStatus provision(IProfileChangeRequest profileChangeRequest, ProvisioningContext context, IProgressMonitor monitor);
-
- /**
- * Reverts the profile to a previous state described in the target revertProfile.
- *
- * @param profile The profile to revert
- * @param revertProfile The profile snapshot state to revert to
- * @param context The provisioning context used for finding resources
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- */
- public IStatus revert(IProfile profile, IProfile revertProfile, ProvisioningContext context, IProgressMonitor monitor);
-}
diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java
deleted file mode 100644
index 417806a1e..000000000
--- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/provisional/p2/director/PlanExecutionHelper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 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.director;
-
-import java.io.IOException;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.director.DirectorActivator;
-import org.eclipse.equinox.internal.p2.director.Messages;
-import org.eclipse.equinox.internal.provisional.configurator.Configurator;
-import org.eclipse.equinox.p2.engine.*;
-
-public class PlanExecutionHelper {
- public static IStatus executePlan(IProvisioningPlan result, IEngine engine, ProvisioningContext context, IProgressMonitor progress) {
- return executePlan(result, engine, PhaseSetFactory.createDefaultPhaseSet(), context, progress);
- }
-
- public static IStatus executePlan(IProvisioningPlan result, IEngine engine, IPhaseSet phaseSet, ProvisioningContext context, IProgressMonitor progress) {
- if (!result.getStatus().isOK())
- return result.getStatus();
-
- if (result.getInstallerPlan() != null) {
- IStatus installerPlanStatus = ((IEngine) result.getInstallerPlan().getProfile().getProvisioningAgent().getService(IEngine.SERVICE_NAME)).perform(result.getInstallerPlan(), phaseSet, progress);
- if (!installerPlanStatus.isOK())
- return installerPlanStatus;
- Configurator configChanger = (Configurator) ServiceHelper.getService(DirectorActivator.context, Configurator.class.getName());
- try {
- configChanger.applyConfiguration();
- } catch (IOException e) {
- return new Status(IStatus.ERROR, DirectorActivator.PI_DIRECTOR, Messages.Director_error_applying_configuration, e);
- }
- }
- return engine.perform(result, phaseSet, progress);
- }
-}

Back to the top