Author: norman
Date: Wed Jul 26 13:03:35 2006
New Revision: 425824
URL: http://svn.apache.org/viewvc?rev=425824&view=rev
Log:
Add javadocs
Modified:
james/server/trunk/src/java/org/apache/james/util/SpamAssassinInvoker.java
james/server/trunk/src/test/org/apache/james/test/mock/util/MockSpamd.java
Modified:
james/server/trunk/src/java/org/apache/james/util/SpamAssassinInvoker.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/util/SpamAssassinInvoker.java?rev=425824&r1=425823&r2=425824&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/util/SpamAssassinInvoker.java
(original)
+++ james/server/trunk/src/java/org/apache/james/util/SpamAssassinInvoker.java
Wed Jul 26 13:03:35 2006
@@ -34,8 +34,14 @@
*/
public class SpamAssassinInvoker {
+ /**
+ * The mail attribute under which the status get stored
+ */
public final static String STATUS_MAIL_ATTRIBUTE_NAME =
"org.apache.james.spamassassin.status";
+ /**
+ * The mail attribute under which the flag get stored
+ */
public final static String FLAG_MAIL_ATTRIBUTE_NAME =
"org.apache.james.spamassassin.flag";
private String spamdHost;
@@ -48,6 +54,12 @@
private HashMap headers = new HashMap();
+ /**
+ * Init the spamassassin invoker
+ *
+ * @param spamdHost The host on which spamd runs
+ * @param spamdPort The port on which spamd listen
+ */
public SpamAssassinInvoker(String spamdHost, int spamdPort) {
this.spamdHost = spamdHost;
this.spamdPort = spamdPort;
@@ -75,6 +87,7 @@
.getInputStream()));
out.write("CHECK SPAMC/1.2\r\n\r\n".getBytes());
+ // pass the message to spamd
message.writeTo(out);
out.flush();
socket.shutdownOutput();
@@ -134,6 +147,7 @@
out.close();
socket.close();
} catch (Exception e) {
+ // Should never happin
}
}
@@ -160,7 +174,7 @@
/**
* Return the headers as attributes which spamd generates
*
- * @return headers Map of headers to add
+ * @return headers Map of headers to add as attributes
*/
public Map getHeadersAsAttribute() {
return headers;
Modified:
james/server/trunk/src/test/org/apache/james/test/mock/util/MockSpamd.java
URL:
http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/test/mock/util/MockSpamd.java?rev=425824&r1=425823&r2=425824&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/test/mock/util/MockSpamd.java
(original)
+++ james/server/trunk/src/test/org/apache/james/test/mock/util/MockSpamd.java
Wed Jul 26 13:03:35 2006
@@ -23,10 +23,14 @@
import java.net.ServerSocket;
import java.net.Socket;
-// Mocked SPAMD Daemon
+/**
+ * This class can be used to run a mocked SPAMD daemom
+ */
public class MockSpamd implements Runnable {
- // The GTUBE teststring
+ /**
+ * Mailcontent which is 100% spam
+ */
public final static String GTUBE = "-SPAM-";
public final static String NOT_SPAM = "Spam: False ; 3 / 5";
@@ -41,17 +45,25 @@
ServerSocket socket;
- boolean stopped = false;
-
+ /**
+ * Init the mocked SPAMD daemon
+ *
+ * @param port The port on which the mocked SPAMD daemon will be bind
+ * @throws IOException
+ */
public MockSpamd(int port) throws IOException {
socket = new ServerSocket(port);
}
+ /**
+ * @see java.lang.Runnable#run()
+ */
public void run() {
boolean spam = false;
try {
+ // Accept connections
spamd = socket.accept();
in = new BufferedReader(new InputStreamReader(spamd
@@ -60,6 +72,7 @@
String line = null;
+ // Parse the message
while ((line = in.readLine()) != null) {
if (line.indexOf(GTUBE) >= 0) {
spam = true;
@@ -79,6 +92,7 @@
socket.close();
} catch (IOException e) {
+ // Should not happen
e.printStackTrace();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]