[java-opensaml COMMIT] in /trunk/opensaml-util/src: main/java/org/opensaml/util/storage/AbstractStorageService.java m...

noreply at shibboleth.net noreply at shibboleth.net
Sun May 26 17:28:38 EDT 2013


Author: scantor
Date: Sun May 26 17:28:38 2013
New Revision: 3347

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3347&view=rev
Log:
Strip down storage API to eliminate string/text distinction.

Modified:
    trunk/opensaml-util/src/main/java/org/opensaml/util/storage/AbstractStorageService.java
    trunk/opensaml-util/src/main/java/org/opensaml/util/storage/ReplayCache.java
    trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageCapabilities.java
    trunk/opensaml-util/src/main/java/org/opensaml/util/storage/StorageService.java
    trunk/opensaml-util/src/main/java/org/opensaml/util/storage/impl/MemoryStorageService.java
    trunk/opensaml-util/src/test/java/org/opensaml/util/storage/StorageServiceTest.java

Modified: trunk/opensaml-util/src/main/java/org/opensaml/util/storage/AbstractStorageService.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-util/src/main/java/org/opensaml/util/storage/AbstractStorageService.java?rev=3347&r1=3346&r2=3347&view=diff
==============================================================================
--- trunk/opensaml-util/src/main/java/org/opensaml/util/storage/AbstractStorageService.java (original)
+++ trunk/opensaml-util/src/main/java/org/opensaml/util/storage/AbstractStorageService.java Sun May 26 17:28:38 2013
@@ -25,7 +25,6 @@
 import javax.annotation.Nullable;
 
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
-import net.shibboleth.utilities.java.support.collection.Pair;
 import net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
 import net.shibboleth.utilities.java.support.component.ComponentValidationException;
@@ -33,9 +32,8 @@
 /**
  * Abstract base class for {@link StorageService} implementations.
  * 
- * <p>The base class handles support for a background cleanup task, supplies Text method
- * implementations that call through to unimplemented String-based versions, and handles
- * calling of custom object serializers. 
+ * <p>The base class handles support for a background cleanup task, and handles
+ * calling of custom object serializers.</p>
  */
 public abstract class AbstractStorageService extends AbstractDestructableIdentifiableInitializableComponent
     implements StorageService {
@@ -77,7 +75,7 @@
      * 
      * @param interval number of seconds between one cleanup and another
      */
-    public synchronized void setCleanupInterval(long interval) {
+    public synchronized void setCleanupInterval(final long interval) {
         if (isInitialized()) {
             return;
         }
@@ -144,7 +142,7 @@
     }
 
     /** {@inheritDoc} */
-    public synchronized void setId(String componentId) {
+    public synchronized void setId(@Nonnull @NotEmpty final String componentId) {
         super.setId(componentId);
     }
     
@@ -154,108 +152,44 @@
     }
 
     /** {@inheritDoc} */
-    public boolean createText(@Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key,
-            @Nonnull @NotEmpty String value) throws IOException {
-        return createString(context, key, value);
+    public boolean create(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
+            @Nonnull final Object value, @Nonnull final StorageSerializer serializer) throws IOException {
+        return create(context, key, serializer.serialize(value));
     }
 
     /** {@inheritDoc} */
-    public boolean createText(@Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key,
-            @Nonnull @NotEmpty String value, long expiration) throws IOException {
-        return createString(context, key, value, expiration);
+    public boolean create(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
+            @Nonnull final Object value, @Nonnull final StorageSerializer serializer, final long expiration)
+                    throws IOException {
+        return create(context, key, serializer.serialize(value), expiration);
+    }
+    
+    /** {@inheritDoc} */
+    @Nullable public Integer update(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
+            @Nonnull final Object value, @Nonnull final StorageSerializer serializer) throws IOException {
+        return update(context, key, serializer.serialize(value));
     }
 
     /** {@inheritDoc} */
-    public boolean createText(@Nonnull @NotEmpty String context, @Nonnull @NotEmpty String key, @Nonnull Object value,
-            @Nonnull StorageSerializer serializer) throws IOException {
-        return createString(context, key, serializer.serialize(value));
+    @Nullable public Integer update(@Nonnull @NotEmpty final String context, @Nonnull @NotEmpty final String key,
+            @Nonnull final Object value, @Nonnull final StorageSerializer serializer, final long expiration)
+                    throws IOException {
+        return update(context, key, serializer.serialize(value), expiration);
     }
 

[... 1053 lines stripped ...]


More information about the commits mailing list