Author: sebb
Date: Fri Mar 25 00:11:19 2011
New Revision: 1085211

URL: http://svn.apache.org/viewvc?rev=1085211&view=rev
Log:
Rework API to ensure backwards API compatibilty

Added:
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java
   (with props)
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java
   (with props)
Modified:
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Article.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommand.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
    
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Threader.java

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Article.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Article.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Article.java 
(original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Article.java 
Fri Mar 25 00:11:19 2011
@@ -149,7 +149,7 @@ public class Article implements Threadab
         return articleId;
     }
 
-    public long getArticleNumber() {
+    public long getArticleNumberLong() {
         return articleNumber;
     }
 
@@ -234,4 +234,21 @@ public class Article implements Threadab
     public String toString(){ // Useful for Eclipse debugging
         return articleNumber + " " +articleId + " " + subject;
     }
+    
+    // DEPRECATED METHODS - for API compatibility only - DO NOT USE
+
+    @Deprecated
+    public int getArticleNumber() {
+        return (int) articleNumber;
+    }
+    
+    @Deprecated
+    public void setArticleNumber(int a) {
+        articleNumber = a;
+    }
+    @Deprecated
+
+    public void addHeaderField(String name, String val) {
+    }
+
 }

Added: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java?rev=1085211&view=auto
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java
 (added)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java
 Fri Mar 25 00:11:19 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.net.nntp;
+/**
+ * Class contains details about an article.
+ * Create an instance of the class and pass it to the appropriate NNTP method.
+ * The values will be populated on return.
+ * 
+ */
+public class ArticleInfo {
+
+    public String articleId;
+    
+    public long articleNumber;
+    
+    public ArticleInfo() {
+    }
+}

Propchange: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticleInfo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/ArticlePointer.java
 Fri Mar 25 00:11:19 2011
