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:09:28 UTC
cvs commit: jakarta-james/src/java/org/apache/james/nntpserver ArticleWriter.java AuthState.java LISTGroup.java NNTPException.java NNTPHandler.java NNTPServer.java
hbedi 01/11/10 15:09:28
Modified: src/java/org/apache/james/nntpserver ArticleWriter.java
AuthState.java LISTGroup.java NNTPException.java
NNTPHandler.java NNTPServer.java
Log:
NNTP HDR command was not working correctly. Better comments. First pass at cleanup/javadoc.
Revision Changes Path
1.2 +13 -8 jakarta-james/src/java/org/apache/james/nntpserver/ArticleWriter.java
Index: ArticleWriter.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/ArticleWriter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArticleWriter.java 2001/05/15 14:41:30 1.1
+++ ArticleWriter.java 2001/11/10 23:09:27 1.2
@@ -7,16 +7,21 @@
*/
package org.apache.james.nntpserver;
-import java.io.*;
+import java.io.PrintWriter;
import org.apache.james.nntpserver.repository.NNTPArticle;
-// this is used by ARTICLE, HEAD, BODY, STAT command.
-// these commands are identical except in the writing the Article header
-// and body to the response stream
-// ARTICLE - writes header and body
-// HEAD - writes headers
-// BODY - writes body
-// STAT - does not write anything
+
+/**
+ * used by ARTICLE, HEAD, BODY, STAT command.
+ * these commands are identical except in the writing the Article header
+ * and body to the response stream
+ * ARTICLE - writes header and body
+ * HEAD - writes headers
+ * BODY - writes body
+ * STAT - does not write anything
+ *
+ * @author Harmeet <ha...@kodemuse.com>
+ */
interface ArticleWriter {
void write(NNTPArticle article);
class Factory {
1.3 +8 -11 jakarta-james/src/java/org/apache/james/nntpserver/AuthState.java
Index: AuthState.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/AuthState.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AuthState.java 2001/06/24 17:06:00 1.2
+++ AuthState.java 2001/11/10 23:09:27 1.3
@@ -7,20 +7,17 @@
*/
package org.apache.james.nntpserver;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
import org.apache.james.services.UsersRepository;
/**
- * @version 1.0.0, 31/03/2001
- * @author Harmeet
- *
- * implements the authentication state. Should this be moved to a more common place ??
+ * implements the authentication state.
+ * Should this be moved to a more common place ??
* Should there be an authenication service, that manufactures and hands to the different
- * protocol servers AuthState objects.
- */
+ * protocol servers AuthState objects ?
+ *
+ * @version 1.0.0, 31/03/2001
+ * @author Harmeet <ha...@kodemuse.com>
+*/
public class AuthState {
private final boolean requiredAuth;
private final UsersRepository repo;
@@ -41,7 +38,7 @@
} else {
return false;
}
- } else {
+ } else {
return true;
}
}
1.2 +8 -3 jakarta-james/src/java/org/apache/james/nntpserver/LISTGroup.java
Index: LISTGroup.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/LISTGroup.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LISTGroup.java 2001/05/15 14:41:32 1.1
+++ LISTGroup.java 2001/11/10 23:09:27 1.2
@@ -7,11 +7,16 @@
*/
package org.apache.james.nntpserver;
-import java.io.*;
+import java.io.PrintWriter;
import org.apache.james.nntpserver.repository.NNTPGroup;
-// group information would be displayed differently depending on the
-// LIST command paramter
+/**
+ * formatted Group Information.
+ * Group information is displayed differently depending on the
+ * LIST command parameter
+ *
+ * @author Harmeet Bedi <ha...@kodemuse.com>
+ */
interface LISTGroup {
void show(NNTPGroup group);
class Factory {
1.2 +8 -0 jakarta-james/src/java/org/apache/james/nntpserver/NNTPException.java
Index: NNTPException.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NNTPException.java 2001/05/15 14:41:32 1.1
+++ NNTPException.java 2001/11/10 23:09:27 1.2
@@ -7,6 +7,14 @@
*/
package org.apache.james.nntpserver;
+/**
+ * Exception Wrapper, like javax.servlet.ServletException.
+ * Purpose is to catch and wrap exceptions into unchecked NNTP specific.
+ * Protocol handler catches the exception and returns error info to client.
+ * Error Information is obtained by calling 'getMessage'
+ *
+ * @author Harmeet Bedi <ha...@kodemuse.com>
+ */
public class NNTPException extends RuntimeException {
private final Throwable t;
public NNTPException(String msg) {
1.3 +4 -16 jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java
Index: NNTPHandler.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NNTPHandler.java 2001/06/24 17:06:01 1.2
+++ NNTPHandler.java 2001/11/10 23:09:27 1.3
@@ -10,7 +10,6 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.text.DateFormat;
@@ -19,34 +18,24 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import java.util.Vector;
-import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.cornerstone.services.connection.ConnectionHandler;
+import org.apache.avalon.cornerstone.services.scheduler.PeriodicTimeTrigger;
+import org.apache.avalon.cornerstone.services.scheduler.Target;
+import org.apache.avalon.cornerstone.services.scheduler.TimeScheduler;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
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.context.Context;
-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.cornerstone.services.connection.ConnectionHandler;
-import org.apache.avalon.cornerstone.services.scheduler.PeriodicTimeTrigger;
-import org.apache.avalon.cornerstone.services.scheduler.Target;
-import org.apache.avalon.cornerstone.services.scheduler.TimeScheduler;
-import org.apache.avalon.excalibur.collections.ListUtils;
-import org.apache.james.Constants;
import org.apache.james.BaseConnectionHandler;
import org.apache.james.nntpserver.repository.NNTPArticle;
import org.apache.james.nntpserver.repository.NNTPGroup;
import org.apache.james.nntpserver.repository.NNTPLineReaderImpl;
import org.apache.james.nntpserver.repository.NNTPRepository;
-import org.apache.james.nntpserver.repository.NNTPUtil;
import org.apache.james.services.UsersRepository;
import org.apache.james.services.UsersStore;
@@ -507,7 +496,6 @@
}
private void doHDR(StringTokenizer tok) {
// 9.5.3
- writer.println("500 Command not recognized");
String hdr = tok.nextToken();
String range = tok.hasMoreTokens() ? tok.nextToken() : null;
NNTPArticle[] article = getRange(range);
1.3 +6 -8 jakarta-james/src/java/org/apache/james/nntpserver/NNTPServer.java
Index: NNTPServer.java
===================================================================
RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPServer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NNTPServer.java 2001/06/24 17:06:01 1.2
+++ NNTPServer.java 2001/11/10 23:09:27 1.3
@@ -8,20 +8,18 @@
package org.apache.james.nntpserver;
import java.net.InetAddress;
+import java.io.PrintStream;
import java.net.UnknownHostException;
-import org.apache.avalon.framework.activity.Initializable;
-import org.apache.avalon.framework.component.Component;
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.DefaultComponentManager;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.cornerstone.services.connection.AbstractService;
import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
import org.apache.avalon.cornerstone.services.connection.DefaultHandlerFactory;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
/**
- * @author Harmeet <hb...@apache.org>
+ * NNTP Server Protocol Handler
+ *
+ * @author Harmeet Bedi <ha...@kodemuse.com>
*/
public class NNTPServer extends AbstractService {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>