Package org.eclipse.pde.core.target

# Interface ITargetLocation

All Superinterfaces:
  `IAdaptable`

public interface ITargetLocation extends IAdaptable
Describes a location in a target that provides bundles and features. Abstracts the storage and provisioning of bundles. May contain a combination of executable and source bundles.

Clients are allowed to provide their own implementations. For the target definition to be persisted correctly, clients must provide a factory through the `org.eclipse.pde.core.targetLocations` extension point.

It is recommended that implementors override `Object.equals(Object)` to return `true` if the content of two containers are equal. This allows PDE to determine if two different target definitions have equivalent content.

To display an implementation in the PDE UI, clients may do the following:

- Implement `ITargetLocationWizard` and contribute to the `org.eclipse.pde.ui.targetLocationProvisioners` extension point.

- Have their target location adapt to `org.eclipse.jface.viewers.ILabelProvider` to provide text and icon labels in the target definition wizard and editor.

- Have their target location adapt to `org.eclipse.jface.viewers.ITreeContentProvider` to provide children items in the target definition wizard and editor. The children must adapt to `ILabelProvider` to get text and icon labels in the tree.

- Have their target location adapt to `org.eclipse.pde.ui.target.ITargetLocationEditor` to open an edit wizard when the edit button is pressed on the target definition wizard and editor.

- Have their target location adapt to `org.eclipse.pde.ui.target.ITargetLocationUpdater` to run an update job on the location when the update button is pressed on the target definition wizard and editor.

Since:
  3.8

## Method Summary

Modifier and Type
Method
Description
`TargetBundle[]`
`getBundles()`
Returns the bundles in this location or `null` if this location is not resolved
`TargetFeature[]`
`getFeatures()`
Returns all features available in this location or `null` if this location is not resolved.
`String`
`getLocation(boolean resolve)`
Returns a path in the local file system to the root of the target location.
`IStatus`
`getStatus()`
Returns the status of the last bundle resolution or `null` if this location has not been resolved.
`String`
`getType()`
Returns a string that identifies the implementation of this target location.
`String[]`
`getVMArguments()`
Returns VM Arguments that are specified in the bundle location or `null` if none.
`boolean`
`isResolved()`
Returns whether this location has resolved all of its contents.
`IStatus`
`resolve(ITargetDefinition definition, IProgressMonitor monitor)`
Resolves all contents of this location in the context of the specified target.
`String`
`serialize()`
Returns a serialized XML string that stores information about this location so it can be restored later using a `ITargetLocationFactory`.

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

## Method Details

### resolve

IStatus resolve(ITargetDefinition definition, IProgressMonitor monitor)
Resolves all contents of this location in the context of the specified target. Returns a status describing the resolution.

If resolution is successful an OK status is returned. If a problem occurs while resolving a non-OK status will be returned. If the progress monitor is cancelled a CANCEL status will be returned. The returned status can be accessed later using `getStatus()`.

This location will be considered resolved even if a problem occurs while resolving. See `isResolved()`

Parameters:
  `definition` - target being resolved for
  `monitor` - progress monitor or `null`
Returns:
  resolution status

### isResolved

boolean isResolved()
Returns whether this location has resolved all of its contents. If there was a problem during the resolution the location will still be considered resolved, see `getStatus()`.

Returns:
  whether this location has resolved all of its contents
See Also:
  - `resolve(ITargetDefinition, IProgressMonitor)`

### getStatus

IStatus getStatus()
Returns the status of the last bundle resolution or `null` if this location has not been resolved. If there was a problem during the resolution, the status returned by `resolve(ITargetDefinition, IProgressMonitor)` will be returned.

Returns:
  resolution status or `null`

### getType

String getType()
Returns a string that identifies the implementation of this target location. For target definitions to be persisted correctly, this must match the type in a contributed `org.eclipse.pde.core.targetLocations` extension.

Returns:
  string identifier for the type of target location.

### getLocation

String getLocation(boolean resolve) throws CoreException
Returns a path in the local file system to the root of the target location.

The current target platform framework requires a local file location but this requirement may be removed in the future. This method should not be referenced.

Parameters:
  `resolve` - whether to resolve variables in the path
Returns:
  home location
Throws:
  `CoreException` - if unable to resolve the location
Restriction:
  This method is not intended to be referenced by clients.

### getBundles

TargetBundle[] getBundles()
Returns the bundles in this location or `null` if this location is not resolved

Some of the returned bundles may have non-OK statuses. These bundles may be missing some information (location, version, source target). To get a bundle's status call `TargetBundle.getStatus()`. You can also use `getStatus()` to get the complete set of problems.

Returns:
  resolved bundles or `null`

### getFeatures

TargetFeature[] getFeatures()
Returns all features available in this location or `null` if this location is not resolved.

This method may return no features, even if the location has multiple bundles. For all returned features, the bundles that the features reference should be returned in the list returned by `getBundles()`

Returns:
  features or `null`

### getVMArguments

String[] getVMArguments()
Returns VM Arguments that are specified in the bundle location or `null` if none.

Returns:
  list of VM Arguments or `null` if none available

### serialize

String serialize()
Returns a serialized XML string that stores information about this location so it can be restored later using a `ITargetLocationFactory`. May return `null` to have this location ignored when saving a target definition.

The returned xml must contain a single root element named `location`. The root element may have attributes set and children. The xml should not be prefixed by a XML declaration such as `<?xml version="1.0" encoding="UTF-8"?>`.

Returns:
  an XML string storing all location information or `null`