Search in sources :

Example 1 with Version

use of com.sun.messaging.jmq.Version in project openmq by eclipse-ee4j.

the class GetBrokerPropsHandler method handle.

/**
 * Handle the incomming administration message.
 *
 * @param con The Connection the message came in on.
 * @param cmd_msg The administration message
 * @param cmd_props The properties from the administration message
 */
@Override
public boolean handle(IMQConnection con, Packet cmd_msg, Hashtable cmd_props) {
    int status = Status.OK;
    String emsg = null;
    if (DEBUG) {
        logger.log(Logger.DEBUG, this.getClass().getName() + ": " + cmd_props);
    }
    /*
         * We need to create a copy of the broker configuration because the protocol requires we send a serialized
         * java.util.Properties object. If we just serialize (or clone the serialize) BrokerConfig it will end up being a
         * serialized BrokerConfig object, not a serialized Properties object (even if we cast). So we do this rather expensive
         * operation.
         */
    Properties brokerProps = Globals.getConfig().toProperties();
    /* Add the version properties */
    Version version = Globals.getVersion();
    brokerProps.putAll(version.getProps());
    brokerProps.put(Globals.IMQ + ".system.current_count", String.valueOf(DL.totalCount()));
    brokerProps.put(Globals.IMQ + ".system.current_size", String.valueOf(DL.totalBytes()));
    Queue[] qs = DL.getDMQ(null);
    // PART
    Queue dmq = qs[0];
    brokerProps.put(Globals.IMQ + ".dmq.current_count", String.valueOf(dmq.size()));
    brokerProps.put(Globals.IMQ + ".dmq.current_size", String.valueOf(dmq.byteSize()));
    String val = brokerProps.getProperty(DL.USE_DMQ_STR);
    if (val == null || val.trim().equals("")) {
        brokerProps.put(DL.USE_DMQ_STR, String.valueOf(DL.defaultUseDMQ));
    }
    if (Globals.getBrokerID() != null) {
        brokerProps.put(Globals.IMQ + ".brokerid", Globals.getBrokerID());
    }
    if (Globals.getClusterID() != null) {
        brokerProps.put(Globals.IMQ + ".cluster.clusterid", Globals.getClusterID());
    }
    if (DL.isPartitionMode() && DL.isPartitionMigratable()) {
        brokerProps.put(Globals.IMQ + ".partitionmigratable", "true");
    }
    brokerProps.put(Globals.IMQ + ".embedded", Boolean.toString(Broker.isInProcess()));
    if (Globals.getHAEnabled()) {
        brokerProps.put(ClusterManager.CONFIG_SERVER, "");
    } else if (Globals.useSharedConfigRecord()) {
        String shareccVendor = null;
        try {
            shareccVendor = Globals.getStore().getShareConfigChangeStore().getVendorPropertySetting();
        } catch (BrokerException e) {
            logger.logStack(Logger.WARNING, e.getMessage(), e);
        }
        brokerProps.put(ClusterManager.CONFIG_SERVER, "[" + Globals.NO_MASTERBROKER_PROP + "=" + brokerProps.get(Globals.NO_MASTERBROKER_PROP) + ", " + shareccVendor + "]");
    }
    /**
     * OK, use the cluster object to get active and normal brokers
     */
    ClusterManager cfg = Globals.getClusterManager();
    // calculate url
    String list = null;
    Iterator itr = cfg.getConfigBrokers();
    // OK we want to remove any duplicates
    Set s = new HashSet();
    while (itr.hasNext()) {
        ClusteredBroker cb = (ClusteredBroker) itr.next();
        s.add(cb.getBrokerURL().toString());
    }
    itr = s.iterator();
    while (itr.hasNext()) {
        if (list == null) {
            list = itr.next().toString();
        } else {
            list += "," + itr.next().toString();
        }
    }
    if (list == null) {
        list = "";
    }
    brokerProps.put("imq.cluster.brokerlist", list);
    list = null;
    s = new HashSet();
    itr = cfg.getActiveBrokers();
    while (itr.hasNext()) {
        ClusteredBroker cb = (ClusteredBroker) itr.next();
        s.add(cb.getBrokerURL().toString());
    }
    itr = s.iterator();
    while (itr.hasNext()) {
        if (list == null) {
            list = itr.next().toString();
        } else {
            list += "," + itr.next().toString();
        }
    }
    if (list == null) {
        list = "";
    }
    brokerProps.put("imq.cluster.brokerlist.active", list);
    // Send reply
    Packet reply = new Packet(con.useDirectBuffers());
    reply.setPacketType(PacketType.OBJECT_MESSAGE);
    setProperties(reply, MessageType.GET_BROKER_PROPS_REPLY, status, emsg);
    setBodyObject(reply, brokerProps);
    parent.sendReply(con, cmd_msg, reply);
    return true;
}
Also used : BrokerException(com.sun.messaging.jmq.jmsserver.util.BrokerException) Set(java.util.Set) HashSet(java.util.HashSet) Properties(java.util.Properties) Version(com.sun.messaging.jmq.Version) Iterator(java.util.Iterator) Queue(com.sun.messaging.jmq.jmsserver.core.Queue) HashSet(java.util.HashSet)

Example 2 with Version

use of com.sun.messaging.jmq.Version in project openmq by eclipse-ee4j.

the class AdminConsole method printVersion.

private static void printVersion() {
    Version version = Globals.getVersion();
    Globals.stdOutPrintln(version.getVersion());
    Globals.stdOutPrintln(ar.getString(ar.I_JAVA_VERSION) + System.getProperty("java.version") + " " + System.getProperty("java.vendor") + " " + System.getProperty("java.home"));
    Globals.stdOutPrintln(ar.getString(ar.I_JAVA_CLASSPATH) + System.getProperty("java.class.path"));
}
Also used : Version(com.sun.messaging.jmq.Version)

Example 3 with Version

use of com.sun.messaging.jmq.Version in project openmq by eclipse-ee4j.

the class AdminConsole method printBanner.

private static void printBanner() {
    Version version = new Version(false);
    Globals.stdOutPrintln(version.getBanner(false));
}
Also used : Version(com.sun.messaging.jmq.Version)

Example 4 with Version

use of com.sun.messaging.jmq.Version in project openmq by eclipse-ee4j.

the class ServiceConfig method initProps.

private void initProps() {
    if (!propsStale) {
        return;
    }
    brokerProps = Globals.getConfig().toProperties();
    Version version = Globals.getVersion();
    brokerProps.putAll(version.getProps());
    propsStale = false;
}
Also used : Version(com.sun.messaging.jmq.Version)

Example 5 with Version

use of com.sun.messaging.jmq.Version in project openmq by eclipse-ee4j.

the class BrokerConfig method initProps.

private void initProps() {
    brokerProps = Globals.getConfig().toProperties();
    Version version = Globals.getVersion();
    brokerProps.putAll(version.getProps());
}
Also used : Version(com.sun.messaging.jmq.Version)

Aggregations

Version (com.sun.messaging.jmq.Version)17 LabelValuePanel (com.sun.messaging.jmq.admin.apps.console.util.LabelValuePanel)1 LabelledComponent (com.sun.messaging.jmq.admin.apps.console.util.LabelledComponent)1 Queue (com.sun.messaging.jmq.jmsserver.core.Queue)1 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)1 JMSException (jakarta.jms.JMSException)1 ResourceAdapterInternalException (jakarta.resource.spi.ResourceAdapterInternalException)1 Color (java.awt.Color)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Properties (java.util.Properties)1 Set (java.util.Set)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSeparator (javax.swing.JSeparator)1 JTextArea (javax.swing.JTextArea)1