Class MetadataFactory

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

public final class MetadataFactory extends Object
A factory class for instantiating various p2 metadata objects.
Since:
2.0
  • Constructor Details

    • MetadataFactory

      public MetadataFactory()
  • Method Details

    • 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
    • createProvidedCapability

      public static IProvidedCapability createProvidedCapability(String namespace, Map<String,Object> properties)
      Returns a IProvidedCapability with the given values.
      Parameters:
      namespace - The capability namespace
      properties - 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 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, 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(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(String namespace, String propsFilter, IMatchExpression<IInstallableUnit> envFilter, int minCard, int maxCard, boolean greedy)
      Parameters:
      namespace - the namespace for the requirement. Must not be null.
      propsFilter - filter applied on IProvidedCapability.getProperties() of every IInstallableUnit.getProvidedCapabilities()
      envFilter - matcher over IInstallableUnit.getProperties()
      minCard - minimum cardinality
      maxCard - maximum cardinality
      greedy - true if the requirement should be considered greedy and false 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 be null.
      propsFilter - filter applied on IProvidedCapability.getProperties() of every IInstallableUnit.getProvidedCapabilities()
      envFilter - matcher over IInstallableUnit.getProperties()
      minCard - minimum cardinality
      maxCard - maximum cardinality
      greedy - true if the requirement should be considered greedy and false 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 be null.
      propsFilter - filter applied on IProvidedCapability.getProperties() of every IInstallableUnit.getProvidedCapabilities()
      envFilter - matcher over IInstallableUnit.getProperties()
      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
      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 expression
      envFilter - 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> envFilter, int minCard, int maxCard, boolean greedy, String description)
      Create and return a new requirement (IRequirement) with the specified values.
      Parameters:
      requirement - the match expression
      envFilter - 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:
    • 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)
      Parameters:
      descriptors - The IUs that the descriptor provides updates for.
      severity - The update severity (either IUpdateDescriptor.NORMAL or IUpdateDescriptor.HIGH)
      description - A description of the update
      location - a URI specifying the location or null
      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 for
      range - The version range that the descriptor provides updates for
      severity - The update severity (either IUpdateDescriptor.NORMAL or IUpdateDescriptor.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 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