Eclipse Platform
Release 3.7

org.eclipse.equinox.p2.operations
Class OperationFactory

java.lang.Object
  extended by org.eclipse.equinox.p2.operations.OperationFactory

public class OperationFactory
extends Object

OperationFactory provides a set of helpers to simplify dealing with the running installation. Among other things, it simplifies the installation, un-installation and update. If the system you are trying to modify is not the running one, you need to directly use the various subclass of ProfileChangeOperation.

Since:
2.1

Constructor Summary
OperationFactory()
           
 
Method Summary
 InstallOperation createInstallOperation(Collection<IVersionedId> toInstall, Collection<URI> repos, IProgressMonitor monitor)
          This factory method creates an InstallOperation to install all the elements listed from the specified repositories.
 SynchronizeOperation createSynchronizeOperation(Collection<IVersionedId> toInstall, Collection<URI> repos, IProgressMonitor monitor)
          This factory method creates an SynchronizeOperation that will cause the current installation to exclusively contain the elements listed once executed.
 UninstallOperation createUninstallOperation(Collection<IVersionedId> toUninstall, Collection<URI> repos, IProgressMonitor monitor)
          Create an UninstallOperation that will uninstall the listed elements from the running instance.
 UpdateOperation createUpdateOperation(Collection<IVersionedId> toUpdate, Collection<URI> repos, IProgressMonitor monitor)
          Create an UpdateOperation that will update the elements specified.
 IQueryResult<IInstallableUnit> listInstalledElements(boolean rootsOnly, IProgressMonitor monitor)
          Return the IInstallableUnit that are installed in the running instance of eclipse.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationFactory

public OperationFactory()
Method Detail

createInstallOperation

public InstallOperation createInstallOperation(Collection<IVersionedId> toInstall,
                                               Collection<URI> repos,
                                               IProgressMonitor monitor)
                                        throws ProvisionException
This factory method creates an InstallOperation to install all the elements listed from the specified repositories.

Parameters:
toInstall - the elements to install. This can not be null.
repos - the repositories to install the elements from.
monitor - the progress monitor
Returns:
an operation to install
Throws:
ProvisionException

createUninstallOperation

public UninstallOperation createUninstallOperation(Collection<IVersionedId> toUninstall,
                                                   Collection<URI> repos,
                                                   IProgressMonitor monitor)
                                            throws ProvisionException
Create an UninstallOperation that will uninstall the listed elements from the running instance.

Parameters:
toUninstall - the elements to uninstall. This can not be null.
repos - the repositories to install the elements from. Passing null will
monitor - the progress monitor
Returns:
an operation to uninstall
Throws:
ProvisionException

listInstalledElements

public IQueryResult<IInstallableUnit> listInstalledElements(boolean rootsOnly,
                                                            IProgressMonitor monitor)
Return the IInstallableUnit that are installed in the running instance of eclipse.

Parameters:
rootsOnly - set to true to return only the elements that have been explicitly installed (aka roots).
monitor - the progress monitor
Returns:
the installable units installed

createUpdateOperation

public UpdateOperation createUpdateOperation(Collection<IVersionedId> toUpdate,
                                             Collection<URI> repos,
                                             IProgressMonitor monitor)
                                      throws ProvisionException
Create an UpdateOperation that will update the elements specified.

Parameters:
toUpdate -
repos -
monitor -
Returns:
an instance of UpdateOperation
Throws:
ProvisionException

createSynchronizeOperation

public SynchronizeOperation createSynchronizeOperation(Collection<IVersionedId> toInstall,
                                                       Collection<URI> repos,
                                                       IProgressMonitor monitor)
                                                throws ProvisionException
This factory method creates an SynchronizeOperation that will cause the current installation to exclusively contain the elements listed once executed.

Parameters:
toInstall - the elements to install. This can not be null.
repos - the repositories to install the elements from.
monitor - the progress monitor
Returns:
an instance of SynchronizeOperation.
Throws:
ProvisionException

Eclipse Platform
Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.