import java.util.*;
import java.sql.Timestamp;
-public class Graylist {
-
- private Connection conn;
+public class Graylist extends SqliteTable {
public Graylist(String filename) {
- try {
- Class.forName("org.sqlite.JDBC");
- conn = DriverManager.getConnection("jdbc:sqlite:"+filename);
- conn.prepareStatement("create table if not exists "+
- "'whitelist' (ip unique)").executeUpdate();
- conn.prepareStatement("create table if not exists "+
- "'graylist' (ip,fromaddr,toaddr,date, primary key(ip,fromaddr,toaddr))").executeUpdate();
- }
- catch (SQLException e) { throw new RuntimeException(e); }
- catch (ClassNotFoundException e) { throw new RuntimeException(e); }
+ super(filename,
+ new String[] {
+ "create table if not exists 'whitelist' (ip unique)",
+ "create table if not exists 'graylist' (ip,fromaddr,toaddr,date, primary key(ip,fromaddr,toaddr))"
+ },
+ "graylist",
+ "date");
}
public synchronized void addWhitelist(InetAddress ip) {