use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doUpdateDestination.
private void doUpdateDestination(ObjAdminEvent oae, ConsoleObj selObj) {
ObjStore os = oae.getObjStore();
String lookupName = oae.getLookupName();
boolean readOnly = oae.isReadOnly();
Object currentObj = ((ObjStoreDestCObj) selObj).getObject();
Object updatedObject = updateObject(currentObj, oae.getDestinationType(), oae.getObjProperties(), readOnly);
if (updatedObject == null) {
return;
}
try {
os.add(lookupName, updatedObject, true);
} catch (NameAlreadyExistsException naee) {
// Should never happen, since we pass true to add
} catch (Exception e) {
JOptionPane.showOptionDialog(app.getFrame(), e.toString(), acr.getString(acr.I_OBJSTORE_DEST_PROPS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
/*
* Now replace this updated object in the tree.
*/
((ObjStoreDestCObj) selObj).setObject(updatedObject);
// ConsoleObj parent = (ConsoleObj)selObj.getParent();
// app.getExplorer().removeFromParent(selObj);
// ObjStoreDestCObj destCObj = new ObjStoreDestCObj(os, lookupName, updatedObject);
// app.getExplorer().addToParent(parent, destCObj);
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_UPDATE_DEST, selObj.toString(), os.getID()));
app.getInspector().selectedObjectUpdated();
if (oae.isOKAction()) {
objStoreDestPropsDialog.setVisible(false);
}
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doUpdateObjStore.
private void doUpdateObjStore(ObjAdminEvent oae, ConsoleObj selObj) {
ObjStoreAttrs osa = oae.getObjStoreAttrs();
ObjStoreManager osMgr = app.getObjStoreListCObj().getObjStoreManager();
boolean connect = oae.isConnectAttempt();
ObjStore prevOs = ((ObjStoreCObj) selObj).getObjStore();
String newName = oae.getObjStoreID();
/*
* Create/Update a new store and connect (if requested).
*/
ObjStore os = updateStore(prevOs, newName, osMgr, osa, connect);
/*
* If valid object store, then now try reading in any existing objects.
*/
if (os == null) {
// Don't do anything, just keep the old os.
return;
} else {
/*
* Read in the objects from the os.
*/
if (os.isOpen()) {
readObjStore(selObj, os);
}
}
/*
* If os is still valid, then update it cobj with the new obj store.
*/
((ObjStoreCObj) selObj).setObjStore(os);
/*
* We know that 0 is the dest list and 1 is the con factory list.
*/
ObjStoreDestListCObj destListCObj = (ObjStoreDestListCObj) selObj.getChildAt(0);
ObjStoreConFactoryListCObj cfListCObj = (ObjStoreConFactoryListCObj) selObj.getChildAt(1);
destListCObj.setObjStore(os);
cfListCObj.setObjStore(os);
app.getExplorer().nodeChanged(selObj);
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_UPDATE, selObj.toString()));
app.getInspector().selectedObjectUpdated();
// Update menu items, buttons.
controller.setActions(selObj);
/*
* If check box to connect is not checked, then remove all destination/connection factory objects from this object store
* node hierarchy
*/
if (!connect) {
clearStore(selObj);
}
/*
* Bring down the dialog if successful, otherwise keep it up.
*/
if (oae.isOKAction()) {
objStorePropsDialog.setVisible(false);
}
saveObjStoreList();
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doRefreshObjStore.
/*
* private void doRefreshConnFactory(ConsoleObj selObj) {
*
* ObjStore os = ((ObjStoreConFactoryCObj)selObj).getObjStore(); String lookupName =
* ((ObjStoreConFactoryCObj)selObj).getLookupName(); Object object = null;
*
* try { object = os.retrieve(lookupName); } catch (Exception e) { JOptionPane.showOptionDialog(app.getFrame(),
* e.toString(), acr.getString(acr.I_OBJSTORE_REFRESH_CF), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null,
* close, close[0]); return; }
*
* // Now replace this updated object in the tree. ((ObjStoreConFactoryCObj)selObj).setObject(object);
*
* app.getStatusArea().appendText(acr.getString(acr.S_OS_CF_REFRESH, selObj.toString(), os.getID()));
* app.getInspector().selectedObjectUpdated();
*
* }
*/
/*
* private void doRefreshDestination(ConsoleObj selObj) {
*
* ObjStore os = ((ObjStoreDestCObj)selObj).getObjStore(); String lookupName =
* ((ObjStoreDestCObj)selObj).getLookupName(); Object object = null;
*
* try { object = os.retrieve(lookupName); } catch (Exception e) { JOptionPane.showOptionDialog(app.getFrame(),
* e.toString(), acr.getString(acr.I_OBJSTORE_REFRESH_DEST), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null,
* close, close[0]); return; }
*
* // Now replace this updated object in the tree. ((ObjStoreDestCObj)selObj).setObject(object);
*
* app.getStatusArea().appendText(acr.getString(acr.S_OS_DEST_REFRESH, selObj.toString(), os.getID()));
* app.getInspector().selectedObjectUpdated();
*
* }
*/
private void doRefreshObjStore(ConsoleObj selObj) {
ObjStore os = null;
ConsoleObj cObj = selObj;
if (selObj instanceof ObjStoreCObj) {
os = ((ObjStoreCObj) selObj).getObjStore();
cObj = selObj;
} else if (selObj instanceof ObjStoreDestListCObj) {
os = ((ObjStoreDestListCObj) selObj).getObjStore();
cObj = (ConsoleObj) selObj.getParent();
} else if (selObj instanceof ObjStoreConFactoryListCObj) {
os = ((ObjStoreConFactoryListCObj) selObj).getObjStore();
cObj = (ConsoleObj) selObj.getParent();
}
if (!os.isOpen()) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_OBJSTORE_NOT_CONNECTED, selObj.toString()), acr.getString(acr.I_OBJSTORE_REFRESH) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_OBJSTORE_NOT_CONNECTED), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
boolean success = finishDoConnectObjStore(cObj, os);
if (success) {
// Update menu items, buttons.
controller.setActions(selObj);
// XXX This causes selection in inspector to go away.
app.getInspector().refresh();
if (selObj instanceof ObjStoreCObj) {
app.getStatusArea().appendText(acr.getString(acr.S_OS_REFRESH, os.getID()));
} else if (selObj instanceof ObjStoreDestListCObj) {
app.getStatusArea().appendText(acr.getString(acr.S_OS_DESTLIST_REFRESH, os.getID()));
} else if (selObj instanceof ObjStoreConFactoryListCObj) {
app.getStatusArea().appendText(acr.getString(acr.S_OS_CFLIST_REFRESH, os.getID()));
}
}
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doDeleteConnFactory.
private void doDeleteConnFactory(ConsoleObj selObj) {
ObjStore os = ((ObjStoreConFactoryCObj) selObj).getObjStore();
int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_CF_OBJ_DELETE, selObj.toString(), os.getID()), acr.getString(acr.I_DELETE_OBJSTORE_CF), JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION) {
return;
}
/*
* Disconnect and delete the object store.
*/
String lookupName = selObj.toString();
try {
os.delete(lookupName);
} catch (Exception e) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_DELETE_CF_OBJ, selObj.toString(), e.toString()), acr.getString(acr.I_DELETE_OBJSTORE_CF) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_DELETE_CF_OBJ), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_DELETE_CF, selObj.toString(), os.getID()));
ObjStoreConFactoryListCObj cfList = (ObjStoreConFactoryListCObj) selObj.getParent();
app.getExplorer().removeFromParent(selObj);
// Force selection of ObjStoreDestListCObj
app.getExplorer().select((cfList));
app.getInspector().refresh();
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doDeleteDestination.
private void doDeleteDestination(ConsoleObj selObj) {
ObjStore os = ((ObjStoreDestCObj) selObj).getObjStore();
int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_DEST_OBJ_DELETE, selObj.toString(), os.getID()), acr.getString(acr.I_DELETE_OBJSTORE_DEST), JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION) {
return;
}
/*
* Disconnect and delete the object store.
*/
String lookupName = selObj.toString();
try {
os.delete(lookupName);
} catch (Exception e) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_DELETE_DEST_OBJ, selObj.toString(), e.toString()), acr.getString(acr.I_DELETE_OBJSTORE_DEST) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_DELETE_DEST_OBJ), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_DELETE_DEST, selObj.toString(), os.getID()));
ObjStoreDestListCObj destList = (ObjStoreDestListCObj) selObj.getParent();
app.getExplorer().removeFromParent(selObj);
// Force selection of ObjStoreDestListCObj
app.getExplorer().select((destList));
app.getInspector().refresh();
}
Aggregations