/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using Apache.NMS; using Apache.NMS.Util; using Apache.NMS.XMS.Util; using IBM.XMS; namespace Apache.NMS.XMS { public class Destination : IDestination { public IBM.XMS.IDestination xmsDestination; #region Constructors /// /// Constructs a destination object. /// /// IBM XMS destination. public Destination(IBM.XMS.IDestination destination) { this.xmsDestination = destination; } /// /// Constructs a destination object specifying if the destination is /// temporary. /// /// IBM XMS destination. /// Whether the destination is temporary. /// public Destination(IBM.XMS.IDestination destination, bool isTemporary) { this.xmsDestination = destination; this.isTemporary = isTemporary; } #endregion #region IDestination implementation /// /// Destination type. /// public DestinationType DestinationType { get { return XMSConvert.ToDestinationType( this.xmsDestination.TypeId, this.isTemporary); } } /// /// Checks if destination is a topic. /// public bool IsTopic { get { return (this.xmsDestination.TypeId == IBM.XMS.DestinationType.Topic); } } /// /// Checks if destination is a queue. /// public bool IsQueue { get { return (this.xmsDestination.TypeId == IBM.XMS.DestinationType.Queue); } } private readonly bool isTemporary; /// /// Checks if destination is temporary. /// public bool IsTemporary { get { return this.isTemporary; } } #endregion #region XMS IDestination properties // http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.msc.doc/props_dest.htm?lang=en #region Common properties /// /// Destination name. /// public string Name { get { return this.xmsDestination.Name; } } /// /// The delivery mode of messages sent to the destination. /// public Int32 XMSDeliveryMode { get { return this.xmsDestination.GetIntProperty(XMSC.DELIVERY_MODE); } set { this.xmsDestination.SetIntProperty(XMSC.DELIVERY_MODE, value); } } /// /// The delivery mode of messages sent to the destination. /// public Apache.NMS.XMS.Util.DeliveryMode DeliveryMode { get { return XMSConvert.ToDeliveryMode(this.XMSDeliveryMode); } set { this.XMSDeliveryMode = XMSConvert.ToXMSDeliveryMode(value); } } /// /// The priority of messages sent to the destination. /// public Int32 Priority { get { return this.xmsDestination.GetIntProperty(XMSC.PRIORITY); } set { this.xmsDestination.SetIntProperty(XMSC.PRIORITY, value); } } /// /// The time to live in milliseconds for messages sent to the /// destination. /// public Int32 TimeToLive { get { return this.xmsDestination.GetIntProperty(XMSC.TIME_TO_LIVE); } set { this.xmsDestination.SetIntProperty(XMSC.TIME_TO_LIVE, value); } } #endregion #region RTT-specific properties /// /// The multicast setting for the destination. /// [UriAttribute("rtt.XMSMulticast")] public Int32 XMSMulticast { get { return this.xmsDestination.GetIntProperty(XMSC.RTT_MULTICAST); } set { this.xmsDestination.SetIntProperty(XMSC.RTT_MULTICAST, value); } } /// /// The multicast setting for the destination. /// [UriAttribute("rtt.Multicast")] public Multicast Multicast { get { return XMSConvert.ToMulticast(this.XMSMulticast); } set { this.XMSMulticast = XMSConvert.ToXMSMulticast(value); } } #endregion #region WMQ-specific properties /// /// The type of broker used by the application for the destination. /// [UriAttribute("wmq.XMSBrokerVersion")] public Int32 XMSBrokerVersion { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_BROKER_VERSION); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_BROKER_VERSION, value); } } /// /// The type of broker used by the application for the destination. /// [UriAttribute("wmq.BrokerVersion")] public BrokerVersion BrokerVersion { get { return XMSConvert.ToBrokerVersion(this.XMSBrokerVersion); } set { this.XMSBrokerVersion = XMSConvert.ToXMSBrokerVersion(value); } } /// /// The identifier (CCSID) of the coded character set, or code page, /// that the strings of character data in the body of a message are in /// when the XMS client forwards the message to the destination. /// [UriAttribute("wmq.DestinationCCSID")] public Int32 DestinationCCSID { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_CCSID); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_CCSID, value); } } /// /// The name of the subscriber queue for a durable subscriber that is /// receiving messages from the destination. /// [UriAttribute("wmq.SubscriberQueueName")] public string SubscriberQueueName { get { return this.xmsDestination.GetStringProperty(XMSC.WMQ_DUR_SUBQ); } set { this.xmsDestination.SetStringProperty(XMSC.WMQ_DUR_SUBQ, value); } } /// /// How numerical data in the body of a message is represented when /// the XMS client forwards the message to the destination. /// [UriAttribute("wmq.XMSEncoding")] public Int32 XMSEncoding { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_ENCODING); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_ENCODING, value); } } /// /// How numerical data in the body of a message is represented when /// the XMS client forwards the message to the destination. /// [UriAttribute("wmq.Encoding")] public Encoding Encoding { get { return XMSConvert.ToEncoding(this.XMSEncoding); } set { this.XMSEncoding = XMSConvert.ToXMSEncoding(value); } } /// /// Whether calls to certain methods fail if the queue manager to which /// the application is connected is in a quiescing state. /// [UriAttribute("wmq.XMSFailIfQuiesce")] public Int32 XMSFailIfQuiesce { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_FAIL_IF_QUIESCE); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_FAIL_IF_QUIESCE, value); } } /// /// Whether calls to certain methods fail if the queue manager to which /// the application is connected is in a quiescing state. /// [UriAttribute("wmq.FailIfQuiesce")] public bool FailIfQuiesce { get { return XMSConvert.ToFailIfQuiesce(this.XMSFailIfQuiesce); } set { this.XMSFailIfQuiesce = XMSConvert.ToXMSFailIfQuiesce(value); } } /// /// This property determines whether an XMS application processes the /// MQRFH2 of a WebSphere MQ message as part of the message /// payload (that is, as part of the message body). /// [UriAttribute("wmq.XMSMessageBody")] public Int32 XMSMessageBody { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_MESSAGE_BODY); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_MESSAGE_BODY, value); } } /// /// This property determines whether an XMS application processes the /// MQRFH2 of a WebSphere MQ message as part of the message /// payload (that is, as part of the message body). /// [UriAttribute("wmq.MessageBody")] public MessageBody MessageBody { get { return XMSConvert.ToMessageBody(this.XMSMessageBody); } set { this.XMSMessageBody = XMSConvert.ToXMSMessageBody(value); } } /// /// Determines what level of message context is to be set by the XMS /// application. The application must be running with appropriate /// context authority for this property to take effect. /// [UriAttribute("wmq.XMSMessageContext")] public Int32 XMSMessageContext { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_MQMD_MESSAGE_CONTEXT); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_MQMD_MESSAGE_CONTEXT, value); } } /// /// Determines what level of message context is to be set by the XMS /// application. The application must be running with appropriate /// context authority for this property to take effect. /// [UriAttribute("wmq.MessageContext")] public MessageContext MessageContext { get { return XMSConvert.ToMessageContext(this.XMSMessageContext); } set { this.XMSMessageContext = XMSConvert.ToXMSMessageContext(value); } } /// /// This property determines whether an XMS application can extract /// the values of MQMD fields or not. /// [UriAttribute("wmq.XMSMQMDReadEnabled")] public Int32 XMSMQMDReadEnabled { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_MQMD_READ_ENABLED); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_MQMD_READ_ENABLED, value); } } /// /// This property determines whether an XMS application can extract /// the values of MQMD fields or not. /// [UriAttribute("wmq.MQMDReadEnabled")] public bool MQMDReadEnabled { get { return XMSConvert.ToMQMDReadEnabled(this.XMSMQMDReadEnabled); } set { this.XMSMQMDReadEnabled = XMSConvert.ToXMSMQMDReadEnabled(value); } } /// /// This property determines whether an XMS application can set /// the values of MQMD fields or not. /// [UriAttribute("wmq.XMSMQMDWriteEnabled")] public Int32 XMSMQMDWriteEnabled { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_MQMD_WRITE_ENABLED); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_MQMD_WRITE_ENABLED, value); } } /// /// This property determines whether an XMS application can set /// the values of MQMD fields or not. /// [UriAttribute("wmq.MQMDWriteEnabled")] public bool MQMDWriteEnabled { get { return XMSConvert.ToMQMDWriteEnabled(this.XMSMQMDWriteEnabled); } set { this.XMSMQMDWriteEnabled = XMSConvert.ToXMSMQMDWriteEnabled(value); } } /// /// This property determines whether message consumers and queue /// browsers are allowed to use read ahead to get non-persistent, /// non-transactional messages from this destination into an internal /// buffer before receiving them. /// [UriAttribute("wmq.XMSReadAheadAllowed")] public Int32 XMSReadAheadAllowed { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_READ_AHEAD_ALLOWED); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_READ_AHEAD_ALLOWED, value); } } /// /// This property determines whether message consumers and queue /// browsers are allowed to use read ahead to get non-persistent, /// non-transactional messages from this destination into an internal /// buffer before receiving them. /// [UriAttribute("wmq.ReadAheadAllowed")] public ReadAheadAllowed ReadAheadAllowed { get { return XMSConvert.ToReadAheadAllowed(this.XMSReadAheadAllowed); } set { this.XMSReadAheadAllowed = XMSConvert.ToXMSReadAheadAllowed(value); } } /// /// This property determines, for messages being delivered to an /// asynchronous message listener, what happens to messages in the /// internal read ahead buffer when the message consumer is closed. /// [UriAttribute("wmq.XMSReadAheadClosePolicy")] public Int32 XMSReadAheadClosePolicy { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_READ_AHEAD_CLOSE_POLICY); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_READ_AHEAD_CLOSE_POLICY, value); } } /// /// This property determines, for messages being delivered to an /// asynchronous message listener, what happens to messages in the /// internal read ahead buffer when the message consumer is closed. /// [UriAttribute("wmq.ReadAheadClosePolicy")] public ReadAheadClosePolicy ReadAheadClosePolicy { get { return XMSConvert.ToReadAheadClosePolicy(this.XMSReadAheadClosePolicy); } set { this.XMSReadAheadClosePolicy = XMSConvert.ToXMSReadAheadClosePolicy(value); } } /// /// Destination property that sets the target CCSID for queue manager /// message conversion. The value is ignored unless /// XMSC.WMQ_RECEIVE_CONVERSION is set to /// WMQ_RECEIVE_CONVERSION_QMGR. /// [UriAttribute("wmq.ReceiveCCSID")] public Int32 ReceiveCCSID { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_RECEIVE_CCSID); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_RECEIVE_CCSID, value); } } /// /// Destination property that determines whether data conversion is /// going to be performed by the queue manager. /// [UriAttribute("wmq.XMSReceiveConversion")] public Int32 XMSReceiveConversion { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_RECEIVE_CONVERSION); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_RECEIVE_CONVERSION, value); } } /// /// Destination property that determines whether data conversion is /// going to be performed by the queue manager. /// [UriAttribute("wmq.ReceiveConversion")] public ReceiveConversion ReceiveConversion { get { return XMSConvert.ToReceiveConversion(this.XMSReceiveConversion); } set { this.XMSReceiveConversion = XMSConvert.ToXMSReceiveConversion(value); } } /// /// Whether messages sent to the destination contain an MQRFH2 /// header. /// [UriAttribute("wmq.XMSTargetClient")] public Int32 XMSTargetClient { get { return this.xmsDestination.GetIntProperty(XMSC.WMQ_TARGET_CLIENT); } set { this.xmsDestination.SetIntProperty(XMSC.WMQ_TARGET_CLIENT, value); } } /// /// Whether messages sent to the destination contain an MQRFH2 /// header. /// [UriAttribute("wmq.TargetClient")] public TargetClient TargetClient { get { return XMSConvert.ToTargetClient(this.XMSTargetClient); } set { this.XMSTargetClient = XMSConvert.ToXMSTargetClient(value); } } /// /// When creating temporary topics, XMS generates a topic string of /// the form "TEMP/TEMPTOPICPREFIX/unique_id", or if this property /// contains the default value, then this string, "TEMP/unique_id", /// is generated. Specifying a non-empty value allows specific model /// queues to be defined for creating the managed queues for subscribers /// to temporary topics created under this connection. /// [UriAttribute("wmq.TemporaryTopicPrefix")] public string WMQTemporaryTopicPrefix { get { return this.xmsDestination.GetStringProperty(XMSC.WMQ_TEMP_TOPIC_PREFIX); } set { this.xmsDestination.SetStringProperty(XMSC.WMQ_TEMP_TOPIC_PREFIX, value); } } #endregion #region WPM-specific properties /// /// The name of the service integration bus in which the destination /// exists. /// [UriAttribute("wpm.BusName")] public string BusName { get { return this.xmsDestination.GetStringProperty(XMSC.WPM_BUS_NAME); } set { this.xmsDestination.SetStringProperty(XMSC.WPM_BUS_NAME, value); } } /// /// The name of the topic space that contains the topic. /// [UriAttribute("wpm.TopicSpace")] public string TopicSpace { get { return this.xmsDestination.GetStringProperty(XMSC.WPM_TOPIC_SPACE); } set { this.xmsDestination.SetStringProperty(XMSC.WPM_TOPIC_SPACE, value); } } #endregion #endregion #region IDisposable implementation public void Dispose() { } #endregion } }