| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009, 2017 IBM Corporation and others. |
| 3 |
* |
| 4 |
* This program and the accompanying materials |
| 5 |
* are made available under the terms of the Eclipse Public License 2.0 |
| 6 |
* which accompanies this distribution, and is available at |
| 7 |
* https://www.eclipse.org/legal/epl-2.0/ |
| 8 |
* |
| 9 |
* SPDX-License-Identifier: EPL-2.0 |
| 10 |
* |
| 11 |
* Contributors: |
| 12 |
* IBM Corporation - initial API and implementation |
| 13 |
*******************************************************************************/ |
| 14 |
package org.eclipse.equinox.internal.p2.engine; |
| 15 |
|
| 16 |
import org.eclipse.equinox.p2.core.IProvisioningAgent; |
| 17 |
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; |
| 18 |
import org.eclipse.equinox.p2.engine.IEngine; |
| 19 |
|
| 20 |
/** |
| 21 |
* Component that provides a factory that can create and initialize |
| 22 |
* {@link IEngine} instances. |
| 23 |
*/ |
| 24 |
public class EngineComponent implements IAgentServiceFactory { |
| 25 |
|
| 26 |
@Override |
| 27 |
public Object createService(IProvisioningAgent agent) { |
| 28 |
//ensure there is a garbage collector created for this agent if available |
| 29 |
agent.getService("org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector"); //$NON-NLS-1$ |
| 30 |
//various parts of the engine may need an open-ended set of services, so we pass the agent to the engine directly |
| 31 |
return new Engine(agent); |
| 32 |
} |
| 33 |
} |