opends/src/ads/org/opends/admin/ads/ADSContext.java
@@ -1982,7 +1982,7 @@ String ben = backendName ; if (backendName == null) { ben = getBackendName() ; ben = getDefaultBackendName() ; } helper.createAdministrationSuffix(getDirContext(), ben, getDbName(), getImportTemp()); @@ -1995,10 +1995,14 @@ private void removeAdministrationSuffix() throws ADSContextException { ADSContextHelper helper = new ADSContextHelper(); helper.removeAdministrationSuffix(getDirContext(), getBackendName()); helper.removeAdministrationSuffix(getDirContext(), getDefaultBackendName()); } private static String getBackendName() /** * Returns the default backend name of the administration data. * @return the default backend name of the administration data. */ public static String getDefaultBackendName() { return "adminRoot"; } opends/src/guitools/org/opends/guitools/statuspanel/BaseDNDescriptor.java
@@ -27,7 +27,12 @@ package org.opends.guitools.statuspanel; import java.io.UnsupportedEncodingException; import java.util.logging.Level; import java.util.logging.Logger; import org.opends.quicksetup.util.Utils; import org.opends.server.util.StaticUtils; /** * This class is used to represent a Base DN / Replica and is aimed to be @@ -56,6 +61,10 @@ private int ageOfOldestMissingChange; private Type type; private String baseDn; private String unescapedDn; private static final Logger LOG = Logger.getLogger(BaseDNDescriptor.class.getName()); /** * Constructor for this class. @@ -73,6 +82,15 @@ this.type = type; this.ageOfOldestMissingChange = ageOfOldestMissingChange; this.missingChanges = missingChanges; try { this.unescapedDn = unescapeUtf8(baseDn); } catch (Throwable t) { this.unescapedDn = baseDn; LOG.log(Level.WARNING, "Error unescaping dn: "+baseDn, t); } } /** @@ -85,6 +103,17 @@ } /** * Return the String DN associated with the base DN with unescaped UTF-8 * characters. * @return the String DN associated with the base DN with unescaped UTF-8 * characters. */ public String getUnescapedDn() { return unescapedDn; } /** * {@inheritDoc} */ public boolean equals(Object v) @@ -191,4 +220,148 @@ { this.db = db; } private String unescapeUtf8(String v) throws UnsupportedEncodingException { byte[] stringBytes = v.getBytes("UTF-8"); byte[] decodedBytes = new byte[stringBytes.length]; int pos = 0; for (int i = 0; i < stringBytes.length; i++) { if ((stringBytes[i] == '\\') && (i + 2 < stringBytes.length) && StaticUtils.isHexDigit(stringBytes[i+1]) && StaticUtils.isHexDigit(stringBytes[i+2])) { // Convert hex-encoded UTF-8 to 16-bit chars. byte b; byte escapedByte1 = stringBytes[++i]; switch (escapedByte1) { case '0': b = (byte) 0x00; break; case '1': b = (byte) 0x10; break; case '2': b = (byte) 0x20; break; case '3': b = (byte) 0x30; break; case '4': b = (byte) 0x40; break; case '5': b = (byte) 0x50; break; case '6': b = (byte) 0x60; break; case '7': b = (byte) 0x70; break; case '8': b = (byte) 0x80; break; case '9': b = (byte) 0x90; break; case 'a': case 'A': b = (byte) 0xA0; break; case 'b': case 'B': b = (byte) 0xB0; break; case 'c': case 'C': b = (byte) 0xC0; break; case 'd': case 'D': b = (byte) 0xD0; break; case 'e': case 'E': b = (byte) 0xE0; break; case 'f': case 'F': b = (byte) 0xF0; break; default: throw new IllegalStateException("Unexpected byte: "+escapedByte1); } byte escapedByte2 = stringBytes[++i]; switch (escapedByte2) { case '0': break; case '1': b |= 0x01; break; case '2': b |= 0x02; break; case '3': b |= 0x03; break; case '4': b |= 0x04; break; case '5': b |= 0x05; break; case '6': b |= 0x06; break; case '7': b |= 0x07; break; case '8': b |= 0x08; break; case '9': b |= 0x09; break; case 'a': case 'A': b |= 0x0A; break; case 'b': case 'B': b |= 0x0B; break; case 'c': case 'C': b |= 0x0C; break; case 'd': case 'D': b |= 0x0D; break; case 'e': case 'E': b |= 0x0E; break; case 'f': case 'F': b |= 0x0F; break; default: throw new IllegalStateException("Unexpected byte: "+escapedByte2); } decodedBytes[pos++] = b; } else { decodedBytes[pos++] = stringBytes[i]; } } return new String(decodedBytes, 0, pos, "UTF-8"); } } opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromFile.java
@@ -37,6 +37,7 @@ import java.util.logging.Logger; import org.opends.server.core.DirectoryServer; import org.opends.admin.ads.ADSContext; import org.opends.messages.Message; import org.opends.server.util.LDIFException; import org.opends.server.util.LDIFReader; @@ -64,6 +65,8 @@ DirectoryServer.getObjectClass("ds-cfg-ldap-connection-handler", true); private final ObjectClass jmxConnectionHandlerOc = DirectoryServer.getObjectClass("ds-cfg-jmx-connection-handler", true); private final ObjectClass ldifConnectionHandlerOc = DirectoryServer.getObjectClass("ds-cfg-ldif-connection-handler", true); private final ObjectClass backendOc = DirectoryServer.getObjectClass("ds-cfg-backend", true); private final ObjectClass administrativeUserOc = @@ -411,7 +414,10 @@ "schema".equalsIgnoreCase(id) || "config".equalsIgnoreCase(id) || "monitor".equalsIgnoreCase(id) || "backup".equalsIgnoreCase(id); "backup".equalsIgnoreCase(id) || ADSContext.getDefaultBackendName().equalsIgnoreCase(id) || "ads-truststore".equalsIgnoreCase(id) || "replicationchanges".equalsIgnoreCase(id); } @@ -510,6 +516,22 @@ state = ListenerDescriptor.State.DISABLED; } } else if (entry.hasObjectClass(ldifConnectionHandlerOc)) { addressPort = INFO_UNKNOWN_LABEL.get().toString(); protocol = ListenerDescriptor.Protocol.LDIF; protocolDescription = INFO_LDIF_PROTOCOL_LABEL.get(); boolean enabled = "true".equalsIgnoreCase( getFirstValue(entry, "ds-cfg-connection-handler-enabled")); if (enabled) { state = ListenerDescriptor.State.ENABLED; } else { state = ListenerDescriptor.State.DISABLED; } } else { addressPort = INFO_UNKNOWN_LABEL.get().toString(); opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java
@@ -870,6 +870,22 @@ state = ListenerDescriptor.State.DISABLED; } } else if (hasObjectClass(entry, "ds-cfg-ldif-connection-handler")) { addressPort = INFO_UNKNOWN_LABEL.get().toString(); protocol = ListenerDescriptor.Protocol.LDIF; protocolDescription = INFO_LDIF_PROTOCOL_LABEL.get(); boolean enabled = "true".equalsIgnoreCase( getFirstValue(entry, "ds-cfg-connection-handler-enabled")); if (enabled) { state = ListenerDescriptor.State.ENABLED; } else { state = ListenerDescriptor.State.DISABLED; } } else { addressPort = INFO_UNKNOWN_LABEL.get().toString(); opends/src/guitools/org/opends/guitools/statuspanel/ListenerDescriptor.java
@@ -77,6 +77,10 @@ */ JMXS, /** * LDIF protocol. */ LDIF, /** * Other protocol. */ OTHER opends/src/guitools/org/opends/guitools/statuspanel/ServerStatusDescriptor.java
@@ -49,6 +49,18 @@ private Message errorMsg; private boolean isAuthenticated; private static String hostName = "locahost"; static { try { hostName = java.net.InetAddress.getLocalHost().getHostName(); } catch (Throwable t) { } }; /** * Enumeration indicating the status of the server. * @@ -359,4 +371,13 @@ { this.listeners = listeners; } /** * Returns the host name of the server. * @return the host name of the server. */ public String getHostname() { return hostName; } } opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
@@ -34,6 +34,7 @@ import java.net.URI; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; import java.util.TreeSet; import java.util.logging.Level; @@ -570,6 +571,7 @@ { INFO_SERVER_STATUS_LABEL.get(), INFO_CONNECTIONS_LABEL.get(), INFO_HOSTNAME_LABEL.get(), INFO_ADMINISTRATIVE_USERS_LABEL.get(), INFO_INSTALLATION_PATH_LABEL.get(), INFO_OPENDS_VERSION_LABEL.get(), @@ -589,6 +591,7 @@ title = INFO_SERVER_DETAILS_TITLE.get(); out.println(centerTitle(title)); writeHostnameContents(desc, labelWidth); writeAdministrativeUserContents(desc, labelWidth); writeInstallPathContents(desc, labelWidth); writeVersionContents(desc, labelWidth); @@ -691,9 +694,22 @@ } /** * Writes the host name contents. * @param desc the ServerStatusDescriptor object. * @param maxLabelWidth the maximum label width of the left label. */ private void writeHostnameContents(ServerStatusDescriptor desc, int maxLabelWidth) { writeLabelValue(INFO_HOSTNAME_LABEL.get(), Message.raw(desc.getHostname()), maxLabelWidth); } /** * Writes the administrative user contents displaying with what is specified * in the provided ServerStatusDescriptor object. * @param desc the ServerStatusDescriptor object. * @param maxLabelWidth the maximum label width of the left label. */ private void writeAdministrativeUserContents(ServerStatusDescriptor desc, int maxLabelWidth) @@ -748,6 +764,7 @@ * Writes the install path contents displaying with what is specified in the * provided ServerStatusDescriptor object. * @param desc the ServerStatusDescriptor object. * @param maxLabelWidth the maximum label width of the left label. */ private void writeInstallPathContents(ServerStatusDescriptor desc, int maxLabelWidth) @@ -778,6 +795,7 @@ * the provided ServerStatusDescriptor object. * This method must be called from the event thread. * @param desc the ServerStatusDescriptor object. * @param maxLabelWidth the maximum label width of the left label. */ private void writeJavaVersionContents(ServerStatusDescriptor desc, int maxLabelWidth) @@ -815,7 +833,16 @@ Message title = INFO_LISTENERS_TITLE.get(); out.println(centerTitle(title)); Set<ListenerDescriptor> listeners = desc.getListeners(); Set<ListenerDescriptor> allListeners = desc.getListeners(); Set<ListenerDescriptor> listeners = new LinkedHashSet<ListenerDescriptor>(); for (ListenerDescriptor listener: allListeners) { if (listener.getProtocol() != ListenerDescriptor.Protocol.LDIF) { listeners.add(listener); } } if (listeners.size() == 0) { @@ -839,7 +866,7 @@ else { ListenersTableModel listenersTableModel = new ListenersTableModel(); listenersTableModel.setData(desc.getListeners()); listenersTableModel.setData(listeners); writeTableModel(listenersTableModel, desc); } } opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java
@@ -329,7 +329,7 @@ BaseDNDescriptor desc = dataArray.get(row); if (col == 0) { v = desc.getDn(); v = desc.getUnescapedDn(); } else if (col == 1) { @@ -433,7 +433,7 @@ private int compareDns(BaseDNDescriptor desc1, BaseDNDescriptor desc2) { return desc1.getDn().compareTo(desc2.getDn()); return desc1.getUnescapedDn().compareTo(desc2.getUnescapedDn()); } private int compareRepl(BaseDNDescriptor desc1, BaseDNDescriptor desc2) opends/src/guitools/org/opends/guitools/statuspanel/ui/StatusPanelDialog.java
@@ -68,6 +68,7 @@ import org.opends.guitools.statuspanel.BaseDNDescriptor; import org.opends.guitools.statuspanel.DatabaseDescriptor; import org.opends.guitools.statuspanel.ListenerDescriptor; import org.opends.guitools.statuspanel.ServerStatusDescriptor; import org.opends.guitools.statuspanel.event.StatusPanelButtonListener; import org.opends.quicksetup.event.MinimumSizeComponentListener; @@ -99,6 +100,7 @@ private JLabel lServerStatus; private JLabel lCurrentConnections; private JLabel lHostname; private JLabel lAdministrativeUsers; private JLabel lInstallPath; private JLabel lOpenDSVersion; @@ -189,6 +191,8 @@ updateCurrentConnectionContents(desc); updateHostnameContents(desc); updateAdministrativeUserContents(desc); updateInstallPathContents(desc); @@ -645,6 +649,9 @@ JLabel[] leftLabels = { UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, INFO_HOSTNAME_LABEL.get(), UIFactory.TextStyle.PRIMARY_FIELD_VALID), UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, INFO_ADMINISTRATIVE_USERS_LABEL.get(), UIFactory.TextStyle.PRIMARY_FIELD_VALID), UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, @@ -658,6 +665,9 @@ UIFactory.TextStyle.PRIMARY_FIELD_VALID) }; lHostname = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, NOT_AVAILABLE, UIFactory.TextStyle.READ_ONLY); lAdministrativeUsers = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, NOT_AVAILABLE, UIFactory.TextStyle.READ_ONLY); lInstallPath = UIFactory.makeJLabel(UIFactory.IconType.NO_ICON, @@ -669,7 +679,8 @@ JLabel[] rightLabels = { lAdministrativeUsers, lInstallPath, lOpenDSVersion, lJavaVersion lHostname, lAdministrativeUsers, lInstallPath, lOpenDSVersion, lJavaVersion }; @@ -942,7 +953,18 @@ } /** * Updates the admiinistrative user contents displaying with what is specified * Updates the host name contents displaying with what is specified * in the provided ServerStatusDescriptor object. * This method must be called from the event thread. * @param desc the ServerStatusDescriptor object. */ private void updateHostnameContents(ServerStatusDescriptor desc) { lHostname.setText(desc.getHostname()); } /** * Updates the administrative user contents displaying with what is specified * in the provided ServerStatusDescriptor object. * This method must be called from the event thread. * @param desc the ServerStatusDescriptor object. @@ -1049,7 +1071,17 @@ */ private void updateListenerContents(ServerStatusDescriptor desc) { listenersTableModel.setData(desc.getListeners()); Set<ListenerDescriptor> allListeners = desc.getListeners(); Set<ListenerDescriptor> listeners = new LinkedHashSet<ListenerDescriptor>(); for (ListenerDescriptor listener: allListeners) { if (listener.getProtocol() != ListenerDescriptor.Protocol.LDIF) { listeners.add(listener); } } listenersTableModel.setData(listeners); if (listenersTableModel.getRowCount() == 0) { @@ -1092,6 +1124,7 @@ { Set<BaseDNDescriptor> replicas = new HashSet<BaseDNDescriptor>(); Set<DatabaseDescriptor> dbs = desc.getDatabases(); for (DatabaseDescriptor db: dbs) { replicas.addAll(db.getBaseDns()); opends/src/messages/messages/admin_tool.properties
@@ -47,6 +47,7 @@ # word separator # INFO_ADDRESS_PORT_COLUMN=Address:Port INFO_HOSTNAME_LABEL=Host Name: INFO_ADMINISTRATIVE_USERS_LABEL=Administrative Users: INFO_AGE_OF_OLDEST_MISSING_CHANGE_COLUMN=<html>Age of Oldest<br>Missing \ Change<br>(hh:mm:ss) @@ -220,7 +221,8 @@ INFO_JMX_SECURE_PROTOCOL_LABEL=JMX (Secure) INFO_LDAP_PROTOCOL_LABEL=LDAP INFO_LDAPS_PROTOCOL_LABEL=LDAPS INFO_LISTENERS_TITLE=Listener Ports INFO_LDIF_PROTOCOL_LABEL=LDIF INFO_LISTENERS_TITLE=Connection Handlers INFO_LOGIN_CANCEL_BUTTON_TOOLTIP=Close Login Dialog INFO_LOGIN_DIALOG_MSG=You must provide an Administrative User DN and password \ to retrieve monitoring information.