/// <summary> /// Create a Destination using the name given, the type is determined by the /// value of the type parameter. /// </summary> /// <param name="type"></param> /// <param name="pyhsicalName"></param> /// <param name="remote"></param> /// <param name="skipDesinationNameFormatting"> /// A value indicating whether the destination name formatting will be skipped /// or not. /// </param> /// <returns></returns> private static Destination CreateDestination(Int32 type, String pyhsicalName, Boolean remote, Boolean skipDesinationNameFormatting) { Destination result; if (pyhsicalName == null) { return(null); } switch (type) { case StompTopic: result = new Topic(pyhsicalName, skipDesinationNameFormatting); break; case StompTemporaryTopic: result = new TempTopic(pyhsicalName, skipDesinationNameFormatting); break; case StompQueue: result = new Queue(pyhsicalName, skipDesinationNameFormatting); break; default: result = new TempQueue(pyhsicalName, skipDesinationNameFormatting); break; } result.RemoteDestination = remote; return(result); }
/// <summary> /// </summary> /// <param name="destination"></param> /// <returns></returns> public static Destination Transform(IDestination destination) { Destination result = null; if (destination == null) { return(null); } if (destination is Destination) { result = (Destination)destination; } else { if (destination is ITemporaryQueue) { result = new TempQueue(((IQueue)destination).QueueName); } else if (destination is ITemporaryTopic) { result = new TempTopic(((ITopic)destination).TopicName); } else if (destination is IQueue) { result = new Queue(((IQueue)destination).QueueName); } else if (destination is ITopic) { result = new Topic(((ITopic)destination).TopicName); } } return(result); }