[java-opensaml COMMIT] in /trunk: opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/Abstract...

noreply at shibboleth.net noreply at shibboleth.net
Wed May 28 19:59:46 EDT 2014


Author: putmanb
Date: Wed May 28 19:59:45 2014
New Revision: 3899

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3899&view=rev
Log:
Pull out generically-parameterized AbstractChainingCredentialResolver for reuse of Iterable and Iterator code.
Implement ChainingKeyInfoCredentialResolver and tests.

Added:
    trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/AbstractChainingCredentialResolver.java
      - copied, changed from r3897, trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/ChainingCredentialResolver.java
    trunk/opensaml-xmlsec-impl/src/main/java/org/opensaml/xmlsec/keyinfo/impl/ChainingKeyInfoCredentialResolver.java   (with props)
    trunk/opensaml-xmlsec-impl/src/test/java/org/opensaml/xmlsec/keyinfo/impl/ChainingKeyInfoCredentialResolverTest.java   (with props)
Modified:
    trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/ChainingCredentialResolver.java

Copied: trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/AbstractChainingCredentialResolver.java (from r3897, trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/ChainingCredentialResolver.java)
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/AbstractChainingCredentialResolver.java?p2=trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/AbstractChainingCredentialResolver.java&p1=trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/ChainingCredentialResolver.java&r1=3897&r2=3899&rev=3899&view=diff
==============================================================================
--- trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/ChainingCredentialResolver.java (original)
+++ trunk/opensaml-security-impl/src/main/java/org/opensaml/security/credential/impl/AbstractChainingCredentialResolver.java Wed May 28 19:59:45 2014
@@ -42,24 +42,27 @@
 import com.google.common.collect.Lists;
 
 /**
- * An implementation of {@link CredentialResolver} which chains together one or more underlying credential resolver
- * implementations. Resolved credentials are returned from all underlying resolvers in the chain, in the order implied
- * by the order of the resolvers in the chain.
+ * An abstract implementation of {@link CredentialResolver} which chains together one or more underlying credential 
+ * resolver implementations. Resolved credentials are returned from all underlying resolvers in the chain, 
+ * in the order implied by the order of the resolvers in the chain.
+ * 
+ * @param <ResolverType> the subtype of CredentialResolver to be chained
  */
-public class ChainingCredentialResolver extends AbstractCredentialResolver {
+public abstract class AbstractChainingCredentialResolver<ResolverType extends CredentialResolver> 
+        extends AbstractCredentialResolver {
 
     /** Logger. */
     private final Logger log = LoggerFactory.getLogger(ChainingCredentialResolver.class);
 
     /** List of credential resolvers in the chain. */
-    private List<CredentialResolver> resolvers;
+    private List<ResolverType> resolvers;
 
     /**
      * Constructor.
      * 
      * @param credResolvers the list of chained credential resolvers
      */
-    public ChainingCredentialResolver(@Nonnull final List<CredentialResolver> credResolvers) {
+    public AbstractChainingCredentialResolver(@Nonnull final List<ResolverType> credResolvers) {
         Constraint.isNotNull(credResolvers, "CredentialResolver list may not be null");
         resolvers = Lists.newArrayList(Collections2.filter(credResolvers, Predicates.notNull()));
     }
@@ -69,7 +72,7 @@
      * 
      * @return the list of credential resolvers in the chain
      */
-    @Nonnull @NonnullElements @Unmodifiable @NotLive public List<CredentialResolver> getResolverChain() {
+    @Nonnull @NonnullElements @Unmodifiable @NotLive public List<ResolverType> getResolverChain() {
         return ImmutableList.copyOf(resolvers);
     }
 
@@ -88,7 +91,7 @@
     public class CredentialIterable implements Iterable<Credential> {
 
         /** The chaining credential resolver which owns this instance. */
-        private ChainingCredentialResolver parent;
+        private AbstractChainingCredentialResolver<ResolverType> parent;
 
         /** The criteria set on which to base resolution. */
         private CriteriaSet critSet;
@@ -99,7 +102,7 @@
          * @param resolver the chaining parent of this iterable
          * @param criteriaSet the set of criteria which is input to the underyling resolvers
          */
-        public CredentialIterable(@Nonnull final ChainingCredentialResolver resolver,
+        public CredentialIterable(@Nonnull final AbstractChainingCredentialResolver<ResolverType> resolver,
                 @Nullable final CriteriaSet criteriaSet) {
             parent = resolver;
             critSet = criteriaSet;
@@ -121,13 +124,13 @@

[... 266 lines stripped ...]


More information about the commits mailing list