[java-identity-provider COMMIT] /trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/session/SAML2SPSessio...

noreply at shibboleth.net noreply at shibboleth.net
Tue Dec 31 17:14:56 EST 2013


Author: scantor
Date: Tue Dec 31 17:14:56 2013
New Revision: 5128

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5128&view=rev
Log:
Add setter for parser pool.

Modified:
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/session/SAML2SPSessionSerializer.java

Modified: trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/session/SAML2SPSessionSerializer.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/session/SAML2SPSessionSerializer.java?rev=5128&r1=5127&r2=5128&view=diff
==============================================================================
--- trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/session/SAML2SPSessionSerializer.java (original)
+++ trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/session/SAML2SPSessionSerializer.java Tue Dec 31 17:14:56 2013
@@ -23,7 +23,6 @@
 import java.util.Map;
 
 import javax.annotation.Nonnull;
-import javax.annotation.concurrent.ThreadSafe;
 import javax.json.JsonObject;
 import javax.json.stream.JsonGenerator;
 
@@ -42,6 +41,8 @@
 import net.shibboleth.utilities.java.support.annotation.constraint.NonNegative;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
 import net.shibboleth.utilities.java.support.annotation.constraint.Positive;
+import net.shibboleth.utilities.java.support.annotation.constraint.ThreadSafeAfterInit;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.xml.ParserPool;
 import net.shibboleth.utilities.java.support.xml.SerializeSupport;
@@ -50,7 +51,7 @@
 /**
  * A serializer for {@link SAML2SPSession} objects.
  */
- at ThreadSafe
+ at ThreadSafeAfterInit
 public class SAML2SPSessionSerializer extends AbstractSPSessionSerializer {
 
     /** Field name of NameID. */
@@ -63,21 +64,33 @@
     @Nonnull private static final Map<String, Object> NO_XML_DECL_PARAMS;
     
     /** Parser for NameID fields. */
-    @Nonnull private final ParserPool parserPool;
+    @Nonnull private ParserPool parserPool;
     
     /**
      * Constructor.
      * 
      * @param offset milliseconds to substract from record expiration to establish session expiration value
      */
-    protected SAML2SPSessionSerializer(@Duration @NonNegative long offset) {
+    public SAML2SPSessionSerializer(@Duration @NonNegative long offset) {
         super(offset);
         
         parserPool = Constraint.isNotNull(XMLObjectProviderRegistrySupport.getParserPool(),
                 "ParserPool cannot be null");
     }
-
+    
+    /**
+     * Set the {@link ParserPool} to use.
+     * 
+     * @param pool  parser source
+     */
+    public void setParserPool(@Nonnull final ParserPool pool) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        parserPool = Constraint.isNotNull(pool, "ParserPool cannot be null");
+    }
+   
     /** {@inheritDoc} */
+    @Override
     protected void doSerializeAdditional(@Nonnull final SPSession instance, @Nonnull final JsonGenerator generator) {
         SAML2SPSession saml2Session = (SAML2SPSession) instance;
         
@@ -91,6 +104,7 @@
     }
 
     /** {@inheritDoc} */
+    @Override
     @Nonnull protected SPSession doDeserialize(@Nonnull final JsonObject obj,
             @Nonnull @NotEmpty final String id, @Nonnull @NotEmpty final String flowId,
             @Duration @Positive final long creation, @Duration @Positive final long expiration) throws IOException {



More information about the commits mailing list