Package org.apache.sling.feature
Class Extension
java.lang.Object
org.apache.sling.feature.Extension
- All Implemented Interfaces:
Serializable
An Extension can either be of type
- Artifacts : it contains a list of artifacts
- Text : it contains text
- JSON : it contains a blob of JSON
An extension can be in one of these states
- Required : Required extensions need to be processed by tooling
- Optional : Optional extensions might be processed by tooling, for example they might contain environment specific parts
- Transient: Transient extensions are cache like extensions where tooling can store additional information to avoid reprocessing of down stream tooling. However such tooling must work without the transient extension being available.
This class is not thread-safe.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Extension name containing the assembled features as produced byFeatureBuilder.assemble(ArtifactId, BuilderContext, Feature...)
.static final String
Common extension name to specify the content packages for Apache Sling.static final String
Extension name containing internal data.static final String
Common extension name to specify the repoinit part for Apache Sling. -
Constructor Summary
ConstructorsConstructorDescriptionExtension
(ExtensionType type, String name, ExtensionState state) Create a new extension -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Create a copy of the Extensionboolean
Get the artifacts of the extensiongetJSON()
Get the JSON of the extensionjakarta.json.JsonStructure
Get the JSON structure of the extensiongetName()
Get the extension namegetState()
Get the extension stategetText()
Get the text of the extensiongetType()
Get the extension typeint
hashCode()
void
Set the JSON of the extensionvoid
setJSONStructure
(jakarta.json.JsonStructure struct) Set the JSON structure of the extensionvoid
Set the text of the extensiontoString()
-
Field Details
-
EXTENSION_NAME_REPOINIT
Common extension name to specify the repoinit part for Apache Sling. This extension is of typeExtensionType.TEXT
and is required.- See Also:
-
EXTENSION_NAME_CONTENT_PACKAGES
Common extension name to specify the content packages for Apache Sling. This extension is of typeExtensionType.ARTIFACTS
and is required.- See Also:
-
EXTENSION_NAME_ASSEMBLED_FEATURES
Extension name containing the assembled features as produced byFeatureBuilder.assemble(ArtifactId, BuilderContext, Feature...)
. This extension is of typeExtensionType.ARTIFACTS
and is optional.- See Also:
-
EXTENSION_NAME_INTERNAL_DATA
Extension name containing internal data. An extension with this name must not be created by hand, it is managed by the feature model implementation. This extension is of typeExtensionType.JSON
and is optional.- Since:
- 1.7.0
- See Also:
-
-
Constructor Details
-
Extension
Create a new extension- Parameters:
type
- The type of the extensionname
- The name of the extensionstate
- The state of the extension- Throws:
IllegalArgumentException
- If name, type or state isnull
- Since:
- 1.1
-
-
Method Details
-
getType
Get the extension type- Returns:
- The type
-
getState
Get the extension state- Returns:
- The state
- Since:
- 1.1
-
getName
Get the extension name- Returns:
- The name
-
getText
Get the text of the extension- Returns:
- The text
- Throws:
IllegalStateException
- if the type is notExtensionType#TEXT
-
setText
Set the text of the extension- Parameters:
text
- The text- Throws:
IllegalStateException
- if the type is notExtensionType#TEXT
-
getJSON
Get the JSON of the extension- Returns:
- The JSON or
null
- Throws:
IllegalStateException
- if the type is notExtensionType#JSON
-
setJSON
Set the JSON of the extension- Parameters:
text
- The JSON- Throws:
IllegalStateException
- if the type is notExtensionType#JSON
IllegalArgumentException
- If the structure is not valid
-
getJSONStructure
public jakarta.json.JsonStructure getJSONStructure()Get the JSON structure of the extension- Returns:
- The JSON object or
null
- Throws:
IllegalStateException
- if the type is notExtensionType#JSON
- Since:
- 1.1
-
setJSONStructure
public void setJSONStructure(jakarta.json.JsonStructure struct) Set the JSON structure of the extension- Parameters:
struct
- The JSON structure- Throws:
IllegalStateException
- if the type is notExtensionType#JSON
IllegalArgumentException
- If the structure is not valid- Since:
- 1.1
-
getArtifacts
Get the artifacts of the extension- Returns:
- The artifacts
- Throws:
IllegalStateException
- if the type is notExtensionType#ARTIFACTS
-
copy
Create a copy of the Extension- Returns:
- A copy of the Extension
-
hashCode
public int hashCode() -
equals
-
toString
-