All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.bonita.env.binding.QuerierDbSessionBinding Maven / Gradle / Ivy

package org.ow2.bonita.env.binding;

import org.ow2.bonita.env.descriptor.QuerierDbSessionDescriptor;
import org.ow2.bonita.pvm.internal.util.TagBinding;
import org.ow2.bonita.pvm.internal.wire.xml.WireParser;
import org.ow2.bonita.pvm.internal.xml.Parse;
import org.ow2.bonita.pvm.internal.xml.Parser;
import org.ow2.bonita.util.EnvConstants;
import org.w3c.dom.Element;

/**
 *
 * @author Marc Blachon, Guillaume Porcher, Charles Souillard, Miguel Valdes, Pierre Vigneras
 */
public class QuerierDbSessionBinding extends TagBinding {

  public QuerierDbSessionBinding() {
    super(EnvConstants.QUERIER_DB_SESSION_TAG, null, WireParser.CATEGORY_DESCRIPTOR);
  }
  
  public Object parse(Element element, Parse parse, Parser parser) {
    QuerierDbSessionDescriptor descriptor = new QuerierDbSessionDescriptor();
    
    if (element.hasAttribute("session")) {
      descriptor.setSessionName(element.getAttribute("session"));
    } else {
      throw new RuntimeException("session attribute on " + EnvConstants.QUERIER_DB_SESSION_TAG + " must be specified");
    }
    
    if (element.hasAttribute("name")) {
      descriptor.setName(element.getAttribute("name"));
    } else {
      throw new RuntimeException("name attribute on " + EnvConstants.QUERIER_DB_SESSION_TAG + " must be specified");
    }
    return descriptor;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy