Source Code Cross Referenced for EditDomainAction.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » domain » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.webapp.jonasadmin.domain 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999-2004 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: EditDomainAction.java 9680 2006-10-06 12:08:33Z danesa $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.webapp.jonasadmin.domain;
025:
026:        import java.io.IOException;
027:        import java.util.ArrayList;
028:        import java.util.Collections;
029:        import java.util.Iterator;
030:
031:        import javax.management.ObjectName;
032:        import javax.servlet.ServletException;
033:        import javax.servlet.http.HttpServletRequest;
034:        import javax.servlet.http.HttpServletResponse;
035:
036:        import org.apache.struts.action.ActionForm;
037:        import org.apache.struts.action.ActionForward;
038:        import org.apache.struts.action.ActionMapping;
039:
040:        import org.objectweb.jonas.jmx.J2eeObjectName;
041:        import org.objectweb.jonas.jmx.ManagementReprLoader;
042:        import org.objectweb.jonas.management.cluster.BaseCluster;
043:        import org.objectweb.jonas.management.j2eemanagement.J2EEDomain;
044:        import org.objectweb.jonas.management.monitoring.ClusterDaemonProxy;
045:        import org.objectweb.jonas.management.monitoring.DomainMonitor;
046:        import org.objectweb.jonas.management.monitoring.ServerProxy;
047:        import org.objectweb.jonas.webapp.jonasadmin.JonasBaseAction;
048:        import org.objectweb.jonas.webapp.jonasadmin.common.BeanComparator;
049:
050:        /**
051:         * Display domain or cluster informations
052:         * @author Adriana Danes
053:         */
054:        public class EditDomainAction extends JonasBaseAction {
055:
056:            /**
057:             * Compute info about this cluster or domain
058:             * Populate the DomainForm
059:             * Eventually call the domain.jsp for display
060:             */
061:            public ActionForward executeAction(ActionMapping p_Mapping,
062:                    ActionForm p_Form, HttpServletRequest p_Request,
063:                    HttpServletResponse p_Response) throws IOException,
064:                    ServletException {
065:
066:                try {
067:                    DomainForm oForm = (DomainForm) p_Form;
068:                    String domainName = m_WhereAreYou.getCurrentDomainName();
069:                    boolean changeMap;
070:                    Boolean changeMapObj = ((Boolean) m_Session
071:                            .getAttribute("mapChanged"));
072:                    if (changeMapObj == null) {
073:                        changeMap = false;
074:                    } else {
075:                        changeMap = changeMapObj.booleanValue();
076:                    }
077:                    String selected = p_Request.getParameter("select");
078:                    if (selected == null) {
079:                        // By default we edit the domain page
080:                        // -- this is necessary for example when creating a cluster in the
081:                        // domain, at the end of the ApplyClusterAction we comme back
082:                        // into EdirDomainAction
083:                        // -- maybe this should be treated otherwise ?
084:                        selected = domainName;
085:                    }
086:                    // domain or cluster name
087:                    String name = selected;
088:                    m_Session.setAttribute("currentCluster", name);
089:
090:                    // Support mgmt context switch from a slave to the master
091:                    // (to the administrator server)
092:                    String adminServerName = m_WhereAreYou
093:                            .getAdminJonasServerName();
094:                    boolean changeManagement = false;
095:                    if (!adminServerName.equals(m_WhereAreYou
096:                            .getCurrentJonasServerName())) {
097:                        // change management conext from a managed server in the domain
098:                        // to the JonasAdmin server
099:                        ManagementReprLoader.loadServerRepr(adminServerName);
100:                        m_WhereAreYou
101:                                .refreshServers(p_Request, adminServerName);
102:                        // onCurrentServer = m_WhereAreYou.getCurrentJonasServer();
103:                        changeManagement = true;
104:                    }
105:
106:                    // Force the node selected in tree
107:                    m_WhereAreYou.selectNameNode("domain", true);
108:
109:                    if (changeManagement) {
110:                        refreshServerTree(p_Request);
111:                    }
112:                    if (changeMap) {
113:                        //refreshDomainMonitoringTree(p_Request);
114:                        refreshServerTree(p_Request);
115:
116:                        m_WhereAreYou.setTreeToRefresh(true);
117:                        m_Session
118:                                .setAttribute("mapChanged", new Boolean(false));
119:                    }
120:                    // domain or cluster
121:                    boolean inCluster = false;
122:                    if (domainName.equals(selected)) {
123:                        // this is a domain
124:                        oForm.setType("Domain");
125:                    } else {
126:                        inCluster = true;
127:                        oForm.setType("Cluster");
128:                    }
129:
130:                    // set general properties
131:                    oForm.setName(name);
132:                    oForm.setDomainName(domainName);
133:                    //oForm.setDescription(getStringAttribute(onDomain, "description"));
134:                    oForm.setCluster(inCluster);
135:                    oForm.setMasterName(adminServerName);
136:                    oForm.setMasterON(J2eeObjectName.J2EEServer(domainName,
137:                            adminServerName).toString());
138:                    oForm.setMaster(getBooleanAttribute(m_WhereAreYou
139:                            .getCurrentDomain(), "master"));
140:
141:                    // Get access to the DomainMonitor and domain/cluster management data
142:                    BaseCluster baseCluster = null;
143:                    DomainMonitor dm = J2EEDomain.getInstance()
144:                            .getDomainMonitor();
145:                    if (dm != null) {
146:                        baseCluster = dm.findCluster(name);
147:                        if (baseCluster == null) {
148:                            throw new RuntimeException("Cannot find cluster "
149:                                    + name);
150:                        }
151:                        ObjectName clOn = ObjectName.getInstance(baseCluster
152:                                .getObjectName());
153:                        oForm.setClusterType(clOn.getKeyProperty("type"));
154:                        // Get servers running in this domain (or cluster)
155:                        ArrayList al = new ArrayList();
156:                        for (Iterator it = baseCluster.getServerProxyList()
157:                                .iterator(); it.hasNext();) {
158:                            ServerProxy proxy = (ServerProxy) it.next();
159:                            ObjectName on = ObjectName.getInstance(proxy
160:                                    .getJ2eeObjectName());
161:                            al.add(new ServerItem(on, proxy.getState(), proxy
162:                                    .getClusterDaemonName()));
163:                        }
164:                        Collections.sort(al, new BeanComparator(
165:                                new String[] { "name" }));
166:                        p_Request.setAttribute("listServers", al);
167:
168:                        if (!inCluster) {
169:                            // Get clusters in this domain
170:                            ArrayList clustAl = new ArrayList();
171:                            for (Iterator it = dm.getTotalClusterList()
172:                                    .iterator(); it.hasNext();) {
173:                                BaseCluster cl = (BaseCluster) it.next();
174:                                String clusterName = cl.getName();
175:                                if (!domainName.equals(clusterName)) {
176:                                    ObjectName on = new ObjectName(cl
177:                                            .getObjectName());
178:                                    ServerItem item = new ServerItem(on, cl
179:                                            .getState(), null);
180:                                    item.setName(clusterName);
181:                                    clustAl.add(item);
182:                                }
183:                            }
184:                            Collections.sort(clustAl, new BeanComparator(
185:                                    new String[] { "name" }));
186:                            p_Request.setAttribute("listClusters", clustAl);
187:
188:                            // Get cluster daemons
189:                            ArrayList clustDaemonAl = new ArrayList();
190:                            for (Iterator it = dm.getClusterDaemonList()
191:                                    .iterator(); it.hasNext();) {
192:                                ClusterDaemonProxy cdp = (ClusterDaemonProxy) it
193:                                        .next();
194:                                String cdpName = cdp.getName();
195:                                ObjectName on = new ObjectName(cdp
196:                                        .getObjectName());
197:                                ServerItem item = new ServerItem(on, cdp
198:                                        .getState(), null);
199:                                item.setName(cdpName);
200:                                clustDaemonAl.add(item);
201:                            }
202:                            Collections.sort(clustDaemonAl, new BeanComparator(
203:                                    new String[] { "name" }));
204:                            p_Request.setAttribute("listCdps", clustDaemonAl);
205:                            // Re-check server states for a more accurate display
206:                            dm.refreshStates();
207:                        } else {
208:                            p_Request.setAttribute("listClusters",
209:                                    new ArrayList());
210:                            p_Request.setAttribute("listCdps", new ArrayList());
211:                        }
212:                    }
213:                } catch (Throwable t) {
214:                    addGlobalError(t);
215:                    saveErrors(p_Request, m_Errors);
216:                    return (p_Mapping.findForward("Global Error"));
217:                }
218:                // Forward to the jsp.
219:                return (p_Mapping.findForward("Domain"));
220:
221:            }
222:
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.