java.lang.Object
com.aoindustries.aoserv.master.MysqlHandler
The
MySQLHandler
handles all the accesses to the MySQL tables.- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
addDatabase
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Database.Name name, int mysqlServer, Account.Name packageName) Adds a MySQL database to the system.static int
addDatabaseUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int database, int userServer, boolean canSelect, boolean canInsert, boolean canUpdate, boolean canDelete, boolean canCreate, boolean canDrop, boolean canReference, boolean canIndex, boolean canAlter, boolean canCreateTempTable, boolean canLockTables, boolean canCreateView, boolean canShowView, boolean canCreateRoutine, boolean canAlterRoutine, boolean canExecute, boolean canEvent, boolean canTrigger) Grants a UserServer access to a MySQLMasterDatabase.getDatabase().static void
addUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) Adds a MySQL user.static int
addUserServer
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user, int mysqlServer, String host) Adds a MySQL server user.static void
checkAccessDatabase
(DatabaseConnection conn, RequestSource source, String action, int database) static void
checkAccessDatabaseUser
(DatabaseConnection conn, RequestSource source, String action, int databaseUser) static void
checkAccessServer
(DatabaseConnection conn, RequestSource source, String action, int mysqlServer) static void
checkAccessUser
(DatabaseConnection conn, RequestSource source, String action, User.Name user) static void
checkAccessUserServer
(DatabaseConnection conn, RequestSource source, String action, int userServer) static void
checkTables
(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, List<TableName> tableNames, StreamableOutput out) static void
disableUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, User.Name user) static void
disableUserServer
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, int userServer) static void
dumpDatabase
(DatabaseConnection conn, RequestSource source, StreamableOutput out, int database, boolean gzip) Dumps a MySQL database.static void
enableUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) static void
enableUserServer
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) static Database.Name
generateDatabaseName
(DatabaseConnection conn, String templateBase, String templateAdded) Generates a unique MySQL database name.static Account.Name
getAccountForDatabase
(DatabaseConnection conn, int database) static Account.Name
getAccountForDatabaseUser
(DatabaseConnection conn, int databaseUser) static Account.Name
getAccountForUserServer
(DatabaseConnection conn, int userServer) static int
getDatabaseForDatabaseUser
(DatabaseConnection conn, int databaseUser) static int
getDisableLogForUser
(DatabaseConnection conn, User.Name user) static int
getDisableLogForUserServer
(DatabaseConnection conn, int userServer) static int
getLinuxServerForServer
(DatabaseConnection conn, int mysqlServer) static void
getMasterStatus
(DatabaseConnection conn, RequestSource source, int mysqlServer, StreamableOutput out) static Tuple2<Server.Name,
Port> getNameAndPortForServer
(DatabaseConnection conn, int mysqlServer) static Database.Name
getNameForDatabase
(DatabaseConnection conn, int database) static int
getPackageForDatabase
(DatabaseConnection conn, int database) static Account.Name
getPackageForServer
(DatabaseConnection conn, int mysqlServer) static int
getServerForBackupMysqlReplication
(DatabaseConnection conn, int mysqlReplication) static int
getServerForDatabase
(DatabaseConnection conn, int database) static int
getServerForDatabaseUser
(DatabaseConnection conn, int databaseUser) static int
getServerForUserServer
(DatabaseConnection conn, int userServer) static void
getSlaveStatus
(DatabaseConnection conn, RequestSource source, int failoverMysqlReplication, StreamableOutput out) static void
getTableStatus
(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, StreamableOutput out) static User.Name
getUserForUserServer
(DatabaseConnection conn, int userServer) static int
getUserServerForDatabaseUser
(DatabaseConnection conn, int databaseUser) static IntList
getUserServersForUser
(DatabaseConnection conn, User.Name user) static void
invalidateTable
(Table.TableId tableId) static boolean
isDatabaseNameAvailable
(DatabaseConnection conn, RequestSource source, Database.Name name, int mysqlServer) Determines if a MySQL database name is available.static boolean
isUser
(DatabaseConnection conn, User.Name user) static boolean
isUserDisabled
(DatabaseConnection conn, User.Name user) static boolean
isUserServerDisabled
(DatabaseConnection conn, int userServer) static boolean
isUserServerPasswordSet
(DatabaseConnection conn, RequestSource source, int userServer) static void
removeDatabase
(DatabaseConnection conn, InvalidateList invalidateList, int database) Removes a Database from the system.static void
removeDatabase
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int database) Removes a Database from the system.static void
removeDatabaseUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int databaseUser) Removes a DatabaseUser from the system.static void
removeUser
(DatabaseConnection conn, InvalidateList invalidateList, User.Name user) Removes a User from the system.static void
removeUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) Removes a User from the system.static void
removeUserServer
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) Removes a UserServer from the system.static void
restartServer
(DatabaseConnection conn, RequestSource source, int mysqlServer) static void
setUserServerPassword
(DatabaseConnection conn, RequestSource source, int userServer, String password) Sets a MySQL password.static void
setUserServerPredisablePassword
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer, String password) static void
startServer
(DatabaseConnection conn, RequestSource source, int mysqlServer) static void
stopServer
(DatabaseConnection conn, RequestSource source, int mysqlServer) static void
waitForDatabaseRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer) Waits for any pending or processing MySQL database config rebuild to complete.static void
waitForDatabaseUserRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer) Waits for any pending or processing MySQL database config rebuild to complete.static void
waitForServerRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer) static void
waitForUserRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer) Waits for any pending or processing MySQL database config rebuild to complete.
-
Method Details
-
checkAccessDatabase
public static void checkAccessDatabase(DatabaseConnection conn, RequestSource source, String action, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkAccessDatabaseUser
public static void checkAccessDatabaseUser(DatabaseConnection conn, RequestSource source, String action, int databaseUser) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkAccessUserServer
public static void checkAccessUserServer(DatabaseConnection conn, RequestSource source, String action, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkAccessServer
public static void checkAccessServer(DatabaseConnection conn, RequestSource source, String action, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkAccessUser
public static void checkAccessUser(DatabaseConnection conn, RequestSource source, String action, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
addDatabase
public static int addDatabase(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Database.Name name, int mysqlServer, Account.Name packageName) throws IOException, SQLException Adds a MySQL database to the system.- Throws:
IOException
SQLException
-
addDatabaseUser
public static int addDatabaseUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int database, int userServer, boolean canSelect, boolean canInsert, boolean canUpdate, boolean canDelete, boolean canCreate, boolean canDrop, boolean canReference, boolean canIndex, boolean canAlter, boolean canCreateTempTable, boolean canLockTables, boolean canCreateView, boolean canShowView, boolean canCreateRoutine, boolean canAlterRoutine, boolean canExecute, boolean canEvent, boolean canTrigger) throws IOException, SQLException Grants a UserServer access to a MySQLMasterDatabase.getDatabase().- Throws:
IOException
SQLException
-
addUserServer
public static int addUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user, int mysqlServer, String host) throws IOException, SQLException Adds a MySQL server user.- Throws:
IOException
SQLException
-
addUser
public static void addUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Adds a MySQL user.- Throws:
IOException
SQLException
-
disableUserServer
public static void disableUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
disableUser
public static void disableUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
dumpDatabase
public static void dumpDatabase(DatabaseConnection conn, RequestSource source, StreamableOutput out, int database, boolean gzip) throws IOException, SQLException Dumps a MySQL database.- Throws:
IOException
SQLException
-
enableUserServer
public static void enableUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
enableUser
public static void enableUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
generateDatabaseName
public static Database.Name generateDatabaseName(DatabaseConnection conn, String templateBase, String templateAdded) throws IOException, SQLException Generates a unique MySQL database name.- Throws:
IOException
SQLException
-
getDisableLogForUserServer
public static int getDisableLogForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getDisableLogForUser
public static int getDisableLogForUser(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
getUserForUserServer
public static User.Name getUserForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getNameForDatabase
public static Database.Name getNameForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
invalidateTable
-
isUserServerDisabled
public static boolean isUserServerDisabled(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
isUser
public static boolean isUser(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
isUserDisabled
public static boolean isUserDisabled(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
isDatabaseNameAvailable
public static boolean isDatabaseNameAvailable(DatabaseConnection conn, RequestSource source, Database.Name name, int mysqlServer) throws IOException, SQLException Determines if a MySQL database name is available.- Throws:
IOException
SQLException
-
isUserServerPasswordSet
public static boolean isUserServerPasswordSet(DatabaseConnection conn, RequestSource source, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
removeDatabase
public static void removeDatabase(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int database) throws IOException, SQLException Removes a Database from the system.- Throws:
IOException
SQLException
-
removeDatabase
public static void removeDatabase(DatabaseConnection conn, InvalidateList invalidateList, int database) throws IOException, SQLException Removes a Database from the system.- Throws:
IOException
SQLException
-
removeDatabaseUser
public static void removeDatabaseUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int databaseUser) throws IOException, SQLException Removes a DatabaseUser from the system.- Throws:
IOException
SQLException
-
removeUserServer
public static void removeUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) throws IOException, SQLException Removes a UserServer from the system.- Throws:
IOException
SQLException
-
removeUser
public static void removeUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Removes a User from the system.- Throws:
IOException
SQLException
-
removeUser
public static void removeUser(DatabaseConnection conn, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Removes a User from the system.- Throws:
IOException
SQLException
-
setUserServerPassword
public static void setUserServerPassword(DatabaseConnection conn, RequestSource source, int userServer, String password) throws IOException, SQLException Sets a MySQL password.- Throws:
IOException
SQLException
-
setUserServerPredisablePassword
public static void setUserServerPredisablePassword(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer, String password) throws IOException, SQLException - Throws:
IOException
SQLException
-
waitForDatabaseRebuild
public static void waitForDatabaseRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) throws IOException, SQLException Waits for any pending or processing MySQL database config rebuild to complete.- Throws:
IOException
SQLException
-
waitForDatabaseUserRebuild
public static void waitForDatabaseUserRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) throws IOException, SQLException Waits for any pending or processing MySQL database config rebuild to complete.- Throws:
IOException
SQLException
-
waitForServerRebuild
public static void waitForServerRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
waitForUserRebuild
public static void waitForUserRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) throws IOException, SQLException Waits for any pending or processing MySQL database config rebuild to complete.- Throws:
IOException
SQLException
-
getAccountForDatabase
public static Account.Name getAccountForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getAccountForDatabaseUser
public static Account.Name getAccountForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOException
SQLException
-
getAccountForUserServer
public static Account.Name getAccountForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getPackageForDatabase
public static int getPackageForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getUserServersForUser
public static IntList getUserServersForUser(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOException
SQLException
-
getServerForDatabase
public static int getServerForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getLinuxServerForServer
public static int getLinuxServerForServer(DatabaseConnection conn, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getPackageForServer
public static Account.Name getPackageForServer(DatabaseConnection conn, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getNameAndPortForServer
public static Tuple2<Server.Name,Port> getNameAndPortForServer(DatabaseConnection conn, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getServerForBackupMysqlReplication
public static int getServerForBackupMysqlReplication(DatabaseConnection conn, int mysqlReplication) throws IOException, SQLException - Throws:
IOException
SQLException
-
getServerForDatabaseUser
public static int getServerForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOException
SQLException
-
getDatabaseForDatabaseUser
public static int getDatabaseForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOException
SQLException
-
getUserServerForDatabaseUser
public static int getUserServerForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOException
SQLException
-
getServerForUserServer
public static int getServerForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
restartServer
public static void restartServer(DatabaseConnection conn, RequestSource source, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
startServer
public static void startServer(DatabaseConnection conn, RequestSource source, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
stopServer
public static void stopServer(DatabaseConnection conn, RequestSource source, int mysqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getMasterStatus
public static void getMasterStatus(DatabaseConnection conn, RequestSource source, int mysqlServer, StreamableOutput out) throws IOException, SQLException - Throws:
IOException
SQLException
-
getSlaveStatus
public static void getSlaveStatus(DatabaseConnection conn, RequestSource source, int failoverMysqlReplication, StreamableOutput out) throws IOException, SQLException - Throws:
IOException
SQLException
-
getTableStatus
public static void getTableStatus(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, StreamableOutput out) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkTables
public static void checkTables(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, List<TableName> tableNames, StreamableOutput out) throws IOException, SQLException - Throws:
IOException
SQLException
-