01: /*
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * --------------------------------------------------------------------------
22: * $Id: BaseSecurityAction.java 9680 2006-10-06 12:08:33Z danesa $
23: * --------------------------------------------------------------------------
24: */
25:
26: package org.objectweb.jonas.webapp.jonasadmin.security;
27:
28: import javax.management.ObjectName;
29: import javax.servlet.http.HttpServletRequest;
30:
31: import org.objectweb.jonas.jmx.J2eeObjectName;
32: import org.objectweb.jonas.webapp.jonasadmin.JonasTreeBuilder;
33: import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
34: import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction;
35: import org.objectweb.jonas.webapp.taglib.TreeControl;
36: import org.objectweb.jonas.webapp.taglib.TreeControlNode;
37:
38: /**
39: * @author Michel-Ange ANTON
40: */
41:
42: abstract public class BaseSecurityAction extends BaseDeployAction {
43:
44: // --------------------------------------------------------- Protected Methods
45:
46: /**
47: * Refresh the tree.
48: *
49: * @throws Exception
50: */
51: protected void refreshTree(HttpServletRequest p_Request)
52: throws Exception {
53: // Refresh Security Tree
54: refreshSecurityTree(p_Request);
55: // Refresh MBeans Tree
56: refreshMBeansTree(p_Request);
57: // Force display to refresh
58: m_WhereAreYou.setTreeToRefresh(true);
59: }
60:
61: /**
62: * Refresh the security branch tree.
63: *
64: * @throws Exception
65: */
66: protected void refreshSecurityTree(HttpServletRequest p_Request)
67: throws Exception {
68: String sCurrentNodeNameItem = "domain"
69: + WhereAreYou.NODE_SEPARATOR
70: + m_WhereAreYou.getCurrentJonasServerName()
71: + WhereAreYou.NODE_SEPARATOR + "security";
72: // Get current tree
73: TreeControl oControl = m_WhereAreYou.getTreeControl();
74: // Get branch root node
75: TreeControlNode oBranchRootNode = oControl
76: .findNode(sCurrentNodeNameItem);
77: // Enable auto-refresh mode
78: oControl.enableAutoRefresh();
79: // Remove old children
80: TreeControlNode[] aoNodes = oBranchRootNode.findChildren();
81: for (int i = 0; i < aoNodes.length; i++) {
82: aoNodes[i].remove();
83: }
84: // Build node for the Service
85: JonasTreeBuilder oBuilder = new JonasTreeBuilder();
86: oBuilder.getSecurityFactories(oBranchRootNode, m_Resources,
87: p_Request);
88: // Disable auto-refresh mode
89: oControl.disableAutoRefresh();
90: }
91: }
|