Source Code Cross Referenced for BaseApacheHandler.java in  » EJB-Server-geronimo » plugins » org » apache » geronimo » console » apache » jk » 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 » EJB Server geronimo » plugins » org.apache.geronimo.console.apache.jk 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */package org.apache.geronimo.console.apache.jk;
017:
018:        import java.io.Serializable;
019:        import java.util.ArrayList;
020:        import java.util.List;
021:        import java.util.Map;
022:        import javax.portlet.ActionResponse;
023:        import javax.portlet.PortletRequest;
024:        import javax.portlet.PortletSession;
025:        import org.apache.geronimo.console.MultiPageAbstractHandler;
026:        import org.apache.geronimo.console.MultiPageModel;
027:        import org.apache.geronimo.console.util.PortletManager;
028:        import org.apache.geronimo.kernel.repository.Artifact;
029:        import org.apache.geronimo.gbean.AbstractName;
030:
031:        /**
032:         * The base class for all handlers for this portlet
033:         *
034:         * @version $Rev: 588005 $ $Date: 2007-10-24 13:28:08 -0700 (Wed, 24 Oct 2007) $
035:         */
036:        public abstract class BaseApacheHandler extends
037:                MultiPageAbstractHandler {
038:            protected static final String INDEX_MODE = "index";
039:            protected static final String BASIC_CONFIG_MODE = "basic";
040:            protected static final String AJP_MODE = "ajp";
041:            protected static final String WEB_APP_MODE = "webapp";
042:            protected static final String RESULTS_MODE = "results";
043:
044:            protected BaseApacheHandler(String mode, String viewName) {
045:                super (mode, viewName);
046:            }
047:
048:            public final static class WebAppData implements  Serializable {
049:                private String parentConfigId;
050:                private String childName;
051:                private String moduleBeanName;
052:                private boolean enabled;
053:                private String dynamicPattern;
054:                private boolean serveStaticContent;
055:                private String contextRoot;
056:                private String webAppDir;
057:
058:                public WebAppData(Artifact parentConfigId, String childName,
059:                        AbstractName moduleBeanName, boolean enabled,
060:                        String dynamicPattern, boolean serveStaticContent) {
061:                    this .parentConfigId = parentConfigId.toString();
062:                    this .enabled = enabled;
063:                    this .dynamicPattern = dynamicPattern;
064:                    this .serveStaticContent = serveStaticContent;
065:                    this .moduleBeanName = moduleBeanName == null ? null
066:                            : moduleBeanName.toString();
067:                    this .childName = childName;
068:                }
069:
070:                public WebAppData(PortletRequest request, String prefix) {
071:                    parentConfigId = request.getParameter(prefix + "configId");
072:                    childName = request.getParameter(prefix + "childName");
073:                    moduleBeanName = request.getParameter(prefix
074:                            + "moduleBeanName");
075:                    dynamicPattern = request.getParameter(prefix
076:                            + "dynamicPattern");
077:                    String test = request.getParameter(prefix + "enabled");
078:                    enabled = test != null && !test.equals("")
079:                            && !test.equals("false");
080:                    test = request.getParameter(prefix + "serveStaticContent");
081:                    serveStaticContent = test != null && !test.equals("")
082:                            && !test.equals("false");
083:                    contextRoot = request.getParameter(prefix + "contextRoot");
084:                    webAppDir = request.getParameter(prefix + "webAppDir");
085:                }
086:
087:                public void save(ActionResponse response, String prefix) {
088:                    response.setRenderParameter(prefix + "configId",
089:                            parentConfigId);
090:                    response.setRenderParameter(prefix + "moduleBeanName",
091:                            moduleBeanName);
092:                    response.setRenderParameter(prefix + "dynamicPattern",
093:                            dynamicPattern);
094:                    response.setRenderParameter(prefix + "enabled", Boolean
095:                            .toString(enabled));
096:                    response.setRenderParameter(prefix + "serveStaticContent",
097:                            Boolean.toString(serveStaticContent));
098:                    if (!isEmpty(contextRoot))
099:                        response.setRenderParameter(prefix + "contextRoot",
100:                                contextRoot);
101:                    if (!isEmpty(webAppDir))
102:                        response.setRenderParameter(prefix + "webAppDir",
103:                                webAppDir);
104:                    if (!isEmpty(childName))
105:                        response.setRenderParameter(prefix + "childName",
106:                                childName);
107:                }
108:
109:                public boolean isEnabled() {
110:                    return enabled;
111:                }
112:
113:                public void setEnabled(boolean enabled) {
114:                    this .enabled = enabled;
115:                }
116:
117:                public String getParentConfigId() {
118:                    return parentConfigId;
119:                }
120:
121:                public void setParentConfigId(String parentConfigId) {
122:                    this .parentConfigId = parentConfigId;
123:                }
124:
125:                public String getDynamicPattern() {
126:                    return dynamicPattern;
127:                }
128:
129:                public void setDynamicPattern(String dynamicPattern) {
130:                    this .dynamicPattern = dynamicPattern;
131:                }
132:
133:                public boolean isServeStaticContent() {
134:                    return serveStaticContent;
135:                }
136:
137:                public void setServeStaticContent(boolean serveStaticContent) {
138:                    this .serveStaticContent = serveStaticContent;
139:                }
140:
141:                public String getContextRoot() {
142:                    return contextRoot;
143:                }
144:
145:                public void setContextRoot(String contextRoot) {
146:                    this .contextRoot = contextRoot;
147:                }
148:
149:                public String getWebAppDir() {
150:                    return webAppDir;
151:                }
152:
153:                public void setWebAppDir(String webAppDir) {
154:                    this .webAppDir = webAppDir;
155:                }
156:
157:                public String getChildName() {
158:                    return childName;
159:                }
160:
161:                public String getModuleBeanName() {
162:                    return moduleBeanName;
163:                }
164:
165:                public String getName() {
166:                    return isEmpty(childName) ? parentConfigId : childName;
167:                }
168:
169:                public boolean isRunning() {
170:                    return webAppDir != null;
171:                }
172:            }
173:
174:            public final static class ApacheModel implements  MultiPageModel {
175:                public final static String WEB_APP_SESSION_KEY = "console.apache.jk.WebApps";
176:                private String os;
177:                private Integer addAjpPort;
178:                private String logFilePath;
179:                private String workersPath;
180:                private List webApps = new ArrayList();
181:
182:                public ApacheModel(PortletRequest request) {
183:                    Map map = request.getParameterMap();
184:                    os = request.getParameter("os");
185:                    // logFilePath and workersPath need to be encoded before saving
186:                    // and decoded after fetching
187:                    logFilePath = request.getParameter("logFilePath");
188:                    if (logFilePath == null) {
189:                        logFilePath = PortletManager.getCurrentServer(request)
190:                                .getServerInfo().resolve(
191:                                        "var/log/apache_mod_jk.log").getPath();
192:                    }
193:                    workersPath = request.getParameter("workersPath");
194:                    if (workersPath == null) {
195:                        workersPath = PortletManager.getCurrentServer(request)
196:                                .getServerInfo().resolve(
197:                                        "var/config/workers.properties")
198:                                .getPath();
199:                    }
200:                    String ajp = request.getParameter("addAjpPort");
201:                    if (!isEmpty(ajp))
202:                        addAjpPort = new Integer(ajp);
203:                    int index = 0;
204:                    boolean found = false;
205:                    while (true) {
206:                        String key = "webapp." + (index++) + ".";
207:                        if (!map.containsKey(key + "configId")) {
208:                            break;
209:                        }
210:                        found = true;
211:                        WebAppData data = new WebAppData(request, key);
212:                        webApps.add(data);
213:                    }
214:                    if (!found) {
215:                        List list = (List) request.getPortletSession(true)
216:                                .getAttribute(WEB_APP_SESSION_KEY);
217:                        if (list != null) {
218:                            webApps = list;
219:                        }
220:                    }
221:                }
222:
223:                public void save(ActionResponse response, PortletSession session) {
224:                    if (!isEmpty(os))
225:                        response.setRenderParameter("os", os);
226:                    if (!isEmpty(logFilePath))
227:                        response.setRenderParameter("logFilePath", logFilePath);
228:                    if (!isEmpty(workersPath))
229:                        response.setRenderParameter("workersPath", workersPath);
230:                    if (addAjpPort != null)
231:                        response.setRenderParameter("addAjpPort", addAjpPort
232:                                .toString());
233:                    if (webApps.size() > 0) {
234:                        session.setAttribute(WEB_APP_SESSION_KEY, webApps);
235:                    }
236:                }
237:
238:                public String getOs() {
239:                    return os;
240:                }
241:
242:                public void setOs(String os) {
243:                    this .os = os;
244:                }
245:
246:                public Integer getAddAjpPort() {
247:                    return addAjpPort;
248:                }
249:
250:                public void setAddAjpPort(Integer addAjpPort) {
251:                    this .addAjpPort = addAjpPort;
252:                }
253:
254:                public String getLogFilePath() {
255:                    return logFilePath;
256:                }
257:
258:                public void setLogFilePath(String logFilePath) {
259:                    this .logFilePath = logFilePath;
260:                }
261:
262:                public String getWorkersPath() {
263:                    return workersPath;
264:                }
265:
266:                public void setWorkersPath(String workersPath) {
267:                    this .workersPath = workersPath;
268:                }
269:
270:                public List getWebApps() {
271:                    return webApps;
272:                }
273:
274:                public void setWebApps(List webApps) {
275:                    this.webApps = webApps;
276:                }
277:            }
278:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.