// Path: JMSPerfHarness/src/com/ibm/uk/hursley/perfharness/jms/DestinationWrapper.java
// public final class DestinationWrapper<E extends Destination> {
// 	
// 	public E destination;
// 	public String name;
// 	
// 	public DestinationWrapper( String name, E destination ) {
// 		this.destination = destination;
// 		this.name = name;
// 	}
// 	
// }


import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import javax.jms.ConnectionFactory;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NamingException;
import com.ibm.mq.jms.JMSC;
import com.ibm.mq.constants.CMQC;
import com.ibm.mq.jms.MQConnectionFactory;
import com.ibm.mq.jms.MQDestination;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.mq.jms.MQTopic;
import com.ibm.mq.jms.MQTopicConnectionFactory;
import com.ibm.mq.pcf.CMQCFC;
import com.ibm.mq.pcf.PCFMessage;
import com.ibm.mq.pcf.PCFMessageAgent;
import com.ibm.msg.client.wmq.WMQConstants;
import com.ibm.msg.client.wmq.common.CommonConstants;
import com.ibm.uk.hursley.perfharness.Config;
import com.ibm.uk.hursley.perfharness.Log;
import com.ibm.uk.hursley.perfharness.jms.DestinationWrapper;
	/**
	 * Create a new vendor-specific ConnectionFactory (or delegate to JNDI if that is has been selected).
	 */
	public TopicConnectionFactory lookupTopicConnectionFactory(String name) throws JMSException,NamingException {

		if ( usingJNDI ) {
			return super.lookupTopicConnectionFactory(name);
		} else {
			MQTopicConnectionFactory tcf = new MQTopicConnectionFactory();
			configureMQConnectionFactory(tcf);
			return tcf;
		} // end if tcf==null
		
	}

	/**
	 * Create a new vendor-specific ConnectionFactory (or delegate to JNDI if that is has been selected).
	 */	
	public synchronized QueueConnectionFactory lookupQueueConnectionFactory(String name) throws JMSException,NamingException {

		if ( usingJNDI ) {
			return super.lookupQueueConnectionFactory(name);
		} else {
			MQQueueConnectionFactory qcf = new MQQueueConnectionFactory();
			configureMQConnectionFactory(qcf);
			return qcf;
		} // end if qcf==null

	}	
	
// Path: JMSPerfHarness/src/com/ibm/uk/hursley/perfharness/jms/DestinationWrapper.java
// public final class DestinationWrapper<E extends Destination> {
// 	
// 	public E destination;
// 	public String name;
// 	
// 	public DestinationWrapper( String name, E destination ) {
// 		this.destination = destination;
// 		this.name = name;
// 	}
// 	
// }


// Path: JMSPerfHarness/src/com/ibm/uk/hursley/perfharness/jms/providers/WebSphereMQ.java
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import javax.jms.ConnectionFactory;
import javax.jms.JMSContext;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicConnectionFactory;
import javax.jms.TopicSession;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NamingException;
import com.ibm.mq.jms.JMSC;
import com.ibm.mq.constants.CMQC;
import com.ibm.mq.jms.MQConnectionFactory;
import com.ibm.mq.jms.MQDestination;
import com.ibm.mq.jms.MQQueue;
import com.ibm.mq.jms.MQQueueConnectionFactory;
import com.ibm.mq.jms.MQTopic;
import com.ibm.mq.jms.MQTopicConnectionFactory;
import com.ibm.mq.pcf.CMQCFC;
import com.ibm.mq.pcf.PCFMessage;
import com.ibm.mq.pcf.PCFMessageAgent;
import com.ibm.msg.client.wmq.WMQConstants;
import com.ibm.msg.client.wmq.common.CommonConstants;
import com.ibm.uk.hursley.perfharness.Config;
import com.ibm.uk.hursley.perfharness.Log;
import com.ibm.uk.hursley.perfharness.jms.DestinationWrapper;

	/**
	 * Create a new vendor-specific ConnectionFactory (or delegate to JNDI if that is has been selected).
	 */
	public TopicConnectionFactory lookupTopicConnectionFactory(String name) throws JMSException,NamingException {

		if ( usingJNDI ) {
			return super.lookupTopicConnectionFactory(name);
		} else {
			MQTopicConnectionFactory tcf = new MQTopicConnectionFactory();
			configureMQConnectionFactory(tcf);
			return tcf;
		} // end if tcf==null
		
	}

	/**
	 * Create a new vendor-specific ConnectionFactory (or delegate to JNDI if that is has been selected).
	 */	
	public synchronized QueueConnectionFactory lookupQueueConnectionFactory(String name) throws JMSException,NamingException {

		if ( usingJNDI ) {
			return super.lookupQueueConnectionFactory(name);
		} else {
			MQQueueConnectionFactory qcf = new MQQueueConnectionFactory();
			configureMQConnectionFactory(qcf);
			return qcf;
		} // end if qcf==null

	}	
	
	public DestinationWrapper<Queue> lookupQueue( String queue, QueueSession session ) throws JMSException, NamingException {