inescID.revs.database
Class DB_Commissioner

java.lang.Object
  extended byinescID.revs.database.CommonDatabase
      extended byinescID.revs.database.DB_ElectionConfiguration
          extended byinescID.revs.database.DB_EC_Voters
              extended byinescID.revs.database.DB_Commissioner

public class DB_Commissioner
extends DB_EC_Voters


Field Summary
(package private)  KeyStoreTool kst
           
(package private)  java.sql.PreparedStatement preCountElectionsByVotersGroup
           
(package private)  java.sql.PreparedStatement preDeleteAdministratorElection
           
(package private)  java.sql.PreparedStatement preDeleteAdministratorElectionByAdministrator
           
(package private)  java.sql.PreparedStatement preDeleteAdministratorElectionByElection
           
(package private)  java.sql.PreparedStatement preDeletePasswordsByVoter
           
(package private)  java.sql.PreparedStatement preDeleteVotersGroup
           
(package private)  java.sql.PreparedStatement preGetAdministratorElection
           
(package private)  java.sql.PreparedStatement preGetAdministratorPublicKey
           
(package private)  java.sql.PreparedStatement preGetAdministrators
           
(package private)  java.sql.PreparedStatement preGetAdministratorsElection
           
(package private)  java.sql.PreparedStatement preGetAdministratorsEnable
           
(package private)  java.sql.PreparedStatement preGetAnonymizerPublicKey
           
(package private)  java.sql.PreparedStatement preGetAnonymizers
           
(package private)  java.sql.PreparedStatement preGetAnonymizersEnable
           
(package private)  java.sql.PreparedStatement preGetCounterPublicKey
           
(package private)  java.sql.PreparedStatement preGetCounters
           
(package private)  java.sql.PreparedStatement preGetCountersEnable
           
(package private)  java.sql.PreparedStatement preGetDistributorPublicKey
           
(package private)  java.sql.PreparedStatement preGetDistributors
           
(package private)  java.sql.PreparedStatement preGetDistributorsEnable
           
(package private)  java.sql.PreparedStatement preGetPasswords
           
(package private)  java.sql.PreparedStatement preGetVotersGroup
           
(package private)  java.sql.PreparedStatement preGetVotersGroupIdByDescription
           
(package private)  java.sql.PreparedStatement preGetVotersGroups
           
(package private)  java.sql.PreparedStatement preInsertAdministrator
           
(package private)  java.sql.PreparedStatement preInsertAdministratorElection
           
(package private)  java.sql.PreparedStatement preInsertAnonymizer
           
(package private)  java.sql.PreparedStatement preInsertCounter
           
(package private)  java.sql.PreparedStatement preInsertDistributor
           
(package private)  java.sql.PreparedStatement preInsertPasswords
           
(package private)  java.sql.PreparedStatement preInsertVotersGroup
           
(package private)  java.sql.PreparedStatement preUpdateAdministrator
           
(package private)  java.sql.PreparedStatement preUpdateAdministratorElection
           
(package private)  java.sql.PreparedStatement preUpdateAdministratorPublicKey
           
(package private)  java.sql.PreparedStatement preUpdateAnonymizer
           
(package private)  java.sql.PreparedStatement preUpdateAnonymizerPublicKey
           
(package private)  java.sql.PreparedStatement preUpdateCounter
           
(package private)  java.sql.PreparedStatement preUpdateCounterPublicKey
           
(package private)  java.sql.PreparedStatement preUpdateDistributor
           
(package private)  java.sql.PreparedStatement preUpdateDistributorPublicKey
           
(package private)  java.sql.PreparedStatement preUpdatePasswords
           
(package private)  java.sql.PreparedStatement preUpdateVotersGroup
           
 
Fields inherited from class inescID.revs.database.DB_EC_Voters
ALL_VOTERS_GROUP, ALL_VOTERS_GROUP_ID, EMPTY_VOTERS_GROUP, EMPTY_VOTERS_GROUP_ID, preDeleteVoter, preDeleteVoter2GroupByGroup, preDeleteVoter2GroupByVoter, preGetAllVotersID, preGetElectionsByGroup, preGetGroupsByVoter, preGetVoter, preGetVoters, preGetVoters2Group, preGetVotersWithoutPassword, preInsertVoter, preInsertVoter2Group, preUpdateVoter, preVerifyVoterElection
 
