net.spamcomplaint.dao
Class WhoisDAO

java.lang.Object
  extended by net.spamcomplaint.dao.WhoisDAO

public class WhoisDAO
extends java.lang.Object


Constructor Summary
WhoisDAO(ConnectionDAO dao)
           
 
Method Summary
 void cache(WhoisMsgStruct msg, java.lang.String ip)
           Saves the Whois message if it does not already exists Linkes the IP address to the whois message (unless there is a link already
 int delete(int daysOld)
          Purge whois messages over n days old.
 int deleteWhois(java.lang.String uniqueSha1)
           
 void insertWhois(WhoisMsgStruct msg)
          Inserts message; sets the new WhoisMsgStruct.id value from the database.
 void insertWhoisIp(int whoisId, java.lang.String ip)
           
 int selectWhoisId(java.lang.String uniqueSha1)
           
 WhoisMsgStruct selectWhoisMsg(java.lang.String ip)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WhoisDAO

public WhoisDAO(ConnectionDAO dao)
Method Detail

delete

public int delete(int daysOld)
           throws java.sql.SQLException
Purge whois messages over n days old.

Parameters:
daysOld -
Returns:
num of records deleted
Throws:
java.sql.SQLException

cache

public void cache(WhoisMsgStruct msg,
                  java.lang.String ip)
           throws java.sql.SQLException,
                  java.security.NoSuchAlgorithmException
  1. Saves the Whois message if it does not already exists
  2. Linkes the IP address to the whois message (unless there is a link already

Parameters:
msg -
ip -
Throws:
java.sql.SQLException
java.security.NoSuchAlgorithmException

insertWhois

public void insertWhois(WhoisMsgStruct msg)
                 throws java.sql.SQLException,
                        java.security.NoSuchAlgorithmException
Inserts message; sets the new WhoisMsgStruct.id value from the database.

Throws:
java.sql.SQLException
java.security.NoSuchAlgorithmException

insertWhoisIp

public void insertWhoisIp(int whoisId,
                          java.lang.String ip)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

selectWhoisId

public int selectWhoisId(java.lang.String uniqueSha1)
                  throws java.sql.SQLException
Parameters:
uniqueSha1 -
Returns:
Whois_Id or -1 if an entry was not found
Throws:
java.sql.SQLException

deleteWhois

public int deleteWhois(java.lang.String uniqueSha1)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

selectWhoisMsg

public WhoisMsgStruct selectWhoisMsg(java.lang.String ip)
                              throws java.sql.SQLException
Returns:
{ Whois message found by IP } or null if one was not found
Throws:
java.sql.SQLException


Copyright © 2008. All Rights Reserved.