Interface HstComponentConfiguration
-
- All Superinterfaces:
HstComponentInfo
public interface HstComponentConfiguration extends HstComponentInfo
AHstComponentConfiguration
specifies a (Java) componentClassName implementing theHstComponent
interface to provide the actual behavior for content rendering and (inter)action processing. Furthermore, aHstComponentConfiguration
can have childHstComponentConfiguration
elements which are identified by a referenceName. ThisreferenceName
can be used by theHstComponent
and its renderer to access its children request state and include their rendering output within its own rendering output. This referenceName is also use to build up a uniquereferencePath
to identify a specificHstComponent
within the whole tree of theHstComponent
elements within the current request. It is up to the implementation to if thisreferenceName
needs to be configured, or is auto-created. The constraint to thereferenceName
is that is MUST be unique for sibblingHstComponentConfiguration
's. Implementations auto-creating thereferenceName
can better use a deterministic algorithm to make sure that the same configuration results in the same auto-createdreferenceName
's, to avoid the need of sticky sessions in a clustered environment. Though, this is up to the implementation. ThereferencePath
is derived automatically by prepending aHstComponentConfiguration
its parentreferencePath
to thereferenceName
, separated by a configurable character. As aHstComponent
its referencePath is furthermore used to uniquely (prefix) request parameters which might end up in an external URL, areferenceName
is not allowed to contain any of the following characters (bracket not included):[.,:/\'"?& |-+#$%~]
For aroot HstComponentConfiguration
however, the HstComponent referencePath will only contain the (root) ".", not its own referenceName which is simply ignored, and as such there is no restriction on which characters are used for it (or even that it has a value). A rootHstComponentConfiguration
on the other hand is required to have an id, uniquely identifying it among other root HstComponentConfiguration objects. This id is used for lookup from theHstComponentsConfiguration
and as reference by aHstSiteMapItem
. A HstComponentConfiguration provides access to its children through aLinkedHashMap<String, HstComponentConfiguration>
, allowing the HST2 runtime to look them up byreferenceName
and/orreferencePath
, as well as process them in a sorted order. As the ordering in whichHstComponent
children are processed might be significant, theHstComponentConfiguration
implementation is required to use aLinkedHashMap
implementation (like a TreeMap) which returns the children in the order of the configuration/creation (not the "natural" ordering based only on the referenceName). AHstComponentConfiguration
may define arendererPath
to a view renderer (resource) which is a web application context relative (possibly servlet) path to be dispatched to during rendering, for example pointing to a JSP file, or maybe a script (like Velocity/Freemarker) to be "executed". Note: to allow repository based/stored renderer scripts, a prefix might be used for indicating scripts that live in the repository. This is up to the implementation to provide. Finally, aHstComponentConfiguration
may have additional parameters which are meaningful for its actualHstComponent
implementation, which are provided as a simple map, accessible throughgetParameters()
. The actualHstComponent
will access theHstComponentConfiguration
throughParameterConfiguration.getParameter(String, org.hippoecm.hst.core.request.ResolvedSiteMapItem)
HstComponent
might be interested in some parameters from the matchedHstSiteMapItem
item. Suppose the matchedHstSiteMapItem
has a parameter namefoo
with valuebar
, then aHstComponentConfiguration
could have a parameter name calledlux
with value${foo}
. The runtimeHstComponent
fetching the parameterlux
could then get the resolved valuebar
returned from the matchedHstSiteMapItem
. Obviously, theHstSiteMapItem
could also have the value${1}
where ${1} might first be substituted by the matched wildcard in theHstSiteMapItem
. Obviously, this is all up to the implementation whether to support this. NOTE: AsHstComponent
instances can accessHstComponentConfiguration
instances but should not be able to modify them, implementations must make sure that through the api aHstComponentConfiguration
instance cannot be changed. Returned List and Map should be therefore unmodifiable.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
HstComponentConfiguration.Type
AHstComponentConfiguration
comes in three different main types.
-
Field Summary
Fields Modifier and Type Field Description static char
PARAMETER_PREFIX_NAME_DELIMITER
The delimiter that is used between the parametername and the parameterprefix when there is a prefix value
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Stream<HstComponentConfiguration>
flattened()
String
getCanonicalIdentifier()
Returns the identifier of the backing stored component configuration.String
getCanonicalStoredLocation()
Returns the canonical (real physical) location of the stored configuration of this HstComponentConfigurationHstComponentConfiguration
getChildByName(String name)
Returns the child HstComponentConfiguration by its name, or null if it doens't existMap<String,HstComponentConfiguration>
getChildren()
Implementations should return an unmodifiable linked map, for exampleCollections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)
to avoid client code changing configurationString
getComponentDefinition()
Returns a reference to a catalog itemString
getComponentFilterTag()
The filter tag (seeHstRequestContext.getComponentFilterTags()
) for this component.String
getCType()
Allows to 'map' a specific component (catalog item type) to their implementation logic.default Optional<DynamicParameter>
getDynamicComponentParameter(String name)
Returns an optional of the component parameter(named or residual) that has the specified namedefault List<DynamicParameter>
getDynamicComponentParameters()
Returns the list of all named and residual component parametersList<DynamicFieldGroup>
getFieldGroups()
Returns the list of a component's field groupsString
getHippoIdentifier()
In case the component has a hippo:identifier, it is returned.String
getHstTemplate()
String
getIconPath()
Calendar
getLastModified()
String
getLocalParameter(String name)
Returns the parameter value without inheritance for the parametername
andnull
if not present.Map<String,String>
getLocalParameters()
seegetParameter(String)
, but now only parameters directly present on the HstConfigurationItem are returned.List<String>
getMountVariants()
This method returns allgetParameterPrefixes()
for the entireMount
combinedString
getNamedRenderer()
String
getNamedResourceServer()
String
getPageErrorHandlerClassName()
String
getParameter(String name)
Returns the parameter value for the parametername
andnull
if not present.Set<String>
getParameterPrefixes()
Parameters can have prefixes (variant).Map<String,String>
getParameters()
Returns the map of all parameters.HstComponentConfiguration
getParent()
Returns the parentHstComponentConfiguration
for this this component or null if a root component.String
getReferenceName()
Return the referenceName of thisHstComponentConfiguration
.String
getRenderPath()
String
getServeResourcePath()
List<String>
getVariants()
This method returnsgetParameterPrefixes()
for the entire composite tree of descendant components including the current componentString
getXType()
boolean
isExperiencePageComponent()
boolean
isHidden()
true
if this catalog item should be hidden in channel managerboolean
isInherited()
boolean
isMarkedDeleted()
true
when thisHstComponentConfiguration
is marked as deleted.boolean
isPrototype()
boolean
isShared()
boolean
isUnresolvedXpageLayoutContainer()
-
Methods inherited from interface org.hippoecm.hst.configuration.components.HstComponentInfo
getAndSetLogWasteMessageProcessed, getAsyncMode, getComponentClassName, getComponentType, getId, getLabel, getName, getParametersInfoClassName, isAsync, isCompositeCacheable, isStandalone, isSuppressWasteMessage
-
-
-
-
Field Detail
-
PARAMETER_PREFIX_NAME_DELIMITER
static final char PARAMETER_PREFIX_NAME_DELIMITER
The delimiter that is used between the parametername and the parameterprefix when there is a prefix value- See Also:
- Constant Field Values
-
-
Method Detail
-
getParent
HstComponentConfiguration getParent()
Returns the parentHstComponentConfiguration
for this this component or null if a root component.
-
getReferenceName
String getReferenceName()
Return the referenceName of thisHstComponentConfiguration
. It must be unique amongst siblingHstComponentConfiguration
's. The value returned by this method, is the value that will occur as part of thereferencePath
in request parameter names- Returns:
- the referenceName this HstComponentConfiguration, unique amongst its siblings
-
getRenderPath
String getRenderPath()
- Returns:
- the location of the view renderer. Returns
null
whengetNamedRenderer()
does not returnnull
- See Also:
getNamedRenderer()
-
getNamedRenderer
String getNamedRenderer()
- Returns:
- the name of the renderer, when using named servlet. Returns
null
whengetRenderPath()
does not returnnull
- See Also:
getRenderPath()
-
getServeResourcePath
String getServeResourcePath()
- Returns:
- return the servletpath of the servlet that must serve the resources for this
HstComponent
-
getNamedResourceServer
String getNamedResourceServer()
- Returns:
- the name of the resource server, when using named servlet. Returns
null
whengetServeResourcePath()
does not returnnull
- See Also:
getServeResourcePath()
-
getPageErrorHandlerClassName
String getPageErrorHandlerClassName()
- Returns:
- the fully classified className of the class implementing
PageErrorHandler
ornull
when not configured
-
getParameter
String getParameter(String name)
Returns the parameter value for the parametername
andnull
if not present. Note that from theHstComponentConfiguration
always 'raw' parameters are returned. 'Raw' as in unresolved with respect to property placeholders. So, a value might be ${year} or ${1}. In aHstComponent
instance, the implementation might have implemented some resolving for these values. Parameters for components are inherited from ancestor configurations. In case the component configured a parameter also present on an ancestor, the parameter from the ancestor is ignored- Parameters:
name
- the name of the parameter- Returns:
- the configured parameter value for this
name
andnull
if not existing
-
getLocalParameter
String getLocalParameter(String name)
Returns the parameter value without inheritance for the parametername
andnull
if not present. It returns the parameters configured directly on this HstComponentConfiguration, without the merged parameters from parent components (which have precedence, seegetParameter(String)
)- Parameters:
name
- the name of the parameter- Returns:
- the configured parameter value for this
name
andnull
if not existing
-
getParameters
Map<String,String> getParameters()
Returns the map of all parameters. Also seegetParameter(String)
. Implementations should return an unmodifiable map, for exampleCollections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)
to avoid client code changing configuration Parameters are inherited from ancestor configurations. Parameters that are configured in an ancestor override parameters configured in this component. Ancestors have precedence. Note that this is opposite toHstSiteMapItem.getParameters()
- Returns:
- the map of all configured parameters, and an empty map if no parameters present
-
getDynamicComponentParameters
default List<DynamicParameter> getDynamicComponentParameters()
Returns the list of all named and residual component parameters- Returns:
- the list of all named and residual component parameters, and an empty list if no parameters present
-
getFieldGroups
List<DynamicFieldGroup> getFieldGroups()
Returns the list of a component's field groups- Returns:
-
getComponentDefinition
String getComponentDefinition()
Returns a reference to a catalog item- Returns:
- a reference to a catalog item
-
getDynamicComponentParameter
default Optional<DynamicParameter> getDynamicComponentParameter(String name)
Returns an optional of the component parameter(named or residual) that has the specified name- Returns:
- an optional of the component parameter(named or residual) that has the specified name, and an empty optional if nothing found
-
getParameterPrefixes
Set<String> getParameterPrefixes()
Parameters can have prefixes (variant). If there are prefixes in used, this method returns the (possibly unmodifiable)Set
of prefixes / variants in use. Only the prefixes/variants on the current component are returned, thus not for descendant components likegetVariants()
does.
-
getVariants
List<String> getVariants()
This method returnsgetParameterPrefixes()
for the entire composite tree of descendant components including the current component- Returns:
- the List of all unique variants for this
HstComponentConfiguration
plus all the variants of all its descendantHstComponentConfiguration
s. If no variants are present, and EMPTY List is returned.
-
getMountVariants
List<String> getMountVariants()
This method returns allgetParameterPrefixes()
for the entireMount
combined- Returns:
- the List of all unique variants for this
Mount
. If no variants are present, an empty list is returned. For XPage document basedHstComponentConfiguration
instances, this returns all the 'mount variants' PLUS possibly the variants for the XPage Document container items if they are present
-
getLocalParameters
Map<String,String> getLocalParameters()
seegetParameter(String)
, but now only parameters directly present on the HstConfigurationItem are returned. Thus, no inheritance by parents involved- Returns:
- the map of all configured parameters, and an empty map if no parameters present
-
getChildren
Map<String,HstComponentConfiguration> getChildren()
Implementations should return an unmodifiable linked map, for exampleCollections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)
to avoid client code changing configuration- Returns:
- all
HstComponentConfiguration
children in order they were added, and an empty Map if no children present
-
getChildByName
HstComponentConfiguration getChildByName(String name)
Returns the child HstComponentConfiguration by its name, or null if it doens't exist- Parameters:
name
- the name of the child HstComponentConfiguration
-
getCanonicalStoredLocation
String getCanonicalStoredLocation()
Returns the canonical (real physical) location of the stored configuration of this HstComponentConfiguration- Returns:
- the canonical location where the configuration is stored
-
getCanonicalIdentifier
String getCanonicalIdentifier()
Returns the identifier of the backing stored component configuration. Note that multipleHstComponentConfiguration
's can share the same canonical identifier due to inheritance. Also, multiple subsites can share the same backing configuration, and thus share the same canonical identifiers- Returns:
- the identifier of the backing stored component configuration
-
getXType
String getXType()
- Returns:
- the xtype of this ComponentConfiguration and
null
if the component does not have an xtype
-
getCType
String getCType()
Allows to 'map' a specific component (catalog item type) to their implementation logic.
-
getComponentFilterTag
String getComponentFilterTag()
The filter tag (seeHstRequestContext.getComponentFilterTags()
) for this component.- Returns:
- the filter tag of this component, or null if no tag is available.
-
isInherited
boolean isInherited()
- Returns:
true
when the backing provider (HstNode
) of thisHstComponentConfiguration
is inherited, aka anHstNode
belonging to a different hst:configuration tree than thisHstComponentConfiguration
-
isShared
boolean isShared()
- Returns:
true
when the backing provider (HstNode
) of thisHstComponentConfiguration
is most likely / can be shared with otherHstComponentConfiguration
instances
-
isPrototype
boolean isPrototype()
- Returns:
true
when thisHstComponentConfiguration
can be used as a prototype to create otherHstComponentConfiguration
s with
-
getIconPath
String getIconPath()
- Returns:
- the icon path if present and
null
otherwise. The iconPath should be a path relative to the site webapp
-
getLastModified
Calendar getLastModified()
- Returns:
- if
Calendar
time this component got changed for the last time ornull
if not available
-
getHstTemplate
String getHstTemplate()
- Returns:
- the hst template property if available
-
isMarkedDeleted
boolean isMarkedDeleted()
true
when thisHstComponentConfiguration
is marked as deleted. AnHstComponentConfiguration
that has an ancestor that is marked as deleted will itself also be marked as deleted. A marked deleted component item will be part of the HST model viaHstComponentsConfiguration.getComponentConfigurations()
but should be skipped during execution.- Returns:
true
when thisHstComponentConfiguration
is marked as deleted.
-
getHippoIdentifier
String getHippoIdentifier()
In case the component has a hippo:identifier, it is returned. Typically, an hst:containercomponent will have an autocreated hippo:identifier with as value a uuid: This can be used a stable identifier across different (versions) of the same node, for example for an HST Config branch it can have the same value (opposed to the uuid of the node) and across unpublished/published versions below a document variant the xpage containers can have a stable uuid
- Returns:
- the hippo identifier if available for this
HstComponentConfiguration
, otherwisenull
-
isExperiencePageComponent
boolean isExperiencePageComponent()
- Returns:
true
if this component is part of a component STORED below an experience page document variant
-
isUnresolvedXpageLayoutContainer
boolean isUnresolvedXpageLayoutContainer()
- Returns:
true
if this is a container component AND is part of a request based XPage config but comes from an XPage Layout since the XPage document does not have a representation of the container : in that case, very specific Channel Mgr behavior and page-composer behavior is needed: when an item is added to the container, the container should be CREATED in the XPage document
-
isHidden
boolean isHidden()
true
if this catalog item should be hidden in channel manager
-
flattened
default Stream<HstComponentConfiguration> flattened()
- Returns:
- a depth-first stream of this
HstComponentConfiguration
plus its descendants
-
-