Eclipse Platform
Release 3.6

org.eclipse.equinox.p2.metadata
Class MetadataFactory

java.lang.Object
  extended by org.eclipse.equinox.p2.metadata.MetadataFactory

public final class MetadataFactory
extends Object

A factory class for instantiating various p2 metadata objects.

Since:
2.0
Restriction:
Restriction:

Nested Class Summary
static class MetadataFactory.InstallableUnitDescription
          A description containing information about an installable unit.
static class MetadataFactory.InstallableUnitFragmentDescription
          A description containing information about an installable unit fragment.
static class MetadataFactory.InstallableUnitPatchDescription
          A description containing information about an installable unit patch.
 
Constructor Summary
MetadataFactory()
           
 
Method Summary
static ICopyright createCopyright(URI location, String body)
          Returns a new ICopyright.
static IInstallableUnit createInstallableUnit(MetadataFactory.InstallableUnitDescription description)
          Returns an IInstallableUnit based on the given description.
static IInstallableUnitFragment createInstallableUnitFragment(MetadataFactory.InstallableUnitFragmentDescription description)
          Returns an IInstallableUnitFragment based on the given description.
static IInstallableUnitPatch createInstallableUnitPatch(MetadataFactory.InstallableUnitPatchDescription description)
          Returns an IInstallableUnitPatch based on the given description.
static ILicense createLicense(URI location, String body)
          Return a new ILicense The body should contain either the full text of the license or an summary for a license fully specified in the given location.
static IProvidedCapability createProvidedCapability(String namespace, String name, Version version)
          Returns a IProvidedCapability with the given values.
static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy)
          Create and return a new requirement (IRequirement) with the specified values.
static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy, String description)
          Create and return a new requirement (IRequirement) with the specified values.
static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple)
          Returns a IRequirement with the given values.
static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy)
          Create and return a new requirement (IRequirement) with the specified values.
static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, int minCard, int maxCard, boolean greedy, String description)
          Create and return a new requirement (IRequirement) with the specified values.
static IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy)
          Create and return a new requirement (IRequirement) with the specified values.
static IRequirementChange createRequirementChange(IRequirement applyOn, IRequirement newValue)
          Returns a new requirement change.
static IInstallableUnit createResolvedInstallableUnit(IInstallableUnit unit, IInstallableUnitFragment[] fragments)
          Returns an IInstallableUnit that represents the given unit bound to the given fragments.
static ITouchpointData createTouchpointData(Map<String,? extends Object> instructions)
          Returns an instance of ITouchpointData with the given instructions.
static ITouchpointInstruction createTouchpointInstruction(String body, String importAttribute)
           
static ITouchpointType createTouchpointType(String id, Version version)
          Returns a TouchpointType with the given id and version.
static IUpdateDescriptor createUpdateDescriptor(Collection<IMatchExpression<IInstallableUnit>> descriptors, int severity, String description, URI location)
           
static IUpdateDescriptor createUpdateDescriptor(String id, VersionRange range, int severity, String description)
           
static IUpdateDescriptor createUpdateDescriptor(String id, VersionRange range, int severity, String description, URI location)
          Create and return a new update descriptor IUpdateDescriptor with the specified values.
static ITouchpointData mergeTouchpointData(ITouchpointData initial, Map<String,ITouchpointInstruction> incomingInstructions)
          Merge the given touchpoint instructions with a pre-existing touchpoint data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetadataFactory

public MetadataFactory()
Method Detail

createInstallableUnit

public static IInstallableUnit createInstallableUnit(MetadataFactory.InstallableUnitDescription description)
Returns an IInstallableUnit based on the given description. Once the installable unit has been created, the information is discarded from the description object.

Parameters:
description - The description of the unit to create
Returns:
The created installable unit

createInstallableUnitFragment

public static IInstallableUnitFragment createInstallableUnitFragment(MetadataFactory.InstallableUnitFragmentDescription description)
Returns an IInstallableUnitFragment based on the given description. Once the fragment has been created, the information is discarded from the description object.

