Search in sources :

Example 1 with BrokerResources

use of com.sun.messaging.jmq.jmsserver.resources.BrokerResources in project openmq by eclipse-ee4j.

the class DestinationUtil method checkCreateDestinationAttrs.

public static void checkCreateDestinationAttrs(String type, AttributeList attrs) throws BrokerException {
    String[] validAttrs = null;
    checkDestType(type);
    if (attrs == null) {
        return;
    }
    if (type.equals(DestinationType.QUEUE)) {
        validAttrs = queueCreateAttrs;
    } else if (type.equals(DestinationType.TOPIC)) {
        validAttrs = topicCreateAttrs;
    }
    for (Iterator i = attrs.iterator(); i.hasNext(); ) {
        Attribute attr = (Attribute) i.next();
        String name = attr.getName();
        if (!checkOneDestAttr(name, validAttrs)) {
            BrokerResources rb = Globals.getBrokerResources();
            String err;
            if (type.equals(DestinationType.QUEUE)) {
                err = rb.getString(rb.X_JMX_INVALID_CREATE_TIME_ATTR_SPEC_QUEUE, name);
            } else {
                err = rb.getString(rb.X_JMX_INVALID_CREATE_TIME_ATTR_SPEC_TOPIC, name);
            }
            throw new BrokerException(err);
        }
    }
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) Iterator(java.util.Iterator) SizeString(com.sun.messaging.jmq.util.SizeString) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Example 2 with BrokerResources

use of com.sun.messaging.jmq.jmsserver.resources.BrokerResources in project openmq by eclipse-ee4j.

the class DestinationUtil method compactAllDestinations.

public static void compactAllDestinations() throws BrokerException {
    Iterator[] itrs = Globals.getDestinationList().getAllDestinations(null);
    // PART
    Iterator itr = itrs[0];
    boolean docompact = true;
    String errMsg = null;
    BrokerResources rb = Globals.getBrokerResources();
    while (itr.hasNext()) {
        // make sure all are paused
        Destination d = (Destination) itr.next();
        /*
             * Skip internal, admin, or temp destinations. Skipping temp destinations may need to be revisited.
             */
        if (d.isInternal() || d.isAdmin() || d.isTemporary()) {
            continue;
        }
        if (!d.isPaused()) {
            docompact = false;
            String msg = rb.getString(rb.E_SOME_DESTINATIONS_NOT_PAUSED);
            errMsg = rb.getString(rb.X_COMPACT_DSTS_EXCEPTION, msg);
            throw (new BrokerException(errMsg));
        }
    }
    if (docompact) {
        itrs = Globals.getDestinationList().getAllDestinations(null);
        itr = itrs[0];
        while (itr.hasNext()) {
            Destination d = (Destination) itr.next();
            /*
                 * Skip internal, admin, or temp destinations. Skipping temp destinations may need to be revisited.
                 */
            if (d.isInternal() || d.isAdmin() || d.isTemporary()) {
                continue;
            }
            d.compact();
        }
    }
}
Also used : Destination(com.sun.messaging.jmq.jmsserver.core.Destination) BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) Iterator(java.util.Iterator) SizeString(com.sun.messaging.jmq.util.SizeString) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Example 3 with BrokerResources

use of com.sun.messaging.jmq.jmsserver.resources.BrokerResources in project openmq by eclipse-ee4j.

the class ProducerUtil method getProducerInfo.

public static CompositeData getProducerInfo(String producerID) throws BrokerException, OpenDataException {
    CompositeData cd = null;
    ProducerUID pid = null;
    BrokerResources rb = Globals.getBrokerResources();
    if (producerID == null) {
        throw new IllegalArgumentException(rb.getString(rb.X_JMX_NULL_PRODUCER_ID_SPEC));
    }
    long longPid = 0;
    try {
        longPid = Long.parseLong(producerID);
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException(rb.getString(rb.X_JMX_INVALID_PRODUCER_ID_SPEC, producerID));
    }
    pid = new ProducerUID(longPid);
    cd = getProducerInfo(pid);
    return (cd);
}
Also used : ProducerUID(com.sun.messaging.jmq.jmsserver.core.ProducerUID) CompositeData(javax.management.openmbean.CompositeData) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Example 4 with BrokerResources

