use of com.sun.messaging.jmq.admin.apps.console.event.ObjAdminEvent in project openmq by eclipse-ee4j.
the class ObjStoreConFactoryPropsDialog method doOK.
@Override
public void doOK() {
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_CF_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.QCF;
AdministeredObject tempObj = null;
if (cfLabel.getText().equals(acr.getString(acr.I_QCF))) {
type = ObjAdminEvent.QCF;
tempObj = new com.sun.messaging.QueueConnectionFactory();
} else if (cfLabel.getText().equals(acr.getString(acr.I_TCF))) {
type = ObjAdminEvent.TCF;
tempObj = new com.sun.messaging.TopicConnectionFactory();
} else if (cfLabel.getText().equals(acr.getString(acr.I_CF))) {
type = ObjAdminEvent.CF;
tempObj = new com.sun.messaging.ConnectionFactory();
} else if (cfLabel.getText().equals(acr.getString(acr.I_XAQCF))) {
type = ObjAdminEvent.XAQCF;
tempObj = new com.sun.messaging.XAQueueConnectionFactory();
} else if (cfLabel.getText().equals(acr.getString(acr.I_XATCF))) {
type = ObjAdminEvent.XATCF;
tempObj = new com.sun.messaging.XATopicConnectionFactory();
} else if (cfLabel.getText().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;
}
// Remove this propName from the props, no longer applies.
if (!(cfItem.getComponent().isEnabled())) {
props.remove(propName);
continue;
}
try {
propType = tempObj.getPropertyType(propName);
propLabel = tempObj.getPropertyLabel(propName);
} catch (jakarta.jms.JMSException jmsex) {
JOptionPane.showOptionDialog(this, jmsex.toString(), acr.getString(acr.I_OBJSTORE_CF_PROPS), 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.trim());
props.put(propName, propValue.trim());
} 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_OBJSTORE_CF_PROPS) + ": " + 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_OBJSTORE_CF_PROPS), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
}
return;
}
}
ObjAdminEvent oae = new ObjAdminEvent(this, ObjAdminEvent.UPDATE_CONN_FACTORY);
ObjStore os = osConFactoryCObj.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.apps.console.event.ObjAdminEvent 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.jmq.admin.apps.console.event.ObjAdminEvent in project openmq by eclipse-ee4j.
the class ObjStoreDestAddDialog 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_DEST) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_NO_LOOKUP_NAME), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
return;
}
/*
* Destination Type
*/
int type = ObjAdminEvent.QUEUE;
AdministeredObject tempObj = null;
if (queueButton.isSelected()) {
type = ObjAdminEvent.QUEUE;
tempObj = new com.sun.messaging.Queue();
} else if (topicButton.isSelected()) {
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.ADD_DESTINATION);
ObjStore os = osCObj.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.jmq.admin.apps.console.event.ObjAdminEvent 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.apps.console.event.ObjAdminEvent in project openmq by eclipse-ee4j.
the class ObjStorePropsDialog method doOK.
@Override
public void doOK() {
String osName = null;
osName = osText.getText();
osName = osName.trim();
//
if (osName.equals("")) {
JOptionPane.showOptionDialog(this, acr.getString(acr.E_NO_OBJSTORE_NAME), acr.getString(acr.I_OBJSTORE_PROPS) + ": " + acr.getString(acr.I_ERROR_CODE, AdminConsoleResources.E_NO_OBJSTORE_NAME), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, close, close[0]);
osText.requestFocus();
return;
}
ObjAdminEvent oae;
ObjStoreAttrs osa = constructAttrs(osName);
if (osa == null) {
return;
}
oae = new ObjAdminEvent(this, ObjAdminEvent.UPDATE_OBJSTORE);
oae.setObjStoreID(osName);
oae.setObjStore((this.osCObj).getObjStore());
oae.setObjStoreAttrs(osa);
oae.setConnectAttempt(false);
oae.setOKAction(true);
fireAdminEventDispatched(oae);
}
Aggregations