[java-metadata-aggregator COMMIT] in /trunk/aggregator-pipeline/src: main/java/net/shibboleth/metadata/dom/AbstractXS...

noreply at shibboleth.net noreply at shibboleth.net
Wed Nov 13 08:33:04 EST 2013


Author: rdw
Date: Wed Nov 13 08:33:04 2013
New Revision: 295

URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=295&view=rev
Log:
MDA-124, IDP-298  Make the MDA use spring resources.

Modified:
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/BaseDOMTest.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/MultiOutputXSLTransformationStageTest.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLTtransformationStageTest.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XSLValidationStageTest.java

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java?rev=295&r1=294&r2=295&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/AbstractXSLProcessingStage.java Wed Nov 13 08:33:04 2013
@@ -17,6 +17,7 @@
 
 package net.shibboleth.metadata.dom;
 
+import java.io.IOException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -48,11 +49,10 @@
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
-import net.shibboleth.utilities.java.support.resource.Resource;
-import net.shibboleth.utilities.java.support.resource.ResourceException;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.io.Resource;
 import org.w3c.dom.Element;
 
 /**
@@ -88,7 +88,7 @@
      * If not set, an empty collection.
      */
     private Map<String, Object> transformParameters = Collections.emptyMap();
-    
+
     /** {@link URIResolver} to use in the transformer. Default value: <code>null</code>. */
     @Nullable private URIResolver uriResolver;
 
@@ -220,8 +220,7 @@
     }
 
     /**
-     * Set the {@link URIResolver} for this transform, or <code>null</code> to
-     * specify none.
+     * Set the {@link URIResolver} for this transform, or <code>null</code> to specify none.
      * 
      * @param resolver the {@link URIResolver} to use, or <code>null</code>
      */
@@ -262,7 +261,7 @@
 
     /** {@inheritDoc} */
     protected void doDestroy() {
-        xslResource.destroy();
+
         xslResource = null;
         xslTemplate = null;
         transformAttributes = null;
@@ -282,14 +281,10 @@
                     + ", XslResource must not be null");
         }
 
-        if (!xslResource.isInitialized()) {
-            xslResource.initialize();
-        }
-
         try {
             if (!xslResource.exists()) {
                 throw new ComponentInitializationException("Unable to initialize " + getId() + ", XslResource "
-                        + xslResource.getLocation() + " does not exist");
+                        + xslResource.getDescription() + " does not exist");
             }
 
             final TransformerFactory tfactory = TransformerFactory.newInstance();
@@ -301,19 +296,19 @@
             for (Entry<String, Boolean> features : transformFeatures.entrySet()) {
                 tfactory.setFeature(features.getKey(), features.getValue());
             }
-            
+
             if (uriResolver != null) {
                 tfactory.setURIResolver(uriResolver);
             }
 
             log.debug("{} pipeline stage compiling XSL file {}", getId(), xslResource);
-            xslTemplate =
-                    tfactory.newTemplates(new StreamSource(xslResource.getInputStream(), xslResource.getLocation()));
+            xslTemplate = tfactory.newTemplates(new StreamSource(xslResource.getInputStream(), 
+                                                xslResource.getURL().toExternalForm()));
         } catch (TransformerConfigurationException e) {
             throw new ComponentInitializationException("XSL transformation engine misconfigured", e);
-        } catch (ResourceException e) {
+        } catch (IOException e) {
             throw new ComponentInitializationException("Unable to initialize " + getId()
-                    + ", error reading XslResource " + xslResource.getLocation() + " information", e);
+                    + ", error reading XslResource " + xslResource.getDescription() + " information", e);
         }
     }
 

Modified: trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/BaseDOMTest.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/BaseDOMTest.java?rev=295&r1=294&r2=295&view=diff

[... 153 lines stripped ...]


More information about the commits mailing list