Parameters:
description - The description of the unit to create
Returns:
The created installable unit fragment

createInstallableUnitPatch

public static IInstallableUnitPatch createInstallableUnitPatch(MetadataFactory.InstallableUnitPatchDescription description)
Returns an IInstallableUnitPatch based on the given description. Once the patch installable unit has been created, the information is discarded from the description object.

Parameters:
description - The description of the unit to create
Returns:
The created installable unit patch

createProvidedCapability

public static IProvidedCapability createProvidedCapability(String namespace,
                                                           String name,
                                                           Version version)
Returns a IProvidedCapability with the given values.

Parameters:
namespace - The capability namespace
name - The capability name
version - The capability version

createRequirement

public static IRequirement createRequirement(String namespace,
                                             String name,
                                             VersionRange range,
                                             IMatchExpression<IInstallableUnit> filter,
                                             boolean optional,
                                             boolean multiple)
Returns a IRequirement with the given values.

Parameters:
namespace - The capability namespace
name - The required capability name
range - The range of versions that are required, or null to indicate that any version will do.
filter - The filter used to evaluate whether this capability is applicable in the current environment, or null to indicate this capability is always applicable
optional - true if this required capability is optional, and false otherwise.
multiple - true if this capability can be satisfied by multiple provided capabilities, or false if it requires exactly one match
Returns:
the requirement

createRequirement

public static IRequirement createRequirement(String namespace,
                                             String name,
                                             VersionRange range,
                                             IMatchExpression<IInstallableUnit> filter,
                                             int minCard,
                                             int maxCard,
                                             boolean greedy)
Create and return a new requirement (IRequirement) with the specified values.

Parameters:
namespace - the namespace for the requirement. Must not be null.
name - the name for the requirement. Must not be null.
range - the version range. A value of null is equivalent to VersionRange.emptyRange and matches all versions.
filter - The filter used to evaluate whether this capability is applicable in the current environment, or null to indicate this capability is always applicable
minCard - minimum cardinality
maxCard - maximum cardinality
greedy - true if the requirement should be considered greedy and false otherwise
Returns:
the requirement

createRequirement

public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement,
                                             IMatchExpression<IInstallableUnit> filter,
                                             int minCard,
                                             int maxCard,
                                             boolean greedy)
Create and return a new requirement (IRequirement) with the specified values.

Parameters:
requirement - the match expression
filter - The filter used to evaluate whether this capability is applicable in the current environment, or null to indicate this capability is always applicable
minCard - minimum cardinality
maxCard - maximum cardinality
greedy - true if the requirement should be considered greedy and false otherwise
Returns:
the requirement

createRequirement

public static IRequirement createRequirement(String namespace,
                                             String name,
                                             VersionRange range,
                                             String filter,
                                             boolean optional,
                                             boolean multiple,
                                             boolean greedy)
Create and return a new requirement (IRequirement) with the specified values.

Parameters:
namespace - the namespace for the requirement. Must not be null.
name - the name for the requirement. Must not be null.
range - the version range. A value of null is equivalent to VersionRange.emptyRange and matches all versions.
filter - The filter used to evaluate whether this capability is applicable in the current environment, or null to indicate this capability is always applicable
optional - true if this requirement is optional, and false otherwise.
multiple - true if this requirement can be satisfied by multiple provided capabilities, or false if it requires exactly one match
greedy - true if the requirement should be considered greedy and false otherwise
Returns:
the requirement

createRequirement

public static IRequirement createRequirement(String namespace,
                                             String name,
                                             VersionRange range,
                                             IMatchExpression<IInstallableUnit> filter,
                                             int minCard,
                                             int maxCard,
                                             boolean greedy,
                                             String description)
Create and return a new requirement (IRequirement) with the specified values.

Parameters:
namespace - the namespace for the requirement. Must not be null.
name - the name for the requirement. Must not be null.
range - the version range. A value of null is equivalent to VersionRange.emptyRange and matches all versions.
filter - The filter used to evaluate whether this capability is applicable in the current environment, or null to indicate this capability is always applicable
minCard - minimum cardinality
maxCard - maximum cardinality
greedy - true if the requirement should be considered greedy and false otherwise
description - a String description of the requirement, or null
Returns:
the requirement

