You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by hb...@apache.org on 2001/11/11 00:10:59 UTC

cvs commit: jakarta-james/src/java/org/apache/james/nntpserver/repository ArticleIDRepository.java NNTPArticle.java NNTPArticleImpl.java NNTPGroup.java NNTPGroupImpl.java NNTPLineReader.java NNTPLineReaderImpl.java NNTPRepository.java NNTPRepositoryImpl.java NNTPSpooler.java NNTPUtil.java

hbedi       01/11/10 15:10:59

  Modified:    src/java/org/apache/james/nntpserver/repository
                        ArticleIDRepository.java NNTPArticle.java
                        NNTPArticleImpl.java NNTPGroup.java
                        NNTPGroupImpl.java NNTPLineReader.java
                        NNTPLineReaderImpl.java NNTPRepository.java
                        NNTPRepositoryImpl.java NNTPSpooler.java
                        NNTPUtil.java
  Log:
  NNTP HDR command was not working correctly. Better comments. First pass at cleanup/javadoc.
  
  Revision  Changes    Path
  1.3       +17 -12    jakarta-james/src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java
  
  Index: ArticleIDRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/ArticleIDRepository.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ArticleIDRepository.java	2001/06/25 18:13:15	1.2
  +++ ArticleIDRepository.java	2001/11/10 23:10:59	1.3
  @@ -7,26 +7,31 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.util.*;
  -import java.io.*;
  -import org.apache.avalon.excalibur.io.ExtensionFileFilter;
  -import org.apache.avalon.excalibur.io.InvertedFileFilter;
  -import org.apache.avalon.excalibur.io.AndFileFilter;
  -import org.apache.james.nntpserver.NNTPException;
  -import org.apache.james.nntpserver.DateSinceFileFilter;
  +import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.FileOutputStream;
  +import java.io.IOException;
  +import java.util.Date;
  +import java.util.Enumeration;
  +import java.util.Hashtable;
  +import java.util.Properties;
  +import org.apache.james.nntpserver.repository.ArticleIDRepository;
  +import org.apache.james.nntpserver.repository.NNTPGroup;
  +import org.apache.james.nntpserver.repository.NNTPRepository;
   import org.apache.james.util.Base64;
   
  -
   /** 
    * ArticleIDRepository: contains one file for each article.
    * the file name is Base64 encoded article ID
    * The first line of the file is '# <create date of file>
    * the rest of line have <newsgroup name>=<article number>
  + * Allows fast lookup of a message by message id.
  + *
  + * This class allows a process to iterate and sycnhronize messages with other NNTP Servers.
  + * This may be inefficient. It may be better to use an alternate, more 
  + * efficient process for synchronization and this class for sanity check.
    *
  - * this would allow fast lookup of a message by message id.
  - * allow a process to iterate and sycnhronize messages with other NNTP Servers.
  - * this may be inefficient, so could be used for sanity checks and an alternate
  - * more efficient process could be used for synchronization.
  + * @author Harmeet Bedi <ha...@kodemuse.com>
    */
   public class ArticleIDRepository {
       private final File root;
  
  
  
  1.2       +6 -3      jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPArticle.java
  
  Index: NNTPArticle.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPArticle.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPArticle.java	2001/05/15 14:41:39	1.1
  +++ NNTPArticle.java	2001/11/10 23:10:59	1.2
  @@ -7,10 +7,13 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.io.*;
  -import javax.mail.internet.InternetHeaders;
  -import org.apache.james.nntpserver.NNTPException;
  +import java.io.PrintWriter;
   
  +/** 
  + * Contract exposed by a NewsGroup Article
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public interface NNTPArticle {
       NNTPGroup getGroup();
       int getArticleNumber();
  
  
  
  1.2       +11 -1     jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPArticleImpl.java
  
  Index: NNTPArticleImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPArticleImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPArticleImpl.java	2001/05/15 14:41:39	1.1
  +++ NNTPArticleImpl.java	2001/11/10 23:10:59	1.2
  @@ -7,10 +7,20 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.io.*;
  +import java.io.BufferedReader;
  +import java.io.File;
  +import java.io.FileInputStream;
  +import java.io.FileReader;
  +import java.io.IOException;
  +import java.io.PrintWriter;
   import javax.mail.internet.InternetHeaders;
   import org.apache.james.nntpserver.NNTPException;
   
  +/** 
  + * Please see NNTPArticle for comments
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   class NNTPArticleImpl implements NNTPArticle {
       private final File f;
       NNTPArticleImpl(File f) {
  
  
  
  1.2       +10 -8     jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPGroup.java
  
  Index: NNTPGroup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPGroup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPGroup.java	2001/05/15 14:41:39	1.1
  +++ NNTPGroup.java	2001/11/10 23:10:59	1.2
  @@ -7,20 +7,22 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.util.*;
  -import java.io.*;
  -import org.apache.avalon.excalibur.io.ExtensionFileFilter;
  -import org.apache.avalon.excalibur.io.InvertedFileFilter;
  -import org.apache.avalon.excalibur.io.AndFileFilter;
  -import org.apache.james.nntpserver.NNTPException;
  -import org.apache.james.nntpserver.DateSinceFileFilter;
  +import java.util.Date;
  +import java.util.Iterator;
   
  +/** 
  + * Contract exposed by a NewsGroup
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public interface NNTPGroup {
       String getName();
       String getDescription();
       boolean isPostAllowed();
   
  -    // the current article pointer. <0 indicates invalid/unknown value
  +    /** the current article pointer. 
  +     * @return <0 indicates invalid/unknown value
  +     */
       int getCurrentArticleNumber();
       void setCurrentArticleNumber(int articleNumber);
   
  
  
  
  1.2       +12 -6     jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java
  
  Index: NNTPGroupImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPGroupImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPGroupImpl.java	2001/05/15 14:41:39	1.1
  +++ NNTPGroupImpl.java	2001/11/10 23:10:59	1.2
  @@ -7,16 +7,22 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.util.*;
  -import java.io.*;
  +import java.io.File;
  +import java.util.ArrayList;
  +import java.util.Date;
  +import java.util.Iterator;
  +import java.util.List;
  +import org.apache.avalon.excalibur.io.AndFileFilter;
   import org.apache.avalon.excalibur.io.ExtensionFileFilter;
   import org.apache.avalon.excalibur.io.InvertedFileFilter;
  -import org.apache.avalon.excalibur.io.AndFileFilter;
  -import org.apache.james.nntpserver.NNTPException;
   import org.apache.james.nntpserver.DateSinceFileFilter;
   
  -// group is reprensted by a directory.
  -// articles are stored in files with the name of file == article number
  +/**
  + * Group is represented by a directory.
  + * Articles are stored in files with the name of file == article number
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   class NNTPGroupImpl implements NNTPGroup {
       private final File root;
       private int currentArticle = -1;
  
  
  
  1.2       +9 -4      jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPLineReader.java
  
  Index: NNTPLineReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPLineReader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPLineReader.java	2001/05/15 14:41:39	1.1
  +++ NNTPLineReader.java	2001/11/10 23:10:59	1.2
  @@ -9,10 +9,15 @@
   
   import java.io.*;
   
  -// this interface is used to read the data from client and stream it
  -// into server repository
  +/** 
  + * Read and translates client data.
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public interface NNTPLineReader {
  -    // reads a line of data.
  -    // @return null indicates end of data
  +    /** 
  +     * reads a line of data.
  +     * @return null indicates end of data
  +     */
       String readLine();
   }
  
  
  
  1.2       +9 -1      jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPLineReaderImpl.java
  
  Index: NNTPLineReaderImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPLineReaderImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPLineReaderImpl.java	2001/05/15 14:41:40	1.1
  +++ NNTPLineReaderImpl.java	2001/11/10 23:10:59	1.2
  @@ -7,9 +7,17 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.io.*;
  +import java.io.BufferedReader;
  +import java.io.IOException;
   import org.apache.james.nntpserver.NNTPException;
   
  +/**
  + * reads and translates client data. After this translation, 
  + * the data can be streamed into server repository.
  + * Handles Dot Stuffing.
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public class NNTPLineReaderImpl implements NNTPLineReader {
       private final BufferedReader reader;
       public NNTPLineReaderImpl(BufferedReader reader) {
  
  
  
  1.2       +7 -10     jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPRepository.java
  
  Index: NNTPRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPRepository.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NNTPRepository.java	2001/05/15 14:41:40	1.1
  +++ NNTPRepository.java	2001/11/10 23:10:59	1.2
  @@ -7,17 +7,14 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.io.*;
  -import java.util.*;
  -import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.configuration.Configurable;
  -import org.apache.avalon.framework.configuration.Configuration;
  -import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.logger.AbstractLoggable;
  -import org.apache.avalon.excalibur.io.AndFileFilter;
  -import org.apache.avalon.excalibur.io.DirectoryFileFilter;
  -import org.apache.oro.io.GlobFilenameFilter;
  +import java.util.Iterator;
  +import java.util.Date;
   
  +/**
  + * Abstraction of entire NNTP Repository.
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public interface NNTPRepository {
       NNTPGroup getGroup(String groupName);
       NNTPArticle getArticleFromID(String id);
  
  
  
  1.3       +16 -6     jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java
  
  Index: NNTPRepositoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPRepositoryImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NNTPRepositoryImpl.java	2001/09/13 12:17:45	1.2
  +++ NNTPRepositoryImpl.java	2001/11/10 23:10:59	1.3
  @@ -7,10 +7,17 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.io.*;
  -import java.util.*;
  +import java.io.File;
  +import java.io.FileOutputStream;
  +import java.io.IOException;
  +import java.io.PrintStream;
  +import java.util.ArrayList;
  +import java.util.Date;
  +import java.util.Iterator;
  +import java.util.List;
  +import org.apache.avalon.excalibur.io.AndFileFilter;
  +import org.apache.avalon.excalibur.io.DirectoryFileFilter;
   import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  @@ -18,13 +25,16 @@
   import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.logger.AbstractLoggable;
  -import org.apache.avalon.excalibur.io.AndFileFilter;
  -import org.apache.avalon.excalibur.io.DirectoryFileFilter;
  +import org.apache.avalon.phoenix.Block;
   import org.apache.james.nntpserver.DateSinceFileFilter;
   import org.apache.james.nntpserver.NNTPException;
   import org.apache.oro.io.GlobFilenameFilter;
  -import org.apache.avalon.phoenix.Block;
   
  +/**
  + * NNTP Repository implementation.
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public class NNTPRepositoryImpl extends AbstractLoggable 
       implements NNTPRepository, Contextualizable, Configurable, Initializable, Block
   {
  
  
  
  1.3       +6 -2      jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java
  
  Index: NNTPSpooler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPSpooler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NNTPSpooler.java	2001/09/13 12:17:45	1.2
  +++ NNTPSpooler.java	2001/11/10 23:10:59	1.3
  @@ -22,8 +22,12 @@
   import org.apache.avalon.excalibur.io.IOUtil;
   import org.apache.james.util.Lock;
   
  -// processes entries and sends to appropriate groups.
  -// eats up inappropriate entries.
  +/**
  + * Processes entries and sends to appropriate groups.
  + * Eats up inappropriate entries.
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   class NNTPSpooler extends AbstractLoggable 
           implements Contextualizable, Configurable, Initializable {
   
  
  
  
  1.3       +9 -4      jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPUtil.java
  
  Index: NNTPUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/repository/NNTPUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NNTPUtil.java	2001/09/13 12:17:45	1.2
  +++ NNTPUtil.java	2001/11/10 23:10:59	1.3
  @@ -7,8 +7,8 @@
    */
   package org.apache.james.nntpserver.repository;
   
  -import java.io.*;
  -import org.apache.avalon.framework.activity.Initializable;
  +import java.io.File;
  +import java.io.PrintStream;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  @@ -19,8 +19,13 @@
   import org.apache.james.nntpserver.NNTPException;
   import org.apache.log.Logger;
   
  -// processes entries and sends to appropriate groups.
  -// eats up inappropriate entries.
  +/**
  + * Helper fuctions. 
  + * The function in this class are useful but may not have cohesion. 
  + * HB: Please revisit and cleanup
  + *
  + * @author Harmeet Bedi <ha...@kodemuse.com>
  + */
   public class NNTPUtil {
       static File getDirectory(Context context, Configuration configuration, String child)
           throws ConfigurationException
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>