1 31 32 package org.opencms.mail; 33 34 43 public class CmsMailHost implements Comparable { 44 45 46 private String m_hostname; 47 48 49 private Integer m_order; 50 51 52 private String m_password; 53 54 55 private String m_protocol; 56 57 58 private String m_username; 59 60 69 public CmsMailHost(String hostname, Integer order, String protocol, String username, String password) { 70 71 m_hostname = hostname; 72 m_protocol = (protocol != null) ? protocol : CmsMailSettings.MAIL_DEFAULT_PROTOCOL; 73 m_username = username; 74 m_password = password; 75 m_order = order; 76 } 77 78 81 public int compareTo(Object obj) { 82 83 if (obj == this) { 84 return 0; 85 } 86 if (obj instanceof CmsMailHost) { 87 return m_order.compareTo(((CmsMailHost)obj).m_order); 88 } 89 return 0; 90 } 91 92 97 public String getHostname() { 98 99 return m_hostname; 100 } 101 102 107 public Integer getOrder() { 108 109 return m_order; 110 } 111 112 117 public String getPassword() { 118 119 return m_password; 120 } 121 122 127 public String getProtocol() { 128 129 return m_protocol; 130 } 131 132 137 public String getUsername() { 138 139 return m_username; 140 } 141 142 151 public boolean isAuthenticating() { 152 153 return (m_username != null) && (m_password != null); 154 } 155 156 159 public String toString() { 160 161 StringBuffer buf = new StringBuffer (64); 162 buf.append(this.getClass().getName()); 163 buf.append(" hostname="); 164 buf.append(getHostname()); 165 buf.append(" order="); 166 buf.append(m_order); 167 buf.append(" protocol="); 168 buf.append(getProtocol()); 169 if (isAuthenticating()) { 170 buf.append(" user="); 171 buf.append(getUsername()); 172 buf.append(" password="); 173 buf.append(getPassword()); 174 } 175 return buf.toString(); 176 } 177 } | Popular Tags |