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;
}
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"));
}
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));
}
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;
}
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());
}
Aggregations