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);
}
}
}
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();
}
}
}
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);
}
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);
}
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);
}
Aggregations