<%-- - Copyright (C) 2005-2008 Jive Software. All rights reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. --%> <%@ page import="org.jivesoftware.openfire.SessionManager" errorPage="error.jsp" %> <%@ page import="org.jivesoftware.openfire.clearspace.ClearspaceManager" %> <%@ page import="org.jivesoftware.openfire.session.ComponentSession" %> <%@ page import="org.jivesoftware.util.JiveGlobals" %> <%@ page import="java.text.NumberFormat" %> <%@ page import="java.util.Collection" %> <%@ page import="java.util.Date" %> <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %> <%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %> <% webManager.init(request, response, session, application, out ); %> <% boolean test = request.getParameter("test") != null; boolean configure = request.getParameter("configure") != null; String testPage = "setup/setup-clearspace-integration_test.jsp"; ClearspaceManager manager = ClearspaceManager.getInstance(); boolean configured = false; // Checks if CS and OF are currently connected boolean connectedCS = manager.isClearspaceConnected(); boolean connectedOF = manager.isOpenfireConnected(); // If OF is connected to CS and there is a configure action, configure clearspace if (connectedOF && configure) { configured = manager.configClearspace(); } // This fields will hold the status information of the connection Date creationDate = null; Date lastActivity = null; int numServerPackets = 0; int numClientPackets = 0; int numComponents = 0; Collection componentSessions = null; // If connected collects stats from Clearspace sessions if (connectedCS && connectedOF) { SessionManager sessionManager = webManager.getSessionManager(); componentSessions = sessionManager.getComponentSessions(); for (ComponentSession cs : componentSessions) { // All Clearspace sessions start with "clearspace" if (cs.getAddress().getDomain().startsWith("clearspace")) { if (creationDate == null || cs.getCreationDate().before(creationDate)) { creationDate = cs.getCreationDate(); } if (lastActivity == null || cs.getLastActiveDate().after(lastActivity)) { lastActivity = cs.getLastActiveDate(); } numClientPackets += cs.getNumClientPackets(); numServerPackets += cs.getNumServerPackets(); numComponents++; break; } } } // Number dateFormatter for all numbers on this page: NumberFormat numFormatter = NumberFormat.getNumberInstance(); %> <fmt:message key="clearspace.status.title"/> <% if (test) { %> " style="display:none;"> <% } %> <% if (configure && !configured) { %>
<% } %> <% if (connectedCS && connectedOF) { %>

<% if (numComponents > 1) { %> <% } %> <% boolean first = true; for (ComponentSession cs : componentSessions) { if (first) { first = false; %> <% } else { %> <% } %>
<%= numFormatter.format(numComponents) %>
<%= JiveGlobals.formatDateTime(creationDate) %>
<%= JiveGlobals.formatDateTime(lastActivity) %>
<%= numFormatter.format(numClientPackets) %>/<%= numFormatter.format(numServerPackets) %>
<%= cs.getHostAddress() %> / <%= cs.getHostName() %>
<%= cs.getHostAddress() %> / <%= cs.getHostName() %>
<% } %> <% } else { %> <% if (!connectedCS && !connectedOF) { %>

" %>" /> " %>" /> <% } else if (!connectedCS) { %>

" %>" /> " %>" /> <% } else if (!connectedOF) { %>

" %>" /> " %>" /> <% } %>

" id="jive-clearspace-test" border="0"> " id="jive-clearspace-configure" border="0">
<% } %>