Source Code Cross Referenced for PropertiesBean.java in  » J2EE » openejb3 » org » apache » openejb » webadmin » main » 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 » openejb3 » org.apache.openejb.webadmin.main 
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.openejb.webadmin.main;
017:
018:        import java.io.File;
019:        import java.io.IOException;
020:        import java.io.PrintWriter;
021:        import java.util.Arrays;
022:        import java.util.Enumeration;
023:        import java.util.Properties;
024:        import java.util.StringTokenizer;
025:
026:        import org.apache.openejb.webadmin.HttpRequest;
027:        import org.apache.openejb.webadmin.HttpResponse;
028:        import org.apache.openejb.webadmin.WebAdminBean;
029:        import org.apache.openejb.webadmin.HttpHome;
030:
031:        import javax.ejb.Stateless;
032:        import javax.ejb.RemoteHome;
033:
034:        /** Prints out a list of system properties for the server.
035:         * @author <a href="mailto:tim_urberg@yahoo.com">Tim Urberg</a>
036:         */
037:        @Stateless(name="Webadmin/Properties")
038:        @RemoteHome(HttpHome.class)
039:        public class PropertiesBean extends WebAdminBean {
040:
041:            /**
042:             * Called after a new instance of PropertiesBean is created
043:             */
044:            public void ejbCreate() {
045:                // The section variable must match 
046:                // the deployment id name
047:                section = "Properties";
048:            }
049:
050:            /** called after all content is written to the browser
051:             * @param request the http request
052:             * @param response the http response
053:             * @throws IOException if an exception is thrown
054:             */
055:            public void postProcess(HttpRequest request, HttpResponse response)
056:                    throws IOException {
057:            }
058:
059:            /** called before any content is written to the browser
060:             * @param request the http request
061:             * @param response the http response
062:             * @throws IOException if an exception is thrown
063:             */
064:            public void preProcess(HttpRequest request, HttpResponse response)
065:                    throws IOException {
066:            }
067:
068:            /** writes the main body content to the broswer.  This content is inside a <code>&lt;p&gt;</code> block
069:             *  
070:             * 
071:             * @param body the output to write to
072:             * @exception IOException if an exception is thrown
073:             */
074:            public void writeBody(PrintWriter body) throws IOException {
075:                Properties p = System.getProperties();
076:                Enumeration e = p.keys();
077:                String[] propertyList = new String[p.size()];
078:
079:                body
080:                        .println("<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">");
081:                String currentProperty = null;
082:                body
083:                        .println("<tr><th align=\"left\">Property Name</th><th align=\"left\">Property Value</th></tr>");
084:                int j = 0;
085:                while (e.hasMoreElements()) {
086:                    propertyList[j++] = (String) e.nextElement();
087:                }
088:                Arrays.sort(propertyList);
089:
090:                String[] color = new String[] { "c9c5fe", "FFFFFF" };
091:                for (int i = 0; i < propertyList.length; i++) {
092:                    String name = propertyList[i];
093:                    String value = System.getProperty(propertyList[i]);
094:
095:                    body.println("<tr bgcolor=\"#" + color[i % 2] + "\"  >");
096:                    body.println("<td valign=\"top\">" + name + "</td>");
097:                    body.println("<td>");
098:                    if (propertyList[i].endsWith(".path")) {
099:                        StringTokenizer path = new StringTokenizer(value,
100:                                File.pathSeparator);
101:                        while (path.hasMoreTokens()) {
102:                            body.print(path.nextToken());
103:                            body.println("<br>");
104:                        }
105:                    } else {
106:                        body.println(value);
107:                    }
108:                    body.println("&nbsp;</td>");
109:                    body.println("</tr>");
110:                }
111:                body.println("</table>");
112:            }
113:
114:            /** Write the TITLE of the HTML document.  This is the part
115:             * that goes into the <code>&lt;head&gt;&lt;title&gt;
116:             * &lt;/title&gt;&lt;/head&gt;</code> tags
117:             *
118:             * @param body the output to write to
119:             * @exception IOException of an exception is thrown
120:             *
121:             */
122:            public void writeHtmlTitle(PrintWriter body) throws IOException {
123:                body.print(HTML_TITLE);
124:            }
125:
126:            /** Write the title of the page.  This is displayed right
127:             * above the main block of content.
128:             * 
129:             * @param body the output to write to
130:             * @exception IOException if an exception is thrown
131:             */
132:            public void writePageTitle(PrintWriter body) throws IOException {
133:                body.print("System Properties");
134:            }
135:
136:            /** Write the sub items for this bean in the left navigation bar of
137:             * the page.  This should look somthing like the one below:
138:             *
139:             *      <code>
140:             *      &lt;tr&gt;
141:             *       &lt;td valign="top" align="left"&gt;
142:             *        &lt;a href="system?show=deployments"&gt;&lt;span class="subMenuOff"&gt;
143:             *        &nbsp;&nbsp;&nbsp;Deployments
144:             *        &lt;/span&gt;
145:             *        &lt;/a&gt;&lt;/td&gt;
146:             *      &lt;/tr&gt;
147:             *      </code>
148:             *
149:             * Alternately, the bean can use the method formatSubMenuItem(..) which
150:             * will create HTML like the one above
151:             *
152:             * @param body the output to write to
153:             * @exception IOException if an exception is thrown
154:             *
155:             */
156:            public void writeSubMenuItems(PrintWriter body) throws IOException {
157:            }
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.