# HG changeset patch # User Sascha L. Teichmann # Date 1311603134 0 # Node ID d830c398c8f43f82d336f005d3bdba36388a5065 # Parent a111f0984706596fdf6e49ff367c1eea2027ad7a Improved XPath handling for absent flags. flys-artifacts/trunk@2402 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a111f0984706 -r d830c398c8f4 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Jul 25 12:56:53 2011 +0000 +++ b/flys-artifacts/ChangeLog Mon Jul 25 14:12:14 2011 +0000 @@ -1,3 +1,16 @@ +2011-07-25 Sascha L. Teichmann + + * doc/conf/meta-data-template.xml: '$recommended' lead to XPath + errors. Using "dc:contains($parameters, 'recommended')" helps. + + * src/main/java/de/intevation/flys/artifacts/services/meta/Builder.java, + src/main/java/de/intevation/flys/artifacts/services/meta/FunctionResolver.java: + Added some debugging. + + * src/main/java/de/intevation/flys/artifacts/services/meta/DataCage.java: + Added parameters as 'parameters' to parameters. Usefull to check + for containment of variables. + 2011-07-25 Sascha L. Teichmann * src/main/java/de/intevation/flys/artifacts/services/MetaDataService.java: diff -r a111f0984706 -r d830c398c8f4 flys-artifacts/doc/conf/meta-data-template.xml --- a/flys-artifacts/doc/conf/meta-data-template.xml Mon Jul 25 12:56:53 2011 +0000 +++ b/flys-artifacts/doc/conf/meta-data-template.xml Mon Jul 25 14:12:14 2011 +0000 @@ -214,7 +214,7 @@ - + diff -r a111f0984706 -r d830c398c8f4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/Builder.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/Builder.java Mon Jul 25 12:56:53 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/Builder.java Mon Jul 25 14:12:14 2011 +0000 @@ -282,6 +282,11 @@ } protected Boolean evaluateXPath(String expr) { + + if (log.isDebugEnabled()) { + log.debug("evaluate: '" + expr + "'"); + } + try { XPath xpath = XPATH_FACTORY.newXPath(); xpath.setXPathVariableResolver(frames); diff -r a111f0984706 -r d830c398c8f4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/DataCage.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/DataCage.java Mon Jul 25 12:56:53 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/DataCage.java Mon Jul 25 14:12:14 2011 +0000 @@ -87,6 +87,8 @@ parameters.put("artifact-outs", outs); + parameters.put("parameters", parameters); + recommend(parameters, result); } diff -r a111f0984706 -r d830c398c8f4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/FunctionResolver.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/FunctionResolver.java Mon Jul 25 12:56:53 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/FunctionResolver.java Mon Jul 25 14:12:14 2011 +0000 @@ -11,9 +11,13 @@ import javax.xml.namespace.QName; +import org.apache.log4j.Logger; + public class FunctionResolver implements XPathFunctionResolver { + private static Logger log = Logger.getLogger(FunctionResolver.class); + public static final String FUNCTION_NAMESPACE_URI = "dc"; public static final class Entry { @@ -62,6 +66,7 @@ return Boolean.FALSE; } catch (Exception e) { + log.error(e); throw new XPathFunctionException(e); } } diff -r a111f0984706 -r d830c398c8f4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/StackFrames.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/StackFrames.java Mon Jul 25 12:56:53 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/meta/StackFrames.java Mon Jul 25 14:12:14 2011 +0000 @@ -9,9 +9,13 @@ import javax.xml.namespace.QName; +import org.apache.log4j.Logger; + public class StackFrames implements XPathVariableResolver { + private static Logger log = Logger.getLogger(StackFrames.class); + protected List> frames; public StackFrames() { @@ -74,6 +78,9 @@ @Override public Object resolveVariable(QName variableName) { + if (log.isDebugEnabled()) { + log.debug("resolve var: " + variableName); + } return get(variableName.getLocalPart()); } }