You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2006/06/14 12:18:55 UTC
svn commit: r414173 [1/7] - in /geronimo/javamail/trunk: ./
javamail-provider-1.3/ javamail-provider-1.3/src/
javamail-provider-1.3/src/java/ javamail-provider-1.3/src/java/org/
javamail-provider-1.3/src/java/org/apache/ javamail-provider-1.3/src/java/...
Author: rickmcguire
Date: Wed Jun 14 03:18:51 2006
New Revision: 414173
URL: http://svn.apache.org/viewvc?rev=414173&view=rev
Log:
GERONIMO-2107 Begin reorganization of the javamail source tree.
Added:
geronimo/javamail/trunk/
geronimo/javamail/trunk/javamail-provider-1.3/
geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt (with props)
geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt (with props)
geronimo/javamail/trunk/javamail-provider-1.3/pom.xml (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPGroupFolder.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPMessage.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPRootFolder.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPStore.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/newsrc/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrc.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcFile.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/newsrc/NNTPNewsrcGroup.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/newsrc/Range.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/newsrc/RangeList.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3Command.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3CommandFactory.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3Connection.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3Constants.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3Folder.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3Response.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3ResponseBuilder.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/POP3Store.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/message/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/message/POP3Message.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/message/POP3MessageFactory.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/message/POP3MessageWithContentInfo.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/message/POP3MessageWithEnvelope.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/message/POP3MessageWithFlags.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/response/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/response/DefaultPOP3Response.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/response/POP3ListResponse.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/response/POP3ResponseFactory.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/pop3/response/POP3StatusResponse.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/nntp/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPConnection.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPReply.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/nntp/NNTPTransport.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/nntp/StringListInputStream.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/MalformedSMTPReplyException.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressFailedException.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPAddressSucceededException.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPMessage.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPReply.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPSTransport.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPSendFailedException.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransport.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/transport/smtp/SMTPTransportException.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/util/
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/util/MIMEOutputStream.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/util/TraceInputStream.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/util/TraceOutputStream.java (with props)
geronimo/javamail/trunk/javamail-provider-1.3/src/resources/
geronimo/javamail/trunk/javamail-provider-1.3/src/resources/META-INF/
geronimo/javamail/trunk/javamail-provider-1.3/src/resources/META-INF/javamail.default.address.map
geronimo/javamail/trunk/javamail-provider-1.3/src/resources/META-INF/javamail.default.providers
geronimo/javamail/trunk/mail-1.3/
geronimo/javamail/trunk/mail-1.3/LICENSE.txt (with props)
geronimo/javamail/trunk/mail-1.3/NOTICE.txt (with props)
geronimo/javamail/trunk/mail-1.3/maven.xml (with props)
geronimo/javamail/trunk/mail-1.3/pom.xml (with props)
geronimo/javamail/trunk/mail-1.3/src/
geronimo/javamail/trunk/mail-1.3/src/main/
geronimo/javamail/trunk/mail-1.3/src/main/assembly/
geronimo/javamail/trunk/mail-1.3/src/main/assembly/javamail.xml (with props)
geronimo/javamail/trunk/pom.xml (with props)
Added: geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt Wed Jun 14 03:18:51 2006
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt Wed Jun 14 03:18:51 2006
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/NOTICE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/pom.xml?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/pom.xml (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/pom.xml Wed Jun 14 03:18:51 2006
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright 2006 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Rev$ $Date$ -->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>mail</artifactId>
+ <groupId>org.apache.geronimo.javamail</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>geronimo-javamail_1.3.1_provider</artifactId>
+ <version>${javamailProvider13Version}</version>
+ <name>Geronimo :: JavaMail 1.3 Providers</name>
+ <description>Geronimo JavaMail 1.3 Providers</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-activation_1.0.2_spec</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-javamail_1.3.1_spec</artifactId>
+ </dependency>
+ </dependencies>
+</project>
+
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/pom.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java Wed Jun 14 03:18:51 2006
@@ -0,0 +1,84 @@
+/**
+ *
+ * Copyright 2003-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.javamail.authentication;
+
+import javax.mail.MessagingException;
+
+/**
+ * Simplified version of the Java 5 SaslClient interface. This is used to
+ * implement a javamail authentication framework that mimics the Sasl framework
+ * on a 1.4.2 JVM. Only the methods required by the Javamail code are
+ * implemented here, but it should be a simple migration to the fuller SASL
+ * interface.
+ */
+public interface ClientAuthenticator {
+ /**
+ * Evaluate a challenge and return a response that can be sent back to the
+ * server. Bot the challenge information and the response information are
+ * "raw data", minus any special encodings used by the transport. For
+ * example, SMTP DIGEST-MD5 authentication protocol passes information as
+ * Base64 encoded strings. That encoding must be removed before calling
+ * evaluateChallenge() and the resulting respose must be Base64 encoced
+ * before transmission to the server.
+ *
+ * It is the authenticator's responsibility to keep track of the state of
+ * the evaluations. That is, if the authentication process requires multiple
+ * challenge/response cycles, then the authenticator needs to keep track of
+ * context of the challenges.
+ *
+ * @param challenge
+ * The challenge data.
+ *
+ * @return An appropriate response for the challenge data.
+ */
+
+ public byte[] evaluateChallenge(byte[] challenge) throws MessagingException;
+
+ /**
+ * Indicates that the authenticator has data that should be sent when the
+ * authentication process is initiated. For example, the SMTP PLAIN
+ * authentication sends userid/password without waiting for a challenge
+ * response.
+ *
+ * If this method returns true, then the initial response is retrieved using
+ * evaluateChallenge() passing null for the challenge information.
+ *
+ * @return True if the challenge/response process starts with an initial
+ * response on the client side.
+ */
+ public boolean hasInitialResponse();
+
+ /**
+ * Indicates whether the client believes the challenge/response sequence is
+ * now complete.
+ *
+ * @return true if the client has evaluated what it believes to be the last
+ * challenge, false if there are additional stages to evaluate.
+ */
+
+ public boolean isComplete();
+
+ /**
+ * Return the mechanism name implemented by this authenticator.
+ *
+ * @return The string name of the authentication mechanism. This name should
+ * match the names commonly used by the mail servers (e.g., "PLAIN",
+ * "LOGIN", "DIGEST-MD5", etc.).
+ */
+ public String getMechanismName();
+}
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/ClientAuthenticator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java Wed Jun 14 03:18:51 2006
@@ -0,0 +1,173 @@
+/**
+ *
+ * Copyright 2003-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.javamail.authentication;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import javax.mail.MessagingException;
+
+import org.apache.geronimo.mail.util.Hex;
+
+public class CramMD5Authenticator implements ClientAuthenticator {
+
+ // the user we're authenticating
+ protected String username;
+
+ // the user's password (the "shared secret")
+ protected String password;
+
+ // indicates whether we've gone through the entire challenge process.
+ protected boolean complete = false;
+
+ /**
+ * Main constructor.
+ *
+ * @param username
+ * The login user name.
+ * @param password
+ * The login password.
+ */
+ public CramMD5Authenticator(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ /**
+ * Respond to the hasInitialResponse query. This mechanism does not have an
+ * initial response.
+ *
+ * @return Always returns false.
+ */
+ public boolean hasInitialResponse() {
+ return false;
+ }
+
+ /**
+ * Indicate whether the challenge/response process is complete.
+ *
+ * @return True if the last challenge has been processed, false otherwise.
+ */
+ public boolean isComplete() {
+ return complete;
+ }
+
+ /**
+ * Retrieve the authenticator mechanism name.
+ *
+ * @return Always returns the string "CRAM-MD5"
+ */
+ public String getMechanismName() {
+ return "CRAM-MD5";
+ }
+
+ /**
+ * Evaluate a CRAM-MD5 login challenge, returning the a result string that
+ * should satisfy the clallenge.
+ *
+ * @param challenge
+ * The decoded challenge data, as a byte array.
+ *
+ * @return A formatted challege response, as an array of bytes.
+ * @exception MessagingException
+ */
+ public byte[] evaluateChallenge(byte[] challenge) throws MessagingException {
+ // we create the challenge from the userid and password information (the
+ // "shared secret").
+ byte[] passBytes;
+
+ try {
+ // get the password in an UTF-8 encoding to create the token
+ passBytes = password.getBytes("UTF-8");
+ // compute the password digest using the key
+ byte[] digest = computeCramDigest(passBytes, challenge);
+
+ // create a unified string using the user name and the hex encoded
+ // digest
+ String responseString = username + " " + new String(Hex.encode(digest));
+ complete = true;
+ return responseString.getBytes();
+ } catch (UnsupportedEncodingException e) {
+ // got an error, fail this
+ throw new MessagingException("Invalid character encodings");
+ }
+
+ }
+
+ /**
+ * Compute a CRAM digest using the hmac_md5 algorithm. See the description
+ * of RFC 2104 for algorithm details.
+ *
+ * @param key
+ * The key (K) for the calculation.
+ * @param input
+ * The encrypted text value.
+ *
+ * @return The computed digest, as a byte array value.
+ * @exception NoSuchAlgorithmException
+ */
+ protected byte[] computeCramDigest(byte[] key, byte[] input) throws MessagingException {
+ // CRAM digests are computed using the MD5 algorithm.
+ MessageDigest digest;
+ try {
+ digest = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ throw new MessagingException("Unable to access MD5 message digest", e);
+ }
+
+ // if the key is longer than 64 bytes, then we get a digest of the key
+ // and use that instead.
+ // this is required by RFC 2104.
+ if (key.length > 64) {
+ digest.update(key);
+ key = digest.digest();
+ }
+
+ // now we create two 64 bit padding keys, initialized with the key
+ // information.
+ byte[] ipad = new byte[64];
+ byte[] opad = new byte[64];
+
+ System.arraycopy(key, 0, ipad, 0, key.length);
+ System.arraycopy(key, 0, opad, 0, key.length);
+
+ // and these versions are munged by XORing with "magic" values.
+
+ for (int i = 0; i < 64; i++) {
+ ipad[i] ^= 0x36;
+ opad[i] ^= 0x5c;
+ }
+
+ // now there are a pair of MD5 operations performed, and inner and an
+ // outer. The spec defines this as
+ // H(K XOR opad, H(K XOR ipad, text)), where H is the MD5 operation.
+
+ // inner operation
+ digest.reset();
+ digest.update(ipad);
+ digest.update(input); // this appends the text to the pad
+ byte[] md5digest = digest.digest();
+
+ // outer operation
+ digest.reset();
+ digest.update(opad);
+ digest.update(md5digest);
+ return digest.digest(); // final result
+ }
+}
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/CramMD5Authenticator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java Wed Jun 14 03:18:51 2006
@@ -0,0 +1,622 @@
+/**
+ *
+ * Copyright 2003-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.javamail.authentication;
+
+import java.io.UnsupportedEncodingException;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.ArrayList;
+
+import javax.mail.AuthenticationFailedException;
+import javax.mail.MessagingException;
+
+import org.apache.geronimo.mail.util.Base64;
+import org.apache.geronimo.mail.util.Hex;
+
+/**
+ * Process a DIGEST-MD5 authentication, using the challenge/response mechanisms.
+ */
+public class DigestMD5Authenticator implements ClientAuthenticator {
+
+ protected static final int AUTHENTICATE_CLIENT = 0;
+
+ protected static final int AUTHENTICATE_SERVER = 1;
+
+ protected static final int AUTHENTICATION_COMPLETE = 2;
+
+ // the host server name
+ protected String host;
+
+ // the user we're authenticating
+ protected String username;
+
+ // the user's password (the "shared secret")
+ protected String password;
+
+ // the target login realm
+ protected String realm;
+
+ // our message digest for processing the challenges.
+ MessageDigest digest;
+
+ // the string we send to the server on the first challenge.
+ protected String clientResponse;
+
+ // the response back from an authentication challenge.
+ protected String authenticationResponse = null;
+
+ // our list of realms received from the server (normally just one).
+ protected ArrayList realms;
+
+ // the nonce value sent from the server
+ protected String nonce;
+
+ // indicates whether we've gone through the entire challenge process.
+ protected int stage = AUTHENTICATE_CLIENT;
+
+ /**
+ * Main constructor.
+ *
+ * @param host
+ * The server host name.
+ * @param username
+ * The login user name.
+ * @param password
+ * The login password.
+ * @param realm
+ * The target login realm (can be null).
+ */
+ public DigestMD5Authenticator(String host, String username, String password, String realm) {
+ this.host = host;
+ this.username = username;
+ this.password = password;
+ this.realm = realm;
+ }
+
+ /**
+ * Respond to the hasInitialResponse query. This mechanism does not have an
+ * initial response.
+ *
+ * @return Always returns false.
+ */
+ public boolean hasInitialResponse() {
+ return false;
+ }
+
+ /**
+ * Indicate whether the challenge/response process is complete.
+ *
+ * @return True if the last challenge has been processed, false otherwise.
+ */
+ public boolean isComplete() {
+ return stage == AUTHENTICATION_COMPLETE;
+ }
+
+ /**
+ * Retrieve the authenticator mechanism name.
+ *
+ * @return Always returns the string "DIGEST-MD5"
+ */
+ public String getMechanismName() {
+ return "DIGEST-MD5";
+ }
+
+ /**
+ * Evaluate a DIGEST-MD5 login challenge, returning the a result string that
+ * should satisfy the clallenge.
+ *
+ * @param challenge
+ * The decoded challenge data, as a string.
+ *
+ * @return A formatted challege response, as an array of bytes.
+ * @exception MessagingException
+ */
+ public byte[] evaluateChallenge(byte[] challenge) throws MessagingException {
+
+ // DIGEST-MD5 authentication goes in two stages. First state involves us
+ // validating with the
+ // server, the second stage is the server validating with us, using the
+ // shared secret.
+ switch (stage) {
+ // stage one of the process.
+ case AUTHENTICATE_CLIENT: {
+ // get the response and advance the processing stage.
+ byte[] response = authenticateClient(challenge);
+ stage = AUTHENTICATE_SERVER;
+ return response;
+ }
+
+ // stage two of the process.
+ case AUTHENTICATE_SERVER: {
+ // get the response and advance the processing stage to completed.
+ byte[] response = authenticateServer(challenge);
+ stage = AUTHENTICATION_COMPLETE;
+ return response;
+ }
+
+ // should never happen.
+ default:
+ throw new MessagingException("Invalid LOGIN challenge");
+ }
+ }
+
+ /**
+ * Evaluate a DIGEST-MD5 login server authentication challenge, returning
+ * the a result string that should satisfy the clallenge.
+ *
+ * @param challenge
+ * The decoded challenge data, as a string.
+ *
+ * @return A formatted challege response, as an array of bytes.
+ * @exception MessagingException
+ */
+ public byte[] authenticateServer(byte[] challenge) throws MessagingException {
+ // parse the challenge string and validate.
+ if (!parseChallenge(challenge)) {
+ return null;
+ }
+
+ try {
+ // like all of the client validation steps, the following is order
+ // critical.
+ // first add in the URI information.
+ digest.update((":smtp/" + host).getBytes("US-ASCII"));
+ // now mix in the response we sent originally
+ String responseString = clientResponse + new String(Hex.encode(digest.digest()));
+ digest.update(responseString.getBytes("US-ASCII"));
+
+ // now convert that into a hex encoded string.
+ String validationText = new String(Hex.encode(digest.digest()));
+
+ // if everything went well, this calculated value should match what
+ // we got back from the server.
+ // our response back is just a null string....
+ if (validationText.equals(authenticationResponse)) {
+ return new byte[0];
+ }
+ throw new AuthenticationFailedException("Invalid DIGEST-MD5 response from server");
+ } catch (UnsupportedEncodingException e) {
+ throw new MessagingException("Invalid character encodings");
+ }
+
+ }
+
+ /**
+ * Evaluate a DIGEST-MD5 login client authentication challenge, returning
+ * the a result string that should satisfy the clallenge.
+ *
+ * @param challenge
+ * The decoded challenge data, as a string.
+ *
+ * @return A formatted challege response, as an array of bytes.
+ * @exception MessagingException
+ */
+ public byte[] authenticateClient(byte[] challenge) throws MessagingException {
+ // parse the challenge string and validate.
+ if (!parseChallenge(challenge)) {
+ return null;
+ }
+
+ SecureRandom randomGenerator;
+ // before doing anything, make sure we can get the required crypto
+ // support.
+ try {
+ randomGenerator = new SecureRandom();
+ digest = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ throw new MessagingException("Unable to access cryptography libraries");
+ }
+
+ // if not configured for a realm, take the first realm from the list, if
+ // any
+ if (realm == null) {
+ // if not handed any realms, just use the host name.
+ if (realms.isEmpty()) {
+ realm = host;
+ } else {
+ // pretty arbitrary at this point, so just use the first one.
+ realm = (String) realms.get(0);
+ }
+ }
+
+ // use secure random to generate a collection of bytes. that is our
+ // cnonce value.
+ byte[] cnonceBytes = new byte[32];
+
+ randomGenerator.nextBytes(cnonceBytes);
+ // and get this as a base64 encoded string.
+ String cnonce = new String(Base64.encode(cnonceBytes));
+
+ // Now the digest computation part. This gets a bit tricky, and must be
+ // done in strict order.
+
+ try {
+ // this identifies where we're logging into.
+ String idString = username + ":" + realm + ":" + password;
+ // we get a digest for this string, then use the digest for the
+ // first stage
+ // of the next digest operation.
+ digest.update(digest.digest(idString.getBytes("US-ASCII")));
+
+ // now we add the nonce strings to the digest.
+ String nonceString = ":" + nonce + ":" + cnonce;
+ digest.update(nonceString.getBytes("US-ASCII"));
+
+ // hex encode this digest, and add on the string values
+ // NB, we only support "auth" for the quality of protection value
+ // (qop). We save this in an
+ // instance variable because we'll need this to validate the
+ // response back from the server.
+ clientResponse = new String(Hex.encode(digest.digest())) + ":" + nonce + ":00000001:" + cnonce + ":auth:";
+
+ // now we add in identification values to the hash.
+ String authString = "AUTHENTICATE:smtp/" + host;
+ digest.update(authString.getBytes("US-ASCII"));
+
+ // this gets added on to the client response
+ String responseString = clientResponse + new String(Hex.encode(digest.digest()));
+ // and this gets fed back into the digest
+ digest.update(responseString.getBytes("US-ASCII"));
+
+ // and FINALLY, the challege digest is hex encoded for sending back
+ // to the server (whew).
+ String challengeResponse = new String(Hex.encode(digest.digest()));
+
+ // now finally build the keyword/value part of the challenge
+ // response. These can be
+ // in any order.
+ StringBuffer response = new StringBuffer();
+
+ response.append("username=\"");
+ response.append(username);
+ response.append("\"");
+
+ response.append(",realm=\"");
+ response.append(realm);
+ response.append("\"");
+
+ // we only support auth qop values, and the nonce-count (nc) is
+ // always 1.
+ response.append(",qop=auth");
+ response.append(",nc=00000001");
+
+ response.append(",nonce=\"");
+ response.append(nonce);
+ response.append("\"");
+
+ response.append(",cnonce=\"");
+ response.append(cnonce);
+ response.append("\"");
+
+ response.append(",digest-uri=\"smtp/");
+ response.append(host);
+ response.append("\"");
+
+ response.append(",response=");
+ response.append(challengeResponse);
+
+ return response.toString().getBytes("US-ASCII");
+
+ } catch (UnsupportedEncodingException e) {
+ throw new MessagingException("Invalid character encodings");
+ }
+ }
+
+ /**
+ * Parse the challege string, pulling out information required for our
+ * challenge response.
+ *
+ * @param challenge
+ * The challenge data.
+ *
+ * @return true if there were no errors parsing the string, false otherwise.
+ * @exception MessagingException
+ */
+ protected boolean parseChallenge(byte[] challenge) throws MessagingException {
+ realms = new ArrayList();
+
+ DigestParser parser = new DigestParser(new String(challenge));
+
+ // parse the entire string...but we ignore everything but the options we
+ // support.
+ while (parser.hasMore()) {
+ NameValuePair pair = parser.parseNameValuePair();
+
+ String name = pair.name;
+
+ // realm to add to our list?
+ if (name.equalsIgnoreCase("realm")) {
+ realms.add(pair.value);
+ }
+ // we need the nonce to evaluate the client challenge.
+ else if (name.equalsIgnoreCase("nonce")) {
+ nonce = pair.value;
+ }
+ // rspauth is the challenge replay back, which allows us to validate
+ // that server is also legit.
+ else if (name.equalsIgnoreCase("rspauth")) {
+ authenticationResponse = pair.value;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Inner class for parsing a DIGEST-MD5 challenge string, which is composed
+ * of "name=value" pairs, separated by "," characters.
+ */
+ class DigestParser {
+ // the challenge we're parsing
+ String challenge;
+
+ // length of the challenge
+ int length;
+
+ // current parsing position
+ int position;
+
+ /**
+ * Normal constructor.
+ *
+ * @param challenge
+ * The challenge string to be parsed.
+ */
+ public DigestParser(String challenge) {
+ this.challenge = challenge;
+ this.length = challenge.length();
+ position = 0;
+ }
+
+ /**
+ * Test if there are more values to parse.
+ *
+ * @return true if we've not reached the end of the challenge string,
+ * false if the challenge has been completely consumed.
+ */
+ private boolean hasMore() {
+ return position < length;
+ }
+
+ /**
+ * Return the character at the current parsing position.
+ *
+ * @return The string character for the current parse position.
+ */
+ private char currentChar() {
+ return challenge.charAt(position);
+ }
+
+ /**
+ * step forward to the next character position.
+ */
+ private void nextChar() {
+ position++;
+ }
+
+ /**
+ * Skip over any white space characters in the challenge string.
+ */
+ private void skipSpaces() {
+ while (position < length && Character.isWhitespace(currentChar())) {
+ position++;
+ }
+ }
+
+ /**
+ * Parse a quoted string used with a name/value pair, accounting for
+ * escape characters embedded within the string.
+ *
+ * @return The string value of the character string.
+ */
+ private String parseQuotedValue() {
+ // we're here because we found the starting double quote. Step over
+ // it and parse to the closing
+ // one.
+ nextChar();
+
+ StringBuffer value = new StringBuffer();
+
+ while (hasMore()) {
+ char ch = currentChar();
+
+ // is this an escape char?
+ if (ch == '\\') {
+ // step past this, and grab the following character
+ nextChar();
+ // we have an invalid quoted string....
+ if (!hasMore()) {
+ return null;
+ }
+ value.append(currentChar());
+ }
+ // end of the string?
+ else if (ch == '"') {
+ // step over this so the caller doesn't process it.
+ nextChar();
+ // return the constructed string.
+ return value.toString();
+ } else {
+ // step over the character and contine with the next
+ // characteer1
+ value.append(ch);
+ }
+ nextChar();
+ }
+ /* fell off the end without finding a closing quote! */
+ return null;
+ }
+
+ /**
+ * Parse a token value used with a name/value pair.
+ *
+ * @return The string value of the token. Returns null if nothing is
+ * found up to the separater.
+ */
+ private String parseTokenValue() {
+
+ StringBuffer value = new StringBuffer();
+
+ while (hasMore()) {
+ char ch = currentChar();
+ switch (ch) {
+ // process the token separators.
+ case ' ':
+ case '\t':
+ case '(':
+ case ')':
+ case '<':
+ case '>':
+ case '@':
+ case ',':
+ case ';':
+ case ':':
+ case '\\':
+ case '"':
+ case '/':
+ case '[':
+ case ']':
+ case '?':
+ case '=':
+ case '{':
+ case '}':
+ // no token characters found? this is bad.
+ if (value.length() == 0) {
+ return null;
+ }
+ // return the accumulated characters.
+ return value.toString();
+
+ default:
+ // is this a control character? That's a delimiter (likely
+ // invalid for the next step,
+ // but it is a token terminator.
+ if (ch < 32 || ch > 127) {
+ // no token characters found? this is bad.
+ if (value.length() == 0) {
+ return null;
+ }
+ // return the accumulated characters.
+ return value.toString();
+ }
+ value.append(ch);
+ break;
+ }
+ // step to the next character.
+ nextChar();
+ }
+ // no token characters found? this is bad.
+ if (value.length() == 0) {
+ return null;
+ }
+ // return the accumulated characters.
+ return value.toString();
+ }
+
+ /**
+ * Parse out a name token of a name/value pair.
+ *
+ * @return The string value of the name.
+ */
+ private String parseName() {
+ // skip to the value start
+ skipSpaces();
+
+ // the name is a token.
+ return parseTokenValue();
+ }
+
+ /**
+ * Parse out a a value of a name/value pair.
+ *
+ * @return The string value associated with the name.
+ */
+ private String parseValue() {
+ // skip to the value start
+ skipSpaces();
+
+ // start of a quoted string?
+ if (currentChar() == '"') {
+ // parse it out as a string.
+ return parseQuotedValue();
+ }
+ // the value must be a token.
+ return parseTokenValue();
+ }
+
+ /**
+ * Parse a name/value pair in an DIGEST-MD5 string.
+ *
+ * @return A NameValuePair object containing the two parts of the value.
+ * @exception MessagingException
+ */
+ public NameValuePair parseNameValuePair() throws MessagingException {
+ // get the name token
+ String name = parseName();
+ if (name == null) {
+ throw new MessagingException("Name syntax error");
+ }
+
+ // the name should be followed by an "=" sign
+ if (!hasMore() || currentChar() != '=') {
+ throw new MessagingException("Name/value pair syntax error");
+ }
+
+ // step over the equals
+ nextChar();
+
+ // now get the value part
+ String value = parseValue();
+ if (value == null) {
+ throw new MessagingException("Name/value pair syntax error");
+ }
+
+ // skip forward to the terminator, which should either be the end of
+ // the line or a ","
+ skipSpaces();
+ // all that work, only to have a syntax error at the end (sigh)
+ if (hasMore()) {
+ if (currentChar() != ',') {
+ throw new MessagingException("Name/value pair syntax error");
+ }
+ // step over, and make sure we position ourselves at either the
+ // end or the first
+ // real character for parsing the next name/value pair.
+ nextChar();
+ skipSpaces();
+ }
+ return new NameValuePair(name, value);
+ }
+ }
+
+ /**
+ * Simple inner class to represent a name/value pair.
+ */
+ public class NameValuePair {
+ public String name;
+
+ public String value;
+
+ NameValuePair(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ }
+}
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/DigestMD5Authenticator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java Wed Jun 14 03:18:51 2006
@@ -0,0 +1,138 @@
+/**
+ *
+ * Copyright 2003-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.javamail.authentication;
+
+import java.io.UnsupportedEncodingException;
+
+import javax.mail.MessagingException;
+
+public class LoginAuthenticator implements ClientAuthenticator {
+
+ // constants for the authentication stages
+ protected static final int USERNAME = 0;
+
+ protected static final int PASSWORD = 1;
+
+ protected static final int COMPLETE = 2;
+
+ // the user we're authenticating
+ protected String username;
+
+ // the user's password (the "shared secret")
+ protected String password;
+
+ // indicates whether we've gone through the entire challenge process.
+ protected int stage = USERNAME;
+
+ /**
+ * Main constructor.
+ *
+ * @param username
+ * The login user name.
+ * @param password
+ * The login password.
+ */
+ public LoginAuthenticator(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ /**
+ * Respond to the hasInitialResponse query. This mechanism does not have an
+ * initial response.
+ *
+ * @return Always returns false;
+ */
+ public boolean hasInitialResponse() {
+ return false;
+ }
+
+ /**
+ * Indicate whether the challenge/response process is complete.
+ *
+ * @return True if the last challenge has been processed, false otherwise.
+ */
+ public boolean isComplete() {
+ return stage == COMPLETE;
+ }
+
+ /**
+ * Retrieve the authenticator mechanism name.
+ *
+ * @return Always returns the string "LOGIN"
+ */
+ public String getMechanismName() {
+ return "LOGIN";
+ }
+
+ /**
+ * Evaluate a PLAIN login challenge, returning the a result string that
+ * should satisfy the clallenge.
+ *
+ * @param challenge
+ * The decoded challenge data, as a byte array
+ *
+ * @return A formatted challege response, as an array of bytes.
+ * @exception MessagingException
+ */
+ public byte[] evaluateChallenge(byte[] challenge) throws MessagingException {
+
+ // process the correct stage for the challenge
+ switch (stage) {
+ // should never happen
+ case COMPLETE:
+ throw new MessagingException("Invalid LOGIN challenge");
+
+ case USERNAME: {
+ byte[] userBytes;
+
+ try {
+ // get the username and password in an UTF-8 encoding to create
+ // the token
+ userBytes = username.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // got an error, fail this (this should never happen).
+ throw new MessagingException("Invalid encoding");
+ }
+
+ // next time through we're looking for a password.
+ stage = PASSWORD;
+ // the user bytes are the entire challenge respose.
+ return userBytes;
+ }
+
+ case PASSWORD: {
+ byte[] passBytes;
+
+ try {
+ // get the username and password in an UTF-8 encoding to create
+ // the token
+ passBytes = password.getBytes("UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // got an error, fail this (this should never happen).
+ throw new MessagingException("Invalid encoding");
+ }
+ // we're finished
+ stage = COMPLETE;
+ return passBytes;
+ }
+ }
+ // should never get here.
+ throw new MessagingException("Invalid LOGIN challenge");
+ }
+}
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/LoginAuthenticator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java Wed Jun 14 03:18:51 2006
@@ -0,0 +1,110 @@
+/**
+ *
+ * Copyright 2003-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.javamail.authentication;
+
+import java.io.UnsupportedEncodingException;
+
+import javax.mail.MessagingException;
+
+public class PlainAuthenticator implements ClientAuthenticator {
+
+ // the user we're authenticating
+ protected String username;
+
+ // the user's password (the "shared secret")
+ protected String password;
+
+ // indicates whether we've gone through the entire challenge process.
+ protected boolean complete = false;
+
+ /**
+ * Main constructor.
+ *
+ * @param username
+ * The login user name.
+ * @param password
+ * The login password.
+ */
+ public PlainAuthenticator(String username, String password) {
+ this.username = username;
+ this.password = password;
+ }
+
+ /**
+ * Respond to the hasInitialResponse query. This mechanism does have an
+ * initial response, which is the entire challenge sequence.
+ *
+ * @return Always returns true.
+ */
+ public boolean hasInitialResponse() {
+ return true;
+ }
+
+ /**
+ * Indicate whether the challenge/response process is complete.
+ *
+ * @return True if the last challenge has been processed, false otherwise.
+ */
+ public boolean isComplete() {
+ return complete;
+ }
+
+ /**
+ * Retrieve the authenticator mechanism name.
+ *
+ * @return Always returns the string "PLAIN"
+ */
+ public String getMechanismName() {
+ return "PLAIN";
+ }
+
+ /**
+ * Evaluate a PLAIN login challenge, returning the a result string that
+ * should satisfy the clallenge.
+ *
+ * @param challenge
+ * The decoded challenge data, as byte array.
+ *
+ * @return A formatted challege response, as an array of bytes.
+ * @exception MessagingException
+ */
+ public byte[] evaluateChallenge(byte[] challenge) throws MessagingException {
+ try {
+ // get the username and password in an UTF-8 encoding to create the
+ // token
+ byte[] userBytes = username.getBytes("UTF-8");
+ byte[] passBytes = password.getBytes("UTF-8");
+
+ // our token has two copies of the username, one copy of the
+ // password, and nulls
+ // between
+ byte[] tokenBytes = new byte[(userBytes.length * 2) + passBytes.length + 2];
+
+ System.arraycopy(userBytes, 0, tokenBytes, 0, userBytes.length);
+ System.arraycopy(userBytes, 0, tokenBytes, userBytes.length + 1, userBytes.length);
+ System.arraycopy(passBytes, 0, tokenBytes, (userBytes.length * 2) + 2, passBytes.length);
+
+ complete = true;
+ return tokenBytes;
+
+ } catch (UnsupportedEncodingException e) {
+ // got an error, fail this
+ throw new MessagingException("Invalid encoding");
+ }
+ }
+}
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/authentication/PlainAuthenticator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java
URL: http://svn.apache.org/viewvc/geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java?rev=414173&view=auto
==============================================================================
--- geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java (added)
+++ geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java Wed Jun 14 03:18:51 2006
@@ -0,0 +1,447 @@
+/**
+ *
+ * Copyright 2003-2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.javamail.store.nntp;
+
+import javax.mail.Flags;
+import javax.mail.Folder;
+import javax.mail.IllegalWriteException;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.MethodNotSupportedException;
+import javax.mail.Session;
+import javax.mail.event.ConnectionEvent;
+
+import org.apache.geronimo.javamail.transport.nntp.NNTPConnection;
+
+/**
+ * The base NNTP implementation of the javax.mail.Folder This is a base class
+ * for both the Root NNTP server and each NNTP group folder.
+ *
+ * @see javax.mail.Folder
+ *
+ * @version $Rev$
+ */
+public class NNTPFolder extends Folder {
+
+ // our active connection.
+ protected NNTPConnection connection;
+
+ // our attached session
+ protected Session session;
+
+ // the name of this folder (either the name of the server for the root or
+ // the news group name).
+ protected String name;
+
+ // the "full" name of the folder. For the root folder, this is the name
+ // returned by the connection
+ // welcome string. Otherwise, this is the same as the name.
+ protected String fullName;
+
+ // the parent folder. For the root folder, this is null. For a group folder,
+ // this is the root.
+ protected Folder parent;
+
+ // the folder open state
+ protected boolean folderOpen = false;
+
+ // the folder message count. For the root folder, this is always 0.
+ protected int messageCount = 0;
+
+ // the persistent flags we save in the store (basically just the SEEN flag).
+ protected Flags permanentFlags;
+
+ /**
+ * Super class constructor the base NNTPFolder class.
+ *
+ * @param store
+ * The javamail store this folder is attached to.
+ */
+ protected NNTPFolder(NNTPStore store) {
+ super(store);
+ // get the active connection from the store...all commands are sent
+ // there
+ this.connection = store.getConnection();
+ this.session = store.getSession();
+
+ // set up our permanent flags bit.
+ permanentFlags = new Flags();
+ permanentFlags.add(Flags.Flag.SEEN);
+ }
+
+ /**
+ * Retrieve the folder name.
+ *
+ * @return The folder's name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Retrieve the folder's full name (including hierarchy information). NNTP
+ * folders are flat, so the full name is generally the same as the name.
+ *
+ * @return The full name value.
+ */
+ public String getFullName() {
+ return fullName;
+ }
+
+ /**
+ * Returns the parent folder for this folder. Returns null if this is the
+ * root folder.
+ */
+ public Folder getParent() throws MessagingException {
+ return parent;
+ }
+
+ /**
+ * Indicated whether the folder "exists" or not. Existance in this context
+ * indicates that the group still exists on the server.
+ *
+ * @return
+ * @exception MessagingException
+ */
+ public boolean exists() throws MessagingException {
+ // by default, return true. This is really only the case for the root.
+ // The group folder will
+ // need to override this.
+ return true;
+ }
+
+ /**
+ * List the subfolders. For group folders, this is a meaningless so we throw
+ * a MethodNotSupportedException.
+ *
+ * @param pattern
+ * The folder pattern string.
+ *
+ * @return Never returns.
+ * @exception MessagingException
+ */
+ public Folder[] list(String pattern) throws MessagingException {
+ throw new MethodNotSupportedException("NNTP group folders cannot contain sub folders");
+ }
+
+ /**
+ * Retrieve the list of subscribed folders that match the given pattern
+ * string.
+ *
+ * @param pattern
+ * The pattern string used for the matching
+ *
+ * @return An array of matching folders from the subscribed list.
+ */
+ public Folder[] listSubscribed(String pattern) throws MessagingException {
+ throw new MethodNotSupportedException("NNTP group folders cannot contain sub folders");
+ }
+
+ /**
+ * No sub folders, hence there is no notion of a seperator. We return a null
+ * character (consistent with what Sun returns for POP3 folders).
+ */
+ public char getSeparator() throws MessagingException {
+ return '\0';
+ }
+
+ /**
+ * Return whether this folder can hold just messages or also subfolders.
+ * Only the root folder can hold other folders, so it will need to override.
+ *
+ * @return Either Folder.HOLDS_MESSAGES or Folder.HOLDS_FOLDERS.
+ * @exception MessagingException
+ */
+ public int getType() throws MessagingException {
+ return HOLDS_MESSAGES;
+ }
+
+ /**
+ * Create a new folder. NNTP folders are read only, so this is a nop.
+ *
+ * @param type
+ * The type of folder.
+ *
+ * @return Not support, throws an exception.
+ * @exception MessagingException
+ */
+ public boolean create(int type) throws MessagingException {
+ throw new MethodNotSupportedException("Sub folders cannot be created in NNTP");
+ }
+
+ /**
+ * Check for new messages. We always return false for the root folder. The
+ * group folders will need to override.
+ *
+ * @return Always returns false.
+ * @exception MessagingException
+ */
+ public boolean hasNewMessages() throws MessagingException {
+ return false;
+ }
+
+ /**
+ * Get a named subfolder from this folder. This only has meaning from the
+ * root NNTP folder.
+ *
+ * @param name
+ * The requested name.
+ *
+ * @return If the folder exists, returns a Folder object representing the
+ * named folder.
+ * @exception MessagingException
+ */
+ public Folder getFolder(String name) throws MessagingException {
+ throw new MethodNotSupportedException("NNTP Group folders do not support sub folders");
+ }
+
+ /**
+ * Delete a folder. This is not supported for NNTP.
+ *
+ * @param recurse
+ * The recusion flag.
+ *
+ * @return Never returns.
+ * @exception MessagingException
+ */
+ public boolean delete(boolean recurse) throws MessagingException {
+ throw new MethodNotSupportedException("Deleting of NNTP folders is not supported");
+ }
+
+ /**
+ * Rename a folder. Not supported for NNTP folders.
+ *
+ * @param f
+ * The new folder specifying the rename location.
+ *
+ * @return
+ * @exception MessagingException
+ */
+ public boolean renameTo(Folder f) throws MessagingException {
+ throw new MethodNotSupportedException("Renaming of NNTP folders is not supported.");
+ }
+
+ /**
+ * @see javax.mail.Folder#open(int)
+ */
+ public void open(int mode) throws MessagingException {
+
+ // we don't support READ_WRITE mode, so don't allow opening in that
+ // mode.
+ if (mode == READ_WRITE) {
+ throw new IllegalWriteException("Newsgroup folders cannot be opened read/write");
+ }
+
+ // an only be performed on a closed folder
+ checkClosed();
+
+ this.mode = mode;
+
+ // perform folder type-specific open actions.
+ openFolder();
+
+ folderOpen = true;
+
+ notifyConnectionListeners(ConnectionEvent.OPENED);
+ }
+
+ /**
+ * Perform folder type-specific open actions. The default action is to do
+ * nothing.
+ *
+ * @exception MessagingException
+ */
+ protected void openFolder() throws MessagingException {
+ }
+
+ /**
+ * Peform folder type-specific close actions. The default action is to do
+ * nothing.
+ *
+ * @exception MessagingException
+ */
+ protected void closeFolder() throws MessagingException {
+ }
+
+ /**
+ * Close the folder. Cleans up resources, potentially expunges messages
+ * marked for deletion, and sends an event notification.
+ *
+ * @param expunge
+ * The expunge flag, which is ignored for NNTP folders.
+ *
+ * @exception MessagingException
+ */
+ public void close(boolean expunge) throws MessagingException {
+ // Can only be performed on an open folder
+ checkOpen();
+
+ // give the subclasses an opportunity to do some cleanup
+ closeFolder();
+
+ folderOpen = false;
+ notifyConnectionListeners(ConnectionEvent.CLOSED);
+ }
+
+ /**
+ * Tests the open status of the folder.
+ *
+ * @return true if the folder is open, false otherwise.
+ */
+ public boolean isOpen() {
+ return folderOpen;
+ }
+
+ /**
+ * Get the permanentFlags
+ *
+ * @return The set of permanent flags we support (only SEEN).
+ */
+ public Flags getPermanentFlags() {
+ // we need a copy of our master set.
+ return new Flags(permanentFlags);
+ }
+
+ /**
+ * Get the count of messages in this folder.
+ *
+ * @return The message count.
+ * @exception MessagingException
+ */
+ public int getMessageCount() throws MessagingException {
+ return messageCount;
+ }
+
+ /**
+ * Checks wether the message is in cache, if not will create a new message
+ * object and return it.
+ *
+ * @see javax.mail.Folder#getMessage(int)
+ */
+ public Message getMessage(int msgNum) throws MessagingException {
+ // for the base, we just throw an exception.
+ throw new MethodNotSupportedException("Root NNTP folder does not contain messages");
+ }
+
+ /**
+ * Append messages to a folder. NNTP folders are read only, so this is not
+ * supported.
+ *
+ * @param msgs
+ * The list of messages to append.
+ *
+ * @exception MessagingException
+ */
+ public void appendMessages(Message[] msgs) throws MessagingException {
+ throw new MethodNotSupportedException("Root NNTP folder does not contain messages");
+
+ }
+
+ /**
+ * Expunge messages marked for deletion and return a list of the Messages.
+ * Not supported for NNTP.
+ *
+ * @return Never returns.
+ * @exception MessagingException
+ */
+ public Message[] expunge() throws MessagingException {
+ throw new MethodNotSupportedException("Root NNTP folder does not contain messages");
+ }
+
+ /**
+ * Below is a list of convenience methods that avoid repeated checking for a
+ * value and throwing an exception
+ */
+
+ /** Ensure the folder is open */
+ protected void checkOpen() throws IllegalStateException {
+ if (!folderOpen) {
+ throw new IllegalStateException("Folder is not Open");
+ }
+ }
+
+ /** Ensure the folder is not open */
+ protected void checkClosed() throws IllegalStateException {
+ if (folderOpen) {
+ throw new IllegalStateException("Folder is Open");
+ }
+ }
+
+ /**
+ * @see javax.mail.Folder#notifyMessageChangedListeners(int,
+ * javax.mail.Message)
+ *
+ * this method is protected and cannot be used outside of Folder, therefore
+ * had to explicitly expose it via a method in NNTPFolder, so that
+ * NNTPMessage has access to it
+ *
+ * Bad design on the part of the Java Mail API.
+ */
+ public void notifyMessageChangedListeners(int type, Message m) {
+ super.notifyMessageChangedListeners(type, m);
+ }
+
+ /**
+ * Retrieve the subscribed status for a folder. This default implementation
+ * just returns false (which is true for the root folder).
+ *
+ * @return Always returns true.
+ */
+ public boolean isSubscribed() {
+ return false;
+ }
+
+ /**
+ * Set the subscribed status for a folder.
+ *
+ * @param flag
+ * The new subscribed status.
+ *
+ * @exception MessagingException
+ */
+ public void setSubscribed(boolean flag) throws MessagingException {
+ throw new MessagingException("Root NNTP folder cannot be subscribed to");
+ }
+
+ /**
+ * Test if a given article number is marked as SEEN.
+ *
+ * @param article
+ * The target article number.
+ *
+ * @return The articles current seen status.
+ */
+ public boolean isSeen(int article) {
+ return false;
+ }
+
+ /**
+ * Set the SEEN status for an article.
+ *
+ * @param article
+ * The target article.
+ * @param flag
+ * The new seen setting.
+ *
+ * @exception MessagingException
+ */
+ public void setSeen(int article, boolean flag) throws MessagingException {
+ throw new MessagingException("Root NNTP folder does not contain articles");
+ }
+
+}
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/javamail/trunk/javamail-provider-1.3/src/java/org/apache/geronimo/javamail/store/nntp/NNTPFolder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain