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

noreply at shibboleth.net noreply at shibboleth.net
Fri Oct 3 21:41:46 EDT 2014


Author: putmanb
Date: Fri Oct  3 21:41:45 2014
New Revision: 4100

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4100&view=rev
Log:
Additional work on abstract dynamic metadata resolver.

Modified:
    trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java

Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java?rev=4100&r1=4099&r2=4100&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/metadata/resolver/impl/AbstractDynamicMetadataResolver.java Fri Oct  3 21:41:45 2014
@@ -21,6 +21,7 @@
 import java.io.InputStream;
 import java.net.URI;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Timer;
@@ -31,7 +32,12 @@
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.annotation.Nonnull;
-
+import javax.annotation.Nullable;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -55,6 +61,7 @@
 import org.opensaml.saml.saml2.metadata.EntityDescriptor;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.collections.Lists;
 
 import com.google.common.base.Strings;
 
@@ -87,26 +94,32 @@
     /** Generated Accept request header value. */
     private String supportedContentTypesValue;
     
-    // TODO constructor defaults and getter/setter for this
-    // TODO right name?
-    private long maxLastAccessedInterval;
+    /** The maximum idle time for which the resolver will keep data for a given entityID, before it is removed. */
+    private Long maxIdleEntityData;
+    
+    /** The interval in milliseconds at which the cleanup task should run. */
+    private Long cleanupTaskInterval;
+    
+    /** The backing store cleanup sweeper background task. */
+    private BackingStoreCleanupSweeper cleanupTask;
     
     /**
      * Constructor.
      *
-     * @param client
-     */
-    public AbstractDynamicMetadataResolver(HttpClient client) {
+     * @param client the instance of {@link HttpClient} used to fetch remote metadata
+     */
+    public AbstractDynamicMetadataResolver(@Nonnull final HttpClient client) {
         this(null, client);
     }
     
     /**
      * Constructor.
      *
-     * @param backgroundTaskTimer
-     * @param client
-     */
-    public AbstractDynamicMetadataResolver(Timer backgroundTaskTimer, HttpClient client) {
+     * @param backgroundTaskTimer the {@link Timer} instance used to run resolver background managment tasks
+     * @param client the instance of {@link HttpClient} used to fetch remote metadata
+     */
+    public AbstractDynamicMetadataResolver(@Nullable final Timer backgroundTaskTimer, 
+            @Nonnull final HttpClient client) {
         super();
         
         httpClient = Constraint.isNotNull(client, "HttpClient may not be null");
@@ -117,15 +130,62 @@
         } else {
             taskTimer = backgroundTaskTimer;
         }
-    }
-    
+        
+        // Default to 30 minutes.
+        cleanupTaskInterval = 30*60*1000L;
+    }
+    
+    /**
+     * Get the maximum idle time for which the resolver will keep data for a given entityID, before it is removed.
+     * 
+     * @return return the maximum idle time in milliseconds, or null if not value
+     */
+    @Nullable public Long getMaxIdleEntityData() {
+        return maxIdleEntityData;
+    }
+
+    /**
+     * Set the maximum idle time for which the resolver will keep data for a given entityID, before it is removed.
+     * 
+     * @param max the maximum entity data idle time, in milliseconds
+     */
+    public void setMaxIdleEntityData(@Nullable final Long max) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+        maxIdleEntityData = max;
+    }
+
+    /**
+     * Get the interval in milliseconds at which the cleanup task should run.
+     * 
+     * <p>The default is 30 minutes</p>
+     * 
+     * @return return the interval, in milliseconds
+     */
+    @Nonnull public Long getCleanupTaskInterval() {
+        return cleanupTaskInterval;

[... 380 lines stripped ...]


More information about the commits mailing list