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

noreply at shibboleth.net noreply at shibboleth.net
Tue Dec 3 07:12:48 EST 2013


Author: iay
Date: Tue Dec  3 07:12:48 2013
New Revision: 311

URL: http://svn.shibboleth.net/view/java-metadata-aggregator?rev=311&view=rev
Log:
MDA-124: move from using Shibboleth resources to using Spring ones

Modified:
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java
    trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/DOMResourceSourceTest.java
    trunk/aggregator-pipeline/src/test/java/net/shibboleth/metadata/dom/XMLSchemaValidationStageTest.java

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java
URL: http://svn.shibboleth.net/view/java-metadata-aggregator/trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java?rev=311&r1=310&r2=311&view=diff
==============================================================================
--- trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java (original)
+++ trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/DOMResourceSourceStage.java Tue Dec  3 07:12:48 2013
@@ -32,13 +32,12 @@
 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 net.shibboleth.utilities.java.support.resource.Resource;
-import net.shibboleth.utilities.java.support.resource.ResourceException;
 import net.shibboleth.utilities.java.support.xml.ParserPool;
 import net.shibboleth.utilities.java.support.xml.XMLParserException;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.io.Resource;
 import org.w3c.dom.Element;
 
 /**
@@ -138,21 +137,21 @@
         InputStream ins = null;
 
         try {
-            log.debug("Attempting to fetch XML document from '{}'", domResource.getLocation());
+            log.debug("Attempting to fetch XML document from '{}'", domResource.getDescription());
 
             ins = domResource.getInputStream();
             if (ins == null) {
                 log.debug("Resource at location '{}' did not produce any data to parse, nothing left to do",
-                        domResource.getLocation());
+                        domResource.getDescription());
             } else {
                 log.debug("DOM Element from '{}' unchanged since last request, using cached copy",
-                        domResource.getLocation());
+                        domResource.getDescription());
                 populateItemCollection(itemCollection, ins);
             }
-        } catch (ResourceException e) {
+        } catch (IOException e) {
             if (errorCausesSourceFailure) {
                 throw new StageProcessingException("Error retrieving XML document from " +
-                        domResource.getLocation(), e);
+                        domResource.getDescription(), e);
             } else {
                 log.warn("stage {}: unable to read in XML file");
                 log.debug("stage {}: HTTP resource exception", getId(), e);
@@ -178,7 +177,7 @@
     protected void populateItemCollection(@Nonnull @NonnullElements Collection<Item<Element>> itemCollection,
             final InputStream data) throws StageProcessingException {
         try {
-            log.debug("Parsing XML document retrieved from '{}'", domResource.getLocation());
+            log.debug("Parsing XML document retrieved from '{}'", domResource.getDescription());
             itemCollection.add(new DOMElementItem(parserPool.parse(data)));
         } catch (XMLParserException e) {
             if (errorCausesSourceFailure) {
@@ -192,7 +191,6 @@
 
     /** {@inheritDoc} */
     protected void doDestroy() {
-        domResource.destroy();
         domResource = null;
         parserPool = null;
 
@@ -213,18 +211,9 @@
                     + ", either a DomResource must be specified");
         }
 
-        if (!domResource.isInitialized()) {
-            domResource.initialize();
-        }
-
-        try {
-            if (!domResource.exists()) {
-                throw new ComponentInitializationException("Unable to initialize " + getId() + ", DOM resource "
-                        + domResource.getLocation() + " does not exist");
-            }
-        } catch (ResourceException e) {
-            throw new ComponentInitializationException("Unable to initialize " + getId()
-                    + ", error reading DOM resource " + domResource.getLocation() + " information", e);
+        if (!domResource.exists()) {
+            throw new ComponentInitializationException("Unable to initialize " + getId() + ", DOM resource "
+                    + domResource.getDescription() + " does not exist");
         }
     }
 

Modified: trunk/aggregator-pipeline/src/main/java/net/shibboleth/metadata/dom/XMLSchemaValidationStage.java

[... 189 lines stripped ...]


More information about the commits mailing list