Package org.apache.sling.feature
Class Feature
java.lang.Object
org.apache.sling.feature.Feature
- All Implemented Interfaces:
Serializable
,Comparable<Feature>
A feature consists of
- A unique id
ArtifactId
- Bundles
- Configurations
- Framework properties
- Requirements and capabilities
- Prototype
- Extensions
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
copy()
Create a copy of the featurecopy
(ArtifactId id) Create a copy of the feature with a different id For contained items like bundles, artifacts and configurations a copy is created as well.boolean
Get the bundles.List<org.osgi.resource.Capability>
Get the list of capabilities.Get the list of categoriesGet the configurations.Get the descriptionGet the optional document URLGet the list of extensions.getFeatureOrigins
(Map<String, Object> metadata) Get the feature origins for the metadata- if recordedGet the framework properties The returned object is modifiable.Return a mutable map of metadata for the framework propertygetId()
Get the id of the artifact.Get the licenseGet the location.Get the optional prototype feature.Get the list of requirements.Get the SCM information relating to the feature.getTitle()
Get the titleReturn a mutable map of metadata for the variableObtain the variables of the featureGet the vendorint
hashCode()
boolean
Check whether the feature is already assembledboolean
Check whether the feature is complete.boolean
isFinal()
Check whether the feature is final.void
setAssembled
(boolean flag) Set the assembled flagvoid
setComplete
(boolean flag) Set the complete flagvoid
setDescription
(String description) Set the descriptionvoid
Set the document URLvoid
setFeatureOrigins
(Map<String, Object> metadata, List<ArtifactId> featureOrigins) Set the feature origins for the metadatavoid
setFinal
(boolean flag) Set the final flagvoid
setLicense
(String license) Set the vendorvoid
setLocation
(String value) Set the location.void
setPrototype
(Prototype prototype) Set the optional prototype feature.void
setSCMInfo
(String info) Set the SCM informationvoid
Set the titlevoid
Set the vendortoString()
-
Constructor Details
-
Feature
Construct a new feature.- Parameters:
id
- The id of the feature.- Throws:
IllegalArgumentException
- If id isnull
.
-
-
Method Details
-
getId
Get the id of the artifact.- Returns:
- The id.
-
getLocation
Get the location. The location might be the location of the feature file or any other means identifying where the object is defined.- Returns:
- The location or
null
.
-
setLocation
Set the location.- Parameters:
value
- The new location.
-
getBundles
Get the bundles.- Returns:
- The bundles object.
-
getConfigurations
Get the configurations. The returned object is modifiable.- Returns:
- The configurations
-
getFrameworkProperties
Get the framework properties The returned object is modifiable.- Returns:
- The framework properties
-
getRequirements
Get the list of requirements. The returned object is modifiable.- Returns:
- The list of requirements
-
getCapabilities
Get the list of capabilities. The returned object is modifiable.- Returns:
- The list of capabilities
-
getPrototype
Get the optional prototype feature.- Returns:
- The prototype feature or
null
if none.
-
setPrototype
Set the optional prototype feature.- Parameters:
prototype
- The prototype feature ornull
if none.
-
getExtensions
Get the list of extensions. The returned object is modifiable.- Returns:
- The list of extensions
-
getTitle
Get the title- Returns:
- The title or
null
-
setTitle
Set the title- Parameters:
title
- The title
-
getDescription
Get the description- Returns:
- The description or
null
-
setDescription
Set the description- Parameters:
description
- The description
-
getVariables
Obtain the variables of the feature- Returns:
- The variables
-
getVendor
Get the vendor- Returns:
- The vendor or
null
-
setVendor
Set the vendor- Parameters:
vendor
- The vendor
-
getLicense
Get the license- Returns:
- The license or
null
-
setLicense
Set the vendor- Parameters:
license
- The license
-
isFinal
public boolean isFinal()Check whether the feature is final. A final feature can't be a prototype for other features.- Returns:
true
if it is final,false
otherwise
-
setFinal
public void setFinal(boolean flag) Set the final flag- Parameters:
flag
- The flag
-
isComplete
public boolean isComplete()Check whether the feature is complete. A complete feature has no external dependencies and can run as-is.- Returns:
true
if it is complete,false
otherwise
-
setComplete
public void setComplete(boolean flag) Set the complete flag- Parameters:
flag
- The flag
-
isAssembled
public boolean isAssembled()Check whether the feature is already assembled- Returns:
true
if it is assembled,false
if it needs to be assembled
-
setAssembled
public void setAssembled(boolean flag) Set the assembled flag- Parameters:
flag
- The flag
-
getFrameworkPropertyMetadata
Return a mutable map of metadata for the framework property- Parameters:
key
- The name of the property.- Returns:
- A mutable map or
null
if the framework property does not exist - Since:
- 1.7.0
-
getVariableMetadata
Return a mutable map of metadata for the variable- Parameters:
key
- The name of the variable.- Returns:
- A mutable map or
null
if the variable does not exist - Since:
- 1.7.0
-
getFeatureOrigins
Get the feature origins for the metadata- if recorded- Parameters:
metadata
- The metadata (for a variable or framework property)- Returns:
- A immutable list of feature artifact ids - list is never empty
- Throws:
IllegalArgumentException
- If the stored values are not valid artifact ids- Since:
- 1.7
-
setFeatureOrigins
Set the feature origins for the metadata- Parameters:
metadata
- The metadata (for a variable or framework property)featureOrigins
- the list of artifact ids or null to remove the info from this object- Since:
- 1.7
-
getCategories
Get the list of categories- Returns:
- The modifiable list, might be empty
- Since:
- 1.9
-
getDocURL
Get the optional document URL- Returns:
- The document URL or
null
- Since:
- 1.9
-
setDocURL
Set the document URL- Parameters:
url
- The url- Since:
- 1.9
-
getSCMInfo
Get the SCM information relating to the feature. The syntax of the value follows the Bundle-SCM format. See the 'Bundle Manifest Headers' section in the OSGi Core specification.- Returns:
- The SCM information or
null
- Since:
- 1.9
-
setSCMInfo
Set the SCM information- Parameters:
info
- The SCM information- Since:
- 1.9
- See Also:
-
copy
Create a copy of the feature- Returns:
- A copy of the feature
-
copy
Create a copy of the feature with a different id For contained items like bundles, artifacts and configurations a copy is created as well.- Parameters:
id
- The new id- Returns:
- The copy of the feature with the new id
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Feature>
-
hashCode
public int hashCode() -
equals
-
toString
-