[PATCH 1 of 2] Merged default into branch facet-metadata
Wald Commits
scm-commit at wald.intevation.org
Tue Jul 8 18:35:36 CEST 2014
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1404837195 -7200
# Branch facet-metadata
# Node ID 0fdd239f4f39294a70821260ae720b9e0f1d77f6
# Parent ab13ab6acc5c381dc5916b406841229a0bdfbeb5
# Parent 52c11c3a1f79c50ce5dca17ad3fa018c2ba6f556
Merged default into branch facet-metadata.
diff -r ab13ab6acc5c -r 0fdd239f4f39 .hgtags
--- a/.hgtags Wed Jul 02 12:29:21 2014 +0200
+++ b/.hgtags Tue Jul 08 18:33:15 2014 +0200
@@ -58,3 +58,10 @@
0aff3300a490ec47263237cc3b34ce181f9d5b51 3.1.0
da92d120932800e805820d0c88610234aa28b38f 3.1.1
08c82b4e8b58ea48e6d6aa061279f646a73b034a 3.1.2
+863f1fa669814fd73053e733ada79f62a3a924b5 3.1.3
+d364086a01bcadddeabdc8533a4f271b9dfe6747 3.1.13
+d364086a01bcadddeabdc8533a4f271b9dfe6747 3.1.13
+0000000000000000000000000000000000000000 3.1.13
+863f1fa669814fd73053e733ada79f62a3a924b5 3.1.3
+0a2a2d097013cec1ddba1b3f1c08df92b1903203 3.1.3
+992ccb9ad4dea8824a75803bd4d44dbea60a89c2 3.1.4
diff -r ab13ab6acc5c -r 0fdd239f4f39 artifact-database/src/main/java/org/dive4elements/artifactdatabase/DefaultArtifactFactory.java
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/DefaultArtifactFactory.java Wed Jul 02 12:29:21 2014 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/DefaultArtifactFactory.java Tue Jul 08 18:33:15 2014 +0200
@@ -27,6 +27,7 @@
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -141,9 +142,9 @@
try {
Artifact artifact =
(Artifact)artifactClass.newInstance();
+ String oldName = artifact.getName();
- if (artifact.getName() == null ||
- artifact.getName().length() == 0) {
+ if (oldName == null || oldName.length() == 0) {
artifact.setName(artifactName);
}
artifact.setup(
@@ -170,6 +171,8 @@
}
public void setup(Document document, Node factoryNode) {
+ boolean debug = logger.isDebugEnabled();
+
String ttlString = Config.getStringXPath(factoryNode, XPATH_TTL);
if (ttlString != null) {
try {
@@ -185,14 +188,20 @@
name = Config.getStringXPath(
factoryNode, XPATH_NAME, toString());
- logger.debug("setting up " + name);
+
+ if (debug) {
+ logger.debug("setting up " + name);
+ }
String artifact = Config.getStringXPath(
factoryNode, XPATH_ARTIFACT, DEFAULT_ARTIFACT);
artifactName = Config.getStringXPath(
document, XPATH_ARTIFACT_NAME, "default");
- logger.debug(artifactName);
+
+ if (debug) {
+ logger.debug("artifact name: " + artifactName);
+ }
Map<String, String> variables = new HashMap<String, String>();
variables.put("name", name);
NodeList facets = (NodeList) XMLUtils.xpath(
@@ -202,10 +211,14 @@
null,
variables);
- for (int i = 0; i < facets.getLength(); i++) {
- logger.debug(facets.item(i).getAttributes().getNamedItem("class").getNodeValue());
- String className =
- facets.item(i).getAttributes().getNamedItem("class").getNodeValue();
+ for (int i = 0, F = facets.getLength(); i < F; i++) {
+ Element element = (Element)facets.item(i);
+ String className = element.getAttribute("class");
+
+ if (debug) {
+ logger.debug("load facet class: " + className);
+ }
+
try {
facetClasses.add(Class.forName(className));
}
@@ -213,6 +226,7 @@
logger.error(cnfe.getLocalizedMessage(), cnfe);
}
}
+
try {
artifactClass = Class.forName(artifact);
}
diff -r ab13ab6acc5c -r 0fdd239f4f39 artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/StaticFacet.java
--- a/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/StaticFacet.java Wed Jul 02 12:29:21 2014 +0200
+++ b/artifact-database/src/main/java/org/dive4elements/artifactdatabase/state/StaticFacet.java Tue Jul 08 18:33:15 2014 +0200
@@ -8,8 +8,6 @@
package org.dive4elements.artifactdatabase.state;
-import java.io.Serializable;
-
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallMeta;
import org.w3c.dom.Document;
More information about the Dive4Elements-commits
mailing list