/* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ArquillianDescriptor#getDefaultProtocol()
  */
 @Override
 public DefaultProtocolDef getDefaultProtocol() {
   if (model.getSingle("protocol") != null) {
     return new DefaultProtocolDefImpl(getDescriptorName(), model, model.getSingle("protocol"));
   }
   return null;
 }
 @Override
 public Map<String, String> getInitParams() {
   Map<String, String> result = new HashMap<String, String>();
   List<Node> params = filter.get("init-param");
   for (Node node : params) {
     result.put(node.textValue("param-name"), node.textValue("param-value"));
   }
   return result;
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ArquillianDescriptor#getGroups()
  */
 @Override
 public List<GroupDef> getGroups() {
   List<GroupDef> groups = new ArrayList<GroupDef>();
   for (Node group : model.get("group")) {
     groups.add(new GroupDefImpl(getDescriptorName(), model, group));
   }
   return groups;
 }
 @Override
 public List<ExtensionDef> getExtensions() {
   List<ExtensionDef> extensions = new ArrayList<ExtensionDef>();
   for (Node extension : model.get("extension")) {
     extensions.add(new ExtensionDefImpl(getDescriptorName(), model, extension));
   }
   return extensions;
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ArquillianDescriptor#getContainers()
  */
 @Override
 public List<ContainerDef> getContainers() {
   List<ContainerDef> containers = new ArrayList<ContainerDef>();
   for (Node container : model.get("container")) {
     containers.add(new ContainerDefImpl(getDescriptorName(), model, container));
   }
   return containers;
 }
 private void readRecursive(Node target, org.w3c.dom.Node source) {
   readAttributes(target, source);
   NodeList sourceChildren = source.getChildNodes();
   if (sourceChildren != null) {
     for (int i = 0; i < sourceChildren.getLength(); i++) {
       org.w3c.dom.Node child = sourceChildren.item(i);
       if (child.getNodeType() != org.w3c.dom.Node.TEXT_NODE) {
         Node newTarget = target.create(child.getNodeName());
         if (onlyTextChildren(child)) {
           newTarget.text(child.getTextContent());
           readAttributes(newTarget, child);
         } else {
           readRecursive(newTarget, child);
         }
       }
     }
   }
 }
 private void readAttributes(Node target, org.w3c.dom.Node source) {
   NamedNodeMap attributes = source.getAttributes();
   if (attributes != null) {
     for (int i = 0; i < attributes.getLength(); i++) {
       org.w3c.dom.Node attribute = attributes.item(i);
       target.attribute(attribute.getNodeName(), attribute.getNodeValue());
     }
   }
 }
 @Override
 public ExtensionDef extension(String name) {
   return new ExtensionDefImpl(getDescriptorName(), model, model.create("extension"))
       .setExtensionName(name);
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ArquillianDescriptor#group(java.lang.String)
  */
 @Override
 public GroupDef group(String name) {
   return new GroupDefImpl(getDescriptorName(), model, model.create("group")).setGroupName(name);
 }
 public ContainerDef container(String name) {
   return new ContainerDefImpl(getDescriptorName(), model, model.create("container"))
       .setContainerName(name);
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ArquillianDescriptor#engine()
  */
 @Override
 public EngineDef engine() {
   return new EngineDefImpl(getDescriptorName(), model, model.getOrCreate("engine"));
 }
 @Override
 public String getName() {
   return filter.textValue("filter-name");
 }
 /* (non-Javadoc)
  * @see org.jboss.arquillian.impl.configuration.api.ArquillianDescriptor#defaultProtocol()
  */
 @Override
 public DefaultProtocolDef defaultProtocol(String type) {
   return new DefaultProtocolDefImpl(getDescriptorName(), model, model.getOrCreate("protocol"))
       .setType(type);
 }
 @Override
 public FilterDef name(String name) {
   filter.getOrCreate("filter-name").text(name);
   return this;
 }
 @Override
 public FilterDef asyncSupported(boolean value) {
   filter.getOrCreate("async-supported").text(value);
   return this;
 }
 public TopicDescriptor topic(String name, String jndi) {
   return new TopicDescriptor(configuration.getOrCreate("topic@name=" + name), this)
       .name(name)
       .entry(jndi);
 }
 @Override
 public boolean isAsyncSupported() {
   return Strings.isTrue(filter.textValue("async-supported"));
 }
 @Override
 public FilterDef filterClass(String clazz) {
   filter.getOrCreate("filter-class").text(clazz);
   return this;
 }
 @Override
 public String getFilterClass() {
   return filter.textValue("filter-class");
 }
 public QueueDef queue(String name) {
   Node queue = model.getOrCreate("queue").attribute("name", name);
   return new QueueDef(model, queue);
 }
 public QueueDescriptor queue(String name, String jndi) {
   return new QueueDescriptor(configuration.getOrCreate("queue@name=" + name), this)
       .name(name)
       .entry(jndi);
 }