Fields inherited from class inescID.revs.database.DB_ElectionConfiguration
preCountElectionsByConfiguration, preDeleteConfiguration, preDeleteElection, preGetConfiguration, preGetConfigurationIdByDescription, preGetConfigurations, preGetConfigurationsIdDescription, preGetElection, preGetElectionIdByDescription, preGetElections, preGetElectionsByConfiguration, preGetElectionsIdDescription, preGetElectionsIdDescriptionByConfiguration, preGetLastId, preInsertConfiguration, preInsertElection, preUpdateConfiguration, preUpdateElection, preUpdateElectionKey
 
Fields inherited from class inescID.revs.database.CommonDatabase
clock, con, driver, password, preInsereControlo, preURL, url, user
 
Constructor Summary
DB_Commissioner()
           
DB_Commissioner(java.lang.String db, java.lang.String user, java.lang.String password)
           
 
Method Summary
 void alterTableAdministrator(boolean update, Server server)
           
 void alterTableAnonymizer(boolean update, Server server)
           
 void alterTableCounter(boolean update, Server server)
           
 void alterTableDistributor(boolean update, Server server)
           
 void alterTablePasswords(boolean update, int voter, byte[][] passwords)
           
 void alterTableVotersGroup(boolean update, int id, java.lang.String description)
           
 int countElectionsByVotersGroup(int id)
           
 void createAdministratorsElection(int election)
           
 void createTables(java.lang.String error)
           
 void deleteAdministratorElection(int adm, int election)
           
 void deleteAdministratorElectionByAdministrator(int id)
           
 void deleteAdministratorElectionByElection(int id)
           
 int deleteConfiguration(int id)
           
 void deleteElection(int id)
           
 void deletePasswordsByVoter(int id)
           
 void deleteVoter(int id)
           
 int deleteVotersGroup(int id)
           
 AdministratorElection getAdministratorElection(int election, int administrator)
           
 java.security.Key getAdministratorPublicKey(int id)
           
 java.util.Vector getAdministrators(boolean enable)
           
 java.util.Vector getAdministratorsSigningKeysByElection(int election)
           
 java.security.Key getAnonymizerPublicKey(int id)
           
 java.util.Vector getAnonymizers(boolean enable)
           
 int getAvailableVotersGroupId()
           
 java.security.Key getCounterPublicKey(int id)
           
 java.util.Vector getCounters(boolean enable)
           
 java.security.Key getDistributorPublicKey(int id)
           
 java.util.Vector getDistributors(boolean enable)
           
 Passwords getPasswords(int id)
           
 IdDescription getVotersGroup(int id_group)
           
 int getVotersGroupIdByDescription(java.lang.String description)
           
 java.util.Vector getVotersGroups()
           
 void insertTableAdministratorElection(int administrator, int election, byte[] key)
           
 void insertTableAdministratorElection(int administrator, int election, java.security.Key key)
           
(package private)  void prepareCount()
           
protected  void prepareDelete()
           
protected  void prepareGet()
           
protected  void prepareInsert()
           
protected  void prepareUpdate()
           
 void removeTables(java.lang.String error)
           
protected  void tableAdministrator()
           
protected  void tableAdministratorElection()
           
protected  void tableAnonymizer()
           
protected  void tableConfiguration()
           
protected  void tableCounter()
           
protected  void tableDistributor()
           
protected  void tableElection()
           
protected  void tablePasswords()
           
protected  void tableVotersGroup()
           
 void updateAdministratorKey(int id, java.security.Key kpub)
           
 void updateAnonymizerKey(int id, java.security.Key kpub)
           
 void updateCounterKey(int id, java.security.Key kpub)
           
 void updateDistributorKey(int id, java.security.Key kpub)
           
 void updateTableAdministratorElection(int administrator, int election, java.security.Key kpub)
           
 
