//
// FlowStepBodyDel.java - Clear message body, or just a MapMessage item
//

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 FlowStepBodyDel extends FlowStep
  {
  protected String item;
//...sFlowStepBodyDel:2:
public FlowStepBodyDel(Node eStep)
  throws FlowProcessorException
  {
  super(eStep);
  NamedNodeMap nnmStep = eStep.getAttributes();
  Node aItem = nnmStep.getNamedItem("item");
  item = ( aItem != null ) ? aItem.getNodeValue() : null;
  }
//...e
//...sprocess:2:
public void process(FlowContext c)
  throws FlowProcessorException, JMSException
  {
  JmsaMessage m = c.getMessage();
  if ( m instanceof JmsaMapMessage && item != null )
    ((JmsaMapMessage)m).clearItem(item); // not a part of javax.jms.MapMessage
  else
    m.clearBody();
  }
//...e
  }
