use of com.tibco.tibjms.admin.BridgeTarget in project iaf by ibissource.
the class GetTibcoQueues method qInfoToXml.
private XmlBuilder qInfoToXml(QueueInfo qInfo) {
XmlBuilder qInfoXml = new XmlBuilder("qInfo");
XmlBuilder qNameXml = new XmlBuilder("qName");
String qName = qInfo.getName();
qNameXml.setCdataValue(qName);
qInfoXml.addSubElement(qNameXml);
String qNameEncoded = XmlUtils.encodeURL(qName);
if (!qNameEncoded.equals(qName)) {
XmlBuilder qNameEncodedXml = new XmlBuilder("qNameEncoded");
qNameEncodedXml.setCdataValue(qNameEncoded);
qInfoXml.addSubElement(qNameEncodedXml);
}
XmlBuilder pendingMsgCountXml = new XmlBuilder("pendingMsgCount");
long pendingMsgCount = qInfo.getPendingMessageCount();
pendingMsgCountXml.setValue(Long.toString(pendingMsgCount));
qInfoXml.addSubElement(pendingMsgCountXml);
XmlBuilder pendingMsgSizeXml = new XmlBuilder("pendingMsgSize");
long pendingMsgSize = qInfo.getPendingMessageSize();
pendingMsgSizeXml.setValue(Misc.toFileSize(pendingMsgSize));
qInfoXml.addSubElement(pendingMsgSizeXml);
XmlBuilder receiverCountXml = new XmlBuilder("receiverCount");
int receiverCount = qInfo.getReceiverCount();
receiverCountXml.setValue(Integer.toString(receiverCount));
qInfoXml.addSubElement(receiverCountXml);
XmlBuilder inTotalMsgsXml = new XmlBuilder("inTotalMsgs");
long inTotalMsgs = qInfo.getInboundStatistics().getTotalMessages();
inTotalMsgsXml.setValue(Long.toString(inTotalMsgs));
qInfoXml.addSubElement(inTotalMsgsXml);
XmlBuilder outTotalMsgsXml = new XmlBuilder("outTotalMsgs");
long outTotalMsgs = qInfo.getOutboundStatistics().getTotalMessages();
outTotalMsgsXml.setValue(Long.toString(outTotalMsgs));
qInfoXml.addSubElement(outTotalMsgsXml);
XmlBuilder isStaticXml = new XmlBuilder("isStatic");
isStaticXml.setValue(qInfo.isStatic() ? "true" : "false");
qInfoXml.addSubElement(isStaticXml);
XmlBuilder prefetchXml = new XmlBuilder("prefetch");
int prefetch = qInfo.getPrefetch();
prefetchXml.setValue(Integer.toString(prefetch));
qInfoXml.addSubElement(prefetchXml);
XmlBuilder isBridgedXml = new XmlBuilder("isBridged");
BridgeTarget[] bta = qInfo.getBridgeTargets();
isBridgedXml.setValue(bta.length == 0 ? "false" : "true");
qInfoXml.addSubElement(isBridgedXml);
if (bta.length != 0) {
XmlBuilder bridgeTargetsXml = new XmlBuilder("bridgeTargets");
String btaString = null;
for (int j = 0; j < bta.length; j++) {
BridgeTarget bridgeTarget = bta[j];
if (btaString == null) {
btaString = bridgeTarget.toString();
} else {
btaString = btaString + "; " + bridgeTarget.toString();
}
}
bridgeTargetsXml.setCdataValue(btaString);
qInfoXml.addSubElement(bridgeTargetsXml);
}
return qInfoXml;
}
Aggregations