[java-opensaml COMMIT] in /trunk: opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java opensaml-s...

noreply at shibboleth.net noreply at shibboleth.net
Wed Oct 12 17:55:03 EDT 2016


Author: scantor
Date: Wed Oct 12 17:55:03 2016
New Revision: 4534

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4534&view=rev
Log:
Add an extended capability interface to storage plugins to detect client vs. server, etc.

Added:
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageCapabilitiesEx.java   (with props)
Modified:
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java
    trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageCapabilities.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/LDAPStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/MemoryStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/ServletRequestScopedStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/client/ClientStorageService.java
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/memcached/MemcachedStorageCapabilities.java
    trunk/opensaml-storage-impl/src/test/java/org/opensaml/storage/impl/ReplayCacheTest.java

Modified: trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java?rev=4534&r1=4533&r2=4534&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java	(original)
+++ trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/ReplayCache.java	Wed Oct 12 17:55:03 2016
@@ -26,6 +26,8 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.ThreadSafeAfterInit;
 import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
+import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.apache.commons.codec.digest.DigestUtils;
 import org.slf4j.Logger;
@@ -65,7 +67,13 @@
      * @param storageService backing store to use
      */
     public void setStorage(@Nonnull final StorageService storageService) {
-        storage = storageService;
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        storage = Constraint.isNotNull(storageService, "StorageService cannot be null");
+        final StorageCapabilities caps = storage.getCapabilities();
+        if (caps instanceof StorageCapabilitiesEx) {
+            Constraint.isTrue(((StorageCapabilitiesEx) caps).isServerSide(), "StorageService cannot be client-side");
+        }
     }
     
 
@@ -83,7 +91,9 @@
      * 
      * @param flag true iff we should treat storage failures as a replay
      */
-    public void setStrict(boolean flag) {
+    public void setStrict(final boolean flag) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
         strict = flag;
     }
 

Modified: trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageCapabilities.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageCapabilities.java?rev=4534&r1=4533&r2=4534&view=diff
==============================================================================
--- trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageCapabilities.java	(original)
+++ trunk/opensaml-storage-api/src/main/java/org/opensaml/storage/StorageCapabilities.java	Wed Oct 12 17:55:03 2016
@@ -19,6 +19,8 @@
 
 /**
  * Exposes capabilities of a {@link StorageService} implementation.
+ * 
+ * <p>Deprecated in favor of {@link StorageServiceEx}.
  */
 public interface StorageCapabilities {
     

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java?rev=4534&r1=4533&r2=4534&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java	(original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageService.java	Wed Oct 12 17:55:03 2016
@@ -43,6 +43,7 @@
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.storage.AbstractStorageService;
+import org.opensaml.storage.StorageCapabilitiesEx;
 import org.opensaml.storage.StorageRecord;
 import org.opensaml.storage.VersionMismatchException;
 import org.slf4j.Logger;
@@ -51,7 +52,7 @@
 /**
  * Implementation of {@link org.opensaml.storage.StorageService} that uses JPA to persist to a database.
  */

[... 298 lines stripped ...]


More information about the commits mailing list