opends/src/ads/org/opends/admin/ads/ReplicaDescriptor.java
@@ -22,7 +22,7 @@ * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. * Portions Copyright 2007-2008 Sun Microsystems, Inc. */ package org.opends.admin.ads; @@ -42,7 +42,7 @@ private Set<String> replicationServers = new HashSet<String>(); private int replicationId = -1; private int missingChanges = -1; private int ageOfOldestMissingChange = -1; private long ageOfOldestMissingChange = -1; /** * Returns the number of entries contained in the replica. @@ -167,7 +167,7 @@ * Returns the age of the oldest missing change. * @return the age of the oldest missing change. */ public int getAgeOfOldestMissingChange() public long getAgeOfOldestMissingChange() { return ageOfOldestMissingChange; } @@ -176,7 +176,7 @@ * Sets the age of the oldest missing change. * @param ageOfOldestMissingChange the age of the oldest missing change. */ public void setAgeOfOldestMissingChange(int ageOfOldestMissingChange) public void setAgeOfOldestMissingChange(long ageOfOldestMissingChange) { this.ageOfOldestMissingChange = ageOfOldestMissingChange; } opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
@@ -22,7 +22,7 @@ * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. * Portions Copyright 2007-2008 Sun Microsystems, Inc. */ package org.opends.admin.ads; @@ -877,9 +877,10 @@ ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); ctls.setReturningAttributes( new String[] { "approximate-delay", "waiting-changes", "base-dn" "approx-older-change-not-synchronized-millis", "missing-changes", "base-dn", "server-id" }); filter = "(approximate-delay=*)"; filter = "(missing-changes=*)"; jndiName = new LdapName("cn=monitor"); @@ -894,16 +895,26 @@ SearchResult sr = (SearchResult)monitorEntries.next(); String dn = getFirstValue(sr, "base-dn"); int replicaId = -1; try { replicaId = new Integer(getFirstValue(sr, "server-id")); } catch (Throwable t) { } for (ReplicaDescriptor replica: desc.getReplicas()) { if (Utils.areDnsEqual(dn, replica.getSuffix().getDN()) && replica.isReplicated()) replica.isReplicated() && (replica.getReplicationId() == replicaId)) { try { replica.setAgeOfOldestMissingChange( new Integer(getFirstValue(sr, "approximate-delay"))); new Long(getFirstValue(sr, "approx-older-change-not-synchronized-millis"))); } catch (Throwable t) { @@ -911,7 +922,7 @@ try { replica.setMissingChanges( new Integer(getFirstValue(sr, "waiting-changes"))); new Integer(getFirstValue(sr, "missing-changes"))); } catch (Throwable t) { opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
@@ -41,6 +41,7 @@ import java.net.InetAddress; import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; @@ -5020,10 +5021,11 @@ } break; case AGE_OF_OLDEST_MISSING_CHANGE: int ageOfOldestMissingChange = replica.getAgeOfOldestMissingChange(); if (ageOfOldestMissingChange >= 0) long ageOfOldestMissingChange = replica.getAgeOfOldestMissingChange(); if (ageOfOldestMissingChange > 0) { v = Message.raw(String.valueOf(ageOfOldestMissingChange)); Date date = new Date(ageOfOldestMissingChange); v = Message.raw(date.toString()); } else { opends/src/guitools/org/opends/guitools/statuspanel/BaseDNDescriptor.java
@@ -22,7 +22,7 @@ * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. * Portions Copyright 2007-2008 Sun Microsystems, Inc. */ package org.opends.guitools.statuspanel; @@ -59,7 +59,7 @@ private int nEntries; private int missingChanges; private DatabaseDescriptor db; private int ageOfOldestMissingChange; private long ageOfOldestMissingChange; private Type type; private String baseDn; private String unescapedDn; @@ -77,7 +77,7 @@ * @param missingChanges the number of missing changes. */ public BaseDNDescriptor(Type type, String baseDn, DatabaseDescriptor db, int nEntries, int ageOfOldestMissingChange, int missingChanges) int nEntries, long ageOfOldestMissingChange, int missingChanges) { this.baseDn = baseDn; this.db = db; @@ -191,7 +191,7 @@ * @return the age of the oldest missing change in seconds in the * replication topology for this base DN. */ public int getAgeOfOldestMissingChange() public long getAgeOfOldestMissingChange() { return ageOfOldestMissingChange; } opends/src/guitools/org/opends/guitools/statuspanel/ConfigFromLDAP.java
@@ -22,11 +22,12 @@ * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. * Portions Copyright 2007-2008 Sun Microsystems, Inc. */ package org.opends.guitools.statuspanel; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; @@ -65,11 +66,11 @@ private HashSet<String> administrativeUsers = new HashSet<String>(); private Message errorMessage; private boolean replicationConfigured = false; private HashSet<String> replicatedSuffixes = new HashSet<String>(); private ArrayList<String> replicatedSuffixes = new ArrayList<String>(); private HashMap<String, Integer> hmMissingChanges = new HashMap<String, Integer>(); private HashMap<String, Integer> hmAgeOfOldestMissingChanges = new HashMap<String, Integer>(); private HashMap<String, Long> hmAgeOfOldestMissingChanges = new HashMap<String, Long>(); private String dn; private String pwd; @@ -504,13 +505,14 @@ ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); ctls.setReturningAttributes( new String[] { "ds-cfg-base-dn" "ds-cfg-base-dn", "ds-cfg-server-id" }); filter = "(objectclass=ds-cfg-replication-domain)"; jndiName = new LdapName( "cn=Multimaster Synchronization,cn=Synchronization Providers,cn=config"); ArrayList<String> replicaIds = new ArrayList<String>(); try { NamingEnumeration syncProviders = ctx.search(jndiName, filter, ctls); @@ -519,7 +521,8 @@ { SearchResult sr = (SearchResult)syncProviders.next(); replicatedSuffixes.addAll(getValues(sr, "ds-cfg-base-dn")); replicatedSuffixes.add(getFirstValue(sr, "ds-cfg-base-dn")); replicaIds.add(getFirstValue(sr, "ds-cfg-server-id")); } } catch (NameNotFoundException nse) @@ -530,9 +533,10 @@ ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); ctls.setReturningAttributes( new String[] { "approximate-delay", "waiting-changes", "base-dn" "approx-older-change-not-synchronized-millis", "missing-changes", "base-dn", "server-id" }); filter = "(approximate-delay=*)"; filter = "(missing-changes=*)"; jndiName = new LdapName("cn=monitor"); @@ -547,16 +551,19 @@ SearchResult sr = (SearchResult)monitorEntries.next(); String dn = getFirstValue(sr, "base-dn"); String replicaId = getFirstValue(sr, "server-id"); for (String baseDn: replicatedSuffixes) for (int i=0; i<replicatedSuffixes.size(); i++) { if (Utils.areDnsEqual(dn, baseDn)) String baseDn = replicatedSuffixes.get(i); String id = replicaIds.get(i); if (Utils.areDnsEqual(dn, baseDn) && id.equals(replicaId)) { try { hmAgeOfOldestMissingChanges.put(baseDn, new Integer(getFirstValue(sr, "approximate-delay"))); new Long(getFirstValue(sr, "approx-older-change-not-synchronized-millis"))); } catch (Throwable t) { @@ -564,7 +571,7 @@ try { hmMissingChanges.put(baseDn, new Integer(getFirstValue(sr, "waiting-changes"))); new Integer(getFirstValue(sr, "missing-changes"))); } catch (Throwable t) { @@ -762,7 +769,7 @@ { BaseDNDescriptor.Type type; int missingChanges = -1; int ageOfOldestMissingChange = -1; long ageOfOldestMissingChange = -1; String mapSuffixDn = null; boolean replicated = false; @@ -783,11 +790,11 @@ type = BaseDNDescriptor.Type.REPLICATED; Integer missing = hmMissingChanges.get(mapSuffixDn); Integer age = hmAgeOfOldestMissingChanges.get(mapSuffixDn); Long age = hmAgeOfOldestMissingChanges.get(mapSuffixDn); if (age != null) { ageOfOldestMissingChange = age.intValue(); ageOfOldestMissingChange = age.longValue(); } if (missing != null) opends/src/guitools/org/opends/guitools/statuspanel/ui/DatabasesTableModel.java
@@ -22,13 +22,14 @@ * CDDL HEADER END * * * Portions Copyright 2007 Sun Microsystems, Inc. * Portions Copyright 2007-2008 Sun Microsystems, Inc. */ package org.opends.guitools.statuspanel.ui; import java.util.ArrayList; import java.util.Comparator; import java.util.Date; import java.util.HashSet; import java.util.Set; import java.util.TreeSet; @@ -431,6 +432,19 @@ return -1; } private int compareLongs(long n1, long n2) { if (n1 == n2) { return 0; } if (n1 > n2) { return 1; } return -1; } private int compareDns(BaseDNDescriptor desc1, BaseDNDescriptor desc2) { return desc1.getUnescapedDn().compareTo(desc2.getUnescapedDn()); @@ -452,7 +466,7 @@ private int compareAgeOfOldestMissingChange(BaseDNDescriptor desc1, BaseDNDescriptor desc2) { return compareIntegers(desc1.getAgeOfOldestMissingChange(), return compareLongs(desc1.getAgeOfOldestMissingChange(), desc2.getAgeOfOldestMissingChange()); } @@ -504,27 +518,16 @@ Object v; if (rep.getType() == BaseDNDescriptor.Type.REPLICATED) { int age = rep.getAgeOfOldestMissingChange(); if (age >= 0) long age = rep.getAgeOfOldestMissingChange(); if (age > 0) { int remainingSeconds = age % 60; int minutes = age / 60; int remainingMinutes = minutes % 60; int hours = minutes / 60; String sMinutes = (remainingMinutes>=10)? String.valueOf(remainingMinutes) : "0"+remainingMinutes; String sSeconds = (remainingSeconds>=10)? String.valueOf(remainingSeconds) : "0"+remainingSeconds; String sHours = (hours>=10)?String.valueOf(hours):"0"+hours; v = sHours+":"+sMinutes+":"+sSeconds; Date date = new Date(age); v = date.toString(); } else { v = new Integer(age); // Not available v = new Integer(-1); } } else opends/src/messages/messages/admin_tool.properties
@@ -51,9 +51,8 @@ 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) INFO_AGE_OF_OLDEST_MISSING_CHANGE_COLUMN_CLI=Age of Oldest Missing Change \ (hh:mm:ss) Change INFO_AGE_OF_OLDEST_MISSING_CHANGE_COLUMN_CLI=Age of Oldest Missing Change INFO_AUTHENTICATE_BUTTON_LABEL=Authenticate INFO_AUTHENTICATE_STATUS_PANEL_BUTTON_TOOLTIP=Authenticate as an \ administrative user to view all monitoring information @@ -739,8 +738,8 @@ INFO_REPLICATION_STATUS_HEADER_SECURE=Security (4) INFO_REPLICATION_STATUS_REPLICATED_LEGEND=[1] The number of changes that are \ still missing on this server (and that have been at least applied to one of \ the other servers).%n[2] Age of oldest missing change: the age (in \ seconds) of the oldest change that has not arrived to this server.%n[3] The \ the other servers).%n[2] Age of oldest missing change: the date where the \ oldest change that has not arrived to this server was generated.%n[3] The \ port used to communicate between the servers whose contents are being \ replicated.%n[4] Whether the replication communication through the \ replication port is encrypted or not. opends/src/server/org/opends/server/replication/server/LightweightServerHandler.java
@@ -257,6 +257,9 @@ Date date = new Date(olderUpdateTime); attributes.add(new Attribute("approx-older-change-not-synchronized", date.toString())); attributes.add( new Attribute("approx-older-change-not-synchronized-millis", String.valueOf(olderUpdateTime))); } } catch(Exception e)