Source Code Cross Referenced for ProtocolCommandEvent.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » 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 » Net » Apache commons net 1.4.1 » org.apache.commons.net 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2005 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:        package org.apache.commons.net;
017:
018:        import java.util.EventObject;
019:
020:        /***
021:         * There exists a large class of IETF protocols that work by sending an
022:         * ASCII text command and arguments to a server, and then receiving an
023:         * ASCII text reply.  For debugging and other purposes, it is extremely
024:         * useful to log or keep track of the contents of the protocol messages.
025:         * The ProtocolCommandEvent class coupled with the
026:         * {@link org.apache.commons.net.ProtocolCommandListener}
027:         *  interface facilitate this process.
028:         * <p>
029:         * <p>
030:         * @see ProtocolCommandListener
031:         * @see ProtocolCommandSupport
032:         * @author Daniel F. Savarese
033:         ***/
034:
035:        public class ProtocolCommandEvent extends EventObject {
036:            private int __replyCode;
037:            private boolean __isCommand;
038:            private String __message, __command;
039:
040:            /***
041:             * Creates a ProtocolCommandEvent signalling a command was sent to
042:             * the server.  ProtocolCommandEvents created with this constructor
043:             * should only be sent after a command has been sent, but before the
044:             * reply has been received.
045:             * <p>
046:             * @param source  The source of the event.
047:             * @param command The string representation of the command type sent, not
048:             *      including the arguments (e.g., "STAT" or "GET").
049:             * @param message The entire command string verbatim as sent to the server,
050:             *        including all arguments.
051:             ***/
052:            public ProtocolCommandEvent(Object source, String command,
053:                    String message) {
054:                super (source);
055:                __replyCode = 0;
056:                __message = message;
057:                __isCommand = true;
058:                __command = command;
059:            }
060:
061:            /***
062:             * Creates a ProtocolCommandEvent signalling a reply to a command was
063:             * received.  ProtocolCommandEvents created with this constructor
064:             * should only be sent after a complete command reply has been received
065:             * fromt a server.
066:             * <p>
067:             * @param source  The source of the event.
068:             * @param replyCode The integer code indicating the natureof the reply.
069:             *   This will be the protocol integer value for protocols
070:             *   that use integer reply codes, or the reply class constant
071:             *   corresponding to the reply for protocols like POP3 that use
072:             *   strings like OK rather than integer codes (i.e., POP3Repy.OK).
073:             * @param message The entire reply as received from the server.
074:             ***/
075:            public ProtocolCommandEvent(Object source, int replyCode,
076:                    String message) {
077:                super (source);
078:                __replyCode = replyCode;
079:                __message = message;
080:                __isCommand = false;
081:                __command = null;
082:            }
083:
084:            /***
085:             * Returns the string representation of the command type sent (e.g., "STAT"
086:             * or "GET").  If the ProtocolCommandEvent is a reply event, then null
087:             * is returned.
088:             * <p>
089:             * @return The string representation of the command type sent, or null
090:             *         if this is a reply event.
091:             ***/
092:            public String getCommand() {
093:                return __command;
094:            }
095:
096:            /***
097:             * Returns the reply code of the received server reply.  Undefined if
098:             * this is not a reply event.
099:             * <p>
100:             * @return The reply code of the received server reply.  Undefined if
101:             *         not a reply event.
102:             ***/
103:            public int getReplyCode() {
104:                return __replyCode;
105:            }
106:
107:            /***
108:             * Returns true if the ProtocolCommandEvent was generated as a result
109:             * of sending a command.
110:             * <p>
111:             * @return true If the ProtocolCommandEvent was generated as a result
112:             * of sending a command.  False otherwise.
113:             ***/
114:            public boolean isCommand() {
115:                return __isCommand;
116:            }
117:
118:            /***
119:             * Returns true if the ProtocolCommandEvent was generated as a result
120:             * of receiving a reply.
121:             * <p>
122:             * @return true If the ProtocolCommandEvent was generated as a result
123:             * of receiving a reply.  False otherwise.
124:             ***/
125:            public boolean isReply() {
126:                return !isCommand();
127:            }
128:
129:            /***
130:             * Returns the entire message sent to or received from the server.
131:             * <p>
132:             * @return The entire message sent to or received from the server.
133:             ***/
134:            public String getMessage() {
135:                return __message;
136:            }
137:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.