public List<String> getDescriptionList() {
   List<String> result = new ArrayList<String>();
   List<Node> nodes = childNode.get("description");
   for (Node node : nodes) {
     result.add(node.text());
   }
   return result;
 }
Exemplo n.º 2
0
  /**
   * @param root
   * @param node
   */
  private void writeRecursive(org.w3c.dom.Node target, Node source) {
    Document owned = target.getOwnerDocument();
    if (owned == null) {
      owned = (Document) target;
    }
    org.w3c.dom.Node targetChild = null;
    if (source.text() != null) {
      targetChild = owned.createElement(source.name());
      targetChild.appendChild(owned.createTextNode(source.text()));
    } else {
      targetChild = owned.createElement(source.name());
    }

    target.appendChild(targetChild);

    for (Map.Entry<String, String> attribute : source.attributes().entrySet()) {
      Attr attr = owned.createAttribute(attribute.getKey());
      attr.setValue(attribute.getValue());

      targetChild.getAttributes().setNamedItem(attr);
    }
    for (Node sourceChild : source.children()) {
      writeRecursive(targetChild, sourceChild);
    }
  }
  public Map<String, String> getProperties() {
    Node props = protocol.getSingle("configuration");
    Map<String, String> properties = new HashMap<String, String>();

    if (props != null) {
      for (Node prop : props.get("property")) {
        properties.put(prop.attribute("name"), prop.text());
      }
    }
    return properties;
  }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ProtocolDescription#property(java.lang.String, java.lang.String)
  */
 @Override
 public DefaultProtocolDef property(String name, String value) {
   protocol.getOrCreate("configuration").create("property").attribute("name", name).text(value);
   return this;
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.DefaultProtocolDef#getType()
  */
 @Override
 public String getType() {
   return protocol.attribute("type");
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.DefaultProtocolDef#setType(java.lang.String)
  */
 @Override
 public DefaultProtocolDef setType(String type) {
   protocol.attribute("type", type);
   return this;
 }
 // -------------------------------------------------------------------------------------||
 // Element type : param-value
 // isComplexType: false   maxOccurs: -   isAttribute: false
 // -------------------------------------------------------------------------------------||
 public ParamValueType<T> setParamValue(String paramValue) {
   childNode.getOrCreate("param-value").text(paramValue);
   return this;
 }
 public String getParamName() {
   return childNode.textValue("param-name");
 }
 public ParamValueType<T> removeParamName() {
   childNode.remove("param-name");
   return this;
 }
 public ParamValueType<T> removeAllDescription() {
   childNode.remove("description");
   return this;
 }
 // -------------------------------------------------------------------------------------||
 // Element type : description
 // isComplexType: false   maxOccurs: -unbounded   isAttribute: false
 // -------------------------------------------------------------------------------------||
 public ParamValueType<T> setDescription(String description) {
   childNode.create("description").text(description);
   return this;
 }
 public ParamValueTypeImpl(T t, String nodeName, Node node) {
   this.t = t;
   this.node = node;
   this.childNode = node.create(nodeName);
 }
 public String getParamValue() {
   return childNode.textValue("param-value");
 }