[PATCH] Adopt configuation of artifacts into new xml documents to make them configurable inline

Wald Commits scm-commit at wald.intevation.org
Mon Sep 15 15:38:25 CEST 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1410788296 -7200
# Node ID c57b0400ac980154380dc50ef666d62d6c33f4a7
# Parent  f98598cf798c755d42b6f48ca07280e3622ae5bc
Adopt configuation of artifacts into new xml documents to make them configurable inline.

diff -r f98598cf798c -r c57b0400ac98 artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java	Mon Sep 15 15:00:48 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java	Mon Sep 15 15:38:16 2014 +0200
@@ -264,16 +264,22 @@
             String xlink = tmp.getAttribute(XPATH_XLINK);
             xlink        = Config.replaceConfigDir(xlink);
 
-            File file = new File(xlink);
-            if (!file.isFile() || !file.canRead()) {
-                log.warn("Artifact configuration '" + file + "' not found.");
+            if (!xlink.isEmpty()) {
+                File file = new File(xlink);
+                if (!file.isFile() || !file.canRead()) {
+                    log.warn("Artifact configuration '" + file + "' not found.");
+                } else {
+                    Document doc = XMLUtils.parseDocument(file);
+                    if (doc != null) {
+                        docs.add(doc);
+                    }
+                }
                 continue;
             }
-
-            Document doc = XMLUtils.parseDocument(file);
-            if (doc != null) {
-                docs.add(doc);
-            }
+            Document doc = XMLUtils.newDocument();
+            Node copy = doc.adoptNode(tmp.cloneNode(true));
+            doc.appendChild(copy);
+            docs.add(doc);
         }
         return docs;
     }


More information about the Dive4Elements-commits mailing list