Source Code Cross Referenced for ChannelInterceptorBase.java in  » Sevlet-Container » apache-tomcat-6.0.14 » org » apache » catalina » tribes » group » 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.catalina.tribes.group 
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:        package org.apache.catalina.tribes.group;
018:
019:        import org.apache.catalina.tribes.ChannelException;
020:        import org.apache.catalina.tribes.ChannelInterceptor;
021:        import org.apache.catalina.tribes.ChannelMessage;
022:        import org.apache.catalina.tribes.Member;
023:
024:        /**
025:         * Abstract class for the interceptor base class.
026:         * @author Filip Hanik
027:         * @version $Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
028:         */
029:
030:        public abstract class ChannelInterceptorBase implements 
031:                ChannelInterceptor {
032:
033:            protected static org.apache.juli.logging.Log log = org.apache.juli.logging.LogFactory
034:                    .getLog(ChannelInterceptorBase.class);
035:
036:            private ChannelInterceptor next;
037:            private ChannelInterceptor previous;
038:            //default value, always process
039:            protected int optionFlag = 0;
040:
041:            public ChannelInterceptorBase() {
042:
043:            }
044:
045:            public boolean okToProcess(int messageFlags) {
046:                if (this .optionFlag == 0)
047:                    return true;
048:                return ((optionFlag & messageFlags) == optionFlag);
049:            }
050:
051:            public final void setNext(ChannelInterceptor next) {
052:                this .next = next;
053:            }
054:
055:            public final ChannelInterceptor getNext() {
056:                return next;
057:            }
058:
059:            public final void setPrevious(ChannelInterceptor previous) {
060:                this .previous = previous;
061:            }
062:
063:            public void setOptionFlag(int optionFlag) {
064:                this .optionFlag = optionFlag;
065:            }
066:
067:            public final ChannelInterceptor getPrevious() {
068:                return previous;
069:            }
070:
071:            public int getOptionFlag() {
072:                return optionFlag;
073:            }
074:
075:            public void sendMessage(Member[] destination, ChannelMessage msg,
076:                    InterceptorPayload payload) throws ChannelException {
077:                if (getNext() != null)
078:                    getNext().sendMessage(destination, msg, payload);
079:            }
080:
081:            public void messageReceived(ChannelMessage msg) {
082:                if (getPrevious() != null)
083:                    getPrevious().messageReceived(msg);
084:            }
085:
086:            public boolean accept(ChannelMessage msg) {
087:                return true;
088:            }
089:
090:            public void memberAdded(Member member) {
091:                //notify upwards
092:                if (getPrevious() != null)
093:                    getPrevious().memberAdded(member);
094:            }
095:
096:            public void memberDisappeared(Member member) {
097:                //notify upwards
098:                if (getPrevious() != null)
099:                    getPrevious().memberDisappeared(member);
100:            }
101:
102:            public void heartbeat() {
103:                if (getNext() != null)
104:                    getNext().heartbeat();
105:            }
106:
107:            /**
108:             * has members
109:             */
110:            public boolean hasMembers() {
111:                if (getNext() != null)
112:                    return getNext().hasMembers();
113:                else
114:                    return false;
115:            }
116:
117:            /**
118:             * Get all current cluster members
119:             * @return all members or empty array
120:             */
121:            public Member[] getMembers() {
122:                if (getNext() != null)
123:                    return getNext().getMembers();
124:                else
125:                    return null;
126:            }
127:
128:            /**
129:             *
130:             * @param mbr Member
131:             * @return Member
132:             */
133:            public Member getMember(Member mbr) {
134:                if (getNext() != null)
135:                    return getNext().getMember(mbr);
136:                else
137:                    return null;
138:            }
139:
140:            /**
141:             * Return the member that represents this node.
142:             *
143:             * @return Member
144:             */
145:            public Member getLocalMember(boolean incAlive) {
146:                if (getNext() != null)
147:                    return getNext().getLocalMember(incAlive);
148:                else
149:                    return null;
150:            }
151:
152:            /**
153:             * Starts up the channel. This can be called multiple times for individual services to start
154:             * The svc parameter can be the logical or value of any constants
155:             * @param svc int value of <BR>
156:             * DEFAULT - will start all services <BR>
157:             * MBR_RX_SEQ - starts the membership receiver <BR>
158:             * MBR_TX_SEQ - starts the membership broadcaster <BR>
159:             * SND_TX_SEQ - starts the replication transmitter<BR>
160:             * SND_RX_SEQ - starts the replication receiver<BR>
161:             * @throws ChannelException if a startup error occurs or the service is already started.
162:             */
163:            public void start(int svc) throws ChannelException {
164:                if (getNext() != null)
165:                    getNext().start(svc);
166:            }
167:
168:            /**
169:             * Shuts down the channel. This can be called multiple times for individual services to shutdown
170:             * The svc parameter can be the logical or value of any constants
171:             * @param svc int value of <BR>
172:             * DEFAULT - will shutdown all services <BR>
173:             * MBR_RX_SEQ - stops the membership receiver <BR>
174:             * MBR_TX_SEQ - stops the membership broadcaster <BR>
175:             * SND_TX_SEQ - stops the replication transmitter<BR>
176:             * SND_RX_SEQ - stops the replication receiver<BR>
177:             * @throws ChannelException if a startup error occurs or the service is already started.
178:             */
179:            public void stop(int svc) throws ChannelException {
180:                if (getNext() != null)
181:                    getNext().stop(svc);
182:            }
183:
184:            public void fireInterceptorEvent(InterceptorEvent event) {
185:                //empty operation
186:            }
187:
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.