[java-identity-provider COMMIT] in /trunk: idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/Abstr...

noreply at shibboleth.net noreply at shibboleth.net
Tue Nov 11 17:57:39 EST 2014


Author: scantor
Date: Tue Nov 11 17:57:39 2014
New Revision: 6881

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6881&view=rev
Log:
IDP-418 - add a strawman class to cache and expose a SAML2AttributesMapper

Added:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/mapping/impl/SAML2AttributesMapperService.java   (with props)
Modified:
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/AbstractSAMLAttributesMapper.java
    trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/AttributesMapper.java

Modified: trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/AbstractSAMLAttributesMapper.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/AbstractSAMLAttributesMapper.java?rev=6881&r1=6880&r2=6881&view=diff
==============================================================================
--- trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/AbstractSAMLAttributesMapper.java (original)
+++ trunk/idp-saml-api/src/main/java/net/shibboleth/idp/saml/attribute/mapping/AbstractSAMLAttributesMapper.java Tue Nov 11 17:57:39 2014
@@ -25,6 +25,7 @@
 import java.util.Map.Entry;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.idp.attribute.AttributeEncoder;
 import net.shibboleth.idp.attribute.IdPAttribute;
@@ -32,6 +33,7 @@
 import net.shibboleth.idp.attribute.resolver.AttributeResolver;
 import net.shibboleth.idp.saml.attribute.encoding.AttributeMapperProcessor;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
@@ -44,6 +46,7 @@
 import com.google.common.base.Supplier;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
 
 /**
@@ -58,20 +61,18 @@
 public abstract class AbstractSAMLAttributesMapper<InType extends Attribute, OutType extends IdPAttribute> extends
         AbstractIdentifiableInitializableComponent implements AttributesMapper<InType, OutType> {
 
-    /** Log. */
-    private final Logger log = LoggerFactory.getLogger(AbstractSAMLAttributesMapper.class);
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(AbstractSAMLAttributesMapper.class);
 
     /** The mappers we can apply. */
-    private Collection<AttributeMapper<InType, OutType>> mappers = Collections.EMPTY_LIST;
+    @Nonnull @NonnullElements private Collection<AttributeMapper<InType,OutType>> mappers = Collections.EMPTY_LIST;
 
     /** The String used to prefix log message. */
-    private String logPrefix;
+    @Nullable private String logPrefix;
 
-    /**
-     * Default Constructor.
-     *
-     */
+    /** Default Constructor. */
     public AbstractSAMLAttributesMapper() {
+        
     }
     
     /**
@@ -88,22 +89,21 @@
      * @param id The it
      * @param mapperFactory A factory to generate new mappers of the correct type.
      */
-    public AbstractSAMLAttributesMapper(final AttributeResolver resolver, final String id,
-            Supplier<AbstractSAMLAttributeMapper<InType, OutType>> mapperFactory) {
+    public AbstractSAMLAttributesMapper(@Nonnull final AttributeResolver resolver, @Nonnull @NotEmpty final String id,
+            @Nonnull final Supplier<AbstractSAMLAttributeMapper<InType,OutType>> mapperFactory) {
 
-        super();
         setId(id); 
 
-        final Multimap<AbstractSAMLAttributeMapper<InType, OutType>, String> theMappers;
+        final Multimap<AbstractSAMLAttributeMapper<InType,OutType>,String> theMappers;
 
         theMappers = HashMultimap.create();
 
-        for (AttributeDefinition attributeDef : resolver.getAttributeDefinitions().values()) {
-            for (AttributeEncoder encode : attributeDef.getAttributeEncoders()) {
+        for (final AttributeDefinition attributeDef : resolver.getAttributeDefinitions().values()) {
+            for (final AttributeEncoder encode : attributeDef.getAttributeEncoders()) {
                 if (encode instanceof AttributeMapperProcessor) {
                     // There is an appropriate reverse mappers
-                    AttributeMapperProcessor factory = (AttributeMapperProcessor) encode;
-                    AbstractSAMLAttributeMapper<InType, OutType> mapper = mapperFactory.get();
+                    final AttributeMapperProcessor factory = (AttributeMapperProcessor) encode;
+                    final AbstractSAMLAttributeMapper<InType,OutType> mapper = mapperFactory.get();

[... 114 lines stripped ...]


More information about the commits mailing list