Methods inherited from class inescID.revs.database.DB_EC_Voters
addVoters2Group, alterTableVoter, deleteVoter2GroupByGroup, deleteVoter2GroupByVoter, getElectionsByVoter, getGroupsByVoter, getVoter, getVoters, getVoters2Group, getVotersWithoutPassword, insertTableVoter2Group, tableVoter, tableVoter2Group, verifyVoterElection
 
Methods inherited from class inescID.revs.database.DB_ElectionConfiguration
alterTableConfiguration, alterTableElection, countElectionsByConfiguration, getAvailableConfigurationId, getAvailableElectionId, getConfiguration, getConfigurationIdByDescription, getConfigurations, getConfigurationsIdDescription, getElection, getElectionIdByDescription, getElections, getElectionsByConfiguration, getElectionsIdDescription, getElectionsIdDescriptionByConfiguration, getLastID, init, updateElectionKey, verifyElectionPeriod
 
Methods inherited from class inescID.revs.database.CommonDatabase
connectDB, createPingTable, createTables, DBInit, finalize, redoTables, removeTables, verify
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

preInsertVotersGroup

java.sql.PreparedStatement preInsertVotersGroup

preInsertDistributor

java.sql.PreparedStatement preInsertDistributor

preInsertAdministrator

java.sql.PreparedStatement preInsertAdministrator

preInsertAdministratorElection

java.sql.PreparedStatement preInsertAdministratorElection

preInsertAnonymizer

java.sql.PreparedStatement preInsertAnonymizer

preInsertCounter

java.sql.PreparedStatement preInsertCounter

preInsertPasswords

java.sql.PreparedStatement preInsertPasswords

preUpdateVotersGroup

java.sql.PreparedStatement preUpdateVotersGroup

preUpdateDistributor

java.sql.PreparedStatement preUpdateDistributor

preUpdateDistributorPublicKey

java.sql.PreparedStatement preUpdateDistributorPublicKey

preUpdateAdministrator

java.sql.PreparedStatement preUpdateAdministrator

preUpdateAdministratorPublicKey

java.sql.PreparedStatement preUpdateAdministratorPublicKey

preUpdateAdministratorElection

java.sql.PreparedStatement preUpdateAdministratorElection

preUpdateAnonymizer

java.sql.PreparedStatement preUpdateAnonymizer

preUpdateAnonymizerPublicKey

java.sql.PreparedStatement preUpdateAnonymizerPublicKey

preUpdateCounter

java.sql.PreparedStatement preUpdateCounter

preUpdateCounterPublicKey

java.sql.PreparedStatement preUpdateCounterPublicKey

preUpdatePasswords

java.sql.PreparedStatement preUpdatePasswords

preGetVotersGroup

java.sql.PreparedStatement preGetVotersGroup

preGetVotersGroupIdByDescription

java.sql.PreparedStatement preGetVotersGroupIdByDescription

preGetVotersGroups

java.sql.PreparedStatement preGetVotersGroups

preGetDistributors

java.sql.PreparedStatement preGetDistributors

preGetDistributorPublicKey

java.sql.PreparedStatement preGetDistributorPublicKey

preGetDistributorsEnable

java.sql.PreparedStatement preGetDistributorsEnable

preGetAdministrators

java.sql.PreparedStatement preGetAdministrators

preGetAdministratorPublicKey

java.sql.PreparedStatement preGetAdministratorPublicKey

preGetAdministratorsEnable

java.sql.PreparedStatement preGetAdministratorsEnable

preGetAdministratorsElection

java.sql.PreparedStatement preGetAdministratorsElection

preGetAdministratorElection

java.sql.PreparedStatement preGetAdministratorElection

preGetAnonymizers

java.sql.PreparedStatement preGetAnonymizers

preGetAnonymizerPublicKey

java.sql.PreparedStatement preGetAnonymizerPublicKey

preGetAnonymizersEnable

java.sql.PreparedStatement preGetAnonymizersEnable

preGetCounters

java.sql.PreparedStatement preGetCounters

preGetCounterPublicKey

java.sql.PreparedStatement preGetCounterPublicKey

preGetCountersEnable

java.sql.PreparedStatement preGetCountersEnable

preGetPasswords

