T - type of property being returnedpublic abstract class AbstractMetadataDrivenConfigurationLookupStrategy<T> extends AbstractInitializableComponent implements com.google.common.base.Function<BaseContext,T>
The function is tailored with properties that determine what tag it looks for, with subclasses handling the specific type conversion logic.
If a specific property is unavailable, then null is returned.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractMetadataDrivenConfigurationLookupStrategy.CachedConfigurationContext
A child context that caches derived configuration properties.
|
| Modifier and Type | Field and Description |
|---|---|
private static com.google.common.base.Function<MessageContext,EntityDescriptor> |
DEFAULT_MC_METADATA_LOOKUP
Default metadata lookup for MC-based usage.
|
private static com.google.common.base.Function<MessageContext,String> |
DEFAULT_MC_PROFILE_ID_LOOKUP
Default profile ID lookup for MC-based usage.
|
private static com.google.common.base.Function<ProfileRequestContext,EntityDescriptor> |
DEFAULT_PRC_METADATA_LOOKUP
Default metadata lookup for PRC-based usage.
|
private static com.google.common.base.Function<ProfileRequestContext,String> |
DEFAULT_PRC_PROFILE_ID_LOOKUP
Default profile ID lookup for PRC-based usage.
|
private boolean |
enableCaching
Cache the lookup in the context tree.
|
private org.slf4j.Logger |
log
Class logger.
|
private com.google.common.base.Function<BaseContext,EntityDescriptor> |
metadataLookupStrategy
Strategy for obtaining metadata to check.
|
private com.google.common.base.Function<BaseContext,String> |
profileIdLookupStrategy
Strategy for obtaining profile ID for property naming.
|
private Collection<String> |
propertyAliases
Alternative "full" property identifiers to support.
|
private String |
propertyName
Base name of property to produce.
|
private boolean |
strictNameFormat
Require use of URI attribute name format.
|
| Constructor and Description |
|---|
AbstractMetadataDrivenConfigurationLookupStrategy()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
T |
apply(BaseContext input) |
protected void |
doInitialize() |
protected abstract T |
doTranslate(Attribute tag)
Translate the value(s) into a setting of the appropriate type.
|
private Attribute |
findMatchingTag(EntityAttributes entityAttributes,
String name)
Find a matching entity attribute in the input metadata.
|
private Attribute |
findMatchingTag(EntityDescriptor entity,
String name)
Find a matching entity attribute in the input metadata.
|
void |
setEnableCaching(boolean flag)
Set whether property lookup should be cached in the profile context tree.
|
void |
setMetadataLookupStrategy(com.google.common.base.Function<BaseContext,EntityDescriptor> strategy)
Set lookup strategy for metadata to examine.
|
void |
setProfileAliases(Collection<String> aliases)
Set profile ID aliases to include when checking for metadata tags (the property name is suffixed to the
aliases).
|
void |
setProfileIdLookupStrategy(com.google.common.base.Function<BaseContext,String> strategy)
Set lookup strategy for profile ID to base property names on.
|
void |
setPropertyName(String name)
Set the "base" name of the property/setting to derive.
|
void |
setStrictNameFormat(boolean flag)
Set whether tag matching should examine and require an Attribute NameFormat of the URI type.
|
private T |
translate(Attribute tag)
Translate the value(s) into a setting of the appropriate type.
|
destroy, doDestroy, initialize, isDestroyed, isInitialized@Nonnull private static final com.google.common.base.Function<ProfileRequestContext,EntityDescriptor> DEFAULT_PRC_METADATA_LOOKUP
@Nonnull private static final com.google.common.base.Function<ProfileRequestContext,String> DEFAULT_PRC_PROFILE_ID_LOOKUP
@Nonnull private static final com.google.common.base.Function<MessageContext,EntityDescriptor> DEFAULT_MC_METADATA_LOOKUP
@Nonnull private static final com.google.common.base.Function<MessageContext,String> DEFAULT_MC_PROFILE_ID_LOOKUP
@Nonnull private final org.slf4j.Logger log
private boolean strictNameFormat
private boolean enableCaching
@NonnullAfterInit @NotEmpty private String propertyName
@NonnullAfterInit @NonnullElements private Collection<String> propertyAliases
@Nullable private com.google.common.base.Function<BaseContext,EntityDescriptor> metadataLookupStrategy
@Nullable @NotEmpty private com.google.common.base.Function<BaseContext,String> profileIdLookupStrategy
public AbstractMetadataDrivenConfigurationLookupStrategy()
protected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractInitializableComponentComponentInitializationExceptionpublic void setStrictNameFormat(boolean flag)
Default is false.
flag - flag to setpublic void setEnableCaching(boolean flag)
Default is true.
flag - flag to setpublic void setPropertyName(@Nonnull@NotEmpty String name)
name - base property namepublic void setProfileAliases(@Nonnull@NonnullElements Collection<String> aliases)
This allows alternative tag names to be checked.
aliases - alternative profile IDspublic void setMetadataLookupStrategy(@Nonnull com.google.common.base.Function<BaseContext,EntityDescriptor> strategy)
strategy - lookup strategypublic void setProfileIdLookupStrategy(@Nonnull com.google.common.base.Function<BaseContext,String> strategy)
strategy - lookup strategy@Nullable public T apply(@Nullable BaseContext input)
apply in interface com.google.common.base.Function<BaseContext,T>@Nullable private T translate(@Nonnull Attribute tag)
tag - tag to translate@Nullable protected abstract T doTranslate(@Nonnull Attribute tag)
Overrides of this function can assume a non-zero collection of values.
tag - tag to translate@Nullable private Attribute findMatchingTag(@Nonnull EntityDescriptor entity, @Nonnull@NotEmpty String name)
entity - the metadata to examinename - the tag name to search for@Nullable private Attribute findMatchingTag(@Nonnull EntityAttributes entityAttributes, @Nonnull@NotEmpty String name)
entityAttributes - the metadata to examinename - the tag name to search forCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.