use of com.sun.messaging.jmq.admin.objstore.ObjStoreManager in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doAddObjStore.
private void doAddObjStore(ObjAdminEvent oae) {
ObjStoreAttrs osa = oae.getObjStoreAttrs();
ObjStoreManager osMgr = app.getObjStoreListCObj().getObjStoreManager();
boolean connect = oae.isConnectAttempt();
ConsoleObj osCObj = null;
/*
* Create store and connect (if requested).
*/
ObjStore os = createStore(osMgr, osa, connect);
/*
* If valid object store, then now try reading in any existing objects.
*/
if (os != null) {
osCObj = new ObjStoreCObj(os);
if (os.isOpen()) {
readObjStore(osCObj, os);
}
}
/*
* If os is still valid, then add it to the tree list.
*/
if (osCObj != null) {
app.getExplorer().addObjStore(osCObj);
app.getInspector().refresh();
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_ADD, osCObj.toString()));
}
/*
* Bring down the dialog if successful, otherwise keep it up.
*/
if (oae.isOKAction() && os != null) {
objStoreAddDialog.setVisible(false);
}
saveObjStoreList();
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreManager in project openmq by eclipse-ee4j.
the class CmdRunner method createStore.
/*
* 02/05/2001 Creates a store.
*/
private ObjStore createStore(ObjStoreAttrs osa) {
if (osa == null) {
return (null);
}
ObjStore os = null;
/*
* Create ObjStore
*/
try {
ObjStoreManager osmgr = ObjStoreManager.getObjStoreManager();
os = osmgr.createStore(osa);
} catch (NameNotFoundException nnfe) {
Globals.stdErrPrintln(ar.getString(ar.I_ERROR_MESG), ar.getKString(ar.E_CANNOT_LOC_TREE));
} catch (ObjStoreException e) {
handleRunCommandExceptions(e);
}
return (os);
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreManager 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.ObjStoreManager in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doDeleteObjStore.
private void doDeleteObjStore(ConsoleObj selObj) {
int result = JOptionPane.showConfirmDialog(app.getFrame(), acr.getString(acr.Q_OBJSTORE_DELETE, selObj.toString()), acr.getString(acr.I_DELETE_OBJSTORE), JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.NO_OPTION) {
return;
}
/*
* Disconnect and delete the object store.
*/
ObjStore os = ((ObjStoreCObj) selObj).getObjStore();
try {
os.close();
} catch (Exception e) {
}
ObjStoreManager osMgr = app.getObjStoreListCObj().getObjStoreManager();
try {
osMgr.destroyStore(os.getID());
} catch (Exception e) {
}
/*
* Remove the node from the tree.
*/
app.getExplorer().removeFromParent(selObj);
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_DELETE, os.getID()));
/*
* Clear selection if the selection is from the explorer. Otherwise, refresh the inspector.
*/
/*
* if (fromExplorer) controller.clearSelection(); else app.getInspector().refresh();
*/
controller.clearSelection();
saveObjStoreList();
}
Aggregations