01: /**
02: *
03: */package nl.hippo.cms.wizard.aspects;
04:
05: import nl.hippo.cms.wizard.Constants;
06: import nl.hippo.cms.wizard.WizardResult;
07: import nl.hippo.cms.wizard.components.Configuration;
08:
09: /**
10: * @author a.bogaart@hippo.nl
11: *
12: */
13: public class XpathAspect extends AbstractComponentAspect {
14:
15: private String xpath;
16:
17: public void configure(Configuration config) throws Exception {
18: super .configure(config);
19: if (config.get(Constants.XPATH_ATTRIBUTE_NAME) == null)
20: throw new Exception(
21: "Xpath configuration problem: @xpath is required and cannot be empty");
22:
23: this .xpath = config.get(Constants.XPATH_ATTRIBUTE_NAME);
24: }
25:
26: public String getXpath() {
27: return xpath;
28: }
29:
30: public String getType() {
31: if (xpath.indexOf("@") > 0) {
32: return "attribute";
33: }
34: return "element";
35: }
36:
37: public void fillResult(WizardResult result) {
38: result.addXpath(this);
39: }
40:
41: }
|