use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class CmdPreviewer method previewQueryCommand.
/*
* Preview query command
*/
private void previewQueryCommand(ObjMgrProperties objMgrProps) {
/*
* Get object type, props object, and lookup name
*/
// String type = objMgrProps.getObjType();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
String lookupName = objMgrProps.getLookupName();
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_QUERY));
Globals.stdOutPrintln("");
Globals.stdOutPrintln(lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_QUERY_CMD_DESC_STORE));
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(osa, 2, 4);
omp.print();
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_NOT_QUERIED));
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class CmdPreviewer method previewDeleteCommand.
/*
* Preview delete command
*/
private void previewDeleteCommand(ObjMgrProperties objMgrProps) {
/*
* Get object type, props object, and lookup name
*/
// String type = objMgrProps.getObjType();
// Properties objProps = objMgrProps.getObjProperties();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
String lookupName = objMgrProps.getLookupName();
/*
* Check if -f (force) was specified on cmd line.
*/
boolean force = objMgrProps.forceModeSet();
if (force)
Globals.stdOutPrintln(ar.getString(ar.I_PROMPT_OFF));
else
Globals.stdOutPrintln(ar.getString(ar.I_PROMPT_ON));
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_PREVIEW_DELETE));
Globals.stdOutPrintln("");
Globals.stdOutPrintln(lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_DELETE_CMD_DESC_STORE));
Globals.stdOutPrintln("");
ObjMgrPrinter omp = new ObjMgrPrinter(osa, 2, 4);
omp.print();
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_NOT_DELETED));
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ObjStoreListProperties method getObjStoreAttrs.
/**
* Returns a ObjStoreAttrs object containing the attributes that are relevant for creating an object store. These
* attributes are normalized e.g. the preceding <EM>objstore.attrs.</EM> is stripped.
*
* @param index Index for specifying the object store in question.
*
* @return A ObjStoreAttrs object containing attributes needed for creation of an object store.
*/
public ObjStoreAttrs getObjStoreAttrs(int index) {
// ObjStoreAttrs osa = new ObjStoreAttrs();
ObjStoreAttrs osa;
String basePropName, objstoreAttrsStr, idPropName, descPropName;
String id, desc;
int objstoreAttrsStrLen;
basePropName = PROP_NAME_OBJSTORE_BASENAME + Integer.toString(index) + ".";
idPropName = basePropName + PROP_NAME_OBJSTORE_ID_PREFIX;
id = getProperty(idPropName, "");
descPropName = basePropName + PROP_NAME_OBJSTORE_DESC_PREFIX;
desc = getProperty(descPropName, "");
osa = new ObjStoreAttrs(id, desc);
/*
* Construct string: objstore1.attrs.
*/
objstoreAttrsStr = PROP_NAME_OBJSTORE_BASENAME + Integer.toString(index) + "." + PROP_NAME_OBJSTORE_ATTR_PREFIX + ".";
objstoreAttrsStrLen = objstoreAttrsStr.length();
for (Enumeration e = propertyNames(); e.hasMoreElements(); ) {
String propName = (String) e.nextElement();
if (propName.startsWith(objstoreAttrsStr)) {
String newPropName, value;
newPropName = propName.substring(objstoreAttrsStrLen);
value = getProperty(propName);
osa.put(newPropName, value);
}
}
return (osa);
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ConsoleObjStoreManager method writeObjStoresToFile.
/**
* Writes ObjStores to files.
*/
public void writeObjStoresToFile() throws UserPropertiesException {
// Must call ObjStoreAttrs.prepareToTerminate() prior to
// storing
Enumeration e = objStores.elements();
ObjStoreListProperties oslProps = new ObjStoreListProperties();
while (e.hasMoreElements()) {
ObjStore os = (ObjStore) e.nextElement();
ObjStoreAttrs osa = os.getObjStoreAttrs();
osa.prepareToTerminate();
oslProps.addObjStoreAttrs(osa);
}
writeToFile(oslProps);
}
use of com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs in project openmq by eclipse-ee4j.
the class ObjAdminHandler method updateStore.
private ObjStore updateStore(ObjStore prevOs, String newName, ObjStoreManager osMgr, ObjStoreAttrs osa, boolean attemptToConnect) {
ObjStore os = null;
boolean created = false;
if (osMgr == null || osa == null) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_OS_PROCESS), acr.getString(acr.I_OBJSTORE) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_OS_PROCESS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return (null);
}
/*
* Update ObjStore
*/
ObjStoreAttrs prevAttrs = prevOs.getObjStoreAttrs();
os = osMgr.getStore(prevOs.getID());
if (os == null) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_OS_PROCESS), acr.getString(acr.I_OBJSTORE) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_OS_PROCESS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
}
//
try {
if (newName != null && os != null && !newName.equals(os.getID())) {
os = osMgr.createStore(osa);
created = true;
} else if (os != null) {
os.setObjStoreAttrs(osa);
}
} catch (Exception ex) {
JOptionPane.showOptionDialog(app.getFrame(), ex.toString(), acr.getString(acr.I_OBJSTORE_PROPS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return null;
}
/*
* Now try connecting to it (if they want to try). Then read in the objects from the store.
*/
if (attemptToConnect) {
try {
if (os != null) {
os.open();
}
} catch (Exception e) {
JOptionPane.showOptionDialog(app.getFrame(), acr.getString(acr.E_INSUFFICIENT_INFO, e.toString()), acr.getString(acr.I_OBJSTORE_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_INSUFFICIENT_INFO), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
// Don't update it, undo everything
try {
if (created) {
osMgr.destroyStore(osa.getID());
} else {
// Reset old attrs back
os.setObjStoreAttrs(prevAttrs);
}
} catch (Exception ex) {
}
return null;
}
}
//
if (os != null && created) {
try {
if (prevOs.isOpen()) {
prevOs.close();
}
osMgr.destroyStore(prevOs.getID());
if (!attemptToConnect && os.isOpen()) {
os.close();
}
} catch (Exception ex) {
}
}
//
if (os != null && !attemptToConnect && os.isOpen()) {
try {
os.close();
} catch (Exception ex) {
}
}
return (os);
}
Aggregations