//
// FlowStepVarSet.java - Set a variable to a string
//

package nyangau.jmsadapter;

//...simports:0:
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
import javax.jms.JMSException;
//...e

public class FlowStepVarSet extends FlowStep
  {
  protected String var;
  protected String value;
//...sFlowStepVarSet:2:
public FlowStepVarSet(Node eStep)
  throws FlowProcessorException
  {
  super(eStep);
  NamedNodeMap nnmStep = eStep.getAttributes();
  Node aVar = nnmStep.getNamedItem("var");
  var = ( aVar != null ) ? aVar.getNodeValue() : "v0";
  Node aValue = nnmStep.getNamedItem("value");
  if ( aValue == null )
    throw new FlowProcessorException("unexpected missing value in step "+name+", bad jmsadapter.xsd?");
  value = aValue.getNodeValue();
  }
//...e
//...sprocess:2:
public void process(FlowContext c)
  throws FlowProcessorException, JMSException
  {
  c.setVar(var, value);
  }
//...e
  }
