HashMap<AttributeType,List<Attribute>> monitorOperationalAttrs =
new LinkedHashMap<AttributeType,List<Attribute>>();
// Add the "cn" attribute.
Attribute cnAttr = createAttribute(ATTR_COMMON_NAME, ATTR_COMMON_NAME,
"monitor");
ArrayList<Attribute> cnList = new ArrayList<Attribute>(1);
cnList.add(cnAttr);
monitorUserAttrs.put(cnAttr.getAttributeType(), cnList);
// Add the server product name.
Attribute productNameAttr = createAttribute(ATTR_PRODUCT_NAME,
ATTR_PRODUCT_NAME_LC,
DynamicConstants.PRODUCT_NAME);
ArrayList<Attribute> productNameList = new ArrayList<Attribute>(1);
productNameList.add(productNameAttr);
monitorUserAttrs.put(productNameAttr.getAttributeType(), productNameList);
// Add the vendor name.
Attribute vendorNameAttr = createAttribute(ATTR_VENDOR_NAME,
ATTR_VENDOR_NAME_LC,
SERVER_VENDOR_NAME);
ArrayList<Attribute> vendorNameList = new ArrayList<Attribute>(1);
vendorNameList.add(vendorNameAttr);
monitorUserAttrs.put(vendorNameAttr.getAttributeType(), vendorNameList);
// Add the vendor version.
Attribute versionAttr = createAttribute(ATTR_VENDOR_VERSION,
ATTR_VENDOR_VERSION_LC,
DirectoryServer.getVersionString());
ArrayList<Attribute> versionList = new ArrayList<Attribute>(1);
versionList.add(versionAttr);
monitorUserAttrs.put(versionAttr.getAttributeType(), versionList);
// Add the server startup time.
Attribute startTimeAttr =
createAttribute(ATTR_START_TIME, ATTR_START_TIME_LC,
DirectoryServer.getStartTimeUTC());
ArrayList<Attribute> startTimeList = new ArrayList<Attribute>(1);
startTimeList.add(startTimeAttr);
monitorUserAttrs.put(startTimeAttr.getAttributeType(), startTimeList);
// Add the current time.
Attribute currentTimeAttr =
createAttribute(ATTR_CURRENT_TIME, ATTR_CURRENT_TIME_LC,
TimeThread.getGMTTime());
ArrayList<Attribute> currentTimeList = new ArrayList<Attribute>(1);
currentTimeList.add(currentTimeAttr);
monitorUserAttrs.put(currentTimeAttr.getAttributeType(), currentTimeList);
// Add the uptime as a human-readable string.
long upSeconds =
((System.currentTimeMillis() - DirectoryServer.getStartTime()) / 1000);
long upDays = (upSeconds / 86400);
upSeconds %= 86400;
long upHours = (upSeconds / 3600);
upSeconds %= 3600;
long upMinutes = (upSeconds / 60);
upSeconds %= 60;
Message upTimeStr =
INFO_MONITOR_UPTIME.get(upDays, upHours, upMinutes, upSeconds);
Attribute upTimeAttr = createAttribute(ATTR_UP_TIME, ATTR_UP_TIME_LC,
upTimeStr.toString());
ArrayList<Attribute> upTimeList = new ArrayList<Attribute>(1);
upTimeList.add(upTimeAttr);
monitorUserAttrs.put(upTimeAttr.getAttributeType(), upTimeList);
// Add the number of connections currently established.
long currentConns = DirectoryServer.getCurrentConnections();
Attribute currentConnsAttr = createAttribute(ATTR_CURRENT_CONNS,
ATTR_CURRENT_CONNS_LC,
String.valueOf(currentConns));
ArrayList<Attribute> currentConnsList = new ArrayList<Attribute>(1);
currentConnsList.add(currentConnsAttr);
monitorUserAttrs.put(currentConnsAttr.getAttributeType(), currentConnsList);
// Add the maximum number of connections established at one time.
long maxConns = DirectoryServer.getMaxConnections();
Attribute maxConnsAttr = createAttribute(ATTR_MAX_CONNS,
ATTR_MAX_CONNS_LC,
String.valueOf(maxConns));
ArrayList<Attribute> maxConnsList = new ArrayList<Attribute>(1);
maxConnsList.add(maxConnsAttr);
monitorUserAttrs.put(maxConnsAttr.getAttributeType(), maxConnsList);
// Add the total number of connections the server has accepted.
long totalConns = DirectoryServer.getTotalConnections();
Attribute totalConnsAttr = createAttribute(ATTR_TOTAL_CONNS,
ATTR_TOTAL_CONNS_LC,
String.valueOf(totalConns));
ArrayList<Attribute> totalConnsList = new ArrayList<Attribute>(1);
totalConnsList.add(totalConnsAttr);
monitorUserAttrs.put(totalConnsAttr.getAttributeType(), totalConnsList);
// Add all the user-defined attributes.
for (Attribute a : userDefinedAttributes)
{