Search in sources :

Example 11 with AdministeredObject

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);
}
Also used : AdministeredObject(com.sun.messaging.AdministeredObject)

Example 12 with AdministeredObject

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);
}
Also used : AdministeredObject(com.sun.messaging.AdministeredObject)

Example 13 with AdministeredObject

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);
}
Also used : Enumeration(java.util.Enumeration) ObjStore(com.sun.messaging.jmq.admin.objstore.ObjStore) ObjAdminEvent(com.sun.messaging.jmq.admin.apps.console.event.ObjAdminEvent) Properties(java.util.Properties) AdministeredObject(com.sun.messaging.AdministeredObject) AdministeredObject(com.sun.messaging.AdministeredObject)

Example 14 with AdministeredObject

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);
}
Also used : AdministeredObject(com.sun.messaging.AdministeredObject) Enumeration(java.util.Enumeration) AdministeredObject(com.sun.messaging.AdministeredObject) Properties(java.util.Properties)

Example 15 with AdministeredObject

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);
}
Also used : ObjStore(com.sun.messaging.jmq.admin.objstore.ObjStore) NameNotFoundException(com.sun.messaging.jmq.admin.objstore.NameNotFoundException) ObjStoreAttrs(com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs) AdministeredObject(com.sun.messaging.AdministeredObject) GeneralNamingException(com.sun.messaging.jmq.admin.objstore.GeneralNamingException) AuthenticationNotSupportedException(com.sun.messaging.jmq.admin.objstore.AuthenticationNotSupportedException) MissingVersionNumberException(com.sun.messaging.naming.MissingVersionNumberException) ReadOnlyPropertyException(com.sun.messaging.ReadOnlyPropertyException) InvalidPropertyException(com.sun.messaging.InvalidPropertyException) ObjStoreException(com.sun.messaging.jmq.admin.objstore.ObjStoreException) InitializationException(com.sun.messaging.jmq.admin.objstore.InitializationException) AuthenticationException(com.sun.messaging.jmq.admin.objstore.AuthenticationException) SchemaViolationException(com.sun.messaging.jmq.admin.objstore.SchemaViolationException) InvalidPropertyValueException(com.sun.messaging.InvalidPropertyValueException) UnsupportedVersionNumberException(com.sun.messaging.naming.UnsupportedVersionNumberException) NameNotFoundException(com.sun.messaging.jmq.admin.objstore.NameNotFoundException) NoPermissionException(com.sun.messaging.jmq.admin.objstore.NoPermissionException) CommunicationException(com.sun.messaging.jmq.admin.objstore.CommunicationException) NameAlreadyExistsException(com.sun.messaging.jmq.admin.objstore.NameAlreadyExistsException)

Aggregations

AdministeredObject (com.sun.messaging.AdministeredObject)32 Properties (java.util.Properties)9 ObjStore (com.sun.messaging.jmq.admin.objstore.ObjStore)6 Enumeration (java.util.Enumeration)6 LabelledComponent (com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent)5 ObjAdminEvent (com.sun.messaging.jmq.admin.apps.console.event.ObjAdminEvent)4 InvalidPropertyException (com.sun.messaging.InvalidPropertyException)3 InvalidPropertyValueException (com.sun.messaging.InvalidPropertyValueException)3 ReadOnlyPropertyException (com.sun.messaging.ReadOnlyPropertyException)3 ObjStoreAttrs (com.sun.messaging.jmq.admin.objstore.ObjStoreAttrs)3 JComponent (javax.swing.JComponent)3 AuthenticationException (com.sun.messaging.jmq.admin.objstore.AuthenticationException)2 AuthenticationNotSupportedException (com.sun.messaging.jmq.admin.objstore.AuthenticationNotSupportedException)2 CommunicationException (com.sun.messaging.jmq.admin.objstore.CommunicationException)2 GeneralNamingException (com.sun.messaging.jmq.admin.objstore.GeneralNamingException)2 InitializationException (com.sun.messaging.jmq.admin.objstore.InitializationException)2 NameAlreadyExistsException (com.sun.messaging.jmq.admin.objstore.NameAlreadyExistsException)2 NameNotFoundException (com.sun.messaging.jmq.admin.objstore.NameNotFoundException)2 NoPermissionException (com.sun.messaging.jmq.admin.objstore.NoPermissionException)2 ObjStoreException (com.sun.messaging.jmq.admin.objstore.ObjStoreException)2