use of com.sun.messaging.jmq.jmsserver.resources.BrokerResources in project openmq by eclipse-ee4j.

the class ConnectionUtil method getConnections.

/**
 * Returns a List of IMQConnection for a given service
 */
public static List getConnections(String service) {
    ConnectionManager cm = Globals.getConnectionManager();
    List connections = null;
    try {
        Service s = null;
        if (service != null) {
            s = Globals.getServiceManager().getService(service);
            /*
                 * If service object is null, service may not exist or is inactive
                 */
            if (s == null) {
                return (connections);
            }
        }
        connections = cm.getConnectionList(s);
    } catch (Exception e) {
        BrokerResources rb = Globals.getBrokerResources();
        Logger logger = Globals.getLogger();
        logger.log(Logger.WARNING, rb.getString(rb.W_JMX_FAILED_TO_OBTAIN_CONNECTION_LIST), e);
    }
    return (connections);
}
Also used : ConnectionManager(com.sun.messaging.jmq.jmsserver.service.ConnectionManager) Service(com.sun.messaging.jmq.jmsserver.service.Service) List(java.util.List) ArrayList(java.util.ArrayList) Logger(com.sun.messaging.jmq.util.log.Logger) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Example 5 with BrokerResources

use of com.sun.messaging.jmq.jmsserver.resources.BrokerResources in project openmq by eclipse-ee4j.

the class TransactionUtil method getTransactionInfo.

public static CompositeData getTransactionInfo(String transactionID) throws BrokerException, OpenDataException {
    CompositeData cd = null;
    TransactionUID tid = null;
    BrokerResources rb = Globals.getBrokerResources();
    if (transactionID == null) {
        throw new IllegalArgumentException(rb.getString(rb.X_JMX_NULL_TXN_ID_SPEC));
    }
    long longTid = 0;
    try {
        longTid = Long.parseLong(transactionID);
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException(rb.getString(rb.X_JMX_INVALID_TXN_ID_SPEC, transactionID));
    }
    tid = new TransactionUID(longTid);
    cd = getTransactionInfo(tid);
    return (cd);
}
Also used : TransactionUID(com.sun.messaging.jmq.jmsserver.data.TransactionUID) CompositeData(javax.management.openmbean.CompositeData) BrokerResources(com.sun.messaging.jmq.jmsserver.resources.BrokerResources)

Aggregations

BrokerResources (com.sun.messaging.jmq.jmsserver.resources.BrokerResources)13 Logger (com.sun.messaging.jmq.util.log.Logger)7 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)6 Iterator (java.util.Iterator)4 SizeString (com.sun.messaging.jmq.util.SizeString)3 ArrayList (java.util.ArrayList)3 CompositeData (javax.management.openmbean.CompositeData)3 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)2 ChangeRecordInfo (com.sun.messaging.jmq.jmsserver.persist.api.ChangeRecordInfo)2 ConnectionManager (com.sun.messaging.jmq.jmsserver.service.ConnectionManager)2 Service (com.sun.messaging.jmq.jmsserver.service.Service)2 List (java.util.List)2 BrokerMQAddress (com.sun.messaging.jmq.jmsserver.core.BrokerMQAddress)1 Consumer (com.sun.messaging.jmq.jmsserver.core.Consumer)1 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)1 DestinationUID (com.sun.messaging.jmq.jmsserver.core.DestinationUID)1 ProducerUID (com.sun.messaging.jmq.jmsserver.core.ProducerUID)1 TransactionUID (com.sun.messaging.jmq.jmsserver.data.TransactionUID)1 TransactionInfo (com.sun.messaging.jmq.jmsserver.persist.api.TransactionInfo)1 IMQConnection (com.sun.messaging.jmq.jmsserver.service.imq.IMQConnection)1