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 intaddDatabase(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Database.Name name, int mysqlServer, Account.Name packageName) Adds a MySQL database to the system.static intaddDatabaseUser(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 voidaddUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) Adds a MySQL user.static intaddUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user, int mysqlServer, String host) Adds a MySQL server user.static voidcheckAccessDatabase(DatabaseConnection conn, RequestSource source, String action, int database) static voidcheckAccessDatabaseUser(DatabaseConnection conn, RequestSource source, String action, int databaseUser) static voidcheckAccessServer(DatabaseConnection conn, RequestSource source, String action, int mysqlServer) static voidcheckAccessUser(DatabaseConnection conn, RequestSource source, String action, User.Name user) static voidcheckAccessUserServer(DatabaseConnection conn, RequestSource source, String action, int userServer) static voidcheckTables(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, List<TableName> tableNames, StreamableOutput out) static voiddisableUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, User.Name user) static voiddisableUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, int userServer) static voiddumpDatabase(DatabaseConnection conn, RequestSource source, StreamableOutput out, int database, boolean gzip) Dumps a MySQL database.static voidenableUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) static voidenableUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) static Database.NamegenerateDatabaseName(DatabaseConnection conn, String templateBase, String templateAdded) Generates a unique MySQL database name.static Account.NamegetAccountForDatabase(DatabaseConnection conn, int database) static Account.NamegetAccountForDatabaseUser(DatabaseConnection conn, int databaseUser) static Account.NamegetAccountForUserServer(DatabaseConnection conn, int userServer) static intgetDatabaseForDatabaseUser(DatabaseConnection conn, int databaseUser) static intgetDisableLogForUser(DatabaseConnection conn, User.Name user) static intgetDisableLogForUserServer(DatabaseConnection conn, int userServer) static intgetLinuxServerForServer(DatabaseConnection conn, int mysqlServer) static voidgetMasterStatus(DatabaseConnection conn, RequestSource source, int mysqlServer, StreamableOutput out) static Tuple2<Server.Name, Port> getNameAndPortForServer(DatabaseConnection conn, int mysqlServer) static Database.NamegetNameForDatabase(DatabaseConnection conn, int database) static intgetPackageForDatabase(DatabaseConnection conn, int database) static Account.NamegetPackageForServer(DatabaseConnection conn, int mysqlServer) static intgetServerForBackupMysqlReplication(DatabaseConnection conn, int mysqlReplication) static intgetServerForDatabase(DatabaseConnection conn, int database) static intgetServerForDatabaseUser(DatabaseConnection conn, int databaseUser) static intgetServerForUserServer(DatabaseConnection conn, int userServer) static voidgetSlaveStatus(DatabaseConnection conn, RequestSource source, int failoverMysqlReplication, StreamableOutput out) static voidgetTableStatus(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, StreamableOutput out) static User.NamegetUserForUserServer(DatabaseConnection conn, int userServer) static intgetUserServerForDatabaseUser(DatabaseConnection conn, int databaseUser) static IntListgetUserServersForUser(DatabaseConnection conn, User.Name user) static voidinvalidateTable(Table.TableId tableId) static booleanisDatabaseNameAvailable(DatabaseConnection conn, RequestSource source, Database.Name name, int mysqlServer) Determines if a MySQL database name is available.static booleanisUser(DatabaseConnection conn, User.Name user) static booleanisUserDisabled(DatabaseConnection conn, User.Name user) static booleanisUserServerDisabled(DatabaseConnection conn, int userServer) static booleanisUserServerPasswordSet(DatabaseConnection conn, RequestSource source, int userServer) static voidremoveDatabase(DatabaseConnection conn, InvalidateList invalidateList, int database) Removes a Database from the system.static voidremoveDatabase(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int database) Removes a Database from the system.static voidremoveDatabaseUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int databaseUser) Removes a DatabaseUser from the system.static voidremoveUser(DatabaseConnection conn, InvalidateList invalidateList, User.Name user) Removes a User from the system.static voidremoveUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) Removes a User from the system.static voidremoveUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) Removes a UserServer from the system.static voidrestartServer(DatabaseConnection conn, RequestSource source, int mysqlServer) static voidsetUserServerPassword(DatabaseConnection conn, RequestSource source, int userServer, String password) Sets a MySQL password.static voidsetUserServerPredisablePassword(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer, String password) static voidstartServer(DatabaseConnection conn, RequestSource source, int mysqlServer) static voidstopServer(DatabaseConnection conn, RequestSource source, int mysqlServer) static voidwaitForDatabaseRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) Waits for any pending or processing MySQL database config rebuild to complete.static voidwaitForDatabaseUserRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) Waits for any pending or processing MySQL database config rebuild to complete.static voidwaitForServerRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) static voidwaitForUserRebuild(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:
IOExceptionSQLException
-
checkAccessDatabaseUser
public static void checkAccessDatabaseUser(DatabaseConnection conn, RequestSource source, String action, int databaseUser) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkAccessUserServer
public static void checkAccessUserServer(DatabaseConnection conn, RequestSource source, String action, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkAccessServer
public static void checkAccessServer(DatabaseConnection conn, RequestSource source, String action, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkAccessUser
public static void checkAccessUser(DatabaseConnection conn, RequestSource source, String action, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
addUser
public static void addUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Adds a MySQL user.- Throws:
IOExceptionSQLException
-
disableUserServer
public static void disableUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
disableUser
public static void disableUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int disableLog, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
dumpDatabase
public static void dumpDatabase(DatabaseConnection conn, RequestSource source, StreamableOutput out, int database, boolean gzip) throws IOException, SQLException Dumps a MySQL database.- Throws:
IOExceptionSQLException
-
enableUserServer
public static void enableUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
enableUser
public static void enableUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
generateDatabaseName
public static Database.Name generateDatabaseName(DatabaseConnection conn, String templateBase, String templateAdded) throws IOException, SQLException Generates a unique MySQL database name.- Throws:
IOExceptionSQLException
-
getDisableLogForUserServer
public static int getDisableLogForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getDisableLogForUser
public static int getDisableLogForUser(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getUserForUserServer
public static User.Name getUserForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getNameForDatabase
public static Database.Name getNameForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
invalidateTable
-
isUserServerDisabled
public static boolean isUserServerDisabled(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
isUser
public static boolean isUser(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
isUserDisabled
public static boolean isUserDisabled(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
isUserServerPasswordSet
public static boolean isUserServerPasswordSet(DatabaseConnection conn, RequestSource source, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
removeDatabase
public static void removeDatabase(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int database) throws IOException, SQLException Removes a Database from the system.- Throws:
IOExceptionSQLException
-
removeDatabase
public static void removeDatabase(DatabaseConnection conn, InvalidateList invalidateList, int database) throws IOException, SQLException Removes a Database from the system.- Throws:
IOExceptionSQLException
-
removeDatabaseUser
public static void removeDatabaseUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int databaseUser) throws IOException, SQLException Removes a DatabaseUser from the system.- Throws:
IOExceptionSQLException
-
removeUserServer
public static void removeUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer) throws IOException, SQLException Removes a UserServer from the system.- Throws:
IOExceptionSQLException
-
removeUser
public static void removeUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Removes a User from the system.- Throws:
IOExceptionSQLException
-
removeUser
public static void removeUser(DatabaseConnection conn, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Removes a User from the system.- Throws:
IOExceptionSQLException
-
setUserServerPassword
public static void setUserServerPassword(DatabaseConnection conn, RequestSource source, int userServer, String password) throws IOException, SQLException Sets a MySQL password.- Throws:
IOExceptionSQLException
-
setUserServerPredisablePassword
public static void setUserServerPredisablePassword(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer, String password) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
waitForServerRebuild
public static void waitForServerRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
getAccountForDatabase
public static Account.Name getAccountForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getAccountForDatabaseUser
public static Account.Name getAccountForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getAccountForUserServer
public static Account.Name getAccountForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getPackageForDatabase
public static int getPackageForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getUserServersForUser
public static IntList getUserServersForUser(DatabaseConnection conn, User.Name user) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getServerForDatabase
public static int getServerForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getLinuxServerForServer
public static int getLinuxServerForServer(DatabaseConnection conn, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getPackageForServer
public static Account.Name getPackageForServer(DatabaseConnection conn, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getNameAndPortForServer
public static Tuple2<Server.Name,Port> getNameAndPortForServer(DatabaseConnection conn, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getServerForBackupMysqlReplication
public static int getServerForBackupMysqlReplication(DatabaseConnection conn, int mysqlReplication) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getServerForDatabaseUser
public static int getServerForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getDatabaseForDatabaseUser
public static int getDatabaseForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getUserServerForDatabaseUser
public static int getUserServerForDatabaseUser(DatabaseConnection conn, int databaseUser) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getServerForUserServer
public static int getServerForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
restartServer
public static void restartServer(DatabaseConnection conn, RequestSource source, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
startServer
public static void startServer(DatabaseConnection conn, RequestSource source, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
stopServer
public static void stopServer(DatabaseConnection conn, RequestSource source, int mysqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getMasterStatus
public static void getMasterStatus(DatabaseConnection conn, RequestSource source, int mysqlServer, StreamableOutput out) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getSlaveStatus
public static void getSlaveStatus(DatabaseConnection conn, RequestSource source, int failoverMysqlReplication, StreamableOutput out) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getTableStatus
public static void getTableStatus(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, StreamableOutput out) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkTables
public static void checkTables(DatabaseConnection conn, RequestSource source, int database, int mysqlSlave, List<TableName> tableNames, StreamableOutput out) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