@@ -24,11 +24,14 @@ package org.apache.commons.net.nntp;
  * {@link NNTPClient#selectArticle selectArticle}.
  * @author Daniel F. Savarese
  * @see NNTPClient
+ * 
+ * @deprecated 3.0 use {@link ArticleInfo} instead
  */
+@Deprecated
 public final class ArticlePointer
 {
     /** The number of the referenced article. */
-    public long articleNumber;
+    public int articleNumber;
     /**
      * The unique id of the referenced article, including the enclosing
      * &lt and &gt symbols which are technically not part of the

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java 
(original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTP.java 
Fri Mar 25 00:11:19 2011
@@ -1011,6 +1011,33 @@ public class NNTP extends SocketClient
         command.append(wildmat);
         return sendCommand(NNTPCommand.LIST, command.toString());
     }
+
+    // DEPRECATED METHODS - for API compatibility only - DO NOT USE
+
+    @Deprecated
+    public int article(int a) throws IOException
+    {
+        return article((long) a);
+    }
+
+    @Deprecated
+    public int body(int a) throws IOException
+    {
+        return body((long) a);
+    }
+
+    @Deprecated
+    public int head(int a) throws IOException
+    {
+        return head((long) a);
+    }
+
+    @Deprecated
+    public int stat(int a) throws IOException
+    {
+        return stat((long) a);
+    }
+
 }
 
 /* Emacs configuration

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPClient.java
 Fri Mar 25 00:11:19 2011
@@ -19,6 +19,7 @@ package org.apache.commons.net.nntp;
 
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.util.ArrayList;
@@ -89,8 +90,15 @@ import org.apache.commons.net.io.Util;
 public class NNTPClient extends NNTP
 {
 
-    // reply will consist of 22n nnn <aaa>
-    private void __parseArticlePointer(String reply, ArticlePointer pointer)
+    /**
+     * Parse the reply and store the id and number in the pointer.
+     * 
+     * @param reply the reply to parse "22n nnn <aaa>"
+     * @param pointer the pointer to update
+     * 
+     * @throws MalformedServerReplyException
+     */
+    private void __parseArticlePointer(String reply, ArticleInfo pointer)
     throws MalformedServerReplyException
     {
         String tokens[] = reply.split(" ");
@@ -268,7 +276,7 @@ public class NNTPClient extends NNTP
 
 
     private BufferedReader __retrieve(int command,
-                              String articleId, ArticlePointer pointer)
+                              String articleId, ArticleInfo pointer)
     throws IOException
     {
         if (articleId != null)
@@ -294,11 +302,11 @@ public class NNTPClient extends NNTP
 
 
     private BufferedReader __retrieve(int command,
-                              int articleNumber, ArticlePointer pointer)
+                              long articleNumber, ArticleInfo pointer)
     throws IOException
     {
         if (!NNTPReply.isPositiveCompletion(sendCommand(command,
-                                            Integer.toString(articleNumber)))) 
{
+                                            Long.toString(articleNumber)))) {
             return null;
         }
 
@@ -315,8 +323,8 @@ public class NNTPClient extends NNTP
      * Retrieves an article from the NNTP server.  The article is referenced
      * by its unique article identifier (including the enclosing &lt and &gt).
      * The article number and identifier contained in the server reply
-     * are returned through an ArticlePointer.  The <code> articleId </code>
-     * field of the ArticlePointer cannot always be trusted because some
+     * are returned through an ArticleInfo.  The <code> articleId </code>
+     * field of the ArticleInfo cannot always be trusted because some
      * NNTP servers do not correctly follow the RFC 977 reply format.
      * <p>
      * A DotTerminatedMessageReader is returned from which the article can
@@ -350,23 +358,29 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public BufferedReader retrieveArticle(String articleId, ArticlePointer 
pointer)
+    public BufferedReader retrieveArticle(String articleId, ArticleInfo 
pointer)
     throws IOException
     {
         return __retrieve(NNTPCommand.ARTICLE, articleId, pointer);
 
     }
 
-    /*** Same as <code> retrieveArticle(articleId, null) </code> ***/
-    public BufferedReader retrieveArticle(String articleId) throws IOException
+    /**
+     * Same as <code> retrieveArticle(articleId, (ArticleInfo) null) </code>
+     * Note: the return can be cast to a {@link BufferedReader} 
+     */
+    public Reader retrieveArticle(String articleId) throws IOException
     {
-        return retrieveArticle(articleId, null);
+        return retrieveArticle(articleId, (ArticleInfo) null);
     }
 
-    /*** Same as <code> retrieveArticle(null) </code> ***/
-    public BufferedReader retrieveArticle() throws IOException
+    /** 
+     * Same as <code> retrieveArticle((String) null) </code>
+     * Note: the return can be cast to a {@link BufferedReader} 
+     */
+    public Reader retrieveArticle() throws IOException
     {
-        return retrieveArticle(null);
+        return retrieveArticle((String) null);
     }
 
 
@@ -374,8 +388,8 @@ public class NNTPClient extends NNTP
      * Retrieves an article from the currently selected newsgroup.  The
      * article is referenced by its article number.
      * The article number and identifier contained in the server reply
-     * are returned through an ArticlePointer.  The <code> articleId </code>
-     * field of the ArticlePointer cannot always be trusted because some
+     * are returned through an ArticleInfo.  The <code> articleId </code>
+     * field of the ArticleInfo cannot always be trusted because some
      * NNTP servers do not correctly follow the RFC 977 reply format.
      * <p>
      * A DotTerminatedMessageReader is returned from which the article can
@@ -408,14 +422,14 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public BufferedReader retrieveArticle(int articleNumber, ArticlePointer 
pointer)
+    public BufferedReader retrieveArticle(long articleNumber, ArticleInfo 
pointer)
     throws IOException
     {
         return __retrieve(NNTPCommand.ARTICLE, articleNumber, pointer);
     }
 
     /*** Same as <code> retrieveArticle(articleNumber, null) </code> ***/
-    public BufferedReader retrieveArticle(int articleNumber) throws IOException
+    public BufferedReader retrieveArticle(long articleNumber) throws 
IOException
     {
         return retrieveArticle(articleNumber, null);
     }
@@ -427,8 +441,8 @@ public class NNTPClient extends NNTP
      * referenced
      * by its unique article identifier (including the enclosing &lt and &gt).
      * The article number and identifier contained in the server reply
-     * are returned through an ArticlePointer.  The <code> articleId </code>
-     * field of the ArticlePointer cannot always be trusted because some
+     * are returned through an ArticleInfo.  The <code> articleId </code>
+     * field of the ArticleInfo cannot always be trusted because some
      * NNTP servers do not correctly follow the RFC 977 reply format.
      * <p>
      * A DotTerminatedMessageReader is returned from which the article can
@@ -462,23 +476,29 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public BufferedReader retrieveArticleHeader(String articleId, 
ArticlePointer pointer)
+    public BufferedReader retrieveArticleHeader(String articleId, ArticleInfo 
pointer)
     throws IOException
     {
         return __retrieve(NNTPCommand.HEAD, articleId, pointer);
 
     }
 
-    /*** Same as <code> retrieveArticleHeader(articleId, null) </code> ***/
-    public BufferedReader retrieveArticleHeader(String articleId) throws 
IOException
+    /**
+     * Same as <code> retrieveArticleHeader(articleId, (ArticleInfo) null) 
</code> 
+     *  Note: the return can be cast to a {@link BufferedReader}
+     */
+    public Reader retrieveArticleHeader(String articleId) throws IOException
     {
-        return retrieveArticleHeader(articleId, null);
+        return retrieveArticleHeader(articleId, (ArticleInfo) null);
     }
 
-    /*** Same as <code> retrieveArticleHeader(null) </code> ***/
-    public BufferedReader retrieveArticleHeader() throws IOException
+    /**
+     * Same as <code> retrieveArticleHeader((String) null) </code>
+     *  Note: the return can be cast to a {@link BufferedReader}
+     */
+    public Reader retrieveArticleHeader() throws IOException
     {
-        return retrieveArticleHeader(null);
+        return retrieveArticleHeader((String) null);
     }
 
 
@@ -486,8 +506,8 @@ public class NNTPClient extends NNTP
      * Retrieves an article header from the currently selected newsgroup.  The
      * article is referenced by its article number.
      * The article number and identifier contained in the server reply
-     * are returned through an ArticlePointer.  The <code> articleId </code>
-     * field of the ArticlePointer cannot always be trusted because some
+     * are returned through an ArticleInfo.  The <code> articleId </code>
+     * field of the ArticleInfo cannot always be trusted because some
      * NNTP servers do not correctly follow the RFC 977 reply format.
      * <p>
      * A DotTerminatedMessageReader is returned from which the article can
@@ -520,8 +540,8 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public BufferedReader retrieveArticleHeader(int articleNumber,
-                                        ArticlePointer pointer)
+    public BufferedReader retrieveArticleHeader(long articleNumber,
+                                        ArticleInfo pointer)
     throws IOException
     {
         return __retrieve(NNTPCommand.HEAD, articleNumber, pointer);
@@ -529,7 +549,7 @@ public class NNTPClient extends NNTP
 
 
     /*** Same as <code> retrieveArticleHeader(articleNumber, null) </code> ***/
-    public BufferedReader retrieveArticleHeader(int articleNumber) throws 
IOException
+    public BufferedReader retrieveArticleHeader(long articleNumber) throws 
IOException
     {
         return retrieveArticleHeader(articleNumber, null);
     }
@@ -541,8 +561,8 @@ public class NNTPClient extends NNTP
      * referenced
      * by its unique article identifier (including the enclosing &lt and &gt).
      * The article number and identifier contained in the server reply
-     * are returned through an ArticlePointer.  The <code> articleId </code>
-     * field of the ArticlePointer cannot always be trusted because some
+     * are returned through an ArticleInfo.  The <code> articleId </code>
+     * field of the ArticleInfo cannot always be trusted because some
      * NNTP servers do not correctly follow the RFC 977 reply format.
      * <p>
      * A DotTerminatedMessageReader is returned from which the article can
@@ -576,21 +596,27 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public BufferedReader retrieveArticleBody(String articleId, ArticlePointer 
pointer)
+    public BufferedReader retrieveArticleBody(String articleId, ArticleInfo 
pointer)
     throws IOException
     {
         return __retrieve(NNTPCommand.BODY, articleId, pointer);
 
     }
 
-    /*** Same as <code> retrieveArticleBody(articleId, null) </code> ***/
-    public BufferedReader retrieveArticleBody(String articleId) throws 
IOException
+    /**
+     * Same as <code> retrieveArticleBody(articleId, (ArticleInfo) null) 
</code> 
+     *  Note: the return can be cast to a {@link BufferedReader}
+     */
+    public Reader retrieveArticleBody(String articleId) throws IOException
     {
-        return retrieveArticleBody(articleId, null);
+        return retrieveArticleBody(articleId, (ArticleInfo) null);
     }
 
-    /*** Same as <code> retrieveArticleBody(null) </code> ***/
-    public BufferedReader retrieveArticleBody() throws IOException
+    /**
+     * Same as <code> retrieveArticleBody(null) </code> 
+     *  Note: the return can be cast to a {@link BufferedReader} 
+     */
+    public Reader retrieveArticleBody() throws IOException
     {
         return retrieveArticleBody(null);
     }
@@ -600,8 +626,8 @@ public class NNTPClient extends NNTP
      * Retrieves an article body from the currently selected newsgroup.  The
      * article is referenced by its article number.
      * The article number and identifier contained in the server reply
-     * are returned through an ArticlePointer.  The <code> articleId </code>
-     * field of the ArticlePointer cannot always be trusted because some
+     * are returned through an ArticleInfo.  The <code> articleId </code>
+     * field of the ArticleInfo cannot always be trusted because some
      * NNTP servers do not correctly follow the RFC 977 reply format.
      * <p>
      * A DotTerminatedMessageReader is returned from which the article can
@@ -634,8 +660,8 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public BufferedReader retrieveArticleBody(int articleNumber,
-                                      ArticlePointer pointer)
+    public BufferedReader retrieveArticleBody(long articleNumber,
+                                      ArticleInfo pointer)
     throws IOException
     {
         return __retrieve(NNTPCommand.BODY, articleNumber, pointer);
@@ -643,7 +669,7 @@ public class NNTPClient extends NNTP
 
 
     /*** Same as <code> retrieveArticleBody(articleNumber, null) </code> ***/
-    public BufferedReader retrieveArticleBody(int articleNumber) throws 
IOException
+    public BufferedReader retrieveArticleBody(long articleNumber) throws 
IOException
     {
         return retrieveArticleBody(articleNumber, null);
     }
@@ -758,7 +784,7 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public boolean selectArticle(String articleId, ArticlePointer pointer)
+    public boolean selectArticle(String articleId, ArticleInfo pointer)
     throws IOException
     {
         if (articleId != null)
@@ -778,17 +804,17 @@ public class NNTPClient extends NNTP
         return true;
     }
 
-    /**** Same as <code> selectArticle(articleId, null) </code> ***/
+    /**** Same as <code> selectArticle(articleId, (ArticleInfo) null) </code> 
***/
     public boolean selectArticle(String articleId) throws IOException
     {
-        return selectArticle(articleId, null);
+        return selectArticle(articleId, (ArticleInfo) null);
     }
 
     /****
-     * Same as <code> selectArticle(null, articleId) </code>.  Useful
+     * Same as <code> selectArticle((String) null, articleId) </code>.  Useful
      * for retrieving the current article number.
      ***/
-    public boolean selectArticle(ArticlePointer pointer) throws IOException
+    public boolean selectArticle(ArticleInfo pointer) throws IOException
     {
         return selectArticle(null, pointer);
     }
@@ -819,7 +845,7 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public boolean selectArticle(long articleNumber, ArticlePointer pointer)
+    public boolean selectArticle(long articleNumber, ArticleInfo pointer)
     throws IOException
     {
         if (!NNTPReply.isPositiveCompletion(stat(articleNumber)))
@@ -863,7 +889,7 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public boolean selectPreviousArticle(ArticlePointer pointer)
+    public boolean selectPreviousArticle(ArticleInfo pointer)
     throws IOException
     {
         if (!NNTPReply.isPositiveCompletion(last()))
@@ -875,10 +901,10 @@ public class NNTPClient extends NNTP
         return true;
     }
 
-    /*** Same as <code> selectPreviousArticle(null) </code> ***/
+    /*** Same as <code> selectPreviousArticle((ArticleInfo) null) </code> ***/
     public boolean selectPreviousArticle() throws IOException
     {
-        return selectPreviousArticle(null);
+        return selectPreviousArticle((ArticleInfo) null);
     }
 
 
@@ -906,7 +932,7 @@ public class NNTPClient extends NNTP
      * @exception IOException  If an I/O error occurs while either sending a
      *      command to the server or receiving a reply from the server.
      ***/
-    public boolean selectNextArticle(ArticlePointer pointer) throws IOException
+    public boolean selectNextArticle(ArticleInfo pointer) throws IOException
     {
         if (!NNTPReply.isPositiveCompletion(next()))
             return false;
@@ -918,10 +944,10 @@ public class NNTPClient extends NNTP
     }
 
 
-    /*** Same as <code> selectNextArticle(null) </code> ***/
+    /*** Same as <code> selectNextArticle((ArticleInfo) null) </code> ***/
     public boolean selectNextArticle() throws IOException
     {
-        return selectNextArticle(null);
+        return selectNextArticle((ArticleInfo) null);
     }
 
 
@@ -1388,9 +1414,9 @@ public class NNTPClient extends NNTP
      * @return a DotTerminatedReader if successful, null otherwise
      * @throws IOException
      */
-    public BufferedReader retrieveArticleInfo(int articleNumber) throws 
IOException
+    public BufferedReader retrieveArticleInfo(long articleNumber) throws 
IOException
     {
-        return __retrieveArticleInfo(Integer.toString(articleNumber));
+        return __retrieveArticleInfo(Long.toString(articleNumber));
     }
 
     /**
@@ -1478,13 +1504,228 @@ public class NNTPClient extends NNTP
      * @return a DotTerminatedReader if successful, null otherwise
      * @throws IOException
      */
-    public BufferedReader retrieveHeader(String header, int lowArticleNumber,
-                                 int highArticleNumber)
+    public BufferedReader retrieveHeader(String header, long lowArticleNumber,
+                                 long highArticleNumber)
         throws IOException
     {
         return
             __retrieveHeader(header,lowArticleNumber + "-" + 
highArticleNumber);
     }
+
+
+    
+    
+
+    // DEPRECATED METHODS - for API compatibility only - DO NOT USE
+    // ============================================================
+    
+    
+
+    /** 
+     * @deprecated 3.0 use {@link #retrieveHeader(String, long, long)} instead
+     */
+    @Deprecated
+    public Reader retrieveHeader(String s, int l, int h)
+        throws IOException 
+    {
+        return retrieveHeader(s, (long) l, (long) h);
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleInfo(long, long)} instead
+     */
+    @Deprecated
+    public Reader retrieveArticleInfo(int a, int b) throws IOException {
+        return retrieveArticleInfo((long) a, (long) b);
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #retrieveHeader(String, long)} instead
+     */
+    @Deprecated
+    public Reader retrieveHeader(String a, int b) throws IOException {
+        return retrieveHeader(a, (long) b);
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #selectArticle(long, ArticleInfo)} instead
+     */
+    @Deprecated
+    public boolean selectArticle(int a, ArticlePointer ap) throws IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        boolean b = selectArticle(a, ai);
+        __ai2ap(ai, ap);
+        return b;
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleInfo(long)} instead
+     */
+    @Deprecated
+    public Reader retrieveArticleInfo(int a) throws IOException {
+        return retrieveArticleInfo((long) a);
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #selectArticle(long)} instead
+     */
+    @Deprecated
+    public boolean selectArticle(int a) throws IOException {
+        return selectArticle((long) a);
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleHeader(long)} instead
+     */
+    @Deprecated
+    public Reader retrieveArticleHeader(int a) throws IOException {
+        return retrieveArticleHeader((long) a);
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleHeader(long, ArticleInfo)} 
instead
+     */
+    @Deprecated
+    public Reader retrieveArticleHeader(int a, ArticlePointer ap) throws 
IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        Reader rdr = retrieveArticleHeader(a, ai);
+        __ai2ap(ai, ap);
+        return rdr;
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleBody(long)} instead
+     */
+    @Deprecated
+    public Reader retrieveArticleBody(int a) throws IOException {
+        return retrieveArticleBody((long) a);
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticle(long, ArticleInfo)} instead
+     */
+    @Deprecated
+    public Reader retrieveArticle(int a, ArticlePointer ap) throws IOException 
{
+        ArticleInfo ai =  __ap2ai(ap);
+        Reader rdr = retrieveArticle(a, ai);
+        __ai2ap(ai, ap);
+        return rdr;
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticle(long)} instead
+     */
+    @Deprecated
+    public Reader retrieveArticle(int a) throws IOException {
+        return retrieveArticle((long) a);        
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleBody(long, ArticleInfo)} 
instead
+     */
+    @Deprecated
+    public Reader retrieveArticleBody(int a, ArticlePointer ap) throws 
IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        Reader rdr = retrieveArticleBody(a, ai);
+        __ai2ap(ai, ap);
+        return rdr;
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticle(String, ArticleInfo)} 
instead
+     */
+    @Deprecated
+    public Reader retrieveArticle(String a, ArticlePointer ap) throws 
IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        Reader rdr = retrieveArticle(a, ai);
+        __ai2ap(ai, ap);
+        return rdr;        
+    }
+
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleBody(String, ArticleInfo)} 
instead
+     */
+    @Deprecated
+    public Reader retrieveArticleBody(String a, ArticlePointer ap) throws 
IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        Reader rdr = retrieveArticleBody(a, ai);
+        __ai2ap(ai, ap);
+        return rdr;                
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #retrieveArticleHeader(String, ArticleInfo)} 
instead
+     */
+    @Deprecated
+    public Reader retrieveArticleHeader(String a, ArticlePointer ap) throws 
IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        Reader rdr = retrieveArticleHeader(a, ai);
+        __ai2ap(ai, ap);
+        return rdr;                        
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #selectArticle(String, ArticleInfo)} instead
+     */
+    @Deprecated
+    public boolean selectArticle(String a, ArticlePointer ap) throws 
IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        boolean b = selectArticle(a, ai);
+        __ai2ap(ai, ap);
+        return b;
+        
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #selectArticle(ArticleInfo)} instead
+     */
+    @Deprecated
+    public boolean selectArticle(ArticlePointer ap) throws IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        boolean b = selectArticle(ai);
+        __ai2ap(ai, ap);
+        return b;
+        
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #selectNextArticle(ArticleInfo)} instead
+     */
+    @Deprecated
+    public boolean selectNextArticle(ArticlePointer ap) throws IOException {
+        ArticleInfo ai =  __ap2ai(ap);
+        boolean b = selectNextArticle(ai);
+        __ai2ap(ai, ap);
+        return b;
+        
+    }
+    
+    /**
+     * @deprecated 3.0 use {@link #selectPreviousArticle(ArticleInfo)} instead
+     */
+    @Deprecated
+    public boolean selectPreviousArticle(ArticlePointer ap) throws IOException 
{
+        ArticleInfo ai =  __ap2ai(ap);
+        boolean b = selectPreviousArticle(ai);
+        __ai2ap(ai, ap);
+        return b;        
+    }
+
+   // Helper methods
+    
+    private ArticleInfo __ap2ai(@SuppressWarnings("deprecation") 
ArticlePointer ap) {
+        if (ap == null) return null;
+        ArticleInfo ai = new ArticleInfo();
+        return ai;
+    }
+
+    @SuppressWarnings("deprecation")
+    private void __ai2ap(ArticleInfo ai, ArticlePointer ap){
+        if (ap != null) { // ai cannot be null
+            ap.articleId = ai.articleId;
+            ap.articleNumber = (int) ai.articleNumber;
+        }
+    }
 }
 
 

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommand.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommand.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommand.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommand.java
 Fri Mar 25 00:11:19 2011
@@ -67,7 +67,7 @@ public final class NNTPCommand
      * @return The NNTP protcol command string corresponding to a specified
      *         command code.
      ***/
-    static final String getCommand(int command)
+    public static final String getCommand(int command)
     {
         return _commands[command];
     }

Added: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java?rev=1085211&view=auto
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java
 (added)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java
 Fri Mar 25 00:11:19 2011
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.net.nntp;
+
+/**
+ * NNTPCommands stores a set of constants for NNTP command codes.
+ * To interpret the meaning of the codes, familiarity with RFC 977 / RFC 2980 
is assumed.
+ * <p>
+ */
+
+public enum NNTPCommands
+{
+    ARTICLE(1),                               // Message Id or server article 
number
+    AUTHINFO,                                 // TBA
+    BODY(1),                                  // Message Id or server article 
number
+    CHECK(1),                                 // Message Id +++
+    DATE,                                     // NONE ++
+    GROUP(1),                                 // newsgroup name
+    HEAD(1),                                  // Message Id or server article 
number
+    HELP,                                     // NONE
+    IHAVE(1),                                 // Message Id
+    LAST,                                     // NONE
+    LIST,                                     // NONE
+    LIST_ACTIVE("LIST ACTIVE", 1),            // Pattern ++
+    LIST_ACTIVE_TIMES("LIST ACTIVE.TIMES"),   // NONE ++
+    LIST_DISTRIBUTIONS("LIST DISTRIBUTIONS"), // NONE ++
+    LIST_DISTRIB_PATS("LIST DISTRIB.PATS"),   // NONE ++
+    LIST_NEWSGROUPS("LIST NEWSGROUPS", 1),   // Pattern ++
+    LIST_OVERVIEW_FMT("LIST OVERVIEW.FMT"),   // NONE ++
+    LIST_SUBSCRIPTIONS("LIST SUBSCRIPTIONS"), // NONE ++
+    LISTGROUP(1),                             // Newsgroup name
+    MODE_READER("MODE READER"),               // NONE ++
+//  MODE_STREAM,                              // NONE
+    NEWGROUPS(3, 4),                          // date, time, GMT?, 
distribution list
+    NEWNEWS(3, 4),                            // date, time, GMT?, 
distribution list
+    NEXT,                                     // NONE
+    POST,                                     // NONE
+    QUIT,                                     // NONE
+//  SLAVE,                                    // NONE
+    STAT(1),                                  // server article number
+    TAKETHIS(1),                              // Message Id ++
+//  XGTITLE deprecated - see LIST_NEWSGROUPS
+    XHDR(1, 2),                               // Header name [message id | 
range of article numbers]
+//  XINDEX, // Newsgroup name => prefer XOVER
+    XOVER(1, 2),                              // article number or range of 
article numbers
+    XPAT(3, 4),                               // Header name, pattern, message 
id or range of article numbers
+    XPATH(1),                                 // Message id
+//  XREPLIC,
+    XROVER(1, 2),                             // article number or range of 
article numbers
+//  XTHREAD // c.f. XINDEX => prefer XOVER
+   ;
+
+    private final String command;
+    private final int minParamCount;
+    private final int maxParamCount;
+
+    NNTPCommands() {
+        this(null, 0, 0);
+    }
+
+    NNTPCommands(String s) {
+        this(s, 0, 0);
+    }
+
+    NNTPCommands(String s, int count) {
+        this(s, count, count);
+    }
+
+    NNTPCommands(int min, int max) {
+        this(null, min, max);
+    }
+
+    NNTPCommands(int count) {
+        this(null, count, count);
+    }
+
+    NNTPCommands(String s, int min, int max) {
+        this.command = s;
+        this.minParamCount = min;
+        this.maxParamCount = max;
+    }
+
+    /**
+     * Get the command to be sent to the server.
+     *
+     * @return the command string, never {@code null}
+     */
+    public String getCommand() {
+        return command != null ? command : name() ;
+    }
+
+    public boolean hasParam() {
+        return minParamCount > 0;
+    }
+}
+
+/* Emacs configuration
+ * Local variables:        **
+ * mode:             java  **
+ * c-basic-offset:   4     **
+ * indent-tabs-mode: nil   **
+ * End:                    **
+ */

