//
// JmsaXAConnectionFactory.java - JMS Adapter XAConnectionFactory
//
// JmsaCF handles the "administered" object side of things.
//

package nyangau.jmsadapter;

import java.util.Map;
import javax.jms.*;

public class JmsaXAConnectionFactory extends JmsaCF implements XAConnectionFactory
  {
  protected transient XAConnectionFactory cf;
//...sJmsaXAConnectionFactory:2:
// The JmsaXAConnectionFactory isn't registered in JNDI,
// its being directly created, given an underlying ConnectionFactory and Map.
// The map contains
//   no naming properties (if present, they'll be ignored)
//   no underlying ConnectionFactory name (if present, it'll be ignored)
//   JMS Adapter properties
public JmsaXAConnectionFactory(XAConnectionFactory connfact, Map<String,Object> map)
  {
  super(map);
  cf = connfact;
  }

// We get called here when reconstructed from a Reference in JNDI,
// or a JNDI configuration tool is instantiating a CF
// The map contains
//   naming properties
//   underlying XAConnectionFactory name
//   JMS Adapter properties
public JmsaXAConnectionFactory(Map<String,Object> map)
  {
  super(map);
  cf = null;
  }
public JmsaXAConnectionFactory(Map<String,Object> map, Map<String,Object> map2)
  {
  super(map, map2);
  cf = null;
  }

// We get called here when unserialised from JNDI
// The map contains
//   naming properties
//   underlying ConnectionFactory name
//   JMS Adapter properties
public JmsaXAConnectionFactory()
  {
  cf = null;
  }
//...e
//...screateXAConnection:2:
public XAConnection createXAConnection()
  throws JMSException
  {
  if ( cf == null )
    cf = (XAConnectionFactory) findFactory();
  return new JmsaXAConnection( cf.createXAConnection(), getFlowProcessor() );
  }

public XAConnection createXAConnection(String userName, String password)
  throws JMSException
  {
  if ( cf == null )
    cf = (XAConnectionFactory) findFactory();
  return new JmsaXAConnection( cf.createXAConnection(userName, password), getFlowProcessor() );
  }
//...e
  }
