/**
         * Create a Destination
         * @param type
         * @param pyhsicalName
         * @return
         */
        public static ActiveMQDestination CreateDestination(int type, String pyhsicalName)
        {
            ActiveMQDestination result = null;

            if (pyhsicalName == null)
            {
                return(null);
            }
            else if (type == ACTIVEMQ_TOPIC)
            {
                result = new ActiveMQTopic(pyhsicalName);
            }
            else if (type == ACTIVEMQ_TEMPORARY_TOPIC)
            {
                result = new ActiveMQTempTopic(pyhsicalName);
            }
            else if (type == ACTIVEMQ_QUEUE)
            {
                result = new ActiveMQQueue(pyhsicalName);
            }
            else
            {
                result = new ActiveMQTempQueue(pyhsicalName);
            }
            return(result);
        }
        /**
         * @param destination
         */
        public static ActiveMQDestination Transform(IDestination destination)
        {
            ActiveMQDestination result = null;

            if (destination != null)
            {
                if (destination is ActiveMQDestination)
                {
                    result = (ActiveMQDestination)destination;
                }
                else
                {
                    if (destination is ITemporaryQueue)
                    {
                        result = new ActiveMQTempQueue(((IQueue)destination).QueueName);
                    }
                    else if (destination is ITemporaryTopic)
                    {
                        result = new ActiveMQTempTopic(((ITopic)destination).TopicName);
                    }
                    else if (destination is IQueue)
                    {
                        result = new ActiveMQQueue(((IQueue)destination).QueueName);
                    }
                    else if (destination is ITopic)
                    {
                        result = new ActiveMQTopic(((ITopic)destination).TopicName);
                    }
                }
            }
            return(result);
        }
        /**
         * Create a Destination
         * @param type
         * @param pyhsicalName
         * @return
         */
        public static ActiveMQDestination CreateDestination(int type, String pyhsicalName)
        {
            ActiveMQDestination result = null;
			if (pyhsicalName == null)
			{
				return null;
			}
            else if (type == ACTIVEMQ_TOPIC)
            {
                result = new ActiveMQTopic(pyhsicalName);
            }
            else if (type == ACTIVEMQ_TEMPORARY_TOPIC)
            {
                result = new ActiveMQTempTopic(pyhsicalName);
            }
            else if (type == ACTIVEMQ_QUEUE)
            {
                result = new ActiveMQQueue(pyhsicalName);
            }
            else
            {
                result = new ActiveMQTempQueue(pyhsicalName);
            }
            return result;
        }
 /**
  * @param destination
  */
 public static ActiveMQDestination Transform(IDestination destination)
 {
     ActiveMQDestination result = null;
     if (destination != null)
     {
         if (destination is ActiveMQDestination)
         {
             result = (ActiveMQDestination) destination;
         }
         else
         {
             if (destination is ITemporaryQueue)
             {
                 result = new ActiveMQTempQueue(((IQueue) destination).QueueName);
             }
             else if (destination is ITemporaryTopic)
             {
                 result = new ActiveMQTempTopic(((ITopic) destination).TopicName);
             }
             else if (destination is IQueue)
             {
                 result = new ActiveMQQueue(((IQueue) destination).QueueName);
             }
             else if (destination is ITopic)
             {
                 result = new ActiveMQTopic(((ITopic) destination).TopicName);
             }
         }
     }
     return result;
 }