Propchange: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPCommands.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPReply.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NNTPReply.java
 Fri Mar 25 00:11:19 2011
@@ -158,6 +158,88 @@ public final class NNTPReply
         return (reply >= 500 && reply < 600);
     }
 
+    // DEPRECATED for API compatibility only - DO NOT USE
+
+    @Deprecated // 3.0
+    public static final int CODE_100 = 100;
+    @Deprecated
+    public static final int CODE_199 = 199;
+    @Deprecated
+    public static final int CODE_200 = 200;
+    @Deprecated
+    public static final int CODE_201 = 201;
+    @Deprecated
+    public static final int CODE_202 = 202;
+    @Deprecated
+    public static final int CODE_205 = 205;
+    @Deprecated
+    public static final int CODE_211 = 211;
+    @Deprecated
+    public static final int CODE_215 = 215;
+    @Deprecated
+    public static final int CODE_220 = 220;
+    @Deprecated
+    public static final int CODE_221 = 221;
+    @Deprecated
+    public static final int CODE_222 = 222;
+    @Deprecated
+    public static final int CODE_223 = 223;
+    @Deprecated
+    public static final int CODE_230 = 230;
+    @Deprecated
+    public static final int CODE_231 = 231;
+    @Deprecated
+    public static final int CODE_235 = 235;
+    @Deprecated
+    public static final int CODE_240 = 240;
+    @Deprecated
+    public static final int CODE_281 = 281;
+    @Deprecated
+    public static final int CODE_335 = 335;
+    @Deprecated
+    public static final int CODE_340 = 340;
+    @Deprecated
+    public static final int CODE_381 = 381;
+    @Deprecated
+    public static final int CODE_400 = 400;
+    @Deprecated
+    public static final int CODE_408 = 408; // Not actually needed; kept for 
API compatibility
+    @Deprecated
+    public static final int CODE_411 = 411;
+    @Deprecated
+    public static final int CODE_412 = 412;
+    @Deprecated
+    public static final int CODE_420 = 420;
+    @Deprecated
+    public static final int CODE_421 = 421;
+    @Deprecated
+    public static final int CODE_422 = 422;
+    @Deprecated
+    public static final int CODE_423 = 423;
+    @Deprecated
+    public static final int CODE_430 = 430;
+    @Deprecated
+    public static final int CODE_435 = 435;
+    @Deprecated
+    public static final int CODE_436 = 436;
+    @Deprecated
+    public static final int CODE_437 = 437;
+    @Deprecated
+    public static final int CODE_440 = 440;
+    @Deprecated
+    public static final int CODE_441 = 441;
+    @Deprecated
+    public static final int CODE_480 = 480;
+    @Deprecated
+    public static final int CODE_482 = 482;
+    @Deprecated
+    public static final int CODE_500 = 500;
+    @Deprecated
+    public static final int CODE_501 = 501;
+    @Deprecated
+    public static final int CODE_502 = 502;
+    @Deprecated
+    public static final int CODE_503 = 503;
 }
 
 /* Emacs configuration

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/NewsgroupInfo.java
 Fri Mar 25 00:11:19 2011
@@ -100,7 +100,7 @@ public final class NewsgroupInfo
      * <p>
      * @return The estimated number of articles in the newsgroup.
      ***/
