|
|||||||||
Atavism Version 2018.1 | AGIS API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatavism.server.engine.MasterDatabase
public class MasterDatabase
Access to Entities in database - default is MySQL All Entity access requires both an object oid and a Namespace.
Nested Class Summary | |
---|---|
static class |
MasterDatabase.WorldInfo
A class to represent a world - world name, world mgr server, hostname, port, mediaURL |
Constructor Summary | |
---|---|
MasterDatabase()
Constructor starts the keepalive thread |
|
MasterDatabase(java.lang.String sDriver)
General database connection. |
Method Summary | |
---|---|
int |
AOAcctPasswdCheck(java.lang.String username,
java.lang.String password)
Returns the atavism account id if the username and password match. otherwise, returns -1. |
boolean |
checkPlayerCanConnectToWorld(int worldID)
Checks if the specified world is currently online and that there is sufficient population space for them to connect. |
void |
close()
Close the database connection. |
void |
connect(java.lang.String url,
java.lang.String username,
java.lang.String password)
Connect to the database at the host given by the url, using the given username and password |
int |
createAccount(java.lang.String username,
java.lang.String password,
java.lang.String emailAddress,
boolean specificID,
int accountID)
Checks password, returns the user OID if matches, otherwise returns null |
boolean |
createUser(java.lang.String username,
java.lang.String password,
java.lang.String email,
int status)
Create a user - returns false if failed - usually because username is not unique. |
boolean |
databaseContainsTable(java.lang.String dbName,
java.lang.String tableName)
Tests to see if the table of the given name is present in a database. |
boolean |
databaseTableContainsColumn(java.lang.String dbName,
java.lang.String tableName,
java.lang.String columnName)
Tests to see if the table of the given name contain the given row in the current database. |
void |
executeBatch(java.util.List<java.lang.String> statements)
Run the series of SQL statements in the list argument. |
java.sql.ResultSet |
executeSelect(java.lang.String query)
|
void |
executeUpdate(java.lang.String update)
Run the update statement in the string arg. |
static java.lang.String |
generateSaltedPassword(java.lang.String passwd)
|
java.lang.Integer |
getAccountId(java.lang.String username)
|
int |
getCurrentWorld(java.lang.String username)
Reads in the id of the world the player was last connected to. |
java.lang.String |
getPassword(java.lang.String username)
|
int |
getServerToConnectTo(java.lang.String username)
Works out which server the player should connect to. |
int |
getServerWithLowestPopulation()
Finds the server with the lowest population that the player can connect to. |
java.lang.String |
getUserName(long uid)
Get user name. |
int |
getWorldWithPlayersCharacters(int accountID)
Reads in the servers the player has characters on and returns the one with the most players characters on that they can connect to. |
static void |
main(java.lang.String[] args)
A main program that exercises database functionality. |
OID |
passwordCheck(java.lang.String username,
java.lang.String password)
Checks password, returns the user OID if matches, otherwise returns null |
void |
ping()
Runs a select statement to make sure we can still talk to the database. |
MasterDatabase.WorldInfo |
resolveWorldID(int worldID)
Resolves the passed-in world ID to a servername and port. |
int |
statusCheck(java.lang.String username)
Checks account status, returns the user OID if matches, otherwise returns null |
void |
updateUser(java.lang.String username,
java.lang.String password,
int status)
Create a user - returns false if failed - usually because username is not unique. |
void |
updateUserWorld(java.lang.String username,
int worldID)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MasterDatabase()
public MasterDatabase(java.lang.String sDriver)
Method Detail |
---|
public void connect(java.lang.String url, java.lang.String username, java.lang.String password)
url
- Specifies the host to connect to.username
- The account name used to log into the database.password
- The password to use to log in.public void executeUpdate(java.lang.String update)
update
- An SQL update statement, or any other statement
that does not return values.public void executeBatch(java.util.List<java.lang.String> statements)
statements
- A list of SQL statements to be executed.public boolean databaseTableContainsColumn(java.lang.String dbName, java.lang.String tableName, java.lang.String columnName)
tableName
- The name of the table.columnName
- The name of the column.
public boolean databaseContainsTable(java.lang.String dbName, java.lang.String tableName)
dbName
- The name of the database.tableName
- The name of the table.
public void close()
public int AOAcctPasswdCheck(java.lang.String username, java.lang.String password)
username
- The name of the user account.password
- The user's account password.
public MasterDatabase.WorldInfo resolveWorldID(int worldID)
worldName
- The string name of the world.
public int getServerToConnectTo(java.lang.String username)
username
-
public int getCurrentWorld(java.lang.String username)
username
-
public java.lang.String getPassword(java.lang.String username)
public java.lang.Integer getAccountId(java.lang.String username)
public OID passwordCheck(java.lang.String username, java.lang.String password)
username
- The username string.password
- The password string.
public int createAccount(java.lang.String username, java.lang.String password, java.lang.String emailAddress, boolean specificID, int accountID)
username
- The username string.password
- The password string.
public java.sql.ResultSet executeSelect(java.lang.String query)
public static java.lang.String generateSaltedPassword(java.lang.String passwd)
public boolean createUser(java.lang.String username, java.lang.String password, java.lang.String email, int status)
username
- The username string.password
- The password string.
public void updateUser(java.lang.String username, java.lang.String password, int status)
username
- The username string.password
- The password string.public void updateUserWorld(java.lang.String username, int worldID)
public int statusCheck(java.lang.String username)
username
- The username string.password
- The password string.
public java.lang.String getUserName(long uid)
uid
- The user oid.
public boolean checkPlayerCanConnectToWorld(int worldID)
worldID
-
public int getWorldWithPlayersCharacters(int accountID)
accountID
-
public int getServerWithLowestPopulation()
public void ping()
public static void main(java.lang.String[] args)
args
- Command-line args with the format
"java Database
|
Copyright © 2018 Dragonsan Studios Sp. z o.o. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |