[java-identity-provider COMMIT] /trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolve...

noreply at shibboleth.net noreply at shibboleth.net
Sun Mar 25 11:47:16 BST 2012


Author: lajoie
Date: Sun Mar 25 11:47:15 2012
New Revision: 4135

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4135&view=rev
Log:
oopss... forget the getters/setters and stuff

Modified:
    trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ResolutionContextDataAttributeDefinition.java

Modified: trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ResolutionContextDataAttributeDefinition.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ResolutionContextDataAttributeDefinition.java?rev=4135&r1=4134&r2=4135&view=diff
==============================================================================
--- trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ResolutionContextDataAttributeDefinition.java (original)
+++ trunk/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/ad/ResolutionContextDataAttributeDefinition.java Sun Mar 25 11:47:15 2012
@@ -19,11 +19,16 @@
 
 import java.util.Collection;
 
+import javax.annotation.Nonnull;
+
 import net.shibboleth.idp.attribute.Attribute;
 import net.shibboleth.idp.attribute.AttributeValue;
 import net.shibboleth.idp.attribute.resolver.AttributeResolutionContext;
 import net.shibboleth.idp.attribute.resolver.AttributeResolutionException;
 import net.shibboleth.idp.attribute.resolver.BaseAttributeDefinition;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
+import net.shibboleth.utilities.java.support.logic.Assert;
 
 import com.google.common.base.Function;
 import com.google.common.base.Optional;
@@ -36,6 +41,28 @@
 
     /** Function used to extract attribute values from the current resolution context. */
     private Function<AttributeResolutionContext, Collection<? extends AttributeValue>> dataExtractionStrategy;
+
+    /**
+     * Gets the function used to extract attribute values from the current {@link AttributeResolutionContext}.
+     * 
+     * @return function used to extract attribute values from the current {@link AttributeResolutionContext}
+     */
+    public Function<AttributeResolutionContext, Collection<? extends AttributeValue>> getDataExtractionStrategy() {
+        return dataExtractionStrategy;
+    }
+
+    /**
+     * Sets the function used to extract attribute values from the current {@link AttributeResolutionContext}.
+     * 
+     * @param strategy function used to extract attribute values from the current {@link AttributeResolutionContext}
+     */
+    public synchronized void setDataExtractionStrategy(
+            @Nonnull final Function<AttributeResolutionContext, Collection<? extends AttributeValue>> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
+        dataExtractionStrategy = Assert.isNotNull(strategy, "Data extraction strategy can not be null");
+    }
 
     /** {@inheritDoc} */
     protected Optional<Attribute> doAttributeDefinitionResolve(AttributeResolutionContext resolutionContext)
@@ -53,4 +80,19 @@
 
         return Optional.of(attribute);
     }
+
+    /** {@inheritDoc} */
+    protected void doDestroy() {
+        dataExtractionStrategy = null;
+        super.doDestroy();
+    }
+
+    /** {@inheritDoc} */
+    protected void doInitialize() throws ComponentInitializationException {
+        super.doInitialize();
+
+        if (dataExtractionStrategy == null) {
+            throw new ComponentInitializationException("No data extraction strategy has been given");
+        }
+    }
 }



More information about the commits mailing list