use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class JMSObjFactory method createXATopicConnectionFactory.
/**
* Create a JMS XA Topic Connection Factory.
*
* <P>
* No verification of valid param values are needed at this point because the assumption is that valid values were
* checked before this was called.
*
* @param objProps the set of Properties to be set when the JMS XA Topic Connection Factory is created.
* @return the com.sun.messaging.XATopicConnectionFactory
*/
public static Object createXATopicConnectionFactory(Properties objProps) throws JMSException {
AdministeredObject obj = null;
obj = new com.sun.messaging.XATopicConnectionFactory();
setProperties(obj, objProps);
return (obj);
}
use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class JMSObjFactory method updateTopicConnectionFactory.
public static Object updateTopicConnectionFactory(Object oldObj, Properties objProps, String readOnlyValue) throws JMSException {
AdministeredObject newObj = null;
newObj = new com.sun.messaging.TopicConnectionFactory();
if (oldObj instanceof AdministeredObject) {
updateAdministeredObject((AdministeredObject) oldObj, newObj, objProps, readOnlyValue);
}
return (newObj);
}
use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class ObjStoreDestPropsDialog method doOK.
@Override
public void doOK() {
Object object = osDestCObj.getObject();
// was the case.
if (object instanceof AdministeredObject) {
AdministeredObject adminObj = (AdministeredObject) object;
String curVersion = adminObj.getVERSION();
String objVersion = adminObj.getStoredVersion();
if (!adminObj.isStoredVersionCompatible()) {
int response = JOptionPane.showOptionDialog(this, acr.getString(acr.W_INCOMPATIBLE_OBJ, objVersion, curVersion), acr.getString(acr.I_OBJSTORE_DEST_PROPS) + ": " + acr.getString(acr.I_WARNING_CODE, acr.W_INCOMPATIBLE_OBJ), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, okcancel, okcancel[1]);
if (response == JOptionPane.NO_OPTION) {
return;
}
}
}
String lookupName = lookupLabel.getText();
lookupName = lookupName.trim();
if (lookupName == null || lookupName.equals("")) {
JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_LOOKUP_NAME), acr.getString(acr.I_OBJSTORE_DEST_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_NO_LOOKUP_NAME), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
int type = ObjAdminEvent.QUEUE;
AdministeredObject tempObj = null;
if (destLabel.getText().equals(acr.getString(acr.I_QUEUE))) {
type = ObjAdminEvent.QUEUE;
tempObj = new com.sun.messaging.Queue();
} else if (destLabel.getText().equals(acr.getString(acr.I_TOPIC))) {
type = ObjAdminEvent.TOPIC;
tempObj = new com.sun.messaging.Topic();
}
/*
* Object Properties (dest name, ...);
*/
int i = 0;
Properties props = tempObj.getConfiguration();
for (Enumeration e = tempObj.enumeratePropertyNames(); e.hasMoreElements(); i++) {
String propName = (String) e.nextElement();
String value = textItems[i].getText();
value = value.trim();
// so no need to set to "".
if (!(value.trim()).equals("")) {
props.put(propName, value);
}
}
ObjAdminEvent oae = new ObjAdminEvent(this, ObjAdminEvent.UPDATE_DESTINATION);
ObjStore os = osDestCObj.getObjStore();
/*
* Set values in the event.
*/
oae.setLookupName(lookupName);
oae.setObjStore(os);
oae.setDestinationType(type);
oae.setObjProperties(props);
if (checkBox.isSelected()) {
oae.setReadOnly(true);
} else {
oae.setReadOnly(false);
}
oae.setOKAction(true);
fireAdminEventDispatched(oae);
}
use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class ObjStoreDestPropsDialog method show.
public void show(ObjStoreDestCObj osDestCObj) {
this.osDestCObj = osDestCObj;
//
// Set fields to current destination values.
//
lookupLabel.setText(osDestCObj.getLookupName());
Object object = osDestCObj.getObject();
if (object instanceof com.sun.messaging.Queue) {
destLabel.setText(acr.getString(acr.I_QUEUE));
} else {
destLabel.setText(acr.getString(acr.I_TOPIC));
}
//
// Create a temp object and set its default values in the
// text fields.
//
AdministeredObject adminObj = (AdministeredObject) object;
Properties props = adminObj.getConfiguration();
int i = 0;
for (Enumeration e = adminObj.enumeratePropertyNames(); e.hasMoreElements(); i++) {
String propName = (String) e.nextElement();
try {
textItems[i].setText(adminObj.getProperty(propName));
} catch (Exception ex) {
textItems[i].setText("");
}
}
//
if (adminObj.isReadOnly()) {
checkBox.setSelected(true);
} else {
checkBox.setSelected(false);
}
/*
* Set focus to first text item.
*/
if (props.size() > 0) {
textItems[0].requestFocus();
}
setVisible(true);
}
use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class CmdRunner method runQueryCommand.
private int runQueryCommand(ObjMgrProperties objMgrProps) {
int exitcode = 0;
/*
* Get Properties object containing obj attrs
*/
String lookupName = objMgrProps.getLookupName();
Object object = null;
ObjStore os;
/*
* Check if -f (force) was specified on cmd line.
*/
boolean force = objMgrProps.forceModeSet();
ObjStoreAttrs osa = objMgrProps.getObjStoreAttrs();
/*
* Check for any mandatory bind attrs and display warning, if necessary.
*/
checkObjStoreAttrs(osa);
printQueryCmdDescription(lookupName, osa);
os = createStore(osa);
if (os == null) {
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_QUERY_FAILED));
return (1);
}
/*
* Prompt for missing authentication info BEFORE opening the store.
*/
if (!force) {
// Update ObjStoreAttrs in ths ObjStore if some security
// info was missing.
os = promptForAuthentication(os);
}
/*
* Open/Initialize the object store.
*/
try {
openStore(os);
} catch (Exception e) {
handleRunCommandExceptions(e, lookupName);
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_QUERY_FAILED));
return (1);
}
/*
* Retrieve the object by its lookup name.
*/
try {
object = os.retrieve(lookupName);
} catch (NameNotFoundException nnfe) {
Globals.stdErrPrintln(ar.getKString(ar.E_CANNOT_LOC_OBJ, lookupName));
Globals.stdOutPrintln("");
Globals.stdErrPrintln(ar.getString(ar.I_OBJ_QUERY_FAILED));
return (1);
} catch (Exception e) {
handleRunCommandExceptions(e, lookupName);
Globals.stdOutPrintln("");
Globals.stdErrPrintln(ar.getString(ar.I_OBJ_QUERY_FAILED));
return (1);
}
if (object != null) {
/*
* Print the object.
*/
ObjMgrPrinter omp = new ObjMgrPrinter(2, 4);
omp.printJMSObject(object);
Globals.stdOutPrintln("");
ObjMgrPrinter.printReadOnly(((AdministeredObject) object).isReadOnly());
} else {
// object == null
// Should not happen, since if the object cannot be retrieved,
// it should throw NameNotFoundException
Globals.stdErrPrintln(ar.getKString(ar.E_CANNOT_LOC_OBJ, lookupName));
exitcode = 1;
}
if (exitcode == 0) {
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_QUERIED));
} else {
Globals.stdOutPrintln("");
Globals.stdOutPrintln(ar.getString(ar.I_OBJ_QUERY_FAILED));
}
return (exitcode);
}
Aggregations