Class AbstractExtensionDependency

java.lang.Object
org.xwiki.extension.AbstractExtensionDependency
All Implemented Interfaces:
ExtensionDependency
Direct Known Subclasses:
DefaultExtensionDependency

public abstract class AbstractExtensionDependency extends Object implements ExtensionDependency
Base class for ExtensionDependency implementations.
Since:
4.0M1
Version:
$Id: 54c1c2693bf93407b94a3f53621f74c6e8a42c8e $
  • Field Details

  • Constructor Details

    • AbstractExtensionDependency

      public AbstractExtensionDependency(ExtensionDependency dependency)
      Create new instance by cloning the provided one.
      Parameters:
      dependency - the extension dependency to copy
      Since:
      7.3M1
    • AbstractExtensionDependency

      public AbstractExtensionDependency(ExtensionDependency dependency, VersionConstraint versionConstraint)
      Create new instance by cloning the provided one with different version constraint.
      Parameters:
      dependency - the extension dependency to copy
      versionConstraint - the version constraint to set
    • AbstractExtensionDependency

      public AbstractExtensionDependency(String id, VersionConstraint versionConstraint)
      Parameters:
      id - the id (or feature) of the extension dependency
      versionConstraint - the version constraint of the extension dependency
    • AbstractExtensionDependency

      public AbstractExtensionDependency(String id, VersionConstraint versionConstraint, boolean optional)
      Parameters:
      id - the id (or feature) of the extension dependency
      versionConstraint - the version constraint of the extension dependency
      optional - true if the dependency is optional
      Since:
      9.6RC1
    • AbstractExtensionDependency

      public AbstractExtensionDependency(String id, VersionConstraint versionConstraint, Map<String,Object> properties)
      Parameters:
      id - the id (or feature) of the extension dependency
      versionConstraint - the version constraint of the extension dependency
      properties - the custom properties of the extension dependency
    • AbstractExtensionDependency

      public AbstractExtensionDependency(String id, VersionConstraint versionConstraint, boolean optional, Map<String,Object> properties)
      Parameters:
      id - the id (or feature) of the extension dependency
      versionConstraint - the version constraint of the extension dependency
      optional - true if the dependency is optional
      properties - the custom properties of the extension dependency
  • Method Details

    • getId

      public String getId()
      Specified by:
      getId in interface ExtensionDependency
      Returns:
      the id (or feature) of the target extension
    • setId

      public void setId(String id)
      Parameters:
      id - the extension id
      See Also:
    • getVersionConstraint

      public VersionConstraint getVersionConstraint()
      Specified by:
      getVersionConstraint in interface ExtensionDependency
      Returns:
      the version constraint of the target extension
    • setVersionConstraint

      public void setVersionConstraint(VersionConstraint versionConstraint)
      Parameters:
      versionConstraint - the version constraint of the target extension
    • getExclusions

      public Collection<ExtensionPattern> getExclusions()
      Specified by:
      getExclusions in interface ExtensionDependency
      Returns:
      the exclusions patterns to apply to transitive dependencies
    • setExclusions

      public void setExclusions(Collection<? extends ExtensionPattern> exclusions)
      Parameters:
      exclusions - the exclusions patterns to apply to transitive dependencies
      Since:
      12.2
    • addExclusion

      public void addExclusion(ExtensionPattern exclusion)
      Parameters:
      exclusion - an exclusion pattern to apply to transitive dependencies
      Since:
      12.2
    • getRepositories

      public Collection<ExtensionRepositoryDescriptor> getRepositories()
      Specified by:
      getRepositories in interface ExtensionDependency
      Returns:
      the custom repositories provided by the extension (usually to resolve dependencies)
    • setRepositories

      public void setRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories)
      Parameters:
      repositories - the custom repositories provided by the extension (usually to resolve dependencies)
      Since:
      7.3M1
    • addRepository

      public void addRepository(ExtensionRepositoryDescriptor repository)
      Add a new repository to the extension.
      Parameters:
      repository - a repository descriptor
      Since:
      7.3M1
    • isOptional

      public boolean isOptional()
      Specified by:
      isOptional in interface ExtensionDependency
      Returns:
      true if the dependency is not mandatory, usually meaning it will be installed (if valid) by default but can be uninstalled without uninstalling backward dependency
    • isCompatible

      public boolean isCompatible(Extension extension)
      Description copied from interface: ExtensionDependency
      Indicate if the passed extension is compatible with this dependency.
      Specified by:
      isCompatible in interface ExtensionDependency
      Parameters:
      extension - the extension to check
      Returns:
      true if the passed extension is compatible, false otherwise
    • isCompatible

      public boolean isCompatible(ExtensionId extensionId)
      Description copied from interface: ExtensionDependency
      Indicate if the passed extension id is compatible with this dependency.
      Specified by:
      isCompatible in interface ExtensionDependency
      Parameters:
      extensionId - the extension to check
      Returns:
      true if the passed extension id is compatible, false otherwise
    • getProperties

      public Map<String,Object> getProperties()
      Description copied from interface: ExtensionDependency
      Extends ExtensionDependency standard properties.

      Theses are generally provided by specific repositories. For example a AETHER repository will provide AETHER Dependency representation to avoid conversion when searching for the dependency on a AETHER based repository.

      Specified by:
      getProperties in interface ExtensionDependency
      Returns:
      the properties
    • getProperty

      public Object getProperty(String key)
      Specified by:
      getProperty in interface ExtensionDependency
      Parameters:
      key - the property key
      Returns:
      the property value
    • putProperty

      public void putProperty(String key, Object value)
      Set a property.
      Parameters:
      key - the property key
      value - the property value
      See Also:
    • setProperties

      public void setProperties(Map<String,Object> properties)
      Replace existing properties with provided properties.
      Parameters:
      properties - the properties
    • getProperty

      public <T> T getProperty(String key, T def)
      Description copied from interface: ExtensionDependency
      Get a property.
      Specified by:
      getProperty in interface ExtensionDependency
      Type Parameters:
      T - type of the property value
      Parameters:
      key - the property key
      def - the value to return if no property is associated to the provided key
      Returns:
      the property value or default of the property is not found
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object