public abstract class AbstractExtension extends Object implements MutableExtension
Extension
implementations.Modifier and Type | Field and Description |
---|---|
protected Set<String> |
allowedNamespaces |
protected List<ExtensionAuthor> |
authors |
protected String |
category |
protected List<ExtensionComponent> |
components |
protected List<ExtensionDependency> |
dependencies |
protected String |
description |
protected Set<String> |
features
Deprecated.
since 8.0M1, use
featuresMap instead |
protected Map<String,ExtensionId> |
featuresMap |
protected ExtensionFile |
file
The file of the extension.
|
protected ExtensionId |
id |
protected ExtensionIssueManagement |
issueManagement |
protected List<ExtensionLicense> |
licenses |
protected List<ExtensionDependency> |
managedDependencies |
protected String |
name |
protected Map<String,Object> |
properties |
protected ReentrantLock |
propertiesLock
Used to protect properties from concurrent write;
|
protected List<ExtensionRepositoryDescriptor> |
repositories |
protected ExtensionRepository |
repository |
protected ExtensionScm |
scm |
protected String |
summary |
protected String |
type |
protected String |
website |
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 and Description |
---|
AbstractExtension(ExtensionRepository repository,
Extension extension)
Create new extension descriptor by copying provided one.
|
AbstractExtension(ExtensionRepository repository,
ExtensionId id,
String type) |
Modifier and Type | Method and Description |
---|---|
void |
addAllowedNamespace(String namespace)
Add a new allowed namespace to the extension.
|
void |
addAuthor(ExtensionAuthor author)
Add a new author to the extension.
|
void |
addComponent(ExtensionComponent component)
Add a new component to the extension.
|
void |
addDependency(ExtensionDependency dependency)
Add a new dependency to the extension.
|
void |
addExtensionFeature(ExtensionId feature)
Add a new feature to the extension.
|
void |
addFeature(String feature)
Deprecated.
|
void |
addLicense(ExtensionLicense license)
Add a new license to the extension.
|
void |
addManagedDependency(ExtensionDependency managedDependency)
Add a new managed dependency to the extension.
|
void |
addRepository(ExtensionRepositoryDescriptor repository)
Add a new repository to the extension.
|
int |
compareTo(Extension o) |
boolean |
equals(Object obj) |
<T> T |
get(String fieldName)
Get an extension field by name.
|
Collection<String> |
getAllowedNamespaces() |
List<ExtensionAuthor> |
getAuthors() |
String |
getCategory() |
List<ExtensionComponent> |
getComponents() |
List<ExtensionDependency> |
getDependencies() |
String |
getDescription() |
ExtensionId |
getExtensionFeature(String featureId)
Return the
ExtensionId object that matches the passed feature id. |
Collection<ExtensionId> |
getExtensionFeatures()
Indicate in an extension a list of provided "functionalities".
|
Collection<String> |
getFeatures()
Deprecated.
|
ExtensionFile |
getFile()
Access the associated extension file content.
|
ExtensionId |
getId() |
ExtensionIssueManagement |
getIssueManagement() |
Collection<ExtensionLicense> |
getLicenses() |
List<ExtensionDependency> |
getManagedDependencies()
Managed dependencies are used to override transitive dependencies (usually the version of this transitive
dependency).
|
String |
getName() |
Map<String,Object> |
getProperties()
Extends
Extension standard properties. |
<T> T |
getProperty(String key) |
<T> T |
getProperty(String key,
T def)
Get a property.
|
Collection<ExtensionRepositoryDescriptor> |
getRepositories() |
ExtensionRepository |
getRepository() |
ExtensionScm |
getScm() |
String |
getSummary() |
String |
getType() |
String |
getWebSite() |
int |
hashCode() |
void |
putProperty(String key,
Object value)
Set a property.
|
<T> T |
removeProperty(String key)
Remove the property associated to the passed key and return its value.
|
void |
set(Extension extension)
Update optional informations based on the provided extension.
|
void |
setAllowedNamespaces(Collection<String> namespaces) |
void |
setAuthors(Collection<? extends ExtensionAuthor> authors) |
void |
setCategory(String categrory) |
void |
setComponents(Collection<? extends ExtensionComponent> components) |
void |
setDependencies(Collection<? extends ExtensionDependency> dependencies) |
void |
setDescription(String description) |
void |
setExtensionFeatures(Collection<ExtensionId> features) |
void |
setFeatures(Collection<String> features)
Deprecated.
|
protected void |
setFile(ExtensionFile file) |
protected void |
setId(ExtensionId id) |
void |
setIssueManagement(ExtensionIssueManagement issueManagement) |
void |
setLicenses(Collection<ExtensionLicense> licenses) |
void |
setManagedDependencies(Collection<? extends ExtensionDependency> managedDependencies) |
void |
setName(String name) |
void |
setProperties(Map<String,Object> properties)
Replace existing properties with provided properties.
|
void |
setRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories) |
protected void |
setRepository(ExtensionRepository repository) |
void |
setScm(ExtensionScm scm) |
void |
setSummary(String summary) |
protected void |
setType(String type) |
void |
setWebsite(String website) |
String |
toString() |
protected ExtensionId id
getId()
@Deprecated protected Set<String> features
featuresMap
insteadgetExtensionFeatures()
protected Map<String,ExtensionId> featuresMap
getExtensionFeatures()
protected List<ExtensionLicense> licenses
getLicenses()
protected String summary
getSummary()
protected String description
getDescription()
protected List<ExtensionAuthor> authors
getAuthors()
protected List<ExtensionComponent> components
getComponents()
protected String website
getWebSite()
protected Set<String> allowedNamespaces
getAllowedNamespaces()
protected ExtensionRepository repository
getRepository()
protected Map<String,Object> properties
getProperties()
protected ReentrantLock propertiesLock
protected List<ExtensionDependency> dependencies
getDependencies()
protected List<ExtensionDependency> managedDependencies
getManagedDependencies()
protected ExtensionScm scm
getScm()
protected ExtensionIssueManagement issueManagement
getIssueManagement()
protected String category
getCategory()
protected List<ExtensionRepositoryDescriptor> repositories
getRepositories()
protected ExtensionFile file
public AbstractExtension(ExtensionRepository repository, ExtensionId id, String type)
repository
- the repository where this extension comes fromid
- the extension identifiertype
- the extension typepublic AbstractExtension(ExtensionRepository repository, Extension extension)
repository
- the repository where this extension comes fromextension
- the extension to copypublic void set(Extension extension)
MutableExtension
set
in interface MutableExtension
extension
- the extension from which to get informationspublic <T> T get(String fieldName)
public ExtensionId getId()
protected void setId(ExtensionId id)
id
- the extension idgetId()
@Deprecated public Collection<String> getFeatures()
Extension
getFeatures
in interface Extension
@Deprecated public void setFeatures(Collection<String> features)
setFeatures
in interface MutableExtension
features
- the extension ids also provided by this extension@Deprecated public void addFeature(String feature)
MutableExtension
addFeature
in interface MutableExtension
feature
- a feature namepublic Collection<ExtensionId> getExtensionFeatures()
Extension
getExtensionFeatures
in interface Extension
ExtensionId
s also provided by this extension, an empty collection if there is nonepublic ExtensionId getExtensionFeature(String featureId)
Extension
ExtensionId
object that matches the passed feature id.getExtensionFeature
in interface Extension
featureId
- the id of the featureExtensionId
associated to the passed idpublic void setExtensionFeatures(Collection<ExtensionId> features)
setExtensionFeatures
in interface MutableExtension
features
- the ExtensionId
s also provided by this extensionpublic void addExtensionFeature(ExtensionId feature)
MutableExtension
addExtensionFeature
in interface MutableExtension
feature
- a feature namepublic String getType()
protected void setType(String type)
type
- the type of the extensiongetType()
public String getName()
public void setName(String name)
setName
in interface MutableExtension
name
- the display name of the extensionpublic Collection<ExtensionLicense> getLicenses()
getLicenses
in interface Extension
public void setLicenses(Collection<ExtensionLicense> licenses)
setLicenses
in interface MutableExtension
licenses
- the licenses of the extensionpublic void addLicense(ExtensionLicense license)
MutableExtension
addLicense
in interface MutableExtension
license
- a licensepublic String getSummary()
getSummary
in interface Extension
public void setSummary(String summary)
setSummary
in interface MutableExtension
summary
- a short description of the extensionpublic String getDescription()
getDescription
in interface Extension
public void setDescription(String description)
setDescription
in interface MutableExtension
description
- a description of the extensionpublic List<ExtensionAuthor> getAuthors()
getAuthors
in interface Extension
public void setAuthors(Collection<? extends ExtensionAuthor> authors)
setAuthors
in interface MutableExtension
authors
- the authors of the extensionpublic void addAuthor(ExtensionAuthor author)
MutableExtension
addAuthor
in interface MutableExtension
author
- an authorpublic List<ExtensionComponent> getComponents()
getComponents
in interface Extension
public void setComponents(Collection<? extends ExtensionComponent> components)
setComponents
in interface MutableExtension
components
- the components provided by the extensionpublic void addComponent(ExtensionComponent component)
MutableExtension
addComponent
in interface MutableExtension
component
- a component provided by the extensionpublic String getWebSite()
getWebSite
in interface Extension
public void setWebsite(String website)
setWebsite
in interface MutableExtension
website
- an URL for the extension websitepublic Collection<String> getAllowedNamespaces()
getAllowedNamespaces
in interface Extension
public void addAllowedNamespace(String namespace)
MutableExtension
addAllowedNamespace
in interface MutableExtension
namespace
- a namespacepublic void setAllowedNamespaces(Collection<String> namespaces)
setAllowedNamespaces
in interface MutableExtension
namespaces
- the namespaces where it's allowed to install this extensionpublic void addDependency(ExtensionDependency dependency)
MutableExtension
addDependency
in interface MutableExtension
dependency
- a dependencypublic List<ExtensionDependency> getDependencies()
getDependencies
in interface Extension
public void setDependencies(Collection<? extends ExtensionDependency> dependencies)
setDependencies
in interface MutableExtension
dependencies
- the dependencies of the extensionExtension.getDependencies()
public void addManagedDependency(ExtensionDependency managedDependency)
MutableExtension
addManagedDependency
in interface MutableExtension
managedDependency
- a managed dependency;public List<ExtensionDependency> getManagedDependencies()
Extension
getManagedDependencies
in interface Extension
public void setManagedDependencies(Collection<? extends ExtensionDependency> managedDependencies)
setManagedDependencies
in interface MutableExtension
managedDependencies
- the managed dependencies of the extensionExtension.getManagedDependencies()
public ExtensionRepository getRepository()
getRepository
in interface Extension
protected void setRepository(ExtensionRepository repository)
repository
- the repository of the extensiongetRepository()
public ExtensionScm getScm()
public void setScm(ExtensionScm scm)
setScm
in interface MutableExtension
scm
- informations related to extensions's Source Control Management;public ExtensionIssueManagement getIssueManagement()
getIssueManagement
in interface Extension
public void setIssueManagement(ExtensionIssueManagement issueManagement)
setIssueManagement
in interface MutableExtension
issueManagement
- informations related to extension's issues managementpublic ExtensionFile getFile()
Extension
protected void setFile(ExtensionFile file)
file
- the file of the extensionpublic String getCategory()
getCategory
in interface Extension
public void setCategory(String categrory)
setCategory
in interface MutableExtension
categrory
- the category of the extension;public Collection<ExtensionRepositoryDescriptor> getRepositories()
getRepositories
in interface Extension
public void setRepositories(Collection<? extends ExtensionRepositoryDescriptor> repositories)
setRepositories
in interface MutableExtension
repositories
- the custom repositories provided by the extension (usually to resolve dependencies)public void addRepository(ExtensionRepositoryDescriptor repository)
MutableExtension
addRepository
in interface MutableExtension
repository
- a repository descriptor;public Map<String,Object> getProperties()
Extension
Extension
standard properties.
Theses are generally provided by specific repositories. For example a maven repository will provide group and artifacts ids.
getProperties
in interface Extension
public <T> T getProperty(String key)
getProperty
in interface Extension
T
- type of the property valuekey
- the property keypublic <T> T getProperty(String key, T def)
Extension
getProperty
in interface Extension
T
- type of the property valuekey
- the property keydef
- the value to return if no property is associated to the provided keydefault
of the property is not foundExtension.getProperty(String)
public void putProperty(String key, Object value)
MutableExtension
putProperty
in interface MutableExtension
key
- the property keyvalue
- the property valueExtension.getProperty(String)
public void setProperties(Map<String,Object> properties)
MutableExtension
setProperties
in interface MutableExtension
properties
- the propertiespublic <T> T removeProperty(String key)
MutableExtension
removeProperty
in interface MutableExtension
T
- type of the property valuekey
- the property keypublic int compareTo(Extension o)
compareTo
in interface Comparable<Extension>
Copyright © 2004–2021 XWiki. All rights reserved.