java.sql.PreparedStatement preGetPasswords

preDeleteVotersGroup

java.sql.PreparedStatement preDeleteVotersGroup

preDeleteAdministratorElection

java.sql.PreparedStatement preDeleteAdministratorElection

preDeleteAdministratorElectionByAdministrator

java.sql.PreparedStatement preDeleteAdministratorElectionByAdministrator

preDeleteAdministratorElectionByElection

java.sql.PreparedStatement preDeleteAdministratorElectionByElection

preDeletePasswordsByVoter

java.sql.PreparedStatement preDeletePasswordsByVoter

preCountElectionsByVotersGroup

java.sql.PreparedStatement preCountElectionsByVotersGroup

kst

KeyStoreTool kst
Constructor Detail

DB_Commissioner

public DB_Commissioner()
                throws java.sql.SQLException,
                       java.security.NoSuchAlgorithmException

DB_Commissioner

public DB_Commissioner(java.lang.String db,
                       java.lang.String user,
                       java.lang.String password)
                throws java.lang.ClassNotFoundException,
                       java.sql.SQLException,
                       java.security.NoSuchAlgorithmException
Method Detail

createTables

public void createTables(java.lang.String error)
Overrides:
createTables in class DB_EC_Voters

removeTables

public void removeTables(java.lang.String error)
Overrides:
removeTables in class DB_EC_Voters

tableElection

protected void tableElection()
                      throws java.sql.SQLException
Overrides:
tableElection in class DB_ElectionConfiguration
Throws:
java.sql.SQLException

tableConfiguration

protected void tableConfiguration()
                           throws java.sql.SQLException
Overrides:
tableConfiguration in class DB_ElectionConfiguration
Throws:
java.sql.SQLException

tableVotersGroup

protected void tableVotersGroup()
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

tableDistributor

protected void tableDistributor()
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

tableAdministrator

protected void tableAdministrator()
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

tableAdministratorElection

protected void tableAdministratorElection()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

tableAnonymizer

protected void tableAnonymizer()
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

tableCounter

protected void tableCounter()
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

tablePasswords

protected void tablePasswords()
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

prepareInsert

protected void prepareInsert()
                      throws java.sql.SQLException
Overrides:
prepareInsert in class DB_EC_Voters
Throws:
java.sql.SQLException

prepareUpdate

protected void prepareUpdate()
                      throws java.sql.SQLException
Overrides:
prepareUpdate in class DB_EC_Voters
Throws:
java.sql.SQLException

updateTableAdministratorElection

public void updateTableAdministratorElection(int administrator,
                                             int election,
                                             java.security.Key kpub)
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

updateDistributorKey

public void updateDistributorKey(int id,
                                 java.security.Key kpub)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

updateAdministratorKey

public void updateAdministratorKey(int id,
                                   java.security.Key kpub)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

updateAnonymizerKey

public void updateAnonymizerKey(int id,
                                java.security.Key kpub)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

updateCounterKey

public void updateCounterKey(int id,
                             java.security.Key kpub)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

createAdministratorsElection

public void createAdministratorsElection(int election)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

alterTableVotersGroup

public void alterTableVotersGroup(boolean update,
                                  int id,
                                  java.lang.String description)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

insertTableAdministratorElection

public void insertTableAdministratorElection(int administrator,
                                             int election,
                                             java.security.Key key)
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

insertTableAdministratorElection

public void insertTableAdministratorElection(int administrator,
                                             int election,
                                             byte[] key)
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

alterTableDistributor

public void alterTableDistributor(boolean update,
                                  Server server)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

alterTableAdministrator

public void alterTableAdministrator(boolean update,
                                    Server server)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

alterTableAnonymizer

public void alterTableAnonymizer(boolean update,
                                 Server server)
                          throws java.sql.SQLException
Throws:
java.sql.SQLException

alterTableCounter

public void alterTableCounter(boolean update,
                              Server server)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

alterTablePasswords

public void alterTablePasswords(boolean update,
                                int voter,
                                byte[][] passwords)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

prepareGet

protected void prepareGet()
                   throws java.sql.SQLException
