Package org.xwiki.extension
Class AbstractExtension
- java.lang.Object
-
- org.xwiki.extension.AbstractExtension
-
- All Implemented Interfaces:
Comparable<Extension>,Extension,MutableExtension
- Direct Known Subclasses:
AbstractRemoteExtension
public abstract class AbstractExtension extends Object implements MutableExtension
Base class forExtensionimplementations.- Since:
- 4.0M1
- Version:
- $Id: f5425f8baebf68b8d5a755b4fdb919ad349cb664 $
-
-
Field Summary
Fields Modifier and Type Field Description protected Set<String>allowedNamespacesprotected List<ExtensionAuthor>authorsprotected Stringcategoryprotected List<ExtensionComponent>componentsprotected List<ExtensionDependency>dependenciesprotected Stringdescriptionprotected Set<String>featuresDeprecated.since 8.0M1, usefeaturesMapinsteadprotected Map<String,ExtensionId>featuresMapprotected ExtensionFilefileThe file of the extension.protected ExtensionIdidprotected ExtensionIssueManagementissueManagementprotected List<ExtensionLicense>licensesprotected List<ExtensionDependency>managedDependenciesprotected Stringnameprotected Map<String,Object>propertiesprotected ReentrantLockpropertiesLockUsed to protect properties from concurrent write;protected List<ExtensionRepositoryDescriptor>repositoriesprotected ExtensionRepositoryrepositoryprotected ExtensionScmscmprotected Stringsummaryprotected Stringtypeprotected Stringwebsite-
Fields inherited from interface org.xwiki.extension.Extension
FIELD_ALLOWEDNAMESPACE, FIELD_ALLOWEDNAMESPACES, FIELD_AUTHOR, FIELD_AUTHORS, FIELD_CATEGORY, FIELD_COMPONENT, FIELD_COMPONENTS, FIELD_DEPENDENCIES, FIELD_DESCRIPTION, FIELD_EXTENSIONFEATURE, FIELD_EXTENSIONFEATURES, FIELD_FEATURE, FIELD_FEATURES, FIELD_ID, FIELD_ISSUEMANAGEMENT, FIELD_LICENSE, FIELD_LICENSES, FIELD_MANAGEDDEPENDENCIES, FIELD_NAME, FIELD_NAMESPACES, FIELD_PROPERTIES, FIELD_REPOSITORIES, FIELD_REPOSITORY, FIELD_SCM, FIELD_SUMMARY, FIELD_TYPE, FIELD_VERSION, FIELD_WEBSITE, IKEYPREFIX
-
-
Constructor Summary
Constructors Constructor Description AbstractExtension(ExtensionRepository repository, Extension extension)Create new extension descriptor by copying provided one.AbstractExtension(ExtensionRepository repository, ExtensionId id, String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddAllowedNamespace(String namespace)Add a new allowed namespace to the extension.voidaddAuthor(ExtensionAuthor author)Add a new author to the extension.voidaddComponent(ExtensionComponent component)Add a new component to the extension.voidaddDependency(ExtensionDependency dependency)Add a new dependency to the extension.voidaddExtensionFeature(ExtensionId feature)Add a new feature to the extension.voidaddFeature(String feature)Deprecated.voidaddLicense(ExtensionLicense license)Add a new license to the extension.voidaddManagedDependency(ExtensionDependency managedDependency)Add a new managed dependency to the extension.voidaddRepository(ExtensionRepositoryDescriptor repository)Add a new repository to the extension.intcompareTo(Extension o)booleanequals(Object obj)<T> Tget(String fieldName)Get an extension field by name.Collection<String>getAllowedNamespaces()List<ExtensionAuthor>getAuthors()StringgetCategory()List<ExtensionComponent>getComponents()List<ExtensionDependency>getDependencies()StringgetDescription()ExtensionIdgetExtensionFeature(String featureId)Return theExtensionIdobject that matches the passed feature id.Collection<ExtensionId>getExtensionFeatures()Indicate in an extension a list of provided "functionalities".Collection<String>getFeatures()Deprecated.ExtensionFilegetFile()Access the associated extension file content.ExtensionIdgetId()ExtensionIssueManagementgetIssueManagement()Collection<ExtensionLicense>getLicenses()List<ExtensionDependency>getManagedDependencies()Managed dependencies are used to override transitive dependencies (usually the version of this transitive dependency).StringgetName()Map<String,Object>getProperties()ExtendsExtensionstandard properties.<T> TgetProperty(String key)<T> TgetProperty(String key, T def)Get a property.Collection<ExtensionRepositoryDescriptor>getRepositories()ExtensionRepositorygetRepository()ExtensionScmgetScm()StringgetSummary()StringgetType()StringgetWebSite()inthashCode()voidputProperty(String key, Object value)Set a property.<T> TremoveProperty(String key)Remove the property associated to the passed key and return its value.voidset(Extension extension)Update optional informations based on the provided extension.voidsetAllowedNamespaces(Collection<String> namespaces)voidsetAuthors(Collection<? extends ExtensionAuthor> authors)voidsetCategory(String categrory)voidsetComponents(Collection<? extends ExtensionComponent> components)voidsetDependencies(Collection<? extends ExtensionDependency> dependencies)voidsetDescription(String description)voidsetExtensionFeatures(Collection<ExtensionId> features)voidsetFeatures(Collection<String> features)Deprecated.protected voidsetFile(ExtensionFile file)protected voidsetId(ExtensionId id)voidsetIssueManagement(ExtensionIssueManagement issueManagement)voidsetLicenses(Collection<ExtensionLicense> licenses)voidsetManagedDependencies(Collection<? extends ExtensionDependency> managedDependencies)voidsetName(String name)voidsetProperties(Map<String,Object> properties)Replace existing properties with provided properties.voidsetRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories)protected voidsetRepository(ExtensionRepository repository)voidsetScm(ExtensionScm scm)voidsetSummary(String summary)protected voidsetType(String type)voidsetWebsite(String website)StringtoString()
-
-
-
Field Detail
-
id
protected ExtensionId id
- See Also:
getId()
-
features
@Deprecated protected Set<String> features
Deprecated.since 8.0M1, usefeaturesMapinstead- See Also:
getExtensionFeatures()
-
featuresMap
protected Map<String,ExtensionId> featuresMap
- See Also:
getExtensionFeatures()
-
licenses
protected List<ExtensionLicense> licenses
- See Also:
getLicenses()
-
summary
protected String summary
- See Also:
getSummary()
-
description
protected String description
- See Also:
getDescription()
-
authors
protected List<ExtensionAuthor> authors
- See Also:
getAuthors()
-
components
protected List<ExtensionComponent> components
- See Also:
getComponents()
-
website
protected String website
- See Also:
getWebSite()
-
allowedNamespaces
protected Set<String> allowedNamespaces
- See Also:
getAllowedNamespaces()
-
repository
protected ExtensionRepository repository
- See Also:
getRepository()
-
properties
protected Map<String,Object> properties
- See Also:
getProperties()
-
propertiesLock
protected ReentrantLock propertiesLock
Used to protect properties from concurrent write;
-
dependencies
protected List<ExtensionDependency> dependencies
- See Also:
getDependencies()
-
managedDependencies
protected List<ExtensionDependency> managedDependencies
- Since:
- 8.1M1
- See Also:
getManagedDependencies()
-
scm
protected ExtensionScm scm
- See Also:
getScm()
-
issueManagement
protected ExtensionIssueManagement issueManagement
- See Also:
getIssueManagement()
-
category
protected String category
- See Also:
getCategory()
-
repositories
protected List<ExtensionRepositoryDescriptor> repositories
- See Also:
getRepositories()
-
file
protected ExtensionFile file
The file of the extension.
-
-
Constructor Detail
-
AbstractExtension
public AbstractExtension(ExtensionRepository repository, ExtensionId id, String type)
- Parameters:
repository- the repository where this extension comes fromid- the extension identifiertype- the extension type
-
AbstractExtension
public AbstractExtension(ExtensionRepository repository, Extension extension)
Create new extension descriptor by copying provided one.- Parameters:
repository- the repository where this extension comes fromextension- the extension to copy
-
-
Method Detail
-
set
public void set(Extension extension)
Description copied from interface:MutableExtensionUpdate optional informations based on the provided extension.- Specified by:
setin interfaceMutableExtension- Parameters:
extension- the extension from which to get informations
-
get
public <T> T get(String fieldName)
Get an extension field by name. Fallback on properties.
-
getId
public ExtensionId getId()
-
setId
protected void setId(ExtensionId id)
- Parameters:
id- the extension id- See Also:
getId()
-
getFeatures
@Deprecated public Collection<String> getFeatures()
Deprecated.Description copied from interface:ExtensionIndicate in an extension a list of provided "functionalities". Then when resolving extensions dependencies they can be matched in this list.- Specified by:
getFeaturesin interfaceExtension- Returns:
- the extension ids also provided by this extension, an empty collection if there is none
-
setFeatures
@Deprecated public void setFeatures(Collection<String> features)
Deprecated.- Specified by:
setFeaturesin interfaceMutableExtension- Parameters:
features- the extension ids also provided by this extension
-
addFeature
@Deprecated public void addFeature(String feature)
Deprecated.Description copied from interface:MutableExtensionAdd a new feature to the extension.- Specified by:
addFeaturein interfaceMutableExtension- Parameters:
feature- a feature name
-
getExtensionFeatures
public Collection<ExtensionId> getExtensionFeatures()
Description copied from interface:ExtensionIndicate in an extension a list of provided "functionalities". Then when resolving extensions dependencies they can be matched in this list.- Specified by:
getExtensionFeaturesin interfaceExtension- Returns:
- the
ExtensionIds also provided by this extension, an empty collection if there is none
-
getExtensionFeature
public ExtensionId getExtensionFeature(String featureId)
Description copied from interface:ExtensionReturn theExtensionIdobject that matches the passed feature id.- Specified by:
getExtensionFeaturein interfaceExtension- Parameters:
featureId- the id of the feature- Returns:
- the
ExtensionIdassociated to the passed id
-
setExtensionFeatures
public void setExtensionFeatures(Collection<ExtensionId> features)
- Specified by:
setExtensionFeaturesin interfaceMutableExtension- Parameters:
features- theExtensionIds also provided by this extension- Since:
- 8.0M1
-
addExtensionFeature
public void addExtensionFeature(ExtensionId feature)
Description copied from interface:MutableExtensionAdd a new feature to the extension.- Specified by:
addExtensionFeaturein interfaceMutableExtension- Parameters:
feature- a feature name- Since:
- 8.0M1
-
getType
public String getType()
-
setType
protected void setType(String type)
- Parameters:
type- the type of the extension- See Also:
getType()
-
getName
public String getName()
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceMutableExtension- Parameters:
name- the display name of the extension
-
getLicenses
public Collection<ExtensionLicense> getLicenses()
- Specified by:
getLicensesin interfaceExtension- Returns:
- the license of the extension, an empty collection if there is none
-
setLicenses
public void setLicenses(Collection<ExtensionLicense> licenses)
- Specified by:
setLicensesin interfaceMutableExtension- Parameters:
licenses- the licenses of the extension
-
addLicense
public void addLicense(ExtensionLicense license)
Description copied from interface:MutableExtensionAdd a new license to the extension.- Specified by:
addLicensein interfaceMutableExtension- Parameters:
license- a license
-
getSummary
public String getSummary()
- Specified by:
getSummaryin interfaceExtension- Returns:
- a short description of the extension
-
setSummary
public void setSummary(String summary)
- Specified by:
setSummaryin interfaceMutableExtension- Parameters:
summary- a short description of the extension
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceExtension- Returns:
- a description of the extension
-
setDescription
public void setDescription(String description)
- Specified by:
setDescriptionin interfaceMutableExtension- Parameters:
description- a description of the extension
-
getAuthors
public List<ExtensionAuthor> getAuthors()
- Specified by:
getAuthorsin interfaceExtension- Returns:
- the extension authors, an empty collection if there is none
-
setAuthors
public void setAuthors(Collection<? extends ExtensionAuthor> authors)
- Specified by:
setAuthorsin interfaceMutableExtension- Parameters:
authors- the authors of the extension
-
addAuthor
public void addAuthor(ExtensionAuthor author)
Description copied from interface:MutableExtensionAdd a new author to the extension.- Specified by:
addAuthorin interfaceMutableExtension- Parameters:
author- an author
-
getComponents
public List<ExtensionComponent> getComponents()
- Specified by:
getComponentsin interfaceExtension- Returns:
- the XWiki components provided by the extension
-
setComponents
public void setComponents(Collection<? extends ExtensionComponent> components)
- Specified by:
setComponentsin interfaceMutableExtension- Parameters:
components- the components provided by the extension
-
addComponent
public void addComponent(ExtensionComponent component)
Description copied from interface:MutableExtensionAdd a new component to the extension.- Specified by:
addComponentin interfaceMutableExtension- Parameters:
component- a component provided by the extension
-
getWebSite
public String getWebSite()
- Specified by:
getWebSitein interfaceExtension- Returns:
- an URL for the extension website
-
setWebsite
public void setWebsite(String website)
- Specified by:
setWebsitein interfaceMutableExtension- Parameters:
website- an URL for the extension website
-
getAllowedNamespaces
public Collection<String> getAllowedNamespaces()
- Specified by:
getAllowedNamespacesin interfaceExtension- Returns:
- the namespaces where it's allowed to install this extension
-
addAllowedNamespace
public void addAllowedNamespace(String namespace)
Description copied from interface:MutableExtensionAdd a new allowed namespace to the extension.- Specified by:
addAllowedNamespacein interfaceMutableExtension- Parameters:
namespace- a namespace- Since:
- 8.0M1
-
setAllowedNamespaces
public void setAllowedNamespaces(Collection<String> namespaces)
- Specified by:
setAllowedNamespacesin interfaceMutableExtension- Parameters:
namespaces- the namespaces where it's allowed to install this extension- Since:
- 8.0M1
-
addDependency
public void addDependency(ExtensionDependency dependency)
Description copied from interface:MutableExtensionAdd a new dependency to the extension.- Specified by:
addDependencyin interfaceMutableExtension- Parameters:
dependency- a dependency
-
getDependencies
public List<ExtensionDependency> getDependencies()
- Specified by:
getDependenciesin interfaceExtension- Returns:
- the dependencies of the extension, an empty collection if there is none
-
setDependencies
public void setDependencies(Collection<? extends ExtensionDependency> dependencies)
- Specified by:
setDependenciesin interfaceMutableExtension- Parameters:
dependencies- the dependencies of the extension- See Also:
Extension.getDependencies()
-
addManagedDependency
public void addManagedDependency(ExtensionDependency managedDependency)
Description copied from interface:MutableExtensionAdd a new managed dependency to the extension.- Specified by:
addManagedDependencyin interfaceMutableExtension- Parameters:
managedDependency- a managed dependency;- Since:
- 8.1M1
-
getManagedDependencies
public List<ExtensionDependency> getManagedDependencies()
Description copied from interface:ExtensionManaged dependencies are used to override transitive dependencies (usually the version of this transitive dependency).- Specified by:
getManagedDependenciesin interfaceExtension- Returns:
- the managed dependencies, empty list if there is none
-
setManagedDependencies
public void setManagedDependencies(Collection<? extends ExtensionDependency> managedDependencies)
- Specified by:
setManagedDependenciesin interfaceMutableExtension- Parameters:
managedDependencies- the managed dependencies of the extension- See Also:
Extension.getManagedDependencies()
-
getRepository
public ExtensionRepository getRepository()
- Specified by:
getRepositoryin interfaceExtension- Returns:
- the repository of the extension
-
setRepository
protected void setRepository(ExtensionRepository repository)
- Parameters:
repository- the repository of the extension- See Also:
getRepository()
-
getScm
public ExtensionScm getScm()
-
setScm
public void setScm(ExtensionScm scm)
- Specified by:
setScmin interfaceMutableExtension- Parameters:
scm- informations related to extensions's Source Control Management;- Since:
- 6.3M1
-
getIssueManagement
public ExtensionIssueManagement getIssueManagement()
- Specified by:
getIssueManagementin interfaceExtension- Returns:
- informations related to extension's issues management
-
setIssueManagement
public void setIssueManagement(ExtensionIssueManagement issueManagement)
- Specified by:
setIssueManagementin interfaceMutableExtension- Parameters:
issueManagement- informations related to extension's issues management- Since:
- 6.3M1
-
getFile
public ExtensionFile getFile()
Description copied from interface:ExtensionAccess the associated extension file content.
-
setFile
protected void setFile(ExtensionFile file)
- Parameters:
file- the file of the extension
-
getCategory
public String getCategory()
- Specified by:
getCategoryin interfaceExtension- Returns:
- the category of the extension
-
setCategory
public void setCategory(String categrory)
- Specified by:
setCategoryin interfaceMutableExtension- Parameters:
categrory- the category of the extension;- Since:
- 7.0M2
-
getRepositories
public Collection<ExtensionRepositoryDescriptor> getRepositories()
- Specified by:
getRepositoriesin interfaceExtension- Returns:
- the custom repositories provided by the extension (usually to resolve dependencies)
-
setRepositories
public void setRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories)
- Specified by:
setRepositoriesin interfaceMutableExtension- Parameters:
repositories- the custom repositories provided by the extension (usually to resolve dependencies)- Since:
- 7.3M1
-
addRepository
public void addRepository(ExtensionRepositoryDescriptor repository)
Description copied from interface:MutableExtensionAdd a new repository to the extension.- Specified by:
addRepositoryin interfaceMutableExtension- Parameters:
repository- a repository descriptor;- Since:
- 7.3M1
-
getProperties
public Map<String,Object> getProperties()
Description copied from interface:ExtensionExtendsExtensionstandard properties.Theses are generally provided by specific repositories. For example a maven repository will provide group and artifacts ids.
- Specified by:
getPropertiesin interfaceExtension- Returns:
- the properties
-
getProperty
public <T> T getProperty(String key)
- Specified by:
getPropertyin interfaceExtension- Type Parameters:
T- type of the property value- Parameters:
key- the property key- Returns:
- the property value
-
getProperty
public <T> T getProperty(String key, T def)
Description copied from interface:ExtensionGet a property.- Specified by:
getPropertyin interfaceExtension- 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:
Extension.getProperty(String)
-
putProperty
public void putProperty(String key, Object value)
Description copied from interface:MutableExtensionSet a property.- Specified by:
putPropertyin interfaceMutableExtension- Parameters:
key- the property keyvalue- the property value- See Also:
Extension.getProperty(String)
-
setProperties
public void setProperties(Map<String,Object> properties)
Description copied from interface:MutableExtensionReplace existing properties with provided properties.- Specified by:
setPropertiesin interfaceMutableExtension- Parameters:
properties- the properties
-
removeProperty
public <T> T removeProperty(String key)
Description copied from interface:MutableExtensionRemove the property associated to the passed key and return its value.- Specified by:
removePropertyin interfaceMutableExtension- Type Parameters:
T- type of the property value- Parameters:
key- the property key- Returns:
- the previous value associated with
key, ornullif there was no mapping forkey - Since:
- 8.3M1
-
compareTo
public int compareTo(Extension o)
- Specified by:
compareToin interfaceComparable<Extension>
-
-