[java-opensaml COMMIT] in /trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec: DecryptionParameters.java Sig...

noreply at shibboleth.net noreply at shibboleth.net
Thu Feb 20 23:03:43 EST 2014


Author: scantor
Date: Thu Feb 20 23:03:43 2014
New Revision: 3634

URL: http://svn.shibboleth.net/view/java-opensaml?rev=3634&view=rev
Log:
Annotations / collection changes.

Modified:
    trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/DecryptionParameters.java
    trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/SignatureValidationParameters.java

Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/DecryptionParameters.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/DecryptionParameters.java?rev=3634&r1=3633&r2=3634&view=diff
==============================================================================
--- trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/DecryptionParameters.java (original)
+++ trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/DecryptionParameters.java Thu Feb 20 23:03:43 2014
@@ -17,12 +17,24 @@
 
 package org.opensaml.xmlsec;
 
-import java.util.List;
+import java.util.Collection;
+import java.util.Collections;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
+
+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.logic.Constraint;
 
 import org.opensaml.xmlsec.encryption.support.EncryptedKeyResolver;
 import org.opensaml.xmlsec.keyinfo.KeyInfoCredentialResolver;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
 
 /**
  * The effective parameters to use when decrypting encrypted XML.
@@ -30,27 +42,33 @@
 public class DecryptionParameters {
     
     /** Whitelisted algorithm URIs. */
-    private List<String> whiteListedAlgorithmURIs;
+    @Nonnull @NonnullElements private Collection<String> whiteListedAlgorithmURIs;
     
     /** Blacklisted algorithm URIs. */
-    private List<String> blackListedAlgorithmURIs;
+    @Nonnull @NonnullElements private Collection<String> blackListedAlgorithmURIs;
     
     /** The EncryptedData's KeyInfo credential resolver. */
-    private KeyInfoCredentialResolver dataKeyInfoCredentialResolver;
+    @Nullable private KeyInfoCredentialResolver dataKeyInfoCredentialResolver;
     
     /** The EncryptedKey's KeyInfo credential resolver. */
-    private KeyInfoCredentialResolver kekKeyInfoCredentialResolver;
+    @Nullable private KeyInfoCredentialResolver kekKeyInfoCredentialResolver;
     
     /** The EncryptedKey resolver. */
-    private EncryptedKeyResolver encryptedKeyResolver;
+    @Nullable private EncryptedKeyResolver encryptedKeyResolver;
+        
+    /** Constructor. */
+    public DecryptionParameters() {
+        whiteListedAlgorithmURIs = Collections.emptyList();
+        blackListedAlgorithmURIs = Collections.emptyList();
+    }
     
     /**
      * Get the list of whitelisted algorithm URI's.
      * 
      * @return the list of algorithms
      */
-    @Nullable public List<String> getWhitelistedAlgorithmURIs() {
-        return whiteListedAlgorithmURIs;
+    @Nonnull @NonnullElements @NotLive @Unmodifiable public Collection<String> getWhitelistedAlgorithmURIs() {
+        return ImmutableList.copyOf(whiteListedAlgorithmURIs);
     }
     
     /**
@@ -58,8 +76,9 @@
      * 
      * @param uris the list of algorithms
      */
-    public void setWhitelistedAlgorithmURIs(@Nullable final List<String> uris) {
-        whiteListedAlgorithmURIs = uris;
+    public void setWhitelistedAlgorithmURIs(@Nonnull @NonnullElements final Collection<String> uris) {
+        Constraint.isNotNull(uris, "Whitelist cannot be null");
+        whiteListedAlgorithmURIs = Lists.newArrayList(Collections2.filter(uris, Predicates.notNull()));
     }
     
     /**
@@ -67,8 +86,8 @@
      * 
      * @return the list of algorithms
      */
-    @Nullable public List<String> getBlacklistedAlgorithmsURIs() {
-        return blackListedAlgorithmURIs;
+    @Nonnull @NonnullElements @NotLive @Unmodifiable public Collection<String> getBlacklistedAlgorithmsURIs() {
+        return ImmutableList.copyOf(blackListedAlgorithmURIs);
     }
     
     /**
@@ -76,8 +95,9 @@
      * 
      * @param uris the list of algorithms
      */
-    public void setBlacklistedAlgorithmURIs(@Nullable final List<String> uris) {
-        blackListedAlgorithmURIs = uris;
+    public void setBlacklistedAlgorithmURIs(@Nonnull @NonnullElements final Collection<String> uris) {
+        Constraint.isNotNull(uris, "Blacklist cannot be null");
+        blackListedAlgorithmURIs = Lists.newArrayList(Collections2.filter(uris, Predicates.notNull()));
     }
     
     /**

Modified: trunk/opensaml-xmlsec-api/src/main/java/org/opensaml/xmlsec/SignatureValidationParameters.java

[... 98 lines stripped ...]


More information about the commits mailing list