Package org.apache.sling.feature
Class Feature
- java.lang.Object
-
- org.apache.sling.feature.Feature
-
- All Implemented Interfaces:
Comparable<Feature>
public class Feature extends Object implements Comparable<Feature>
A feature consists of- A unique id
ArtifactId - Bundles
- Configurations
- Framework properties
- Requirements and capabilities
- Prototype
- Extensions
-
-
Constructor Summary
Constructors Constructor Description Feature(ArtifactId id)Construct a new feature.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Feature o)Featurecopy()Create a copy of the featureFeaturecopy(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.booleanequals(Object obj)BundlesgetBundles()Get the bundles.List<org.osgi.resource.Capability>getCapabilities()Get the list of capabilities.ConfigurationsgetConfigurations()Get the configurations.StringgetDescription()Get the descriptionExtensionsgetExtensions()Get the list of extensions.Map<String,String>getFrameworkProperties()Get the framework properties The returned object is modifiable.ArtifactIdgetId()Get the id of the artifact.StringgetLicense()Get the licenseStringgetLocation()Get the location.PrototypegetPrototype()Get the optional prototype feature.List<MatchingRequirement>getRequirements()Get the list of requirements.StringgetTitle()Get the titleMap<String,String>getVariables()Obtain the variables of the featureStringgetVendor()Get the vendorinthashCode()booleanisAssembled()Check whether the feature is already assembledbooleanisComplete()Check whether the feature is complete.booleanisFinal()Check whether the feature is final.voidsetAssembled(boolean flag)Set the assembled flagvoidsetComplete(boolean flag)Set the complete flagvoidsetDescription(String description)Set the descriptionvoidsetFinal(boolean flag)Set the final flagvoidsetLicense(String license)Set the vendorvoidsetLocation(String value)Set the location.voidsetPrototype(Prototype prototype)Set the optional prototype feature.voidsetTitle(String title)Set the titlevoidsetVendor(String vendor)Set the vendorStringtoString()
-
-
-
Constructor Detail
-
Feature
public Feature(ArtifactId id)
Construct a new feature.- Parameters:
id- The id of the feature.- Throws:
IllegalArgumentException- If id isnull.
-
-
Method Detail
-
getId
public ArtifactId getId()
Get the id of the artifact.- Returns:
- The id.
-
getLocation
public String 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
public void setLocation(String value)
Set the location.- Parameters:
value- The new location.
-
getBundles
public Bundles getBundles()
Get the bundles.- Returns:
- The bundles object.
-
getConfigurations
public Configurations getConfigurations()
Get the configurations. The returned object is modifiable.- Returns:
- The configurations
-
getFrameworkProperties
public Map<String,String> getFrameworkProperties()
Get the framework properties The returned object is modifiable.- Returns:
- The framework properties
-
getRequirements
public List<MatchingRequirement> getRequirements()
Get the list of requirements. The returned object is modifiable.- Returns:
- The list of requirements
-
getCapabilities
public List<org.osgi.resource.Capability> getCapabilities()
Get the list of capabilities. The returned object is modifiable.- Returns:
- The list of capabilities
-
getPrototype
public Prototype getPrototype()
Get the optional prototype feature.- Returns:
- The prototype feature or
nullif none.
-
setPrototype
public void setPrototype(Prototype prototype)
Set the optional prototype feature.- Parameters:
prototype- The prototype feature ornullif none.
-
getExtensions
public Extensions getExtensions()
Get the list of extensions. The returned object is modifiable.- Returns:
- The list of extensions
-
getTitle
public String getTitle()
Get the title- Returns:
- The title or
null
-
setTitle
public void setTitle(String title)
Set the title- Parameters:
title- The title
-
getDescription
public String getDescription()
Get the description- Returns:
- The description or
null
-
setDescription
public void setDescription(String description)
Set the description- Parameters:
description- The description
-
getVariables
public Map<String,String> getVariables()
Obtain the variables of the feature- Returns:
- The variables
-
getVendor
public String getVendor()
Get the vendor- Returns:
- The vendor or
null
-
setVendor
public void setVendor(String vendor)
Set the vendor- Parameters:
vendor- The vendor
-
getLicense
public String getLicense()
Get the license- Returns:
- The license or
null
-
setLicense
public void setLicense(String license)
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:
trueif it is final,falseotherwise
-
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:
trueif it is complete,falseotherwise
-
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:
trueif it is assembled,falseif it needs to be assembled
-
setAssembled
public void setAssembled(boolean flag)
Set the assembled flag- Parameters:
flag- The flag
-
copy
public Feature copy()
Create a copy of the feature- Returns:
- A copy of the feature
-
copy
public Feature copy(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.- Parameters:
id- The new id- Returns:
- The copy of the feature with the new id
-
compareTo
public int compareTo(Feature o)
- Specified by:
compareToin interfaceComparable<Feature>
-
-