Source Code Cross Referenced for ApplyConnectorAction.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » webapp » jonasadmin » catalina » 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.catalina 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 2003-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: ApplyConnectorAction.java 10100 2007-03-27 13:55:44Z danesa $
023:         * --------------------------------------------------------------------------
024:         */package org.objectweb.jonas.webapp.jonasadmin.catalina;
025:
026:        import java.io.IOException;
027:        import java.net.InetAddress;
028:
029:        import javax.management.ObjectName;
030:        import javax.servlet.ServletException;
031:        import javax.servlet.http.HttpServletRequest;
032:        import javax.servlet.http.HttpServletResponse;
033:
034:        import org.apache.struts.action.ActionMessage;
035:        import org.apache.struts.action.ActionForm;
036:        import org.apache.struts.action.ActionForward;
037:        import org.apache.struts.action.ActionMapping;
038:        import org.objectweb.jonas.jmx.JonasManagementRepr;
039:        import org.objectweb.jonas.jmx.JonasObjectName;
040:        import org.objectweb.jonas.jmx.CatalinaObjectName;
041:        import org.objectweb.jonas.webapp.jonasadmin.JonasAdminJmx;
042:        import org.objectweb.jonas.webapp.jonasadmin.WhereAreYou;
043:
044:        /**
045:         * @author Michel-Ange ANTON
046:         * @author Adriana Danes - update to Tomact 5.0
047:         * Replace MBeanFactory usage with JOnAS CatalinaConnectorFactory MBean
048:         * in order to avoid class loader problems occuring with JRMP
049:         */
050:        public class ApplyConnectorAction extends CatalinaBaseAction {
051:
052:            /**
053:             * Signature for the <code>createStandardConnector</code> operation.
054:             */
055:            private String[] saCreateStandardConnectorTypes = {
056:                    "java.lang.String", "java.lang.String", "int" // port
057:            };
058:
059:            // --------------------------------------------------------- Public Methods
060:
061:            public ActionForward executeAction(ActionMapping p_Mapping,
062:                    ActionForm p_Form, HttpServletRequest p_Request,
063:                    HttpServletResponse p_Response) throws IOException,
064:                    ServletException {
065:                // Current JOnAS server name
066:                String serverName = m_WhereAreYou.getCurrentJonasServerName();
067:                // Next forward
068:                String sForward = "Catalina Connector";
069:                // Identify the requested action
070:                ConnectorForm oForm = (ConnectorForm) p_Form;
071:                String sAction = oForm.getAction();
072:                String sObjectName = oForm.getObjectName();
073:                String sConnectorType = oForm.getConnectorType();
074:
075:                // Populate
076:                try {
077:                    // Perform a "Create Connector operation"
078:                    if ("create".equals(sAction)) {
079:                        String address = oForm.getAddress(); // IP address
080:
081:                        // Ensure that the requested connector name is unique
082:                        ObjectName onConnector = CatalinaObjectName
083:                                .catalinaConnector(m_WhereAreYou
084:                                        .getCurrentCatalinaDomainName(), oForm
085:                                        .getPortText());
086:                        if (JonasAdminJmx.hasMBeanName(onConnector, serverName)) {
087:                            m_Errors.add("connector", new ActionMessage(
088:                                    "error.catalina.connector.exists"));
089:                            saveErrors(p_Request, m_Errors);
090:                            return (new ActionForward(p_Mapping.getInput()));
091:                        }
092:
093:                        // Use CatalinaConnectorFactory to create connector
094:                        ObjectName onConnectorFactory = JonasObjectName
095:                                .catalinaConnectorFactory(m_WhereAreYou
096:                                        .getCurrentDomainName());
097:                        Object values[] = new Object[3];
098:                        values[0] = sConnectorType;
099:                        values[1] = address;
100:                        values[2] = new Integer(oForm.getPortText());
101:                        String operation = "createConnector";
102:                        sObjectName = (String) JonasManagementRepr.invoke(
103:                                onConnectorFactory, operation, values,
104:                                saCreateStandardConnectorTypes, serverName);
105:
106:                        /*
107:                        // Look up the Catalina MBeanFactory
108:                        ObjectName onFactory = CatalinaObjectName.catalinaFactory();
109:                        values[0] = CatalinaObjectName.catalinaService(m_WhereAreYou.
110:                            getCurrentCatalinaDomainName()
111:                            , m_WhereAreYou.getCurrentCatalinaServiceName()).toString();
112:                        values[1] = address;
113:                        values[2] = new Integer(oForm.getPortText());
114:
115:                        if ("HTTP".equalsIgnoreCase(sConnectorType)) {
116:                            operation = "createHttpConnector"; // HTTP
117:                        }
118:                        else if ("HTTPS".equalsIgnoreCase(sConnectorType)) {
119:                            operation = "createHttpsConnector"; // HTTPS
120:                        }
121:                        else {
122:                            operation = "createAjpConnector"; // AJP(HTTP)
123:                        }
124:                        sObjectName = (String) JonasManagementRepr.invoke(onFactory, operation, values
125:                            , sa_CreateStandardConnectorTypes);
126:                         */
127:                        if (sObjectName == null) {
128:                            saveErrors(p_Request, m_Errors);
129:                            return (p_Mapping.findForward("Global Error"));
130:                        }
131:                        // refresh tree
132:                        refreshTree(p_Request);
133:                        // Force the node selected in tree
134:                        String nodeName = getTreeBranchName(DEPTH_SERVER)
135:                                + WhereAreYou.NODE_SEPARATOR + "protocols"
136:                                + WhereAreYou.NODE_SEPARATOR + "connectors";
137:                        //+ WhereAreYou.NODE_SEPARATOR + m_WhereAreYou.getCurrentCatalinaServiceName()
138:                        //+ WhereAreYou.NODE_SEPARATOR + oForm.getPortText();
139:                        if (address != null) {
140:                            nodeName = nodeName + WhereAreYou.NODE_SEPARATOR
141:                                    + address;
142:                        }
143:                        m_WhereAreYou.selectNameNode(nodeName, true);
144:
145:                    }
146:
147:                    ObjectName oObjectName = new ObjectName(sObjectName);
148:
149:                    setIntegerAttribute(oObjectName, "acceptCount", oForm
150:                            .getAcceptCountText());
151:                    String addressValue = oForm.getAddress();
152:                    InetAddress inetAddress = InetAddress
153:                            .getByName(addressValue);
154:                    JonasManagementRepr.setAttribute(oObjectName, "address",
155:                            inetAddress, serverName);
156:                    setBooleanAttribute(oObjectName, "allowTrace", oForm
157:                            .isAllowTrace());
158:                    setIntegerAttribute(oObjectName, "connectionTimeout", oForm
159:                            .getConnTimeOutText());
160:                    setIntegerAttribute(oObjectName, "bufferSize", oForm
161:                            .getBufferSizeText());
162:                    setIntegerAttribute(oObjectName, "maxPostSize", oForm
163:                            .getMaxPostSizeText());
164:                    setBooleanAttribute(oObjectName, "enableLookups", oForm
165:                            .isEnableLookups());
166:                    setBooleanAttribute(oObjectName, "emptySessionPath", oForm
167:                            .isEmptySessionPath());
168:                    setBooleanAttribute(oObjectName, "xpoweredBy", oForm
169:                            .isXpoweredBy());
170:                    setBooleanAttribute(oObjectName, "tcpNoDelay", oForm
171:                            .isTcpNoDelay());
172:                    setBooleanAttribute(oObjectName, "useBodyEncodingForURI",
173:                            oForm.isUseBodyEncodingForURI());
174:                    setIntegerAttribute(oObjectName, "redirectPort", oForm
175:                            .getRedirectPortText());
176:                    setIntegerAttribute(oObjectName, "maxThreads", oForm
177:                            .getMaxThreadsText());
178:                    setIntegerAttribute(oObjectName, "minSpareThreads", oForm
179:                            .getMinSpareThreadsText());
180:                    setIntegerAttribute(oObjectName, "maxSpareThreads", oForm
181:                            .getMaxSpareThreadsText());
182:
183:                    // proxy name and port do not exist for AJP connector
184:                    if ("AJP".equalsIgnoreCase(sConnectorType) == false) {
185:                        setStringAttribute(oObjectName, "proxyName", oForm
186:                                .getProxyName());
187:                        setIntegerAttribute(oObjectName, "proxyPort", oForm
188:                                .getProxyPortText());
189:                    }
190:
191:                    // HTTPS specific properties
192:                    if ("HTTPS".equalsIgnoreCase(sConnectorType) == true) {
193:                        setBooleanAttribute(oObjectName, "clientAuth", oForm
194:                                .isClientAuth());
195:                        setStringAttribute(oObjectName, "keystoreFile", oForm
196:                                .getKeystoreFile());
197:                        setStringAttribute(oObjectName, "keystorePass", oForm
198:                                .getKeystorePass());
199:                    }
200:
201:                    if ("create".equals(sAction) == true) {
202:                        m_Session.removeAttribute(p_Mapping.getAttribute());
203:                        sForward = "ActionListCatalinaConnectors";
204:                    }
205:
206:                    // Save in configuration file
207:                    if (oForm.isSave() == true) {
208:                        oForm.setSave(false);
209:                        p_Request.setAttribute("forward", sForward);
210:                        sForward = "ActionEditServletServer";
211:                        //ObjectName on = CatalinaObjectName.catalinaServer();
212:                        //JonasManagementRepr.invoke(on, "store", null, null);
213:                    }
214:                } catch (Throwable t) {
215:                    addGlobalError(t);
216:                    saveErrors(p_Request, m_Errors);
217:                    return (p_Mapping.findForward("Global Error"));
218:                }
219:
220:                // Forward to the connector display page or the list if create
221:                return p_Mapping.findForward(sForward);
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.