Source Code Cross Referenced for SmtpActionType.java in  » Testing » Dumbster » com » dumbster » smtp » 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 » Testing » Dumbster » com.dumbster.smtp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Dumbster - a dummy SMTP server
003:         * Copyright 2004 Jason Paul Kitchen
004:         * 
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * 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 com.dumbster.smtp;
018:
019:        /**
020:         * Represents an SMTP action or command.
021:         */
022:        public class SmtpActionType {
023:            /** Internal value for the action type. */
024:            private byte value;
025:
026:            /** Internal representation of the CONNECT action. */
027:            private static final byte CONNECT_BYTE = (byte) 1;
028:            /** Internal representation of the EHLO action. */
029:            private static final byte EHLO_BYTE = (byte) 2;
030:            /** Internal representation of the MAIL FROM action. */
031:            private static final byte MAIL_BYTE = (byte) 3;
032:            /** Internal representation of the RCPT action. */
033:            private static final byte RCPT_BYTE = (byte) 4;
034:            /** Internal representation of the DATA action. */
035:            private static final byte DATA_BYTE = (byte) 5;
036:            /** Internal representation of the DATA END (.) action. */
037:            private static final byte DATA_END_BYTE = (byte) 6;
038:            /** Internal representation of the QUIT action. */
039:            private static final byte QUIT_BYTE = (byte) 7;
040:            /** Internal representation of an unrecognized action: body text gets this action type. */
041:            private static final byte UNREC_BYTE = (byte) 8;
042:            /** Internal representation of the blank line action: separates headers and body text. */
043:            private static final byte BLANK_LINE_BYTE = (byte) 9;
044:
045:            /** Internal representation of the stateless RSET action. */
046:            private static final byte RSET_BYTE = (byte) -1;
047:            /** Internal representation of the stateless VRFY action. */
048:            private static final byte VRFY_BYTE = (byte) -2;
049:            /** Internal representation of the stateless EXPN action. */
050:            private static final byte EXPN_BYTE = (byte) -3;
051:            /** Internal representation of the stateless HELP action. */
052:            private static final byte HELP_BYTE = (byte) -4;
053:            /** Internal representation of the stateless NOOP action. */
054:            private static final byte NOOP_BYTE = (byte) -5;
055:
056:            /** CONNECT action. */
057:            public static final SmtpActionType CONNECT = new SmtpActionType(
058:                    CONNECT_BYTE);
059:            /** EHLO action. */
060:            public static final SmtpActionType EHLO = new SmtpActionType(
061:                    EHLO_BYTE);
062:            /** MAIL action. */
063:            public static final SmtpActionType MAIL = new SmtpActionType(
064:                    MAIL_BYTE);
065:            /** RCPT action. */
066:            public static final SmtpActionType RCPT = new SmtpActionType(
067:                    RCPT_BYTE);
068:            /** DATA action. */
069:            public static final SmtpActionType DATA = new SmtpActionType(
070:                    DATA_BYTE);
071:            /** "." action. */
072:            public static final SmtpActionType DATA_END = new SmtpActionType(
073:                    DATA_END_BYTE);
074:            /** Body text action. */
075:            public static final SmtpActionType UNRECOG = new SmtpActionType(
076:                    UNREC_BYTE);
077:            /** QUIT action. */
078:            public static final SmtpActionType QUIT = new SmtpActionType(
079:                    QUIT_BYTE);
080:            /** Header/body separator action. */
081:            public static final SmtpActionType BLANK_LINE = new SmtpActionType(
082:                    BLANK_LINE_BYTE);
083:
084:            /** Stateless RSET action. */
085:            public static final SmtpActionType RSET = new SmtpActionType(
086:                    RSET_BYTE);
087:            /** Stateless VRFY action. */
088:            public static final SmtpActionType VRFY = new SmtpActionType(
089:                    VRFY_BYTE);
090:            /** Stateless EXPN action. */
091:            public static final SmtpActionType EXPN = new SmtpActionType(
092:                    EXPN_BYTE);
093:            /** Stateless HELP action. */
094:            public static final SmtpActionType HELP = new SmtpActionType(
095:                    HELP_BYTE);
096:            /** Stateless NOOP action. */
097:            public static final SmtpActionType NOOP = new SmtpActionType(
098:                    NOOP_BYTE);
099:
100:            /**
101:             * Create a new SMTP action type. Private to ensure no invalid values.
102:             * @param value one of the _BYTE values
103:             */
104:            private SmtpActionType(byte value) {
105:                this .value = value;
106:            }
107:
108:            /**
109:             * Indicates whether the action is stateless or not.
110:             * @return true iff the action is stateless
111:             */
112:            public boolean isStateless() {
113:                return value < 0;
114:            }
115:
116:            /**
117:             * String representation of this SMTP action type.
118:             * @return a String
119:             */
120:            public String toString() {
121:                switch (value) {
122:                case CONNECT_BYTE:
123:                    return "Connect";
124:                case EHLO_BYTE:
125:                    return "EHLO";
126:                case MAIL_BYTE:
127:                    return "MAIL";
128:                case RCPT_BYTE:
129:                    return "RCPT";
130:                case DATA_BYTE:
131:                    return "DATA";
132:                case DATA_END_BYTE:
133:                    return ".";
134:                case QUIT_BYTE:
135:                    return "QUIT";
136:                case RSET_BYTE:
137:                    return "RSET";
138:                case VRFY_BYTE:
139:                    return "VRFY";
140:                case EXPN_BYTE:
141:                    return "EXPN";
142:                case HELP_BYTE:
143:                    return "HELP";
144:                case NOOP_BYTE:
145:                    return "NOOP";
146:                case UNREC_BYTE:
147:                    return "Unrecognized command / data";
148:                case BLANK_LINE_BYTE:
149:                    return "Blank line";
150:                default:
151:                    return "Unknown";
152:                }
153:            }
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.