use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class ObjStoreConFactoryAddDialog method doReset.
@Override
public void doReset() {
// Reset the look up name and factory type.
lookupText.setText("");
factoryCombo.setSelectedItem(acr.getString(acr.I_CF));
checkBox.setSelected(false);
//
// Go through each of the items, get the userData which is
// the property name, then get the default value from a
// temporary object.
//
AdministeredObject tempObj = new com.sun.messaging.QueueConnectionFactory();
// Properties props = tempObj.getConfiguration();
String propName = null, propType = null;
String defaultValue = null;
for (int i = 0; i < cfProps.size(); i++) {
LabelledComponent cfItem = (LabelledComponent) cfProps.elementAt(i);
JComponent comp = cfItem.getComponent();
propName = (String) cfItem.getClientData();
if (propName != null) {
try {
// gets, InvalidPropertyException.
if (comp.isEnabled()) {
propType = tempObj.getPropertyType(propName);
defaultValue = tempObj.getProperty(propName);
setValue(comp, propType, defaultValue);
// setting.
if (comp instanceof JComboBox) {
doComboBox((JComboBox) comp);
}
}
} catch (Exception e) {
System.err.println(e.toString() + ": " + propName);
}
}
}
// XXX Bad
AdministeredObject tempObj2 = new com.sun.messaging.QueueConnectionFactory();
setOtherValues(tempObj2, false);
lookupText.requestFocus();
}
use of com.sun.messaging.AdministeredObject 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.AdministeredObject in project openmq by eclipse-ee4j.
the class ObjStoreConFactoryPropsDialog method show.
public void show(ObjStoreConFactoryCObj osConFactoryCObj) {
this.osConFactoryCObj = osConFactoryCObj;
//
// Set fields to current object values.
//
lookupLabel.setText(osConFactoryCObj.getLookupName());
Object object = osConFactoryCObj.getObject();
if (object instanceof com.sun.messaging.XAQueueConnectionFactory) {
cfLabel.setText(acr.getString(acr.I_XAQCF));
} else if (object instanceof com.sun.messaging.XATopicConnectionFactory) {
cfLabel.setText(acr.getString(acr.I_XATCF));
} else if (object instanceof com.sun.messaging.XAConnectionFactory) {
cfLabel.setText(acr.getString(acr.I_XACF));
} else if (object instanceof com.sun.messaging.QueueConnectionFactory) {
cfLabel.setText(acr.getString(acr.I_QCF));
} else if (object instanceof com.sun.messaging.TopicConnectionFactory) {
cfLabel.setText(acr.getString(acr.I_TCF));
} else if (object instanceof com.sun.messaging.ConnectionFactory) {
cfLabel.setText(acr.getString(acr.I_CF));
}
//
// Go through each of the component items, get the clientData
// which is the property name, then get the value of the
// property from the current adminObj.
//
String propName = null;
String propType = null;
String value = null;
AdministeredObject adminObj = (AdministeredObject) object;
for (int i = 0; i < cfProps.size(); i++) {
LabelledComponent cfItem = (LabelledComponent) cfProps.elementAt(i);
JComponent comp = cfItem.getComponent();
propName = (String) cfItem.getClientData();
if (propName == null) {
continue;
}
try {
if (comp.isEnabled()) {
propType = adminObj.getPropertyType(propName);
value = adminObj.getProperty(propName);
setValue(comp, propType, value);
// setting.
if (comp instanceof JComboBox) {
doComboBox((JComboBox) comp);
}
}
} catch (Exception e) {
System.err.println(e.toString() + ": " + propName);
}
}
// now we should be able to set values.
AdministeredObject tempObj2 = new com.sun.messaging.QueueConnectionFactory();
setOtherValues(tempObj2, true);
// Set read-only box
if (adminObj.isReadOnly()) {
checkBox.setSelected(true);
} else {
checkBox.setSelected(false);
}
/*
* Set focus to first text item. if (props.size() > 0) textItems[0].requestFocus();
*/
// Go back to first tab.
tabbedPane.setSelectedIndex(0);
setVisible(true);
}
use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class JMSObjFactory method createQueueConnectionFactory.
/**
* Create a JMS Queue 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 Queue Connection Factory is created.
* @return the com.sun.messaging.QueueConnectionFactory
*/
public static Object createQueueConnectionFactory(Properties objProps) throws JMSException {
AdministeredObject obj = null;
obj = new com.sun.messaging.QueueConnectionFactory();
setProperties(obj, objProps);
return (obj);
}
use of com.sun.messaging.AdministeredObject in project openmq by eclipse-ee4j.
the class JMSObjFactory method updateConnectionFactory.
public static Object updateConnectionFactory(Object oldObj, Properties objProps, String readOnlyValue) throws JMSException {
AdministeredObject newObj = null;
newObj = new com.sun.messaging.ConnectionFactory();
if (oldObj instanceof AdministeredObject) {
updateAdministeredObject((AdministeredObject) oldObj, newObj, objProps, readOnlyValue);
}
return (newObj);
}
Aggregations