Class MapEntries
java.lang.Object
org.apache.sling.resourceresolver.impl.mapping.MapEntries
- All Implemented Interfaces:
- ExternalResourceChangeListener,- ResourceChangeListener,- MapEntriesHandler
public class MapEntries
extends Object
implements MapEntriesHandler, ResourceChangeListener, ExternalResourceChangeListener
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classUtility class for running paged queries.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.apache.sling.resourceresolver.impl.mapping.MapEntriesHandlerEMPTYFields inherited from interface org.apache.sling.api.resource.observation.ResourceChangeListenerCHANGE_ADDED, CHANGE_CHANGED, CHANGE_PROVIDER_ADDED, CHANGE_PROVIDER_REMOVED, CHANGE_REMOVED, CHANGES, PATHS, PROPERTY_NAMES_HINT
- 
Constructor SummaryConstructorsConstructorDescriptionMapEntries(MapConfigurationProvider factory, org.osgi.framework.BundleContext bundleContext, org.osgi.service.event.EventAdmin eventAdmin, StringInterpolationProvider stringInterpolationProvider, Optional<org.apache.sling.resourceresolver.impl.ResourceResolverMetrics> metrics) 
- 
Method SummaryModifier and TypeMethodDescriptionvoiddispose()Cleans up this class.protected booleandoInit()Actual initializer.@NotNull Map<String,Collection<String>> getAliasMap(String parentPath) Returns all alias entries for children of the specifiedparentPathReturn a flat listing of map entries used for mapping resources to URLsCreates a flat listing of all the map entries used for resolving URLs to resourcesgetResolveMapsIterator(String requestPath) Creates an iterator over the possibly applicable mapping entries for resolving a resourceReturns vanity paths mappingsprotected voidActual vanity paths initializer.booleanWhether alias resolution optimization is enabled.voidLog an error if alias optimization should be used but is currently disabledvoidonChange(List<ResourceChange> changes) Handles the change to any of the node properties relevant for vanity URL mappings.
- 
Field Details- 
PROP_REDIRECT_EXTERNAL- See Also:
 
- 
PROP_REDIRECT_EXTERNAL_STATUS- See Also:
 
- 
PROP_REDIRECT_EXTERNAL_REDIRECT_STATUS- See Also:
 
- 
PROP_VANITY_PATH- See Also:
 
- 
PROP_VANITY_ORDER- See Also:
 
- 
DEFAULT_MAP_ROOT- See Also:
 
- 
DEFAULT_DEFAULT_VANITY_PATH_REDIRECT_STATUSpublic static final int DEFAULT_DEFAULT_VANITY_PATH_REDIRECT_STATUS- See Also:
 
 
- 
- 
Constructor Details- 
MapEntriespublic MapEntries(MapConfigurationProvider factory, org.osgi.framework.BundleContext bundleContext, org.osgi.service.event.EventAdmin eventAdmin, StringInterpolationProvider stringInterpolationProvider, Optional<org.apache.sling.resourceresolver.impl.ResourceResolverMetrics> metrics) throws LoginException, IOException - Throws:
- LoginException
- IOException
 
 
- 
- 
Method Details- 
doInitprotected boolean doInit()Actual initializer. Guards itself against concurrent use by using a ReentrantLock. Does nothing if the resource resolver has already been null-ed.- Returns:
- true if the optimizedAliasResolution is enabled, false otherwise
 
- 
initializeVanityPathsActual vanity paths initializer. Guards itself against concurrent use by using a ReentrantLock. Does nothing if the resource resolver has already been null-ed.- Throws:
- IOException- in case of problems
 
- 
disposepublic void dispose()Cleans up this class.
- 
getResolveMapsDescription copied from interface:MapEntriesHandlerCreates a flat listing of all the map entries used for resolving URLs to resourcesThis method returns information about all resolve rules, such as vanity paths, mapping entries, virtual URLs and URL mappings. This list is computed on-demand and therefore should not be used in performance-critical code. - Specified by:
- getResolveMapsin interface- MapEntriesHandler
- Returns:
- an unmodifiable, sorted, list of resolution map entries
 
- 
getResolveMapsIteratorDescription copied from interface:MapEntriesHandlerCreates an iterator over the possibly applicable mapping entries for resolving a resourceThis method uses the request path to filter out any unapplicable mapping entries and is therefore preferrable over MapEntriesHandler.getResolveMaps().The iterator will iterate over the mapping entries in the order of the pattern length. - Specified by:
- getResolveMapsIteratorin interface- MapEntriesHandler
- Parameters:
- requestPath- the requestPath
- Returns:
- the map entry iterator
 
- 
getMapMapsDescription copied from interface:MapEntriesHandlerReturn a flat listing of map entries used for mapping resources to URLsThis method returns information about all mapping rules. Note that vanity paths are excluded. - Specified by:
- getMapMapsin interface- MapEntriesHandler
- Returns:
- an unmodifiable collection of map entries
 
- 
isOptimizeAliasResolutionEnabledpublic boolean isOptimizeAliasResolutionEnabled()Description copied from interface:MapEntriesHandlerWhether alias resolution optimization is enabled. If it is enabledMapEntriesHandler.getAliasMap(String)can be used.- Specified by:
- isOptimizeAliasResolutionEnabledin interface- MapEntriesHandler
- Returns:
- true if the optimizedAliasResolution should be used, false otherwise
 
- 
getAliasMapDescription copied from interface:MapEntriesHandlerReturns all alias entries for children of the specifiedparentPathThe returned map has resource names as keys and the assigned aliases as values. - Specified by:
- getAliasMapin interface- MapEntriesHandler
- Parameters:
- parentPath- the parent path
- Returns:
- a map of all child alias entries, possibly empty
 
- 
getVanityPathMappingsDescription copied from interface:MapEntriesHandlerReturns vanity paths mappingsThe keys in the map are resource paths and the values are the vanity mappings. - Specified by:
- getVanityPathMappingsin interface- MapEntriesHandler
- Returns:
- an unmodifiable list of vanity path mappings
 
- 
onChangeHandles the change to any of the node properties relevant for vanity URL mappings. TheMapEntries(MapConfigurationProvider, BundleContext, EventAdmin, StringInterpolationProvider, Optional)constructor makes sure the event listener is registered to only get appropriate events.- Specified by:
- onChangein interface- ResourceChangeListener
- Parameters:
- changes- The changes list. This list is immutable.
 
- 
logDisableAliasOptimizationpublic void logDisableAliasOptimization()Description copied from interface:MapEntriesHandlerLog an error if alias optimization should be used but is currently disabled- Specified by:
- logDisableAliasOptimizationin interface- MapEntriesHandler
 
 
-