Overrides:
prepareGet in class DB_EC_Voters
Throws:
java.sql.SQLException

getVotersGroupIdByDescription

public int getVotersGroupIdByDescription(java.lang.String description)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getAvailableVotersGroupId

public int getAvailableVotersGroupId()
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

getAdministratorsSigningKeysByElection

public java.util.Vector getAdministratorsSigningKeysByElection(int election)
                                                        throws java.security.spec.InvalidKeySpecException,
                                                               java.sql.SQLException
Throws:
java.security.spec.InvalidKeySpecException
java.sql.SQLException

getAdministratorElection

public AdministratorElection getAdministratorElection(int election,
                                                      int administrator)
                                               throws java.security.spec.InvalidKeySpecException,
                                                      java.sql.SQLException
Throws:
java.security.spec.InvalidKeySpecException
java.sql.SQLException

getVotersGroups

public java.util.Vector getVotersGroups()
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getVotersGroup

public IdDescription getVotersGroup(int id_group)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getDistributors

public java.util.Vector getDistributors(boolean enable)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getAdministrators

public java.util.Vector getAdministrators(boolean enable)
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

getAnonymizers

public java.util.Vector getAnonymizers(boolean enable)
                                throws java.sql.SQLException
Throws:
java.sql.SQLException

getCounters

public java.util.Vector getCounters(boolean enable)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getPasswords

public Passwords getPasswords(int id)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getDistributorPublicKey

public java.security.Key getDistributorPublicKey(int id)
                                          throws java.security.spec.InvalidKeySpecException,
                                                 java.sql.SQLException
Throws:
java.security.spec.InvalidKeySpecException
java.sql.SQLException

getAdministratorPublicKey

public java.security.Key getAdministratorPublicKey(int id)
                                            throws java.security.spec.InvalidKeySpecException,
                                                   java.sql.SQLException
Throws:
java.security.spec.InvalidKeySpecException
java.sql.SQLException

getAnonymizerPublicKey

public java.security.Key getAnonymizerPublicKey(int id)
                                         throws java.security.spec.InvalidKeySpecException,
                                                java.sql.SQLException
Throws:
java.security.spec.InvalidKeySpecException
java.sql.SQLException

getCounterPublicKey

public java.security.Key getCounterPublicKey(int id)
                                      throws java.security.spec.InvalidKeySpecException,
                                             java.sql.SQLException
Throws:
java.security.spec.InvalidKeySpecException
java.sql.SQLException

prepareDelete

protected void prepareDelete()
                      throws java.sql.SQLException
Overrides:
prepareDelete in class DB_EC_Voters
Throws:
java.sql.SQLException

deleteConfiguration

public int deleteConfiguration(int id)
                        throws java.lang.Exception
Overrides:
deleteConfiguration in class DB_ElectionConfiguration
Throws:
java.lang.Exception

deleteElection

public void deleteElection(int id)
                    throws java.sql.SQLException
Overrides:
deleteElection in class DB_ElectionConfiguration
Throws:
java.sql.SQLException

deleteVotersGroup

public int deleteVotersGroup(int id)
                      throws java.lang.Exception
Throws:
java.lang.Exception

deleteVoter

public void deleteVoter(int id)
                 throws java.sql.SQLException
Overrides:
deleteVoter in class DB_EC_Voters
Throws:
java.sql.SQLException

deleteAdministratorElection

public void deleteAdministratorElection(int adm,
                                        int election)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

deleteAdministratorElectionByElection

public void deleteAdministratorElectionByElection(int id)
                                           throws java.sql.SQLException
Throws:
java.sql.SQLException

deleteAdministratorElectionByAdministrator

public void deleteAdministratorElectionByAdministrator(int id)
                                                throws java.sql.SQLException
Throws:
java.sql.SQLException

deletePasswordsByVoter

public void deletePasswordsByVoter(int id)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

prepareCount

void prepareCount()
            throws java.sql.SQLException
Overrides:
prepareCount in class DB_ElectionConfiguration
Throws:
java.sql.SQLException

countElectionsByVotersGroup

public int countElectionsByVotersGroup(int id)
                                throws java.lang.Exception
Throws:
java.lang.Exception