View Javadoc

1   package org.rundeck.api.parser;
2   
3   import org.dom4j.Node;
4   import org.rundeck.api.domain.ConfigProperty;
5   
6   /**
7    * ProjectConfigPropertyParser parses a {@literal <property/>} element representing
8    * a configuration property.
9    *
10   * @author greg
11   * @since 2014-03-07
12   */
13  public class ProjectConfigPropertyParser extends BaseXpathParser<ConfigProperty> {
14      private String xpath;
15  
16      public ProjectConfigPropertyParser() {
17          super();
18      }
19  
20      public ProjectConfigPropertyParser(final String xpath) {
21          super(xpath);
22      }
23  
24      @Override
25      public ConfigProperty parse(final Node propnode) {
26          final String key = propnode.valueOf("@key");
27          final String value = propnode.valueOf("@value");
28          final ConfigProperty config = new ConfigProperty();
29          config.setKey(key);
30          config.setValue(value);
31          return config;
32      }
33  
34  }