-    public long getArticleCount()
+    public long getArticleCountLong()
     {
         return __estimatedArticleCount;
     }
@@ -110,7 +110,7 @@ public final class NewsgroupInfo
      * <p>
      * @return The number of the first article in the newsgroup.
      ***/
-    public long getFirstArticle()
+    public long getFirstArticleLong()
     {
         return __firstArticle;
     }
@@ -120,7 +120,7 @@ public final class NewsgroupInfo
      * <p>
      * @return The number of the last article in the newsgroup.
      ***/
-    public long getLastArticle()
+    public long getLastArticleLong()
     {
         return __lastArticle;
     }
@@ -153,4 +153,21 @@ public final class NewsgroupInfo
       return buffer.toString();
 }
     */
+    
+    // DEPRECATED METHODS - for API compatibility only - DO NOT USE
+
+    @Deprecated
+    public int getArticleCount() {
+        return (int) __estimatedArticleCount;
+    }
+
+    @Deprecated
+    public int getFirstArticle() {
+        return (int) __firstArticle;
+    }
+
+    @Deprecated
+    public int getLastArticle() {
+        return (int) __lastArticle;
+    }
 }

Modified: 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Threader.java
URL: 
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Threader.java?rev=1085211&r1=1085210&r2=1085211&view=diff
==============================================================================
--- 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Threader.java
 (original)
