Package marauroa.server.game.db
Class AccountDAO
java.lang.Object
marauroa.server.game.db.AccountDAO
data access object for accounts
- Author:
- miguel, hendrik
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDeprecated.voidaddBan(DBTransaction transaction, String username, String reason, Timestamp expire) adds a ban (which may be temporary)voidDeprecated.voidaddPlayer(DBTransaction transaction, String username, byte[] passwordHash, String email) Deprecated.voidaddPlayer(DBTransaction transaction, String username, byte[] passwordHash, String email, Timestamp timestamp) creates an accountvoidchangeEmail(String username, String email) Deprecated.voidchangeEmail(DBTransaction transaction, String username, String email) changes the email-addressvoidchangePassword(String username, String password) Deprecated.voidchangePassword(DBTransaction transaction, String username, String password) changes the passwordgeneratePlayer(String pattern) generates an account name based on the specified pattern (uses for automatic testing)getAccountBanMessage(String username) Deprecated.getAccountBanMessage(DBTransaction transaction, String username) gets the ban message of the accountgetAccountStatus(String username) Deprecated.getAccountStatus(DBTransaction transaction, String username) gets the status of the accountintgetDatabasePlayerId(String username) Deprecated.intgetDatabasePlayerId(DBTransaction transaction, String username) gets the id of the accountDeprecated.getEmail(DBTransaction transaction, String username) gets the email-address of the accountbooleanDeprecated.booleanhasPlayer(DBTransaction transaction, String username) checks if this account existsbooleanisAccountCreationLimitReached(String address) Deprecated.booleanisAccountCreationLimitReached(DBTransaction transaction, String address) is account creation limit reached for recently created accountsbooleanremovePlayer(String username) Deprecated.booleanremovePlayer(DBTransaction transaction, String username) deletes an account from the databasevoidsetAccountStatus(String username, String status) Deprecated.voidsetAccountStatus(DBTransaction transaction, String username, String status) sets the status of the accountbooleanverify(DBTransaction transaction, SecuredLoginInfo info) verifies username and passwordbooleanverify(SecuredLoginInfo informations) Deprecated.booleanverifyPassword(String username, String password) Deprecated.booleanverifyPassword(DBTransaction transaction, String username, String password) verifies the account username and password
-
Constructor Details
-
AccountDAO
protected AccountDAO()Creates a new AccountDAO
-
-
Method Details
-
addPlayer
@Deprecated public void addPlayer(DBTransaction transaction, String username, byte[] passwordHash, String email) throws SQLException Deprecated.creates an account- Parameters:
transaction- DBTransactionusername- usernamepasswordHash- password hashemail- email-address- Throws:
SQLException- in case of an database error
-
addPlayer
public void addPlayer(DBTransaction transaction, String username, byte[] passwordHash, String email, Timestamp timestamp) throws SQLException creates an account- Parameters:
transaction- DBTransactionusername- usernamepasswordHash- password hashemail- email-addresstimestamp- when the account was added- Throws:
SQLException- in case of an database error
-
generatePlayer
generates an account name based on the specified pattern (uses for automatic testing)- Parameters:
pattern-- Returns:
- account name
-
changeEmail
public void changeEmail(DBTransaction transaction, String username, String email) throws SQLException changes the email-address- Parameters:
transaction- DBTransactionusername- usernameemail- new email-address- Throws:
SQLException- in case of an database error
-
changePassword
public void changePassword(DBTransaction transaction, String username, String password) throws SQLException changes the password- Parameters:
transaction- DBTransactionusername- usernamepassword- new password- Throws:
SQLException- in case of an database error
-
hasPlayer
checks if this account exists- Parameters:
transaction- DBTransactionusername- username- Returns:
- true, if the account exists; false otherwise
- Throws:
SQLException- in case of an database error
-
setAccountStatus
public void setAccountStatus(DBTransaction transaction, String username, String status) throws SQLException sets the status of the account- Parameters:
transaction- DBTransactionusername- usernamestatus- account status- Throws:
SQLException- in case of an database error
-
getAccountStatus
gets the status of the account- Parameters:
transaction- DBTransactionusername- username- Returns:
- account status, or
nullif no such account exists - Throws:
SQLException- in case of an database error
-
getAccountBanMessage
gets the ban message of the account- Parameters:
transaction- DBTransactionusername- username- Returns:
- ban message, or
nullif the account is not banned. - Throws:
SQLException- in case of an database error
-
getEmail
gets the email-address of the account- Parameters:
transaction- DBTransactionusername- username- Returns:
- email of account, or
nullif no such account exists - Throws:
SQLException- in case of an database error
-
getDatabasePlayerId
gets the id of the account- Parameters:
transaction- DBTransactionusername- username- Returns:
- id of account, or -1 if no such account exists
- Throws:
SQLException- in case of an database error
-
verify
verifies username and password- Parameters:
transaction- DBTransactioninfo- login credentials- Returns:
- true, on success; false otherwise
- Throws:
SQLException- in case of an database error
-
verifyPassword
public boolean verifyPassword(DBTransaction transaction, String username, String password) throws SQLException verifies the account username and password- Parameters:
transaction- DBTransactionusername- usernamepassword- password- Returns:
- true on success, false if the account does not exists or the password does not match
- Throws:
SQLException- in case of an database error
-
removePlayer
deletes an account from the database- Parameters:
transaction- DBTransactionusername- username- Returns:
- always true
- Throws:
SQLException- in case of an database error
-
isAccountCreationLimitReached
public boolean isAccountCreationLimitReached(DBTransaction transaction, String address) throws SQLException, IOException is account creation limit reached for recently created accounts- Parameters:
transaction- DBTransactionaddress- ip-address- Returns:
- true, if too many accounts have been created recently
- Throws:
SQLException- in case of an database errorIOException- in case of an input/output error
-
addBan
public void addBan(DBTransaction transaction, String username, String reason, Timestamp expire) throws SQLException adds a ban (which may be temporary)- Parameters:
transaction- DBTransactionusername- usernamereason- Reason for the banexpire- timestamp when this ban will expire, may benull- Throws:
SQLException- in case of an database error
-
addPlayer
@Deprecated public void addPlayer(String username, byte[] password, String email) throws SQLException Deprecated.creates an account- Parameters:
username- usernamepassword- the hashed password's bytearrayemail- email-address- Throws:
SQLException- in case of an database error
-
changeEmail
Deprecated.changes the email-address- Parameters:
username- usernameemail- new email-address- Throws:
SQLException- in case of an database error
-
changePassword
Deprecated.changes the password- Parameters:
username- usernamepassword- new password- Throws:
SQLException- in case of an database error
-
hasPlayer
Deprecated.checks if this account exists- Parameters:
username- username- Returns:
- true, if the account exists; false otherwise
- Throws:
SQLException- in case of an database error
-
setAccountStatus
Deprecated.sets the status of the account- Parameters:
username- usernamestatus- account status- Throws:
SQLException- in case of an database error
-
getAccountStatus
Deprecated.gets the status of the account- Parameters:
username- username- Returns:
- account status, or
nullif no such account exists - Throws:
SQLException- in case of an database error
-
getAccountBanMessage
Deprecated.gets the ban message of an account- Parameters:
username- username- Returns:
- account ban message, or
nullif this account is not banned - Throws:
SQLException- in case of an database error
-
getEmail
Deprecated.gets the email-address of the account- Parameters:
username- username- Returns:
- email of account, or
nullif no such account exists - Throws:
SQLException- in case of an database error
-
getDatabasePlayerId
Deprecated.gets the id of the account- Parameters:
username- username- Returns:
- id of account, or -1 if no such account exists
- Throws:
SQLException- in case of an database error
-
verify
Deprecated.verifies username and password- Parameters:
informations- login credentials- Returns:
- true, on success; false otherwise
- Throws:
SQLException- in case of an database error
-
verifyPassword
Deprecated.verifies the account username and password- Parameters:
username- usernamepassword- password- Returns:
- true on success, false if the account does not exists or the password does not match
- Throws:
SQLException- in case of an database error
-
removePlayer
Deprecated.deletes an account from the database- Parameters:
username- username- Returns:
- always true
- Throws:
SQLException- in case of an database error
-
isAccountCreationLimitReached
@Deprecated public boolean isAccountCreationLimitReached(String address) throws SQLException, IOException Deprecated.is account creation limit reached for recently created accounts- Parameters:
address- ip-address- Returns:
- true, if too many accounts have been created recently
- Throws:
SQLException- in case of an database errorIOException- in case of an input/output error
-
addBan
@Deprecated public void addBan(String username, String reason, Timestamp expire) throws SQLException Deprecated.adds a ban (which may be temporary)- Parameters:
username- usernamereason- Reason for the banexpire- timestamp when this ban will expire, may benull- Throws:
SQLException- in case of an database error
-