Source Code Cross Referenced for JkHandler.java in  » Sevlet-Container » tomcat-connectors » org » apache » jk » core » 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 » Sevlet Container » tomcat connectors » org.apache.jk.core 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Copyright 1999-2004 The Apache Software Foundation
003:         *
004:         *  Licensed under the Apache License, Version 2.0 (the "License");
005:         *  you may not use this file except in compliance with the License.
006:         *  You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         *  Unless required by applicable law or agreed to in writing, software
011:         *  distributed under the License is distributed on an "AS IS" BASIS,
012:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         *  See the License for the specific language governing permissions and
014:         *  limitations under the License.
015:         */
016:
017:        package org.apache.jk.core;
018:
019:        import java.io.IOException;
020:        import java.util.Properties;
021:
022:        import javax.management.MBeanRegistration;
023:        import javax.management.MBeanServer;
024:        import javax.management.Notification;
025:        import javax.management.NotificationListener;
026:        import javax.management.ObjectName;
027:
028:        import org.apache.commons.modeler.Registry;
029:
030:        /**
031:         *
032:         * @author Costin Manolache
033:         */
034:        public class JkHandler implements  MBeanRegistration,
035:                NotificationListener {
036:            public static final int OK = 0;
037:            public static final int LAST = 1;
038:            public static final int ERROR = 2;
039:
040:            protected Properties properties = new Properties();
041:            protected WorkerEnv wEnv;
042:            protected JkHandler next;
043:            protected String nextName = null;
044:            protected String name;
045:            protected int id;
046:
047:            // XXX Will be replaced with notes and (configurable) ids
048:            // Each represents a 'chain' - similar with ActionCode in Coyote ( the concepts
049:            // will be merged ).    
050:            public static final int HANDLE_RECEIVE_PACKET = 10;
051:            public static final int HANDLE_SEND_PACKET = 11;
052:            public static final int HANDLE_FLUSH = 12;
053:            public static final int HANDLE_THREAD_END = 13;
054:
055:            public void setWorkerEnv(WorkerEnv we) {
056:                this .wEnv = we;
057:            }
058:
059:            /** Set the name of the handler. Will allways be called by
060:             *  worker env after creating the worker.
061:             */
062:            public void setName(String s) {
063:                name = s;
064:            }
065:
066:            public String getName() {
067:                return name;
068:            }
069:
070:            /** Set the id of the worker. We use an id for faster dispatch.
071:             *  Since we expect a decent number of handler in system, the
072:             *  id is unique - that means we may have to allocate bigger
073:             *  dispatch tables. ( easy to fix if needed )
074:             */
075:            public void setId(int id) {
076:                this .id = id;
077:            }
078:
079:            public int getId() {
080:                return id;
081:            }
082:
083:            /** Catalina-style "recursive" invocation.
084:             *  A chain is used for Apache/3.3 style iterative invocation.
085:             */
086:            public void setNext(JkHandler h) {
087:                next = h;
088:            }
089:
090:            public void setNext(String s) {
091:                nextName = s;
092:            }
093:
094:            public String getNext() {
095:                if (nextName == null) {
096:                    if (next != null)
097:                        nextName = next.getName();
098:                }
099:                return nextName;
100:            }
101:
102:            /** Should register the request types it can handle,
103:             *   same style as apache2.
104:             */
105:            public void init() throws IOException {
106:            }
107:
108:            /** Clean up and stop the handler
109:             */
110:            public void destroy() throws IOException {
111:            }
112:
113:            public MsgContext createMsgContext() {
114:                return new MsgContext();
115:            }
116:
117:            public int invoke(Msg msg, MsgContext mc) throws IOException {
118:                return OK;
119:            }
120:
121:            public void setProperty(String name, String value) {
122:                properties.put(name, value);
123:            }
124:
125:            public String getProperty(String name) {
126:                return properties.getProperty(name);
127:            }
128:
129:            /** Experimental, will be replaced. This allows handlers to be
130:             *  notified when other handlers are added.
131:             */
132:            public void addHandlerCallback(JkHandler w) {
133:
134:            }
135:
136:            public void handleNotification(Notification notification,
137:                    Object handback) {
138:                //        BaseNotification bNot=(BaseNotification)notification;
139:                //        int code=bNot.getCode();
140:                //
141:                //        MsgContext ctx=(MsgContext)bNot.getSource();
142:
143:            }
144:
145:            protected String domain;
146:            protected ObjectName oname;
147:            protected MBeanServer mserver;
148:
149:            public ObjectName getObjectName() {
150:                return oname;
151:            }
152:
153:            public String getDomain() {
154:                return domain;
155:            }
156:
157:            public ObjectName preRegister(MBeanServer server, ObjectName oname)
158:                    throws Exception {
159:                this .oname = oname;
160:                mserver = server;
161:                domain = oname.getDomain();
162:                if (name == null) {
163:                    name = oname.getKeyProperty("name");
164:                }
165:
166:                // we need to create a workerEnv or set one.
167:                ObjectName wEnvName = new ObjectName(domain
168:                        + ":type=JkWorkerEnv");
169:                if (wEnv == null) {
170:                    wEnv = new WorkerEnv();
171:                }
172:                if (!mserver.isRegistered(wEnvName)) {
173:                    Registry.getRegistry().registerComponent(wEnv, wEnvName,
174:                            null);
175:                }
176:                mserver.invoke(wEnvName, "addHandler", new Object[] { name,
177:                        this  }, new String[] { "java.lang.String",
178:                        "org.apache.jk.core.JkHandler" });
179:                return oname;
180:            }
181:
182:            public void postRegister(Boolean registrationDone) {
183:            }
184:
185:            public void preDeregister() throws Exception {
186:            }
187:
188:            public void postDeregister() {
189:            }
190:
191:            public void pause() throws Exception {
192:            }
193:
194:            public void resume() throws Exception {
195:            }
196:
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.