[java-identity-provider COMMIT] in /trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resol...

noreply at shibboleth.net noreply at shibboleth.net
Mon May 6 11:59:19 EDT 2013


Author: rdw
Date: Mon May  6 11:59:19 2013
New Revision: 4466

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4466&view=rev
Log:
IDP-203 introduce getLogPrefix into base classes as an enabler for code tidy in inheriting classes.

Modified:
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/BaseAttributeDefinition.java
    trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/BaseDataConnector.java

Modified: trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/BaseAttributeDefinition.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/BaseAttributeDefinition.java?rev=4466&r1=4465&r2=4466&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/BaseAttributeDefinition.java (original)
+++ trunk/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/BaseAttributeDefinition.java Mon May  6 11:59:19 2013
@@ -32,6 +32,7 @@
 import net.shibboleth.idp.attribute.Attribute;
 import net.shibboleth.idp.attribute.AttributeEncoder;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.annotation.constraint.NullableElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
 import net.shibboleth.utilities.java.support.collection.CollectionSupport;
@@ -69,6 +70,9 @@
     /** Localized human readable description of attribute. */
     private Map<Locale, String> displayDescriptions = Collections.emptyMap();
 
+    /** cache for the log prefix - to save multiple recalculations. */
+    private String logPrefix;
+
     /**
      * Gets whether this attribute definition is only a dependency and thus its values should never be released outside
      * the resolver.
@@ -210,7 +214,7 @@
     protected void doInitialize() throws ComponentInitializationException {
         
         // Set up the dependencies first.  Then the initialize in the parent
-        // will correctly rehash the dependenies.
+        // will correctly rehash the dependencies.
         if (null != sourceAttributeID) {
             for (ResolverPluginDependency depends : getDependencies()) {
                 depends.setDependencyAttributeId(sourceAttributeID);
@@ -218,6 +222,9 @@
         }
         super.doInitialize();
         
+        // The Id is now definitive.  Just in case it was used prior to that, reset the getPrefixCache
+        logPrefix = null;
+        
         for (AttributeEncoder encoder : encoders) {
             ComponentSupport.initialize(encoder);
         }
@@ -246,27 +253,27 @@
         final Attribute resolvedAttribute = doAttributeDefinitionResolve(resolutionContext);
 
         if (null == resolvedAttribute) {
-            log.debug("Attribute definition '{}': no attribute was produced during resolution", getId());
+            log.debug("{} no attribute was produced during resolution", getLogPrefix());
             return null;
         }
 
         if (resolvedAttribute.getValues().isEmpty()) {
-            log.debug("Attribute definition '{}': produced an attribute with no values", getId());
+            log.debug("{} produced an attribute with no values", getLogPrefix());
         } else {
-            log.debug("Attribute definition '{}': produced an attribute with the following values {}", getId(),
+            log.debug("{} produced an attribute with the following values {}", getLogPrefix(),
                     resolvedAttribute.getValues());
         }
 
-        log.debug("Attribute definition '{}': associating the following display descriptions"
-                + " with the resolved attribute: {}", getId(), getDisplayDescriptions());
+        log.debug("{} associating the following display descriptions"
+                + " with the resolved attribute: {}", getLogPrefix(), getDisplayDescriptions());
         resolvedAttribute.setDisplayDescriptions(getDisplayDescriptions());
 
-        log.debug("Attribute definition '{}': associating the following display names with the resolved attribute: {}",
-                getId(), getDisplayNames());
+        log.debug("{} associating the following display names with the resolved attribute: {}",
+                getLogPrefix(), getDisplayNames());
         resolvedAttribute.setDisplayNames(getDisplayNames());
 
-        log.debug("Attribute definition '{}': associating the following encoders with the resolved attribute: {}",
-                getId(), getAttributeEncoders());
+        log.debug("{} associating the following encoders with the resolved attribute: {}",
+                getLogPrefix(), getAttributeEncoders());
         resolvedAttribute.setEncoders(getAttributeEncoders());
 
         return resolvedAttribute;
@@ -285,4 +292,22 @@
      */

[... 106 lines stripped ...]


More information about the commits mailing list