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