ERServer
Class DBase

java.lang.Object
  |
  +--ERServer.DBase

public class DBase
extends java.lang.Object

DBase creates databases, tables and interacts with these through JDBC and SQL. Implementation of the databases is with Hypersonic SQL which is written totally in Java. This implementation was created to support the demoonstration security authorisation system. To implement a new (e.g. biometric) auth system then you *WILL* need to change some SQL. It won't hurt.

Version:
1.5 11 April 2001
Author:
Jason Kitcat

Field Summary
protected static java.lang.String cryptword
           
 
Constructor Summary
DBase()
           
 
Method Summary
protected static boolean checkER(java.lang.String name, java.lang.String code, java.lang.String pword)
          checks Electoral Roll information against that in the database.
protected static boolean confirmVoted(java.lang.String akey)
          A little processor intensive and might need tuning but this method finds the user entry in the Electoral Roll that matches the received key and sets it has having voted.
protected static java.lang.String decrypt(java.lang.String data)
          Decrypts data pulled from the database returning normal strings.
protected static void doSQL(java.lang.String sqlCommand)
          executes the SQL command sent as a parameter and returns the result to DB Console.
protected static void importUsers()
          Imports users from a CSV file and inserts them into ERServer database.
protected static void init()
          initialises the Hypersonic SQL database.
protected static boolean isSafe(java.lang.String input)
          checks String input to make sure it only contains safe characters.
protected static void makeAllKeys()
          Goes through all Electoral Roll data to create keys made with key 1 and writes them to a file for export.
protected static int usersVoted()
          Counts how many people have voted.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cryptword

protected static java.lang.String cryptword
Constructor Detail

DBase

public DBase()
Method Detail

init

protected static void init()
initialises the Hypersonic SQL database.

isSafe

protected static boolean isSafe(java.lang.String input)
                         throws java.lang.Exception
checks String input to make sure it only contains safe characters. It's not pretty but regular expression packages tried all were far too slow.
Parameters:
input - The String to check

decrypt

protected static java.lang.String decrypt(java.lang.String data)
                                   throws java.lang.Exception
Decrypts data pulled from the database returning normal strings.
Parameters:
data - The encrypted string

usersVoted

protected static int usersVoted()
                         throws java.lang.Exception
Counts how many people have voted.

checkER

protected static boolean checkER(java.lang.String name,
                                 java.lang.String code,
                                 java.lang.String pword)
                          throws java.lang.Exception
checks Electoral Roll information against that in the database.
Parameters:
name - String representing the voter's name
code - String representing the voter's vote-specific code
pword - String representing the voter's password

confirmVoted

protected static boolean confirmVoted(java.lang.String akey)
                               throws java.lang.Exception
A little processor intensive and might need tuning but this method finds the user entry in the Electoral Roll that matches the received key and sets it has having voted.
Parameters:
name - String representing the voter's name
code - String representing the voter's vote-specific code
pword - String representing the voter's password

makeAllKeys

protected static void makeAllKeys()
                           throws java.lang.Exception
Goes through all Electoral Roll data to create keys made with key 1 and writes them to a file for export.

importUsers

protected static void importUsers()
                           throws java.lang.Exception
Imports users from a CSV file and inserts them into ERServer database.

doSQL

protected static void doSQL(java.lang.String sqlCommand)
executes the SQL command sent as a parameter and returns the result to DB Console.
Parameters:
sqlCommand - A string containing SQL