Class AttributeTranscoderRegistryImpl
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
-
- net.shibboleth.ext.spring.service.AbstractServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>
-
- net.shibboleth.idp.attribute.transcoding.impl.AttributeTranscoderRegistryImpl
-
- All Implemented Interfaces:
net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry,net.shibboleth.utilities.java.support.component.Component,net.shibboleth.utilities.java.support.component.DestructableComponent,net.shibboleth.utilities.java.support.component.IdentifiableComponent,net.shibboleth.utilities.java.support.component.IdentifiedComponent,net.shibboleth.utilities.java.support.component.InitializableComponent,net.shibboleth.utilities.java.support.service.ServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>,Aware,ApplicationContextAware
@ThreadSafe public class AttributeTranscoderRegistryImpl extends net.shibboleth.ext.spring.service.AbstractServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry> implements net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistryService implementation of theAttributeTranscoderRegistryinterface.
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,Map<Locale,String>>descriptionRegistryRegistry of description mappings associated with internal attribute IDs.private Map<String,Map<Locale,String>>displayNameRegistryRegistry of display name mappings associated with internal attribute IDs.private LoggerlogClass logger.private Map<Class<?>,Function<?,String>>namingFunctionRegistryRegistry of naming functions for supported object types.private Map<String,Multimap<Class<?>,net.shibboleth.idp.attribute.transcoding.TranscodingRule>>transcodingRegistryRegistry of transcoding instructions for a given "name" and type of object.
-
Constructor Summary
Constructors Constructor Description AttributeTranscoderRegistryImpl()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddMapping(String id, net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?> transcoder, Map<String,Object> ruleset)Add a mapping between anIdPAttributename and a set of transcoding rules.private Predicate<org.opensaml.profile.context.ProfileRequestContext>buildActivationCondition(Map<String,Object> ruleset)Build an appropriatePredicateto use as an activation condition within the ruleset.private Collection<net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?>>getAttributeTranscoders(net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)Get the appropriateAttributeTranscoderobjects to use.net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistrygetComponent()Map<Locale,String>getDescriptions(net.shibboleth.idp.attribute.IdPAttribute attribute)Map<Locale,String>getDisplayNames(net.shibboleth.idp.attribute.IdPAttribute attribute)private Class<?>getEffectiveType(Class<?> inputType)Convert an input type into the appropriate type (possibly itself) to use in looking up rules in the registry.Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule>getTranscodingRules(net.shibboleth.idp.attribute.IdPAttribute from, Class<?> to)<T> Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule>getTranscodingRules(T from)voidsetNamingRegistry(Map<Class<?>,Function<?,String>> registry)Installs registry of naming functions mapped against the types of objects they support.voidsetTranscoderRegistry(Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> mappings)Installs the transcoder mappings en masse.-
Methods inherited from class net.shibboleth.ext.spring.service.AbstractServiceableComponent
doDestroy, doInitialize, getApplicationContext, pinComponent, setApplicationContext, unloadComponent, unpinComponent
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final Logger log
Class logger.
-
transcodingRegistry
@Nonnull @NonnullElements private final Map<String,Multimap<Class<?>,net.shibboleth.idp.attribute.transcoding.TranscodingRule>> transcodingRegistry
Registry of transcoding instructions for a given "name" and type of object.
-
displayNameRegistry
@Nonnull @NonnullElements private final Map<String,Map<Locale,String>> displayNameRegistry
Registry of display name mappings associated with internal attribute IDs.
-
descriptionRegistry
@Nonnull @NonnullElements private final Map<String,Map<Locale,String>> descriptionRegistry
Registry of description mappings associated with internal attribute IDs.
-
-
Method Detail
-
getComponent
@Nonnull public net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry getComponent()
- Specified by:
getComponentin interfacenet.shibboleth.utilities.java.support.service.ServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>- Specified by:
getComponentin classnet.shibboleth.ext.spring.service.AbstractServiceableComponent<net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry>
-
setNamingRegistry
public void setNamingRegistry(@Nonnull @NonnullElements Map<Class<?>,Function<?,String>> registry)Installs registry of naming functions mapped against the types of objects they support.- Parameters:
registry- map of types to naming functions
-
setTranscoderRegistry
public void setTranscoderRegistry(@Nonnull @NonnullElements Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> mappings)Installs the transcoder mappings en masse.Each map connects an
IdPAttributename to the rules for transcoding to/from it.The rules MUST contain at least:
AttributeTranscoderRegistry.PROP_ID- internal attribute ID to map to/fromAttributeTranscoderRegistry.PROP_TRANSCODER- anAttributeTranscoderinstance supporting the type
- Parameters:
mappings- transcoding rulesets
-
getDisplayNames
@Nonnull @NonnullElements @NotLive @Unmodifiable public Map<Locale,String> getDisplayNames(@Nonnull net.shibboleth.idp.attribute.IdPAttribute attribute)
- Specified by:
getDisplayNamesin interfacenet.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
-
getDescriptions
@Nonnull @NonnullElements @NotLive @Unmodifiable public Map<Locale,String> getDescriptions(@Nonnull net.shibboleth.idp.attribute.IdPAttribute attribute)
- Specified by:
getDescriptionsin interfacenet.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
-
getTranscodingRules
@Nonnull @NonnullElements @Unmodifiable public Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> getTranscodingRules(@Nonnull net.shibboleth.idp.attribute.IdPAttribute from, @Nonnull Class<?> to)
- Specified by:
getTranscodingRulesin interfacenet.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
-
getTranscodingRules
@Nonnull @NonnullElements @Unmodifiable public <T> Collection<net.shibboleth.idp.attribute.transcoding.TranscodingRule> getTranscodingRules(@Nonnull T from)
- Specified by:
getTranscodingRulesin interfacenet.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry
-
getAttributeTranscoders
@Nonnull @NonnullElements private Collection<net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?>> getAttributeTranscoders(@Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
Get the appropriateAttributeTranscoderobjects to use.- Parameters:
rule- transcoding rule- Returns:
- transcoders to install under a copy of each ruleset's
AttributeTranscoderRegistry.PROP_TRANSCODERproperty
-
addMapping
private void addMapping(@Nonnull @NotEmpty String id, @Nonnull net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<?> transcoder, @Nonnull Map<String,Object> ruleset)Add a mapping between anIdPAttributename and a set of transcoding rules.- Parameters:
id- name of theIdPAttributeto map to/fromtranscoder- the transcoder for this ruleruleset- transcoding rules
-
buildActivationCondition
@Nullable private Predicate<org.opensaml.profile.context.ProfileRequestContext> buildActivationCondition(@Nonnull Map<String,Object> ruleset)
Build an appropriatePredicateto use as an activation condition within the ruleset.- Parameters:
ruleset- transcoding rules- Returns:
- a predicate to install under the ruleset's
AttributeTranscoderRegistry.PROP_CONDITION
-
getEffectiveType
@Nullable private Class<?> getEffectiveType(@Nonnull Class<?> inputType)
Convert an input type into the appropriate type (possibly itself) to use in looking up rules in the registry.- Parameters:
inputType- the type passed into the registry operation- Returns:
- the appropriate type to use subsequently or null if not found
-
-