use of org.apache.sling.discovery.base.connectors.ping.TopologyConnectorClientInformation in project sling by apache.
the class TopologyWebConsolePlugin method printConfiguration.
public void printConfiguration(final PrintWriter pw) {
final TopologyView topology = this.currentView;
pw.println(TITLE);
pw.println("---------------------------------------");
pw.println();
if (topology == null) {
pw.println("No topology available yet!");
return;
}
pw.print("Topology");
if (!topology.isCurrent()) {
pw.print(" CHANGING! (the view is no longer current!)");
}
pw.println();
pw.println();
final Set<ClusterView> clusters = topology.getClusterViews();
final ClusterView myCluster = topology.getLocalInstance().getClusterView();
printCluster(pw, myCluster, myCluster);
for (Iterator<ClusterView> it = clusters.iterator(); it.hasNext(); ) {
ClusterView clusterView = it.next();
if (clusterView.equals(myCluster)) {
// skip - I already rendered that
continue;
}
printCluster(pw, clusterView, myCluster);
}
pw.println();
pw.println();
final Collection<CachedAnnouncement> incomingConnections = announcementRegistry.listLocalIncomingAnnouncements();
if (incomingConnections.size() > 0) {
pw.println("Incoming topology connectors");
pw.println("---------------------------------------");
for (final CachedAnnouncement incomingCachedAnnouncement : incomingConnections) {
Announcement incomingAnnouncement = incomingCachedAnnouncement.getAnnouncement();
pw.print("Owner Sling Id : ");
pw.print(incomingAnnouncement.getOwnerId());
pw.println();
if (incomingAnnouncement.getServerInfo() != null) {
pw.print("Server Info : ");
pw.print(incomingAnnouncement.getServerInfo());
pw.println();
}
pw.println("Last heartbeat received : " + beautifiedTimeDiff(incomingCachedAnnouncement.getLastPing()));
pw.println("Timeout : " + beautifiedDueTime(incomingCachedAnnouncement.getSecondsUntilTimeout()));
pw.println();
}
pw.println();
pw.println();
}
final Collection<TopologyConnectorClientInformation> outgoingConnections = connectorRegistry.listOutgoingConnectors();
if (outgoingConnections.size() > 0) {
pw.println("Outgoing topology connectors");
pw.println("---------------------------------------");
for (final TopologyConnectorClientInformation topologyConnectorClient : outgoingConnections) {
final String remoteSlingId = topologyConnectorClient.getRemoteSlingId();
final boolean autoStopped = topologyConnectorClient.isAutoStopped();
final boolean isConnected = topologyConnectorClient.isConnected() && remoteSlingId != null;
pw.print("Connector URL : ");
pw.print(topologyConnectorClient.getConnectorUrl());
pw.println();
if (autoStopped) {
pw.println("Conncted to Sling Id : auto-stopped");
pw.println("Connector status : auto-stopped due to local-loop");
} else if (isConnected && !topologyConnectorClient.representsLoop()) {
pw.print("Connected to Sling Id : ");
pw.println(remoteSlingId);
pw.println("Connector status : ok, in use");
} else if (topologyConnectorClient.representsLoop()) {
pw.print("Connected to Sling Id : ");
pw.println(remoteSlingId);
pw.println("Connector status : ok, unused (loop or duplicate): standby");
} else {
final int statusCode = topologyConnectorClient.getStatusCode();
final String statusDetails = topologyConnectorClient.getStatusDetails();
final String tooltipText;
switch(statusCode) {
case HttpServletResponse.SC_UNAUTHORIZED:
tooltipText = HttpServletResponse.SC_UNAUTHORIZED + ": possible setup issue of discovery.impl on target instance, or wrong URL";
break;
case HttpServletResponse.SC_NOT_FOUND:
tooltipText = HttpServletResponse.SC_NOT_FOUND + ": possible white list rejection by target instance";
break;
case -1:
tooltipText = "-1: check error log. possible connection refused.";
break;
default:
tooltipText = null;
}
pw.println("Connected to Sling Id : not connected");
pw.print("Connector status : not ok");
if (tooltipText != null) {
pw.print(" (");
pw.print(tooltipText);
pw.print(")");
}
pw.print(" (HTTP StatusCode: " + statusCode + ", " + statusDetails + ")");
pw.println();
pw.println("Last heartbeat sent : " + beautifiedTimeDiff(topologyConnectorClient.getLastPingSent()));
pw.println("Next heartbeat due : " + beautifiedDueTime(topologyConnectorClient.getNextPingDue()));
}
pw.println();
}
pw.println();
pw.println();
}
if (topologyLog.size() > 0) {
pw.println("Topology Change History");
pw.println("---------------------------------------");
for (final String aLogEntry : topologyLog) {
pw.println(aLogEntry);
}
pw.println();
pw.println();
}
if (propertyChangeLog.size() > 0) {
pw.println("Property Change History");
pw.println("---------------------------------------");
for (final String aLogEntry : propertyChangeLog) {
pw.println(aLogEntry);
}
pw.println();
}
pw.println("SyncTokenService History");
pw.println("---------------------------------------");
if (!config.useSyncTokenService()) {
pw.println("(disabled - useSyncTokenService flag is false)");
} else if (syncTokenService == null) {
pw.println("(no SyncTokenService available)");
} else {
ClusterSyncHistory clusterSyncHistory = syncTokenService.getClusterSyncHistory();
if (clusterSyncHistory == null) {
pw.println("(no history available)");
} else {
for (String syncHistoryEntry : clusterSyncHistory.getSyncHistory()) {
pw.println(syncHistoryEntry);
}
}
}
pw.println();
pw.println();
}
use of org.apache.sling.discovery.base.connectors.ping.TopologyConnectorClientInformation in project sling by apache.
the class TopologyWebConsolePlugin method listOutgoingTopologyConnectors.
/**
* Render the outgoing topology connectors - including the header-div and table
*/
private void listOutgoingTopologyConnectors(final PrintWriter pw) {
boolean odd = false;
pw.println("<div class=\"ui-widget-header ui-corner-top buttonGroup\" style=\"height: 15px;\">");
pw.println("<span style=\"float: left; margin-left: 1em;\">Outgoing topology connectors</span>");
pw.println("</div>");
pw.println("<table class=\"adapters nicetable ui-widget tablesorter\">");
pw.println("<thead>");
pw.println("<tr>");
pw.println("<th class=\"header ui-widget-header\">Connector url</th>");
pw.println("<th class=\"header ui-widget-header\">Connected to slingId</th>");
pw.println("<th class=\"header ui-widget-header\">Connector status</th>");
pw.println("<th class=\"header ui-widget-header\">Last heartbeat </th>");
pw.println("<th class=\"header ui-widget-header\">Next heartbeat </th>");
pw.println("<th class=\"header ui-widget-header\">Request encoding </th>");
pw.println("<th class=\"header ui-widget-header\">Response encoding </th>");
// pw.println("<th class=\"header ui-widget-header\">Fallback connector urls</th>");
pw.println("</tr>");
pw.println("</thead>");
pw.println("<tbody>");
Collection<TopologyConnectorClientInformation> outgoingConnections = connectorRegistry.listOutgoingConnectors();
for (Iterator<TopologyConnectorClientInformation> it = outgoingConnections.iterator(); it.hasNext(); ) {
TopologyConnectorClientInformation topologyConnectorClient = it.next();
final String oddEven = odd ? "odd" : "even";
odd = !odd;
final String remoteSlingId = topologyConnectorClient.getRemoteSlingId();
final boolean isConnected = topologyConnectorClient.isConnected() && remoteSlingId != null;
final boolean autoStopped = topologyConnectorClient.isAutoStopped();
final boolean representsLoop = topologyConnectorClient.representsLoop();
if (isConnected || autoStopped || representsLoop) {
pw.println("<tr class=\"" + oddEven + " ui-state-default\">");
} else {
pw.println("<tr class=\"" + oddEven + " ui-state-error\">");
}
pw.println("<td>" + topologyConnectorClient.getConnectorUrl().toString() + "</td>");
if (autoStopped) {
pw.println("<td><b>auto-stopped</b></td>");
pw.println("<td><b>auto-stopped due to local-loop</b></td>");
} else if (isConnected && !representsLoop) {
pw.println("<td>" + remoteSlingId + "</td>");
pw.println("<td>ok, in use</td>");
} else if (representsLoop) {
pw.println("<td>" + remoteSlingId + "</td>");
pw.println("<td>ok, unused (loop or duplicate): standby</td>");
} else {
final int statusCode = topologyConnectorClient.getStatusCode();
final String statusDetails = topologyConnectorClient.getStatusDetails();
final String tooltipText;
switch(statusCode) {
case HttpServletResponse.SC_UNAUTHORIZED:
tooltipText = HttpServletResponse.SC_UNAUTHORIZED + ": possible setup issue of discovery.impl on target instance, or wrong URL";
break;
case HttpServletResponse.SC_NOT_FOUND:
tooltipText = HttpServletResponse.SC_NOT_FOUND + ": possible white list rejection by target instance";
break;
case -1:
tooltipText = "-1: check error log. possible connection refused.";
break;
default:
tooltipText = null;
}
final String tooltip = tooltipText == null ? "" : (" title=\"" + tooltipText + "\"");
pw.println("<td><b>not connected</b></td>");
pw.println("<td" + tooltip + "><b>not ok (HTTP Status-Code: " + statusCode + ", " + statusDetails + ")</b></td>");
}
pw.println("<td>" + beautifiedTimeDiff(topologyConnectorClient.getLastPingSent()) + "</td>");
pw.println("<td>" + beautifiedDueTime(topologyConnectorClient.getNextPingDue()) + "</td>");
pw.println("<td>" + topologyConnectorClient.getLastRequestEncoding() + "</td>");
pw.println("<td>" + topologyConnectorClient.getLastResponseEncoding() + "</td>");
// //TODO fallback urls are not yet implemented!
// String fallbackConnectorUrls;
// List<String> urls = topologyConnectorClient
// .listFallbackConnectorUrls();
// if (urls == null || urls.size() == 0) {
// fallbackConnectorUrls = "n/a";
// } else {
// fallbackConnectorUrls = "";
// for (Iterator<String> it2 = urls.iterator(); it2.hasNext();) {
// String aFallbackConnectorUrl = it2.next();
// fallbackConnectorUrls = fallbackConnectorUrls
// + aFallbackConnectorUrl + "<br/>";
// }
// }
// pw.println("<td>" + fallbackConnectorUrls + "</td>");
}
pw.println("</tbody>");
pw.println("</table>");
}
use of org.apache.sling.discovery.base.connectors.ping.TopologyConnectorClientInformation in project sling by apache.
the class TopologyWebConsolePlugin method listOutgoingTopologyConnectors.
/**
* Render the outgoing topology connectors - including the header-div and table
*/
private void listOutgoingTopologyConnectors(final PrintWriter pw) {
boolean odd = false;
pw.println("<div class=\"ui-widget-header ui-corner-top buttonGroup\" style=\"height: 15px;\">");
pw.println("<span style=\"float: left; margin-left: 1em;\">Outgoing topology connectors</span>");
pw.println("</div>");
pw.println("<table class=\"adapters nicetable ui-widget tablesorter\">");
pw.println("<thead>");
pw.println("<tr>");
pw.println("<th class=\"header ui-widget-header\">Connector url</th>");
pw.println("<th class=\"header ui-widget-header\">Connected to slingId</th>");
pw.println("<th class=\"header ui-widget-header\">Connector status</th>");
pw.println("<th class=\"header ui-widget-header\">Last heartbeat </th>");
pw.println("<th class=\"header ui-widget-header\">Next heartbeat </th>");
pw.println("<th class=\"header ui-widget-header\">Request encoding </th>");
pw.println("<th class=\"header ui-widget-header\">Response encoding </th>");
// pw.println("<th class=\"header ui-widget-header\">Fallback connector urls</th>");
pw.println("</tr>");
pw.println("</thead>");
pw.println("<tbody>");
Collection<TopologyConnectorClientInformation> outgoingConnections = connectorRegistry.listOutgoingConnectors();
for (Iterator<TopologyConnectorClientInformation> it = outgoingConnections.iterator(); it.hasNext(); ) {
TopologyConnectorClientInformation topologyConnectorClient = it.next();
final String oddEven = odd ? "odd" : "even";
odd = !odd;
final String remoteSlingId = topologyConnectorClient.getRemoteSlingId();
final boolean isConnected = topologyConnectorClient.isConnected() && remoteSlingId != null;
final boolean autoStopped = topologyConnectorClient.isAutoStopped();
final boolean representsLoop = topologyConnectorClient.representsLoop();
if (isConnected || autoStopped || representsLoop) {
pw.println("<tr class=\"" + oddEven + " ui-state-default\">");
} else {
pw.println("<tr class=\"" + oddEven + " ui-state-error\">");
}
pw.println("<td>" + topologyConnectorClient.getConnectorUrl().toString() + "</td>");
if (autoStopped) {
pw.println("<td><b>auto-stopped</b></td>");
pw.println("<td><b>auto-stopped due to local-loop</b></td>");
} else if (isConnected && !representsLoop) {
pw.println("<td>" + remoteSlingId + "</td>");
pw.println("<td>ok, in use</td>");
} else if (representsLoop) {
pw.println("<td>" + remoteSlingId + "</td>");
pw.println("<td>ok, unused (loop or duplicate): standby</td>");
} else {
final int statusCode = topologyConnectorClient.getStatusCode();
final String statusDetails = topologyConnectorClient.getStatusDetails();
final String tooltipText;
switch(statusCode) {
case HttpServletResponse.SC_UNAUTHORIZED:
tooltipText = HttpServletResponse.SC_UNAUTHORIZED + ": possible setup issue of discovery.oak on target instance, or wrong URL";
break;
case HttpServletResponse.SC_NOT_FOUND:
tooltipText = HttpServletResponse.SC_NOT_FOUND + ": possible white list rejection by target instance";
break;
case -1:
tooltipText = "-1: check error log. possible connection refused.";
break;
default:
tooltipText = null;
}
final String tooltip = tooltipText == null ? "" : (" title=\"" + tooltipText + "\"");
pw.println("<td><b>not connected</b></td>");
pw.println("<td" + tooltip + "><b>not ok (HTTP Status-Code: " + statusCode + ", " + statusDetails + ")</b></td>");
}
pw.println("<td>" + beautifiedTimeDiff(topologyConnectorClient.getLastPingSent()) + "</td>");
pw.println("<td>" + beautifiedDueTime(topologyConnectorClient.getNextPingDue()) + "</td>");
pw.println("<td>" + topologyConnectorClient.getLastRequestEncoding() + "</td>");
pw.println("<td>" + topologyConnectorClient.getLastResponseEncoding() + "</td>");
// //TODO fallback urls are not yet implemented!
// String fallbackConnectorUrls;
// List<String> urls = topologyConnectorClient
// .listFallbackConnectorUrls();
// if (urls == null || urls.size() == 0) {
// fallbackConnectorUrls = "n/a";
// } else {
// fallbackConnectorUrls = "";
// for (Iterator<String> it2 = urls.iterator(); it2.hasNext();) {
// String aFallbackConnectorUrl = it2.next();
// fallbackConnectorUrls = fallbackConnectorUrls
// + aFallbackConnectorUrl + "<br/>";
// }
// }
// pw.println("<td>" + fallbackConnectorUrls + "</td>");
}
pw.println("</tbody>");
pw.println("</table>");
}
use of org.apache.sling.discovery.base.connectors.ping.TopologyConnectorClientInformation in project sling by apache.
the class TopologyWebConsolePlugin method printConfiguration.
public void printConfiguration(final PrintWriter pw) {
final TopologyView topology = this.currentView;
pw.println(TITLE);
pw.println("---------------------------------------");
pw.println();
if (topology == null) {
pw.println("No topology available yet!");
return;
}
pw.print("Topology");
if (!topology.isCurrent()) {
pw.print(" CHANGING! (the view is no longer current!)");
}
pw.println();
pw.println();
final Set<ClusterView> clusters = topology.getClusterViews();
final ClusterView myCluster = topology.getLocalInstance().getClusterView();
printCluster(pw, myCluster, myCluster);
for (Iterator<ClusterView> it = clusters.iterator(); it.hasNext(); ) {
ClusterView clusterView = it.next();
if (clusterView.equals(myCluster)) {
// skip - I already rendered that
continue;
}
printCluster(pw, clusterView, myCluster);
}
pw.println();
pw.println();
final Collection<CachedAnnouncement> incomingConnections = announcementRegistry.listLocalIncomingAnnouncements();
if (incomingConnections.size() > 0) {
pw.println("Incoming topology connectors");
pw.println("---------------------------------------");
for (final CachedAnnouncement incomingCachedAnnouncement : incomingConnections) {
Announcement incomingAnnouncement = incomingCachedAnnouncement.getAnnouncement();
pw.print("Owner Sling Id : ");
pw.print(incomingAnnouncement.getOwnerId());
pw.println();
if (incomingAnnouncement.getServerInfo() != null) {
pw.print("Server Info : ");
pw.print(incomingAnnouncement.getServerInfo());
pw.println();
}
pw.println("Last heartbeat received : " + beautifiedTimeDiff(incomingCachedAnnouncement.getLastPing()));
pw.println("Timeout : " + beautifiedDueTime(incomingCachedAnnouncement.getSecondsUntilTimeout()));
pw.println();
}
pw.println();
pw.println();
}
final Collection<TopologyConnectorClientInformation> outgoingConnections = connectorRegistry.listOutgoingConnectors();
if (outgoingConnections.size() > 0) {
pw.println("Outgoing topology connectors");
pw.println("---------------------------------------");
for (final TopologyConnectorClientInformation topologyConnectorClient : outgoingConnections) {
final String remoteSlingId = topologyConnectorClient.getRemoteSlingId();
final boolean autoStopped = topologyConnectorClient.isAutoStopped();
final boolean isConnected = topologyConnectorClient.isConnected() && remoteSlingId != null;
pw.print("Connector URL : ");
pw.print(topologyConnectorClient.getConnectorUrl());
pw.println();
if (autoStopped) {
pw.println("Conncted to Sling Id : auto-stopped");
pw.println("Connector status : auto-stopped due to local-loop");
} else if (isConnected && !topologyConnectorClient.representsLoop()) {
pw.print("Connected to Sling Id : ");
pw.println(remoteSlingId);
pw.println("Connector status : ok, in use");
} else if (topologyConnectorClient.representsLoop()) {
pw.print("Connected to Sling Id : ");
pw.println(remoteSlingId);
pw.println("Connector status : ok, unused (loop or duplicate): standby");
} else {
final int statusCode = topologyConnectorClient.getStatusCode();
final String statusDetails = topologyConnectorClient.getStatusDetails();
final String tooltipText;
switch(statusCode) {
case HttpServletResponse.SC_UNAUTHORIZED:
tooltipText = HttpServletResponse.SC_UNAUTHORIZED + ": possible setup issue of discovery.oak on target instance, or wrong URL";
break;
case HttpServletResponse.SC_NOT_FOUND:
tooltipText = HttpServletResponse.SC_NOT_FOUND + ": possible white list rejection by target instance";
break;
case -1:
tooltipText = "-1: check error log. possible connection refused.";
break;
default:
tooltipText = null;
}
pw.println("Connected to Sling Id : not connected");
pw.print("Connector status : not ok");
if (tooltipText != null) {
pw.print(" (");
pw.print(tooltipText);
pw.print(")");
}
pw.print(" (HTTP StatusCode: " + statusCode + ", " + statusDetails + ")");
pw.println();
pw.println("Last heartbeat sent : " + beautifiedTimeDiff(topologyConnectorClient.getLastPingSent()));
pw.println("Next heartbeat due : " + beautifiedDueTime(topologyConnectorClient.getNextPingDue()));
}
pw.println();
}
pw.println();
pw.println();
}
if (topologyLog.size() > 0) {
pw.println("Topology Change History");
pw.println("---------------------------------------");
for (final String aLogEntry : topologyLog) {
pw.println(aLogEntry);
}
pw.println();
pw.println();
}
if (propertyChangeLog.size() > 0) {
pw.println("Property Change History");
pw.println("---------------------------------------");
for (final String aLogEntry : propertyChangeLog) {
pw.println(aLogEntry);
}
pw.println();
}
pw.println("Oak Discovery-Lite Descriptor History");
pw.println("---------------------------------------");
updateDiscoveryLiteHistory();
for (String discoLiteHistoryEntry : discoveryLiteHistory) {
pw.println(discoLiteHistoryEntry);
}
pw.println();
pw.println();
pw.println("ClusterSyncService History");
pw.println("---------------------------------------");
for (String syncHistoryEntry : clusterSyncService.getSyncHistory()) {
pw.println(syncHistoryEntry);
}
pw.println();
pw.println();
}
Aggregations