KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > security > BaseSecurityAction


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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,v 1.9 2005/03/15 14:45:30 danesa Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.security;
27
28 import javax.management.ObjectName JavaDoc;
29
30 import org.objectweb.jonas.jmx.J2eeObjectName;
31 import org.objectweb.jonas.webapp.jonasadmin.JonasTreeBuilder;
32 import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
33 import org.objectweb.jonas.webapp.jonasadmin.deploy.BaseDeployAction;
34 import org.objectweb.jonas.webapp.taglib.TreeControl;
35 import org.objectweb.jonas.webapp.taglib.TreeControlNode;
36
37 /**
38  * @author Michel-Ange ANTON
39  */

40
41 abstract public class BaseSecurityAction extends BaseDeployAction {
42
43 // --------------------------------------------------------- Protected Methods
44

45     /**
46      * Refresh the tree.
47      *
48      * @throws Exception
49      */

50     protected void refreshTree()
51         throws Exception JavaDoc {
52         // Refresh Security Tree
53
refreshSecurityTree();
54         // Refresh MBeans Tree
55
refreshMBeansTree();
56         // Force display to refresh
57
m_WhereAreYou.setTreeToRefresh(true);
58     }
59
60     /**
61      * Refresh the security branch tree.
62      *
63      * @throws Exception
64      */

65     protected void refreshSecurityTree()
66         throws Exception JavaDoc {
67         // Get the security service node name
68
String JavaDoc sCurrentNodeNameItem =
69                 m_WhereAreYou.getCurrentDomainName() + WhereAreYou.NODE_SEPARATOR +
70                 m_WhereAreYou.getCurrentJonasServerName() + WhereAreYou.NODE_SEPARATOR +
71                 "security";
72         // Get current tree
73
TreeControl oControl = m_WhereAreYou.getTreeControl();
74         // Get branch root node
75
TreeControlNode oBranchRootNode = oControl.findNode(sCurrentNodeNameItem);
76         // Enable auto-refresh mode
77
oControl.enableAutoRefresh();
78         // Remove old children
79
TreeControlNode[] aoNodes = oBranchRootNode.findChildren();
80         for (int i = 0; i < aoNodes.length; i++) {
81             aoNodes[i].remove();
82         }
83         // Build node for the Service
84
JonasTreeBuilder oBuilder = new JonasTreeBuilder();
85         oBuilder.getSecurityFactories(oBranchRootNode, m_Resources);
86         // Disable auto-refresh mode
87
oControl.disableAutoRefresh();
88     }
89 }
90
Popular Tags