use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ConsoleObjStoreManager method readObjStoresFromFile.
/**
* Reads the files and populates objStores.
*/
public void readObjStoresFromFile() throws UserPropertiesException, ObjStoreException {
ObjStoreListProperties oslProps = readFromFile();
int count = oslProps.getObjStoreCount();
for (int i = 0; i < count; ++i) {
ObjStoreAttrs osa = oslProps.getObjStoreAttrs(i);
createStore(osa);
}
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doConnectObjStore.
private void doConnectObjStore(ConsoleObj selObj) {
ObjStore os = ((ObjStoreCObj) selObj).getObjStore();
if (os.isOpen()) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_OS_ALREADY_CONNECTED, selObj.toString()), acr.getString(acr.I_CONNECT_OBJSTORE) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_OS_ALREADY_CONNECTED), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
/*
* Retrieve the original ObjStoreAttrs that the user input. This DOES NOT read any jndi property files processed by jndi
* since this is done PRIOR to creating the initialContext.
*/
ObjStoreAttrs osa = os.getObjStoreAttrs();
Vector missingAuthInfo = os.checkAuthentication(osa);
int missingAuthInfoSize = missingAuthInfo.size();
if (missingAuthInfoSize > 0) {
if (objStorePasswdDialog == null && missingAuthInfoSize > 0) {
objStorePasswdDialog = new ObjStorePasswdDialog(app.getFrame());
objStorePasswdDialog.addAdminEventListener(this);
objStorePasswdDialog.setLocationRelativeTo(app.getFrame());
}
if (missingAuthInfoSize > 0) {
objStorePasswdDialog.show(os, missingAuthInfo);
}
} else {
boolean success = finishDoConnectObjStore(selObj, os);
if (success) {
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_CONNECT, selObj.toString()));
}
}
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doUpdateCredentials.
private void doUpdateCredentials(ObjAdminEvent oae, ConsoleObj selObj) {
ObjStore os = oae.getObjStore();
boolean success = finishDoConnectObjStore(selObj, os);
if (success) {
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_CONNECT, selObj.toString()));
}
// Remove missing info that we just added.
ObjStoreAttrs osa = oae.getObjStoreAttrs();
Vector missingInfo = oae.getMissingAuthInfo();
for (int i = 0; i < missingInfo.size(); i++) {
String key = (String) missingInfo.elementAt(i);
osa.remove(key);
}
try {
os.setObjStoreAttrs(osa);
} catch (ObjStoreException ose) {
JOptionPane.showOptionDialog(app.getFrame(), ose.toString(), acr.getString(acr.I_OBJSTORE), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
}
if (success && oae.isOKAction()) {
objStorePasswdDialog.setVisible(false);
}
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs 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.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ObjStorePropsDialog method constructAttrs.
private ObjStoreAttrs constructAttrs(String osName) {
ObjStore os = osCObj.getObjStore();
//
// If they changed the os name to something else,
// make sure it doesn't already exist.
//
String prevOsName = os.getID();
if (// they changed it
!prevOsName.equals(osName) && osMgr != null && osMgr.getStore(osName) != null) {
JOptionPane.showOptionDialog(this, acr.getString(acr.E_OBJSTORE_NAME_IN_USE, osName), acr.getString(acr.I_OBJSTORE_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_OBJSTORE_NAME_IN_USE), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
osText.requestFocus();
osText.selectAll();
return (null);
}
ObjStoreAttrs osa = new ObjStoreAttrs(osName, osName);
if (jndiProps == null) {
return (osa);
}
// Check for any properties that MUST be set.
if (checkMandatoryProps() == 0) {
return null;
}
for (java.util.Enumeration e = jndiProps.propertyNames(); e.hasMoreElements(); ) {
String propName = (String) e.nextElement();
osa.put(propName, jndiProps.getProperty(propName));
}
return (osa);
}
Aggregations