[java-oidc-common] branch main updated: Javadoc and syntax cleanup

Phil Smart philip.smart at jisc.ac.uk
Thu Oct 14 18:08:49 UTC 2021


This is an automated email from the git hooks/post-receive script.

philsmart pushed a commit to branch main
in repository java-oidc-common.

View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=13dd19f7f246dd93a0680104ea767762f66b492a

The following commit(s) were added to refs/heads/main by this push:
     new 13dd19f  Javadoc and syntax cleanup
13dd19f is described below

commit 13dd19f7f246dd93a0680104ea767762f66b492a
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Thu Oct 14 19:08:47 2021 +0100

    Javadoc and syntax cleanup
---
 .../metadata/cache/impl/AbstractMetadataCache.java    | 19 +++++++++----------
 .../oidc/metadata/cache/impl/BatchMetadataCache.java  | 10 ++++++++--
 .../metadata/cache/impl/DynamicMetadataCache.java     |  8 ++++++++
 .../impl/OIDCProviderMetadataCacheFactoryBean.java    |  5 +++--
 4 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java
index e14237d..ac9a00e 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/AbstractMetadataCache.java
@@ -59,10 +59,7 @@ import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
  * A base {@link MetadataCache} implementation. Supports the following:
  * <ul>
  * <li>A configurable backing store to store metadata.</li>
- * <li>Read-write locking on individual metadata entries. Including optimistic reads.</li>
- * <li>Synchronous metadata fetching for new metadata.</li>
- * <li>Synchronous metadata fetching for stale (past refresh point) metadata.</li>
- * <li>A background task to remove expired and idle metadata.</li>
+ * <li>Individual entity metadata filtering during cache save.</li>
  * <li>Configuration of type specific functions via strategies.</li>
  * </ul>
  *
@@ -189,7 +186,8 @@ public abstract class AbstractMetadataCache<IdentifierType, MetadataType>
             // Use thread builder to allow setting threads as deamon and a name.
             // Set as deamon background threads. Do not prevent JVM exit.
             executorService = Executors.newSingleThreadScheduledExecutor(
-                    new ThreadFactoryBuilder().setDaemon(true).setNameFormat(TimerSupport.getTimerName(this)+"-%d").build()); 
+                    new ThreadFactoryBuilder().setDaemon(true).setNameFormat(TimerSupport.getTimerName(this)+"-%d")
+                    .build()); 
         }                  
     }
     
@@ -416,6 +414,11 @@ public abstract class AbstractMetadataCache<IdentifierType, MetadataType>
         
     }
     
+    /**
+     * Write the given metadata to the backing store index.
+     * 
+     * @param metadata the metadata to add to the backing store.
+     */
     protected void writeToBackingStore(@Nonnull final MetadataType metadata) {
         
         final IdentifierType extractedIdentifier = identifierExtractionStrategy.apply(metadata);
@@ -436,9 +439,6 @@ public abstract class AbstractMetadataCache<IdentifierType, MetadataType>
         existingMetadata.add(metadata);
     }    
     
-
-    
-    
     
     /**
      * Get a new instance of {@link MetadataFilterContext} to be used when filtering metadata.
@@ -494,8 +494,7 @@ public abstract class AbstractMetadataCache<IdentifierType, MetadataType>
     /**
      * Remove/discard all metadata for the backing store.
      * 
-     * <p>Ensure thread-safety is observed if this is called from an unsafe
-     * call-site. </p>
+     * <p>Ensure thread-safety is observed in the calling method.</p>
      * 
      * TODO check lock. 
      */
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/BatchMetadataCache.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/BatchMetadataCache.java
index ea8da6a..46c565f 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/BatchMetadataCache.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/BatchMetadataCache.java
@@ -46,11 +46,17 @@ import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 /**
  * A metadata cache implementation that supports 'refresh-ahead' semantics for batch cache updates. 
  * Does not support 'read-through' semantics if an entry does not exist in the cache.
+ * 
+ * 
+ * <p>Supports the following:</p>
+ * <ul>
+ * <li>Batch reloading of metadata using the supplied loading strategy. The cache 
+ * is completely reloaded during each background update.</li>
+ * </ul>
  *
  * @param <IdentifierType> the metadata identifier type.
  * @param <MetadataType> the metadata type.
  */
-//TODO should be called reloadable or batch?
 public class BatchMetadataCache<IdentifierType, MetadataType> 
                                 extends AbstractMetadataCache<IdentifierType, MetadataType> {
 
@@ -75,7 +81,7 @@ public class BatchMetadataCache<IdentifierType, MetadataType>
 
     /**
      * 
-     * Package private constructor.
+     * Constructor.
      *
      * @param store the backing store.
      * @param metadataLoadingStrategy strategy used to load metadata.
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java
index 4445d9c..d91a9eb 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/DynamicMetadataCache.java
@@ -50,6 +50,14 @@ import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 /**
  * A metadata cache implementation that supports 'read-through' semantics. Does not support 'refresh-ahead' semantics
  * for loading about to expire values asynchronously ahead of time.
+ * 
+ * <p>Supports the following:</p>
+ * <ul>
+ * <li>Read-write locking on individual metadata entries. Including optimistic reads.</li>
+ * <li>Synchronous 'read-through' metadata fetching for new metadata.</li>
+ * <li>Synchronous 'read-through' metadata fetching for stale (past refresh point) metadata.</li>
+ * <li>A background task to remove expired and idle metadata.</li>
+ * </ul>
  *
  * @param <IdentifierType> the metadata identifier type.
  * @param <MetadataType> the metadata type.
diff --git a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/OIDCProviderMetadataCacheFactoryBean.java b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/OIDCProviderMetadataCacheFactoryBean.java
index 179bcf6..3c7d6cb 100644
--- a/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/OIDCProviderMetadataCacheFactoryBean.java
+++ b/oidc-common-metadata-impl/src/main/java/net/shibboleth/oidc/metadata/cache/impl/OIDCProviderMetadataCacheFactoryBean.java
@@ -22,7 +22,8 @@ public class OIDCProviderMetadataCacheFactoryBean extends MetadataCacheBuilder<I
     @Override
     protected MetadataCache<OIDCProviderMetadata> createInstance() throws Exception {
         
-        // refresh ahead is only supported by the refreshable 
+        // batch refresh-ahead is only supported by the batch cache type. 
+        //TODO change to explicit batch mode v dynamic mode.
         if (!isRefreshAhead()) {
             final DynamicMetadataCache<Issuer, OIDCProviderMetadata> cache = new DynamicMetadataCache<>(
                     new DefaultDynamicBackingStore<>(getMaxCacheDuration()), getFetchStrategy());
@@ -56,7 +57,7 @@ public class OIDCProviderMetadataCacheFactoryBean extends MetadataCacheBuilder<I
             cache.setCriteriaToIdentifierStrategy(getCriteriaToIdentifierStrategy());
             cache.setMetadataFilterStrategy(getMetadataFilterStrategy());
             cache.setMetadataBeforeRemovalHook(getMetadataBeforeRemovalHook());
-            cache.setId("OIDCProviderRefreshableMetadataCache");
+            cache.setId("OIDCProviderBatchMetadataCache");
             cache.initialize();
             return cache;
         }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list