createRequirement

public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement,
                                             IMatchExpression<IInstallableUnit> filter,
                                             int minCard,
                                             int maxCard,
                                             boolean greedy,
                                             String description)
Create and return a new requirement (IRequirement) with the specified values.

Parameters:
requirement - the match expression
filter - the filter, or null
minCard - minimum cardinality
maxCard - maximum cardinality
greedy - true if the requirement should be considered greedy and false otherwise
description - a String description of the requirement, or null
Returns:
the requirement

createRequirementChange

public static IRequirementChange createRequirementChange(IRequirement applyOn,
                                                         IRequirement newValue)
Returns a new requirement change.

Parameters:
applyOn - The source of the requirement change - the kind of requirement to apply the change to
newValue - The result of the requirement change - the requirement to replace the source requirement with
Returns:
a requirement change

createCopyright

public static ICopyright createCopyright(URI location,
                                         String body)
Returns a new ICopyright.

Parameters:
location - the location of a document containing the copyright notice, or null
body - the copyright body, cannot be null
Throws:
IllegalArgumentException - when the body is null

createLicense

public static ILicense createLicense(URI location,
                                     String body)
Return a new ILicense The body should contain either the full text of the license or an summary for a license fully specified in the given location.

Parameters:
location - the location of a document containing the full license, or null
body - the license body, cannot be null
Throws:
IllegalArgumentException - when the body is null

createResolvedInstallableUnit

public static IInstallableUnit createResolvedInstallableUnit(IInstallableUnit unit,
                                                             IInstallableUnitFragment[] fragments)
Returns an IInstallableUnit that represents the given unit bound to the given fragments.

Parameters:
unit - The unit to be bound
fragments - The fragments to be bound
Returns:
A resolved installable unit
See Also:
IInstallableUnit.isResolved()

createTouchpointData

public static ITouchpointData createTouchpointData(Map<String,? extends Object> instructions)
Returns an instance of ITouchpointData with the given instructions.

Parameters:
instructions - The instructions for the touchpoint data.
Returns:
The created touchpoint data

mergeTouchpointData

public static ITouchpointData mergeTouchpointData(ITouchpointData initial,
                                                  Map<String,ITouchpointInstruction> incomingInstructions)
Merge the given touchpoint instructions with a pre-existing touchpoint data

Parameters:
initial - - the initial ITouchpointData
incomingInstructions - - Map of ITouchpointInstructions to merge into the initial touchpoint data
Returns:
the merged ITouchpointData

createTouchpointInstruction

public static ITouchpointInstruction createTouchpointInstruction(String body,
                                                                 String importAttribute)

createTouchpointType

public static ITouchpointType createTouchpointType(String id,
                                                   Version version)
Returns a TouchpointType with the given id and version.

Parameters:
id - The touchpoint id
version - The touchpoint version
Returns:
A touchpoint type instance with the given id and version

createUpdateDescriptor

public static IUpdateDescriptor createUpdateDescriptor(Collection<IMatchExpression<IInstallableUnit>> descriptors,
                                                       int severity,
                                                       String description,
                                                       URI location)

createUpdateDescriptor

public static IUpdateDescriptor createUpdateDescriptor(String id,
                                                       VersionRange range,
                                                       int severity,
                                                       String description)

createUpdateDescriptor

public static IUpdateDescriptor createUpdateDescriptor(String id,
                                                       VersionRange range,
                                                       int severity,
                                                       String description,
                                                       URI location)
Create and return a new update descriptor IUpdateDescriptor with the specified values.

Parameters:
id - the identifiter for the update. Must not be null.
range - the version range. A null range is equivalent to VersionRange.emptyRange and matches all versions.
severity - the severity
description - a String description or null
location - a URI specifying the location or null
Returns:
the update descriptor

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

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