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
Nested ClassesModifier and TypeClassDescriptionstatic classA description containing information about an installable unit.static classA description containing information about an installable unit fragment.static classA description containing information about an installable unit patch. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ICopyrightcreateCopyright(URI location, String body) Returns a newICopyright.static IInstallableUnitReturns anIInstallableUnitbased on the given description.static IInstallableUnitFragmentReturns anIInstallableUnitFragmentbased on the given description.static IInstallableUnitPatchReturns anIInstallableUnitPatchbased on the given description.static ILicensecreateLicense(URI location, String body) Return a newILicenseThe body should contain either the full text of the license or an summary for a license fully specified in the given location.static IProvidedCapabilitycreateProvidedCapability(String namespace, String name, Version version) Returns aIProvidedCapabilitywith the given values.static IProvidedCapabilitycreateProvidedCapability(String namespace, Map<String, Object> properties) Returns aIProvidedCapabilitywith the given values.static IRequirementcreateRequirement(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy) static IRequirementcreateRequirement(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) static IRequirementcreateRequirement(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 IRequirementcreateRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple) Returns aIRequirementwith the given values.static IRequirementcreateRequirement(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 IRequirementcreateRequirement(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 IRequirementcreateRequirement(String namespace, IFilterExpression propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy, String description) static IRequirementcreateRequirement(IMatchExpression<IInstallableUnit> requirement, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy) Create and return a new requirement (IRequirement) with the specified values.static IRequirementcreateRequirement(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 IRequirementChangecreateRequirementChange(IRequirement applyOn, IRequirement newValue) Returns a new requirement change.static IInstallableUnitcreateResolvedInstallableUnit(IInstallableUnit unit, IInstallableUnitFragment[] fragments) Returns anIInstallableUnitthat represents the given unit bound to the given fragments.static ITouchpointDatacreateTouchpointData(Map<String, ? extends Object> instructions) Returns an instance ofITouchpointDatawith the given instructions.static ITouchpointInstructioncreateTouchpointInstruction(String body, String importAttribute) static ITouchpointTypecreateTouchpointType(String id, Version version) Returns aTouchpointTypewith the given id and version.static IUpdateDescriptorcreateUpdateDescriptor(String id, VersionRange range, int severity, String description) Creates a new update descriptor object.static IUpdateDescriptorcreateUpdateDescriptor(String id, VersionRange range, int severity, String description, URI location) Create and return a new update descriptorIUpdateDescriptorwith the specified values.static IUpdateDescriptorcreateUpdateDescriptor(Collection<IMatchExpression<IInstallableUnit>> descriptors, int severity, String description, URI location) static ITouchpointDatamergeTouchpointData(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 anIInstallableUnitbased 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 anIInstallableUnitFragmentbased 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 anIInstallableUnitPatchbased 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 aIProvidedCapabilitywith 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 aIProvidedCapabilitywith 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 ofnullis equivalent toVersionRange.emptyRangeand matches all versions.filter- The filter used to evaluate whether this capability is applicable in the current environment, ornullto indicate this capability is always applicableoptional-trueif this requirement is optional, andfalseotherwise.multiple-trueif this requirement can be satisfied by multiple provided capabilities, orfalseif it requires exactly one matchgreedy-trueif the requirement should be considered greedy andfalseotherwise- Returns:
- the requirement
-
createRequirement
public static IRequirement createRequirement(String namespace, String name, VersionRange range, IMatchExpression<IInstallableUnit> filter, boolean optional, boolean multiple) Returns aIRequirementwith the given values.- Parameters:
namespace- The capability namespacename- The required capability namerange- The range of versions that are required, ornullto indicate that any version will do.filter- The filter used to evaluate whether this capability is applicable in the current environment, ornullto indicate this capability is always applicableoptional-trueif this required capability is optional, andfalseotherwise.multiple-trueif this capability can be satisfied by multiple provided capabilities, orfalseif 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 ofnullis equivalent toVersionRange.emptyRangeand matches all versions.filter- The filter used to evaluate whether this capability is applicable in the current environment, ornullto indicate this capability is always applicableminCard- minimum cardinalitymaxCard- maximum cardinalitygreedy-trueif the requirement should be considered greedy andfalseotherwise- 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 ofnullis equivalent toVersionRange.emptyRangeand matches all versions.filter- The filter used to evaluate whether this capability is applicable in the current environment, ornullto indicate this capability is always applicableminCard- minimum cardinalitymaxCard- maximum cardinalitygreedy-trueif the requirement should be considered greedy andfalseotherwisedescription- aStringdescription 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-trueif the requirement should be considered greedy andfalseotherwise- 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-trueif the requirement should be considered greedy andfalseotherwise- 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-trueif the requirement should be considered greedy andfalseotherwisedescription- aStringdescription 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, ornullto indicate this capability is always applicableminCard- minimum cardinalitymaxCard- maximum cardinalitygreedy-trueif the requirement should be considered greedy andfalseotherwise- 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, ornullminCard- minimum cardinalitymaxCard- maximum cardinalitygreedy-trueif the requirement should be considered greedy andfalseotherwisedescription- aStringdescription 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, ornullbody- the copyright body, cannot benull- Throws:
IllegalArgumentException- when thebodyisnull
-
createLicense
Return a newILicenseThe 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, ornullbody- the license body, cannot benull- Throws:
IllegalArgumentException- when thebodyisnull
-
createResolvedInstallableUnit
public static IInstallableUnit createResolvedInstallableUnit(IInstallableUnit unit, IInstallableUnitFragment[] fragments) Returns anIInstallableUnitthat 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 ofITouchpointDatawith 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 aTouchpointTypewith 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.NORMALorIUpdateDescriptor.HIGH)description- A description of the updatelocation- aURIspecifying 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.NORMALorIUpdateDescriptor.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 descriptorIUpdateDescriptorwith the specified values.- Parameters:
id- the identifiter for the update. Must not benull.range- the version range. Anullrange is equivalent toVersionRange.emptyRangeand matches all versions.severity- the severitydescription- aStringdescription ornulllocation- aURIspecifying the location ornull- Returns:
- the update descriptor
-