[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/metadata/resolver/impl/AbstractB...

noreply at shibboleth.net noreply at shibboleth.net
Fri Aug 23 20:44:51 EDT 2013


Author: putmanb
Date: Fri Aug 23 20:44:51 2013
New Revision: 3431

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3431&view=rev
Log:
Refactored AbstractMetadataResolver with new processing model, pre-indexing of entity descriptors and new EntityBackingStore abstraction.
Add new abstract metadata resolver specialization for batch source-oriented resolvers.

Added:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractBatchMetadataResolver.java   (with props)
Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractMetadataResolver.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractObservableMetadataResolver.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractReloadingMetadataResolver.java
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/DOMMetadataResolver.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/FilesystemMetadataResolverTest.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/HTTPMetadataResolverTest.java
    trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/metadata/resolver/impl/ResourceBackedMetadataResolverTest.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractMetadataResolver.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractMetadataResolver.java?rev=3431&r1=3430&r2=3431&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractMetadataResolver.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractMetadataResolver.java Fri Aug 23 20:44:51 2013
@@ -19,14 +19,18 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.annotation.Nonnull;
-
-import net.shibboleth.utilities.java.support.collection.LazyList;
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.logic.Constraint;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
 import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 import net.shibboleth.utilities.java.support.resolver.ResolverException;
 import net.shibboleth.utilities.java.support.xml.ParserPool;
@@ -44,14 +48,11 @@
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 
-import com.google.common.base.Objects;
 import com.google.common.base.Strings;
 
 /** An abstract, base, implementation of a metadata provider. */
 public abstract class AbstractMetadataResolver extends BaseMetadataResolver {
     
-    // TODO need to clear index at appropriate time, in light of removable of Observable support.
-
     /** Class logger. */
     private final Logger log = LoggerFactory.getLogger(AbstractMetadataResolver.class);
 
@@ -63,9 +64,9 @@
      * assumption being that in most cases a provider will recover at some point in the future. Default: true.
      */
     private boolean failFastInitialization;
-
-    /** Cache of entity IDs to their descriptors. */
-    private Map<String, EntityDescriptor> indexedDescriptors;
+    
+    /** Backing store for runtime EntityDescriptor data. */
+    private EntityBackingStore entityBackingStore;
 
     /** Pool of parsers used to process XML. */
     private ParserPool parser;
@@ -73,7 +74,6 @@
     /** Constructor. */
     public AbstractMetadataResolver() {
         super();
-        indexedDescriptors = new ConcurrentHashMap<String, EntityDescriptor>();
         failFastInitialization = true;
         initialized = false;
     }
@@ -83,98 +83,16 @@
         //TODO add filtering for entity role, protocol? maybe
         //TODO add filtering for binding? probably not, belongs better in RoleDescriptorResolver
         //TODO this needs to change substantially if we support queries *without* an EntityIdCriterion
+        
         EntityIdCriterion entityIdCriterion = criteria.get(EntityIdCriterion.class);
         if (entityIdCriterion == null || Strings.isNullOrEmpty(entityIdCriterion.getEntityId())) {
             //TODO throw or just log?
             throw new ResolverException("Entity Id was not supplied in criteria set");
         }
         
-        LazyList<EntityDescriptor> list = new LazyList<>();
-        
-        EntityDescriptor entityDescriptor = getEntityDescriptor(entityIdCriterion.getEntityId());
-        if (entityDescriptor != null) {
-            list.add(entityDescriptor);
-        }
-        
-        return list;
-    }
-
-    /** {@inheritDoc} */
-    protected XMLObject getMetadata() throws ResolverException {
-        if (!isInitialized()) {

[... 656 lines stripped ...]


More information about the commits mailing list