BaseLoggerAction.java

00001 /*
00002  * JOnAS: Java(TM) Open Application Server
00003  * Copyright (C) 1999 Bull S.A.
00004  * Contact: jonas-team@objectweb.org
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA
00020  *
00021  * --------------------------------------------------------------------------
00022  * $Id: BaseLoggerAction.java,v 1.5 2004/03/19 14:31:48 sauthieg Exp $
00023  * --------------------------------------------------------------------------
00024  */
00025 
00026 package org.objectweb.jonas.webapp.jonasadmin.logging;
00027 
00028 import javax.management.ObjectName;
00029 import javax.servlet.http.HttpServletRequest;
00030 
00031 import org.objectweb.jonas.jmx.J2eeObjectName;
00032 import org.objectweb.jonas.webapp.jonasadmin.JonasTreeBuilder;
00033 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
00034 import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction;
00035 import org.objectweb.jonas.webapp.taglib.TreeControl;
00036 import org.objectweb.jonas.webapp.taglib.TreeControlNode;
00037 
00041 abstract public class BaseLoggerAction extends BaseDeployAction {
00042 
00043 // --------------------------------------------------------- Protected Methods
00044 
00051     protected void refreshTree(HttpServletRequest p_Request)
00052         throws Exception {
00053         // Refresh Logger Tree
00054         refreshLoggersTree(p_Request);
00055         // Refresh MBeans Tree
00056         refreshMBeansTree();
00057         // Force display to refresh
00058         m_WhereAreYou.setTreeToRefresh(true);
00059     }
00060 
00067     protected void refreshLoggersTree(HttpServletRequest p_Request)
00068         throws Exception {
00069         // Get the server name
00070         ObjectName oObjectName = J2eeObjectName.J2EEServer(m_WhereAreYou.getCurrentDomainName()
00071             , m_WhereAreYou.getCurrentJonasServerName());
00072         String sNameServer = getStringAttribute(oObjectName, "ServerName");
00073         // Get the node name
00074         String sCurrentNodeNameItem = sNameServer + WhereAreYou.NODE_SEPARATOR + "logging";
00075         // Get current tree
00076         TreeControl oControl = m_WhereAreYou.getTreeControl();
00077         // Get branch root node
00078         TreeControlNode oBranchRootNode = oControl.findNode(sCurrentNodeNameItem);
00079         // Enable auto-refresh mode
00080         oControl.enableAutoRefresh();
00081         // Remove old children
00082         TreeControlNode[] aoNodes = oBranchRootNode.findChildren();
00083         for (int i = 0; i < aoNodes.length; i++) {
00084             aoNodes[i].remove();
00085         }
00086         // Build node for the Service
00087         JonasTreeBuilder oBuilder = new JonasTreeBuilder();
00088         oBuilder.getLoggers(oBranchRootNode, m_Resources, p_Request);
00089         // Disable auto-refresh mode
00090         oControl.disableAutoRefresh();
00091     }
00092 }

Generated on Tue Feb 15 15:05:28 2005 for JOnAS by  doxygen 1.3.9.1