Mercurial > dive4elements > river
changeset 8272:c57b0400ac98
Adopt configuation of artifacts into new xml documents to make them configurable inline.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Mon, 15 Sep 2014 15:38:16 +0200 |
parents | f98598cf798c |
children | 5c3b36b519d0 97e148487186 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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; }