Source Code Cross Referenced for CmsMailHost.java in  » Content-Management-System » opencms » org » opencms » mail » 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 » Content Management System » opencms » org.opencms.mail 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src/org/opencms/mail/CmsMailHost.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:41 $
004:         * Version: $Revision: 1.10 $
005:         *
006:         * This library is part of OpenCms -
007:         * the Open Source Content Management System
008:         *
009:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010:         *
011:         * This library is free software; you can redistribute it and/or
012:         * modify it under the terms of the GNU Lesser General Public
013:         * License as published by the Free Software Foundation; either
014:         * version 2.1 of the License, or (at your option) any later version.
015:         *
016:         * This library is distributed in the hope that it will be useful,
017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019:         * Lesser General Public License for more details.
020:         *
021:         * For further information about Alkacon Software GmbH, please see the
022:         * company website: http://www.alkacon.com
023:         *
024:         * For further information about OpenCms, please see the
025:         * project website: http://www.opencms.org
026:         * 
027:         * You should have received a copy of the GNU Lesser General Public
028:         * License along with this library; if not, write to the Free Software
029:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030:         */
031:
032:        package org.opencms.mail;
033:
034:        /**
035:         * Contains the configuration of an individual mail host.<p>
036:         * 
037:         * @author Andreas Zahner 
038:         * 
039:         * @version $Revision: 1.10 $ 
040:         * 
041:         * @since 6.0.0 
042:         */
043:        public class CmsMailHost implements  Comparable {
044:
045:            /** The name of the mail host. */
046:            private String m_hostname;
047:
048:            /** The order of this mail host. */
049:            private Integer m_order;
050:
051:            /** The password to use for authentication. */
052:            private String m_password;
053:
054:            /** The protocol to use. */
055:            private String m_protocol;
056:
057:            /** The user name to use for authentication. */
058:            private String m_username;
059:
060:            /**
061:             * Creates a new mail host.<p>
062:             * 
063:             * @param hostname the name of the mail host
064:             * @param order the order in which the host is tried
065:             * @param protocol the protocol to use (default "smtp")
066:             * @param username the user name to use for authentication 
067:             * @param password the password to use for authentication
068:             */
069:            public CmsMailHost(String hostname, Integer order, String protocol,
070:                    String username, String password) {
071:
072:                m_hostname = hostname;
073:                m_protocol = (protocol != null) ? protocol
074:                        : CmsMailSettings.MAIL_DEFAULT_PROTOCOL;
075:                m_username = username;
076:                m_password = password;
077:                m_order = order;
078:            }
079:
080:            /**
081:             * @see java.lang.Comparable#compareTo(java.lang.Object)
082:             */
083:            public int compareTo(Object obj) {
084:
085:                if (obj == this ) {
086:                    return 0;
087:                }
088:                if (obj instanceof  CmsMailHost) {
089:                    return m_order.compareTo(((CmsMailHost) obj).m_order);
090:                }
091:                return 0;
092:            }
093:
094:            /**
095:             * @see java.lang.Object#equals(java.lang.Object)
096:             */
097:            public boolean equals(Object obj) {
098:
099:                if (obj == this ) {
100:                    return true;
101:                }
102:                if (obj instanceof  CmsMailHost) {
103:                    CmsMailHost other = (CmsMailHost) obj;
104:                    return m_hostname.equals(other.m_hostname)
105:                            && m_protocol.equals(other.m_protocol)
106:                            && m_username.equals(other.m_username);
107:                }
108:                return false;
109:            }
110:
111:            /**
112:             * Returns the host name.<p>
113:             * 
114:             * @return the host name
115:             */
116:            public String getHostname() {
117:
118:                return m_hostname;
119:            }
120:
121:            /**
122:             * Returns the order of this mail host.<p>
123:             * 
124:             * @return the order of this mail host
125:             */
126:            public Integer getOrder() {
127:
128:                return m_order;
129:            }
130:
131:            /**
132:             * Returns the password used for authentication.<p>
133:             * 
134:             * @return the password used for authentication
135:             */
136:            public String getPassword() {
137:
138:                return m_password;
139:            }
140:
141:            /**
142:             * Returns the protocol used for mail sending, default is "smtp".<p>
143:             * 
144:             * @return the protocol used for mail sending
145:             */
146:            public String getProtocol() {
147:
148:                return m_protocol;
149:            }
150:
151:            /**
152:             * Returns the user name used for authentication.<p>
153:             * 
154:             * @return the user name used for authentication
155:             */
156:            public String getUsername() {
157:
158:                return m_username;
159:            }
160:
161:            /** 
162:             * @see java.lang.Object#hashCode()
163:             */
164:            public int hashCode() {
165:
166:                return m_hostname.hashCode() * 1117 + m_protocol.hashCode()
167:                        * 2003 + m_username.hashCode();
168:            }
169:
170:            /**
171:             * Returns <code>true</code> only if authentication is enabled, 
172:             * the default is <code>false</code>.<p>
173:             * 
174:             * Authentication is enabled only if both "username" and "password" 
175:             * are not <code>null</code>.<p>
176:             * 
177:             * @return <code>true</code> only if authentication is enabled
178:             */
179:            public boolean isAuthenticating() {
180:
181:                return (m_username != null) && (m_password != null);
182:            }
183:
184:            /**
185:             * @see java.lang.Object#toString()
186:             */
187:            public String toString() {
188:
189:                StringBuffer buf = new StringBuffer(64);
190:                buf.append(this .getClass().getName());
191:                buf.append(" hostname=");
192:                buf.append(getHostname());
193:                buf.append(" order=");
194:                buf.append(m_order);
195:                buf.append(" protocol=");
196:                buf.append(getProtocol());
197:                if (isAuthenticating()) {
198:                    buf.append(" user=");
199:                    buf.append(getUsername());
200:                    buf.append(" password=");
201:                    buf.append(getPassword());
202:                }
203:                return buf.toString();
204:            }
205:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.