<%-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You 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. --%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <%@ taglib uri="/WEB-INF/CommonMsg.tld" prefix="CommonMsg"%> <%@ page import="java.util.ArrayList" %> <%@ page import="java.util.HashMap" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Set" %> <%@ page import="java.util.TreeMap" %> <%@ page import="javax.management.InstanceNotFoundException" %> <%@ page import="org.apache.geronimo.monitoring.console.MRCConnector" %> <%@ page import="org.apache.geronimo.monitoring.console.data.Node" %> <% MRCConnector mrc = null; boolean isOnline = true; Integer collecting = 0; Long snapshotDuration = new Long(0); Node node = (Node) request.getAttribute("node"); if (node != null) { TreeMap availableBeansMap = null; TreeMap trackedBeansMap = null; long retention = -1; try { mrc = new MRCConnector(node); availableBeansMap = mrc.getFreeStatisticsProviderBeanNamesMap(); retention = mrc.getSnapshotRetention(); trackedBeansMap = mrc.getTrackedBeansMap(); snapshotDuration = (Long)mrc.getSnapshotDuration()/1000/60; collecting = mrc.isSnapshotRunning(); } catch (Exception e) { isOnline = false; collecting = 0; } %>

<%=node.getName()%>

<%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%----%> <%if (isOnline) {%> <%} else { %> <%} %> <%if (isOnline) {%> <%} else { %> <%} %>
:   <%if (isOnline) {%> <%} else {%> <%} %>
:   <%if (isOnline && collecting == 1) {%> <%} else {%> <%} %>
Added: <%=added%>
Modified: <%=modified%>
Last seen: <%=last_seen%>
/:   <%=node.getHost()%>
:  <%=snapshotDuration%>
:  <%=retention%>
<% if (isOnline) { Integer counter = 0; for (Iterator it = trackedBeansMap.keySet().iterator(); it.hasNext();) { String prettyBean = it.next().toString(); Set statAttributes = mrc.getStatAttributesOnMBean(trackedBeansMap.get(prettyBean)); boolean started = true; HashMap beanStats = null; try { beanStats = mrc.getStats(trackedBeansMap.get(prettyBean)); } catch (InstanceNotFoundException infe) { //The bean is not available started = false; } if ((counter%3) == 0) { %> <% } %> <% if ((counter%3) == 2) { %> <% } counter = counter + 1; } %>
<% if (started) { for (Iterator itt = statAttributes.iterator(); itt.hasNext();) { String dataName = itt.next().toString(); %> <%if(request.isUserInRole("admin")){ %> <% }else{ %> <%}//end request.isUserInRole } } else { %> <% } %>
<%=prettyBean%>
"><%=dataName%><%=beanStats.get(dataName) %>
<%=dataName%><%=beanStats.get(dataName) %>
<% } else { %>

<% } %>      
 
 


<%if(request.isUserInRole("admin")){ %>
 
  • ">
  • ">
  • ">
  • <% if(collecting == 1) { %>
  • ">
  • <% } else if (collecting == 0){ %>
  • ">
  • <% } else if (collecting == -1){ %>
  • <% } %>
 


<% try { // store all mbeans into a map [category --> list of mbeans) TreeMap> trackedCategoryMap = new TreeMap>(); for(Iterator it = trackedBeansMap.keySet().iterator(); it.hasNext(); ) { String mbeanPretty = it.next(); String mbean = trackedBeansMap.get(mbeanPretty); // full mbean name String[] params = mbean.split(","); String category = "Other"; for(int i = 0 ; i < params.length; i++) { if(params[i].startsWith("j2eeType=")) { // we've found our category, so stop it category = params[i].split("=")[1]; if(category.equalsIgnoreCase("gbean")) { category = "Other"; } break; } } ArrayList currList = trackedCategoryMap.get(category); if(currList == null) { currList = new ArrayList(); } currList.add(mbean); trackedCategoryMap.put(category, currList); } // view all mbeans by category for (Iterator it = trackedCategoryMap.keySet().iterator(); it.hasNext();) { String category = it.next().toString(); out.println(""); ArrayList mbeanList = trackedCategoryMap.get(category); for(int i = 0 ; i < mbeanList.size(); i++) { String prettyBean = null; boolean found = false; for(Iterator itt = trackedBeansMap.keySet().iterator(); itt.hasNext() && !found; ) { String currPrettyBean = itt.next(); if(trackedBeansMap.get(currPrettyBean).equals(mbeanList.get(i))) { prettyBean = currPrettyBean; found = true; } } %> <% } } } catch (Exception e) { } %>
" + category + "
<%=prettyBean%> ">stop tracking mbean


<% try { // store all mbeans into a map [category --> list of mbeans) TreeMap> availableCategoryMap = new TreeMap>(); for(Iterator it = availableBeansMap.keySet().iterator(); it.hasNext(); ) { String mbeanPretty = it.next(); String mbean = availableBeansMap.get(mbeanPretty); // full mbean name String[] params = mbean.split(","); String category = "Other"; for(int i = 0 ; i < params.length; i++) { if(params[i].startsWith("j2eeType=")) { // we've found our category, so stop it category = params[i].split("=")[1]; if(category.equalsIgnoreCase("gbean")) { category = "Other"; } break; } } ArrayList currList = availableCategoryMap.get(category); if(currList == null) { currList = new ArrayList(); } currList.add(mbean); availableCategoryMap.put(category, currList); } // view all mbeans by category for (Iterator it = availableCategoryMap.keySet().iterator(); it.hasNext();) { String category = it.next().toString(); out.println(""); ArrayList mbeanList = availableCategoryMap.get(category); for(int i = 0 ; i < mbeanList.size(); i++) { String prettyBean = null; boolean found = false; for(Iterator itt = availableBeansMap.keySet().iterator(); itt.hasNext() && !found; ) { String currPrettyBean = itt.next(); if(availableBeansMap.get(currPrettyBean).equals(mbeanList.get(i))) { prettyBean = currPrettyBean; found = true; } } %> <% } } } catch (Exception e) { } %>
" + category + "
<%=prettyBean%> ">start tracking mbean
<% } //end admin%> <% if(null != mrc) mrc.dispose(); } else {%>
<<

     
 
 


 
 
<% }%>