use of com.sun.messaging.jmq.admin.objstore.ObjStore 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();
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjAdminHandler method doUpdateConnFactory.
private void doUpdateConnFactory(ObjAdminEvent oae, ConsoleObj selObj) {
ObjStore os = oae.getObjStore();
String lookupName = oae.getLookupName();
boolean readOnly = oae.isReadOnly();
Object currentObj = ((ObjStoreConFactoryCObj) selObj).getObject();
Object updatedObject = updateObject(currentObj, oae.getFactoryType(), 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_CF_PROPS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
/*
* Now replace this updated object in the tree.
*/
((ObjStoreConFactoryCObj) selObj).setObject(updatedObject);
// ConsoleObj parent = (ConsoleObj)selObj.getParent();
// app.getExplorer().removeFromParent(selObj);
// ObjStoreConFactoryCObj conFactoryCObj = new ObjStoreConFactoryCObj (os, lookupName, updatedObject);
// app.getExplorer().addToParent(parent, conFactoryCObj);
app.getStatusArea().appendText(acr.getString(acr.S_OBJSTORE_UPDATE_CF, selObj.toString(), os.getID()));
app.getInspector().selectedObjectUpdated();
if (oae.isOKAction()) {
objStoreConFactoryPropsDialog.setVisible(false);
}
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjStoreConFactoryAddDialog method doOK.
@Override
public void doOK() {
/*
* Lookup Name
*/
String lookupName = lookupText.getText();
lookupName = lookupName.trim();
if (lookupName == null || lookupName.equals("")) {
JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_LOOKUP_NAME), acr.getString(acr.I_ADD_OBJSTORE_CF) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_NO_LOOKUP_NAME), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
/*
* Factory Type
*/
int type = ObjAdminEvent.CF;
AdministeredObject tempObj = null;
String factory = (String) factoryCombo.getSelectedItem();
if (factory.equals(acr.getString(acr.I_QCF))) {
type = ObjAdminEvent.QCF;
tempObj = new com.sun.messaging.QueueConnectionFactory();
} else if (factory.equals(acr.getString(acr.I_TCF))) {
type = ObjAdminEvent.TCF;
tempObj = new com.sun.messaging.TopicConnectionFactory();
} else if (factory.equals(acr.getString(acr.I_CF))) {
type = ObjAdminEvent.CF;
tempObj = new com.sun.messaging.ConnectionFactory();
} else if (factory.equals(acr.getString(acr.I_XAQCF))) {
type = ObjAdminEvent.XAQCF;
tempObj = new com.sun.messaging.XAQueueConnectionFactory();
} else if (factory.equals(acr.getString(acr.I_XATCF))) {
type = ObjAdminEvent.XATCF;
tempObj = new com.sun.messaging.XATopicConnectionFactory();
} else if (factory.equals(acr.getString(acr.I_XACF))) {
type = ObjAdminEvent.XACF;
tempObj = new com.sun.messaging.XAConnectionFactory();
}
/*
* Conn Factory Object Properties. Go through each of the cfProps, get the userdata which is the property name, get the
* value, set it in props.
*/
Properties props = tempObj.getConfiguration();
String propName, propValue, propType = null, propLabel = null;
for (int i = 0; i < cfProps.size(); i++) {
LabelledComponent cfItem = (LabelledComponent) cfProps.elementAt(i);
propName = (String) cfItem.getClientData();
if (propName == null) {
continue;
}
if (!(cfItem.getComponent().isEnabled())) {
props.remove(propName);
continue;
}
// associated properties or exception will occur.
try {
propType = tempObj.getPropertyType(propName);
propLabel = tempObj.getPropertyLabel(propName);
} catch (jakarta.jms.JMSException jmsex) {
JOptionPane.showOptionDialog(this, jmsex.toString(), acr.getString(acr.I_ADD_OBJSTORE_CF), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
if (propType == null) {
continue;
}
propValue = getValue(cfItem.getComponent(), propType).trim();
// so no need to set to "".
if (propValue.equals("")) {
continue;
}
try {
// Calling setProperty() will verify if this value is valid.
tempObj.setProperty(propName, propValue);
props.put(propName, propValue);
} catch (jakarta.jms.JMSException jmsex) {
if (jmsex instanceof com.sun.messaging.InvalidPropertyValueException) {
JOptionPane.showOptionDialog(this, acr.getString(acr.E_INVALID_VALUE, propLabel), acr.getString(acr.I_ADD_OBJSTORE_CF) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_INVALID_VALUE), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
} else {
JOptionPane.showOptionDialog(this, jmsex.toString(), acr.getString(acr.I_ADD_OBJSTORE_CF), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
}
return;
}
}
ObjAdminEvent oae = new ObjAdminEvent(this, ObjAdminEvent.ADD_CONN_FACTORY);
ObjStore os = osCObj.getObjStore();
/*
* Set values in the event.
*/
oae.setLookupName(lookupName);
oae.setObjStore(os);
oae.setFactoryType(type);
oae.setObjProperties(props);
if (checkBox.isSelected()) {
oae.setReadOnly(true);
} else {
oae.setReadOnly(false);
}
oae.setOKAction(true);
fireAdminEventDispatched(oae);
}
use of com.sun.messaging.jmq.admin.objstore.ObjStore in project openmq by eclipse-ee4j.
the class ObjStorePropsDialog method show.
public void show(ObjStoreCObj osCObj) {
this.osCObj = osCObj;
ObjStore os = osCObj.getObjStore();
checkBox.setSelected(true);
ObjStoreAttrs attrs = os.getObjStoreAttrs();
jndiProps.clear();
if (attrs != null) {
for (java.util.Enumeration e = attrs.keys(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
jndiProps.setProperty(key, (String) attrs.get(key));
}
model.fireTableRowsInserted(0, attrs.size() - 1);
// Select the first one in the list.
if (attrs.size() >= 1) {
table.setRowSelectionInterval(0, 0);
}
} else {
comboBox.setSelectedIndex(0);
delButton.setEnabled(false);
chgButton.setEnabled(false);
model.fireTableDataChanged();
valueText.requestFocus();
}
// If Provider URL = object store name, then
// select provider url button.
// Otherwise, select use own name button and fill in.
//
/*
* String urlName = jndiProps.getProperty(Context.PROVIDER_URL); if (urlName != null && urlName.equals(os.getID())) {
* urlButton.setSelected(true); doUrlButton(); osText.setText(""); urlButton.requestFocus(); } else {
* osTextButton.setSelected(true); doOsTextButton(); osText.setText(os.getID()); osTextButton.requestFocus(); }
*/
osText.setText(os.getID());
if (os.isOpen()) {
setEditable(false);
} else {
setEditable(true);
}
setVisible(true);
}
Aggregations