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 forExtensionDependency
implementations.- Since:
- 4.0M1
- Version:
- $Id: 54c1c2693bf93407b94a3f53621f74c6e8a42c8e $
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ExtensionPattern>
exclusions
protected String
id
protected boolean
optional
protected Map<String,Object>
properties
protected List<ExtensionRepositoryDescriptor>
repositories
protected VersionConstraint
versionConstraint
-
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 void
addExclusion(ExtensionPattern exclusion)
void
addRepository(ExtensionRepositoryDescriptor repository)
Add a new repository to the extension.boolean
equals(Object obj)
Collection<ExtensionPattern>
getExclusions()
String
getId()
Map<String,Object>
getProperties()
ExtendsExtensionDependency
standard properties.Object
getProperty(String key)
<T> T
getProperty(String key, T def)
Get a property.Collection<ExtensionRepositoryDescriptor>
getRepositories()
VersionConstraint
getVersionConstraint()
int
hashCode()
boolean
isCompatible(Extension extension)
Indicate if the passed extension is compatible with this dependency.boolean
isCompatible(ExtensionId extensionId)
Indicate if the passed extension id is compatible with this dependency.boolean
isOptional()
void
putProperty(String key, Object value)
Set a property.void
setExclusions(Collection<? extends ExtensionPattern> exclusions)
void
setId(String id)
void
setProperties(Map<String,Object> properties)
Replace existing properties with provided properties.void
setRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories)
void
setVersionConstraint(VersionConstraint versionConstraint)
String
toString()
-
-
-
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:
getId
in interfaceExtensionDependency
- Returns:
- the id (or feature) of the target extension
-
getVersionConstraint
public VersionConstraint getVersionConstraint()
- Specified by:
getVersionConstraint
in 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:
getExclusions
in 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:
getRepositories
in 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:
isOptional
in 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:ExtensionDependency
Indicate if the passed extension is compatible with this dependency.- Specified by:
isCompatible
in 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:ExtensionDependency
Indicate if the passed extension id is compatible with this dependency.- Specified by:
isCompatible
in 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:ExtensionDependency
ExtendsExtensionDependency
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 interfaceExtensionDependency
- Returns:
- the properties
-
getProperty
public Object getProperty(String key)
- Specified by:
getProperty
in 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:ExtensionDependency
Get a property.- Specified by:
getProperty
in 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
default
of the property is not found - See Also:
ExtensionDependency.getProperty(String)
-
-