Package org.eclipse.equinox.p2.metadata
Class MetadataFactory
java.lang.Object
org.eclipse.equinox.p2.metadata.MetadataFactory
A factory class for instantiating various p2 metadata objects.
- Since:
- 2.0
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A description containing information about an installable unit.static class
A description containing information about an installable unit fragment.static class
A description containing information about an installable unit patch. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ICopyright
createCopyright
(URI location, String body) Returns a newICopyright
.static IInstallableUnit
Returns anIInstallableUnit
based on the given description.static IInstallableUnitFragment
Returns anIInstallableUnitFragment
based on the given description.static IInstallableUnitPatch
Returns anIInstallableUnitPatch
based on the given description.static ILicense
createLicense
(URI location, String body) Return a newILicense
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 aIProvidedCapability
with the given values.static IProvidedCapability
createProvidedCapability
(String namespace, Map<String, Object> properties) Returns aIProvidedCapability
with the given values.static IRequirement
createRequirement
(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy) static IRequirement
createRequirement
(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) 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 IRequirement
createRequirement
(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple) Returns aIRequirement
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, IFilterExpression propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) static IRequirement
createRequirement
(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> envFilter, 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> envFilter, int minCard, int maxCard, boolean greedy, String description) 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 anIInstallableUnit
that represents the given unit bound to the given fragments.static ITouchpointData
createTouchpointData
(Map<String, ? extends Object> instructions) Returns an instance ofITouchpointData
with the given instructions.static ITouchpointInstruction
createTouchpointInstruction
(String body, String importAttribute) static ITouchpointType
createTouchpointType
(String id, Version version) Returns aTouchpointType
with the given id and version.static IUpdateDescriptor
createUpdateDescriptor
(String id, VersionRange range, int severity, String description) Creates a new update descriptor object.static IUpdateDescriptor
createUpdateDescriptor
(String id, VersionRange range, int severity, String description, URI location) Create and return a new update descriptorIUpdateDescriptor
with the specified values.static IUpdateDescriptor
createUpdateDescriptor
(Collection<IMatchExpression<IInstallableUnit>> descriptors, int severity, String description, URI location) static ITouchpointData
mergeTouchpointData
(ITouchpointData initial, Map<String, ITouchpointInstruction> incomingInstructions) Merge the given touchpoint instructions with a pre-existing touchpoint data
-
Constructor Details
-
MetadataFactory
public MetadataFactory()
-
-
Method Details
-
createInstallableUnit
public static IInstallableUnit createInstallableUnit(MetadataFactory.InstallableUnitDescription description) Returns anIInstallableUnit
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 anIInstallableUnitFragment
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 anIInstallableUnitPatch
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 aIProvidedCapability
with the given values.- Parameters:
namespace
- The capability namespacename
- The capability nameversion
- The capability version
-
createProvidedCapability
public static IProvidedCapability createProvidedCapability(String namespace, Map<String, Object> properties) Returns aIProvidedCapability
with the given values.- Parameters:
namespace
- The capability namespaceproperties
- The description of the capability- Since:
- 2.4
-
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 benull
.name
- the name for the requirement. Must not benull
.range
- the version range. A value ofnull
is equivalent toVersionRange.emptyRange
and matches all versions.filter
- The filter used to evaluate whether this capability is applicable in the current environment, ornull
to indicate this capability is always applicableoptional
-true
if this requirement is optional, andfalse
otherwise.multiple
-true
if this requirement can be satisfied by multiple provided capabilities, orfalse
if it requires exactly one matchgreedy
-true
if the requirement should be considered greedy andfalse
otherwise- Returns:
- the requirement
-
createRequirement
public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple) Returns aIRequirement
with the given values.- Parameters:
namespace
- The capability namespacename
- The required capability namerange
- The range of versions that are required, ornull
to indicate that any version will do.filter
- The filter used to evaluate whether this capability is applicable in the current environment, ornull
to indicate this capability is always applicableoptional
-true
if this required capability is optional, andfalse
otherwise.multiple
-true
if this capability can be satisfied by multiple provided capabilities, orfalse
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 benull
.name
- the name for the requirement. Must not benull
.range
- the version range. A value ofnull
is equivalent toVersionRange.emptyRange
and matches all versions.filter
- The filter used to evaluate whether this capability is applicable in the current environment, ornull
to indicate this capability is always applicableminCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
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 benull
.name
- the name for the requirement. Must not benull
.range
- the version range. A value ofnull
is equivalent toVersionRange.emptyRange
and matches all versions.filter
- The filter used to evaluate whether this capability is applicable in the current environment, ornull
to indicate this capability is always applicableminCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
otherwisedescription
- aString
description of the requirement, ornull
- Returns:
- the requirement
-
createRequirement
public static IRequirement createRequirement(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy) - Parameters:
namespace
- the namespace for the requirement. Must not benull
.propsFilter
- filter applied onIProvidedCapability.getProperties()
of everyIInstallableUnit.getProvidedCapabilities()
envFilter
- matcher overIInstallableUnit.getProperties()
minCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
otherwise- Returns:
- the requirement
- Since:
- 2.4
-
createRequirement
public static IRequirement createRequirement(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) - Parameters:
namespace
- the namespace for the requirement. Must not benull
.propsFilter
- filter applied onIProvidedCapability.getProperties()
of everyIInstallableUnit.getProvidedCapabilities()
envFilter
- matcher overIInstallableUnit.getProperties()
minCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
otherwise- Returns:
- the requirement
- Since:
- 2.5
-
createRequirement
public static IRequirement createRequirement(String namespace, IFilterExpression propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) - Parameters:
namespace
- the namespace for the requirement. Must not benull
.propsFilter
- filter applied onIProvidedCapability.getProperties()
of everyIInstallableUnit.getProvidedCapabilities()
envFilter
- matcher overIInstallableUnit.getProperties()
minCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
otherwisedescription
- aString
description of the requirement, ornull
- Returns:
- the requirement
- Since:
- 2.4
-
createRequirement
public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy) Create and return a new requirement (IRequirement
) with the specified values.- Parameters:
requirement
- the match expressionenvFilter
- The filter used to evaluate whether this capability is applicable in the current environment, ornull
to indicate this capability is always applicableminCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
otherwise- Returns:
- the requirement
-
createRequirement
public static IRequirement createRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) Create and return a new requirement (IRequirement
) with the specified values.- Parameters:
requirement
- the match expressionenvFilter
- the filter, ornull
minCard
- minimum cardinalitymaxCard
- maximum cardinalitygreedy
-true
if the requirement should be considered greedy andfalse
otherwisedescription
- aString
description of the requirement, ornull
- 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 tonewValue
- The result of the requirement change - the requirement to replace the source requirement with- Returns:
- a requirement change
-
createCopyright
Returns a newICopyright
.- Parameters:
location
- the location of a document containing the copyright notice, ornull
body
- the copyright body, cannot benull
- Throws:
IllegalArgumentException
- when thebody
isnull
-
createLicense
Return a newILicense
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, ornull
body
- the license body, cannot benull
- Throws:
IllegalArgumentException
- when thebody
isnull
-
createResolvedInstallableUnit
public static IInstallableUnit createResolvedInstallableUnit(IInstallableUnit unit, IInstallableUnitFragment[] fragments) Returns anIInstallableUnit
that represents the given unit bound to the given fragments.- Parameters:
unit
- The unit to be boundfragments
- The fragments to be bound- Returns:
- A resolved installable unit
- See Also:
-
createTouchpointData
Returns an instance ofITouchpointData
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 ITouchpointDataincomingInstructions
- - Map of ITouchpointInstructions to merge into the initial touchpoint data- Returns:
- the merged ITouchpointData
-
createTouchpointInstruction
public static ITouchpointInstruction createTouchpointInstruction(String body, String importAttribute) -
createTouchpointType
Returns aTouchpointType
with the given id and version.- Parameters:
id
- The touchpoint idversion
- 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) - Parameters:
descriptors
- The IUs that the descriptor provides updates for.severity
- The update severity (eitherIUpdateDescriptor.NORMAL
orIUpdateDescriptor.HIGH
)description
- A description of the updatelocation
- aURI
specifying the location ornull
- Returns:
- A new update descriptor
-
createUpdateDescriptor
public static IUpdateDescriptor createUpdateDescriptor(String id, VersionRange range, int severity, String description) Creates a new update descriptor object.- Parameters:
id
- The id of the installable unit that the descriptor provides updates forrange
- The version range that the descriptor provides updates forseverity
- The update severity (eitherIUpdateDescriptor.NORMAL
orIUpdateDescriptor.HIGH
)description
- A description of the update- Returns:
- A new update descriptor
-
createUpdateDescriptor
public static IUpdateDescriptor createUpdateDescriptor(String id, VersionRange range, int severity, String description, URI location) Create and return a new update descriptorIUpdateDescriptor
with the specified values.- Parameters:
id
- the identifiter for the update. Must not benull
.range
- the version range. Anull
range is equivalent toVersionRange.emptyRange
and matches all versions.severity
- the severitydescription
- aString
description ornull
location
- aURI
specifying the location ornull
- Returns:
- the update descriptor
-