use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.
the class BrokerAdminHandler method doPauseDest.
private void doPauseDest(BrokerDestCObj bDestCObj) {
BrokerAdmin ba = bDestCObj.getBrokerAdmin();
DestinationInfo destInfo = bDestCObj.getDestinationInfo();
int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_DEST_PAUSE, destInfo.name, ba.getKey()), acr.getString(acr.I_PAUSE_DEST), JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION) {
return;
}
/*
* Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
* the console in such cases.
*/
if (!ba.isBusy()) {
ba.setAssociatedObj(bDestCObj);
}
if (pauseDest(ba, destInfo.name, destInfo.type, DestState.PAUSED)) {
destInfo = queryDestinationInfo(ba, destInfo.name, destInfo.type);
if (destInfo != null) {
bDestCObj.setDestinationInfo(destInfo);
app.getInspector().selectedObjectUpdated();
}
// Update menu items, buttons.
controller.setActions(bDestCObj);
}
}
use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.
the class BrokerAdminHandler method doUpdateDestination.
private void doUpdateDestination(BrokerAdminEvent bae, ConsoleObj selObj) {
BrokerDestCObj bDestCObj;
BrokerAdmin ba;
String destName = null;
int destTypeMask = -1;
if (!(selObj instanceof BrokerDestCObj)) {
/*
* REMINDER: Need to flag this error ?
*/
return;
}
bDestCObj = (BrokerDestCObj) selObj;
ba = bDestCObj.getBrokerAdmin();
/*
* Broker may take more time to complete the task than the specified timeout value. This value is used when refreshing
* the console in such cases.
*/
if (!ba.isBusy()) {
ba.setAssociatedObj(bDestCObj);
}
destName = bDestCObj.getDestinationInfo().name;
destTypeMask = bDestCObj.getDestinationInfo().type;
DestinationInfo destInfo = bae.getDestinationInfo();
destInfo.setName(destName);
destInfo.setType(destTypeMask);
try {
ba.sendUpdateDestinationMessage(destInfo);
ba.receiveUpdateDestinationReplyMessage();
app.getStatusArea().appendText(acr.getString(acr.S_BROKER_UPDATE_DEST, destName));
if (bae.isOKAction()) {
brokerDestPropsDialog.setVisible(false);
}
} catch (BrokerAdminException baex) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_UPDATE_DEST, destName) + printBrokerAdminExceptionDetails(baex), acr.getString(acr.I_BROKER_DEST_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_UPDATE_DEST), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
if (refreshBrokerDestCObj(bDestCObj, bae.getType())) {
app.getInspector().selectedObjectUpdated();
// Update menu items, buttons.
controller.setActions(bDestCObj);
}
}
use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.
the class BrokerAdminHandler method createDestination.
private DestinationInfo createDestination(BrokerAdminEvent bae) {
DestinationInfo destInfo = new DestinationInfo();
destInfo.setName(bae.getDestinationName());
destInfo.setType(bae.getDestinationTypeMask());
if (DestType.isQueue(bae.getDestinationTypeMask())) {
destInfo.setMaxActiveConsumers(bae.getActiveConsumers());
destInfo.setMaxFailoverConsumers(bae.getFailoverConsumers());
}
destInfo.setMaxProducers(bae.getMaxProducers());
destInfo.setMaxMessageBytes(bae.getMaxMesgBytes());
destInfo.setMaxMessages(bae.getMaxMesg());
destInfo.setMaxMessageSize(bae.getMaxPerMesgSize());
return destInfo;
}
use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.
the class BrokerAdminHandler method queryDestinationInfo.
private DestinationInfo queryDestinationInfo(BrokerAdmin ba, String name, int type) {
DestinationInfo destInfo = null;
try {
ba.sendGetDestinationsMessage(name, type);
/*
* False because users do not need to know whether or not the operation had succeeded after timeout.
*/
Vector dest = ba.receiveGetDestinationsReplyMessage(false);
if ((dest != null) && (dest.size() == 1)) {
Enumeration e = dest.elements();
destInfo = (DestinationInfo) e.nextElement();
}
} catch (BrokerAdminException bae) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_DEST_QUERY, name) + printBrokerAdminExceptionDetails(bae), acr.getString(acr.I_BROKER) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_DEST_QUERY), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
}
return destInfo;
}
use of com.sun.messaging.jmq.util.admin.DestinationInfo in project openmq by eclipse-ee4j.
the class BrokerDestListInspector method getValueAtCollumn.
/**
* Returns the Object at a particular cell collumn for a given ConsoleObj object. Each row in the JTable represents one
* ConsoleObj. This method returns the object/value for the ConsoleObj, for a particular collumn.
*
* @return the Object at a particular cell collumn for a given ConsoleObj object.
*/
@Override
public Object getValueAtCollumn(ConsoleObj conObj, int col) {
BrokerDestCObj bDestCObj;
if (!(conObj instanceof BrokerDestCObj)) {
return null;
}
bDestCObj = (BrokerDestCObj) conObj;
DestinationInfo destInfo = bDestCObj.getDestinationInfo();
/*
* Do not list internal destinations.
*/
if (DestType.isInternal(destInfo.fulltype)) {
return null;
}
if (col == 0) {
return (bDestCObj);
} else if (col == 1) {
return (BrokerAdminUtil.getDestinationType(destInfo.type));
} else if (col == 2) {
// return (DestState.toString(destInfo.destState));
return BrokerAdminUtil.getDestinationState(destInfo.destState);
}
return (null);
}
Aggregations