Search in sources :

Example 31 with DestinationInfo

use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.

the class JMSAdminImpl method getProviderDestinations.

/**
 * Get all provider destinations.
 *
 * @return A multi dimensional array containing information about the JMS destinations. array[0] is a String[] listing
 * the destination names. array[1] is a String[] listing the destination types.
 * @exception JMSException thrown if array could not be obtained.
 */
@Override
public String[][] getProviderDestinations() throws JMSException {
    ObjectMessage mesg = null;
    mesg = session.createObjectMessage();
    mesg.setJMSReplyTo(replyQueue);
    mesg.setIntProperty(MessageType.JMQ_MESSAGE_TYPE, MessageType.GET_DESTINATIONS);
    sender.send(mesg);
    mesg = (ObjectMessage) receiver.receive(timeout);
    mesg.acknowledge();
    checkReplyTypeStatus(mesg, MessageType.GET_DESTINATIONS_REPLY);
    Object obj;
    if ((obj = mesg.getObject()) != null) {
        if (obj instanceof Vector) {
            Vector dests = (Vector) obj;
            /*
                 * Remove temporary, internal and admin destinations by creating a new Vector and adding all the valid destinations into
                 * this new Vector.
                 */
            Vector validDests = new Vector();
            for (int i = 0; i < dests.size(); i++) {
                DestinationInfo di = (DestinationInfo) dests.elementAt(i);
                if ((!MessageType.JMQ_ADMIN_DEST.equals(di.name)) && (!MessageType.JMQ_BRIDGE_ADMIN_DEST.equals(di.name)) && (!DestType.isInternal(di.fulltype)) && (!DestType.isTemporary(di.type))) {
                    validDests.add(di);
                }
            }
            int numElements = validDests.size();
            String[][] destinations = new String[2][numElements];
            for (int i = 0; i < numElements; i++) {
                DestinationInfo di = (DestinationInfo) validDests.get(i);
                destinations[0][i] = di.name;
                destinations[1][i] = this.getDestinationType(di.type);
            }
            return destinations;
        }
    }
    return null;
}
Also used : DestinationInfo(com.sun.messaging.jmq.util.admin.DestinationInfo) ObjectMessage(jakarta.jms.ObjectMessage) AdministeredObject(com.sun.messaging.AdministeredObject) Vector(java.util.Vector)

Aggregations

DestinationInfo (com.sun.messaging.jmq.util.admin.DestinationInfo)31 BrokerAdmin (com.sun.messaging.jmq.admin.bkrutil.BrokerAdmin)14 SizeString (com.sun.messaging.jmq.util.SizeString)13 BrokerAdminException (com.sun.messaging.jmq.admin.bkrutil.BrokerAdminException)12 Vector (java.util.Vector)11 Enumeration (java.util.Enumeration)10 ServiceInfo (com.sun.messaging.jmq.util.admin.ServiceInfo)4 Properties (java.util.Properties)4 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)3 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)3 Hashtable (java.util.Hashtable)3 Iterator (java.util.Iterator)3 AdministeredObject (com.sun.messaging.AdministeredObject)2 HAMonitorService (com.sun.messaging.jmq.jmsserver.cluster.api.ha.HAMonitorService)2 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)2 ObjectMessage (jakarta.jms.ObjectMessage)2 BrokerAdminEvent (com.sun.messaging.jmq.admin.event.BrokerAdminEvent)1 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)1 Producer (com.sun.messaging.jmq.jmsserver.core.Producer)1 PartitionedStore (com.sun.messaging.jmq.jmsserver.persist.api.PartitionedStore)1