Package org.xwiki.extension
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 forExtensionDependencyimplementations.- Since:
- 4.0M1
- Version:
- $Id: 54c1c2693bf93407b94a3f53621f74c6e8a42c8e $
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ExtensionPattern>exclusionsprotected Stringidprotected booleanoptionalprotected Map<String,Object>propertiesprotected List<ExtensionRepositoryDescriptor>repositoriesprotected VersionConstraintversionConstraint
-
Constructor Summary
Constructors Constructor Description AbstractExtensionDependency(String id, VersionConstraint versionConstraint)AbstractExtensionDependency(String id, VersionConstraint versionConstraint, boolean optional)AbstractExtensionDependency(String id, VersionConstraint versionConstraint, boolean optional, Map<String,Object> properties)AbstractExtensionDependency(String id, VersionConstraint versionConstraint, Map<String,Object> properties)AbstractExtensionDependency(ExtensionDependency dependency)Create new instance by cloning the provided one.AbstractExtensionDependency(ExtensionDependency dependency, VersionConstraint versionConstraint)Create new instance by cloning the provided one with different version constraint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddExclusion(ExtensionPattern exclusion)voidaddRepository(ExtensionRepositoryDescriptor repository)Add a new repository to the extension.booleanequals(Object obj)Collection<ExtensionPattern>getExclusions()StringgetId()Map<String,Object>getProperties()ExtendsExtensionDependencystandard properties.ObjectgetProperty(String key)<T> TgetProperty(String key, T def)Get a property.Collection<ExtensionRepositoryDescriptor>getRepositories()VersionConstraintgetVersionConstraint()inthashCode()booleanisCompatible(Extension extension)Indicate if the passed extension is compatible with this dependency.booleanisCompatible(ExtensionId extensionId)Indicate if the passed extension id is compatible with this dependency.booleanisOptional()voidputProperty(String key, Object value)Set a property.voidsetExclusions(Collection<? extends ExtensionPattern> exclusions)voidsetId(String id)voidsetProperties(Map<String,Object> properties)Replace existing properties with provided properties.voidsetRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories)voidsetVersionConstraint(VersionConstraint versionConstraint)StringtoString()
-
-
-
Field Detail
-
versionConstraint
protected VersionConstraint versionConstraint
- See Also:
getVersionConstraint()
-
exclusions
protected List<ExtensionPattern> exclusions
- Since:
- 12.2
- See Also:
getExclusions()
-
repositories
protected List<ExtensionRepositoryDescriptor> repositories
- See Also:
getRepositories()
-
optional
protected boolean optional
- See Also:
isOptional()
-
properties
protected Map<String,Object> properties
- See Also:
getProperties()
-
-
Constructor Detail
-
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 copyversionConstraint- the version constraint to set
-
AbstractExtensionDependency
public AbstractExtensionDependency(String id, VersionConstraint versionConstraint)
- Parameters:
id- the id (or feature) of the extension dependencyversionConstraint- 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 dependencyversionConstraint- the version constraint of the extension dependencyoptional- 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 dependencyversionConstraint- the version constraint of the extension dependencyproperties- 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 dependencyversionConstraint- the version constraint of the extension dependencyoptional- true if the dependency is optionalproperties- the custom properties of the extension dependency
-
-
Method Detail
-
getId
public String getId()
- Specified by:
getIdin interfaceExtensionDependency- Returns:
- the id (or feature) of the target extension
-
getVersionConstraint
public VersionConstraint getVersionConstraint()
- Specified by:
getVersionConstraintin interfaceExtensionDependency- 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:
getExclusionsin interfaceExtensionDependency- 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:
getRepositoriesin interfaceExtensionDependency- 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:
isOptionalin interfaceExtensionDependency- 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:ExtensionDependencyIndicate if the passed extension is compatible with this dependency.- Specified by:
isCompatiblein interfaceExtensionDependency- 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:ExtensionDependencyIndicate if the passed extension id is compatible with this dependency.- Specified by:
isCompatiblein interfaceExtensionDependency- 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:ExtensionDependencyExtendsExtensionDependencystandard 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:
getPropertiesin interfaceExtensionDependency- Returns:
- the properties
-
getProperty
public Object getProperty(String key)
- Specified by:
getPropertyin interfaceExtensionDependency- Parameters:
key- the property key- Returns:
- the property value
-
putProperty
public void putProperty(String key, Object value)
Set a property.- Parameters:
key- the property keyvalue- the property value- See Also:
getProperty(String)
-
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:ExtensionDependencyGet a property.- Specified by:
getPropertyin interfaceExtensionDependency- Type Parameters:
T- type of the property value- Parameters:
key- the property keydef- the value to return if no property is associated to the provided key- Returns:
- the property value or
defaultof the property is not found - See Also:
ExtensionDependency.getProperty(String)
-
-