+++ 
commons/proper/net/trunk/src/main/java/org/apache/commons/net/nntp/Threader.java
 Fri Mar 25 00:11:19 2011
@@ -29,6 +29,7 @@ package org.apache.commons.net.nntp;
 
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 
 public class Threader {
     private ThreadContainer root;
@@ -36,13 +37,24 @@ public class Threader {
     private int bogusIdCount = 0;
 
     /**
-     * The main threader entry point - The client passes in a list of 
Threadable objects, and
+     * The client passes in a list of Threadable objects, and
      * the Threader constructs a connected 'graph' of messages
-     * @param messages iterable of messages to thread
+     * @param messages list of messages to thread
      * @return null if messages == null or root.child == null
      * @since 2.2
      */
-    public Threadable thread(Iterable<? extends Threadable> messages) {
+    public Threadable thread(List<? extends Threadable> messages) {
+        return thread((Iterable<? extends Threadable>)messages);
+    }
+
+    /**
+     * The client passes in a list of Iterable objects, and
+     * the Threader constructs a connected 'graph' of messages
+     * @param messages iterable of messages to thread
+     * @return null if messages == null or root.child == null
+     * @since 3.0
+     */
+    public Threadable thread(Iterable<? extends Threadable> messages) {       
         if (messages == null)
             return null;
 
@@ -402,4 +414,20 @@ public class Threader {
         subjectTable = null;
 
     }
+    
+
+    // DEPRECATED METHODS - for API compatibility only - DO NOT USE
+
+    /**
+     * The client passes in an array of Threadable objects, and
+     * the Threader constructs a connected 'graph' of messages
+     * @param messages array of messages to thread
+     * @return null if messages == null or root.child == null
+     * @deprecated (2.2) prefer {@link #thread(List)}
+     */
+    @Deprecated
+    public Threadable thread(Threadable[] messages) {
+        return thread(java.util.Arrays.asList(messages));
+    }
+
 }


Reply via email to