java.lang.Object
com.aoindustries.aoserv.client.AoservObject<Integer,Database>
com.aoindustries.aoserv.client.CachedObject<Integer,Database>
com.aoindustries.aoserv.client.CachedObjectIntegerKey<Database>
com.aoindustries.aoserv.client.mysql.Database
- All Implemented Interfaces:
Streamable
,StreamReadable
,StreamWritable
,Row
,AoservReadable
,AoservStreamable
,AoservWritable
,Dumpable
,JdbcProvider
,Removable
,SingleTableObject<Integer,
Database>
public final class Database
extends CachedObjectIntegerKey<Database>
implements Removable, Dumpable, JdbcProvider
A
Database
corresponds to a unique MySQL table
space on one server. The database name must be unique per server
and, to aid in account portability, will typically be unique
across the entire system.- Author:
- AO Industries, Inc.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
static final class
Represents a name that may be used for aDatabase
.static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The URL for MySQL JDBC documentation.static final String
The classname of the JDBC driver used for theDatabase
.static final String
The URL for MySQL JDBC documentation.static final String
The classname of the JDBC driver used for theDatabase
.static final Charset
The character set used by the dumps.static final Database.Name
MySQL.static final Database.Name
The root database for a MySQL installation.static final Database.Name
Monitoring.static final Database.Name
MySQL.static final String
The URL for MySQL JDBC documentation.static final String
The classname of the JDBC driver used for theDatabase
.static final Database.Name
MySQL.Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
Fields inherited from class com.aoindustries.aoserv.client.AoservObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
Constructor Summary
ConstructorDescriptionDatabase()
Deprecated.Only required for implementation, do not use directly. -
Method Summary
Modifier and TypeMethodDescriptionint
addMysqlServerUser
(UserServer msu, 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) Deprecated.checkTables
(MysqlReplication mysqlSlave, Collection<TableName> tableNames) Gets the table status on the master server or provided slave server.checkTables
(Collection<TableName> tableNames) Gets the table status on the master server.void
dump
(boolean gzip, StreamHandler streamHandler) Dumps the database inDUMP_ENCODING
encoding into binary form, optionally gzipped.void
dump
(PrintWriter out) Dumps the contents of this object into aPrintWriter
.void
Dumps the database into textual representation, not gzipped.Lists the reasons an object may not be removed.protected Object
getColumnImpl
(int i) Gets the URL of the JDBC documentation.Gets the classname of the driver used to contact the server.getJdbcUrl
(boolean ipOnly) Gets the URL that should be used for JDBC connections.getMysqlDbUser
(UserServer msu) int
getName()
Gets the table status on the master server.getTableStatus
(MysqlReplication mysqlSlave) Gets the table status on the master server or provided slave server.void
Initializes this object from the raw database contents.static boolean
isSafeName
(String name) Deprecated.Useinstead
boolean
static boolean
isSpecial
(Database.Name name) Special MySQL databases may not be added or removed.void
read
(StreamableInput in, AoservProtocol.Version protocolVersion) void
remove()
Removes this object, and all dependant objects, from the system.AoservObject.toString()
implementation that is allowed to throw exceptions.void
write
(StreamableOutput out, AoservProtocol.Version protocolVersion) Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
Methods inherited from class com.aoindustries.aoserv.client.AoservObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxId, getLinuxUserName, getMacAddress, getMysqlDatabaseName, getMysqlServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
Field Details
-
CENTOS_JDBC_DRIVER
The classname of the JDBC driver used for theDatabase
.- See Also:
-
CENTOS_7_JDBC_DRIVER
The classname of the JDBC driver used for theDatabase
.- See Also:
-
ROCKY_9_JDBC_DRIVER
The classname of the JDBC driver used for theDatabase
.- See Also:
-
CENTOS_JDBC_DOCUMENTATION_URL
The URL for MySQL JDBC documentation.- See Also:
-
CENTOS_7_JDBC_DOCUMENTATION_URL
The URL for MySQL JDBC documentation.- See Also:
-
ROCKY_9_JDBC_DOCUMENTATION_URL
The URL for MySQL JDBC documentation.- See Also:
-
MYSQL
The root database for a MySQL installation. -
INFORMATION_SCHEMA
MySQL. -
PERFORMANCE_SCHEMA
MySQL. -
SYS
MySQL. -
MYSQLMON
Monitoring. -
DUMP_ENCODING
The character set used by the dumps.
-
-
Constructor Details
-
Database
Deprecated.Only required for implementation, do not use directly.- See Also:
-
-
Method Details
-
isSpecial
Special MySQL databases may not be added or removed. -
addMysqlServerUser
@Deprecated public int addMysqlServerUser(UserServer msu, 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 Deprecated.- Throws:
IOException
SQLException
-
dump
Dumps the contents of this object into aPrintWriter
.- Specified by:
dump
in interfaceDumpable
- Throws:
IOException
SQLException
- See Also:
-
dump
Dumps the database into textual representation, not gzipped.- Throws:
IOException
SQLException
-
dump
Dumps the database inDUMP_ENCODING
encoding into binary form, optionally gzipped.- Throws:
IOException
SQLException
-
getColumnImpl
- Specified by:
getColumnImpl
in classAoservObject<Integer,
Database>
-
getJdbcDriver
Description copied from interface:JdbcProvider
Gets the classname of the driver used to contact the server.- Specified by:
getJdbcDriver
in interfaceJdbcProvider
- Throws:
SQLException
IOException
-
getJdbcUrl
Description copied from interface:JdbcProvider
Gets the URL that should be used for JDBC connections.- Specified by:
getJdbcUrl
in interfaceJdbcProvider
- Throws:
SQLException
IOException
-
getJdbcDocumentationUrl
Description copied from interface:JdbcProvider
Gets the URL of the JDBC documentation.- Specified by:
getJdbcDocumentationUrl
in interfaceJdbcProvider
- Throws:
SQLException
IOException
-
getMysqlDbUser
- Throws:
IOException
SQLException
-
getMysqlDbUsers
- Throws:
IOException
SQLException
-
getMysqlServerUsers
- Throws:
IOException
SQLException
-
getName
-
isSpecial
public boolean isSpecial() -
getPackage_name
-
getPackage
- Throws:
SQLException
IOException
-
getMysqlServer_id
public int getMysqlServer_id() -
getMysqlServer
- Throws:
SQLException
IOException
-
getMaxCheckTableAlertLevel
-
getTableId
- Specified by:
getTableId
in classAoservObject<Integer,
Database>
-
init
Description copied from class:AoservObject
Initializes this object from the raw database contents.- Specified by:
init
in classAoservObject<Integer,
Database> - Parameters:
result
- theResultSet
containing the row to copy into this object- Throws:
SQLException
-
read
- Specified by:
read
in interfaceAoservReadable
- Specified by:
read
in interfaceAoservStreamable
- Specified by:
read
in classAoservObject<Integer,
Database> - Throws:
IOException
-
getCannotRemoveReasons
Description copied from interface:Removable
Lists the reasons an object may not be removed.- Specified by:
getCannotRemoveReasons
in interfaceRemovable
- Returns:
- an empty
List<CannotRemoveReason>
if this object may be removed, or a list of descriptions - Throws:
SQLException
IOException
-
remove
Description copied from interface:Removable
Removes this object, and all dependant objects, from the system.- Specified by:
remove
in interfaceRemovable
- Throws:
IOException
SQLException
-
toStringImpl
Description copied from class:AoservObject
AoservObject.toString()
implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callsAoservObject.toString()
on the key (fromAoservObject.getKey()
). When the key isnull
, uses the default implementation fromObject.toString()
.- Overrides:
toStringImpl
in classCachedObjectIntegerKey<Database>
-
write
- Specified by:
write
in interfaceAoservStreamable
- Specified by:
write
in interfaceAoservWritable
- Specified by:
write
in classAoservObject<Integer,
Database> - Throws:
IOException
-
getTableStatus
Gets the table status on the master server.- Throws:
IOException
SQLException
-
getTableStatus
public List<Database.TableStatus> getTableStatus(MysqlReplication mysqlSlave) throws IOException, SQLException Gets the table status on the master server or provided slave server.- Throws:
IOException
SQLException
-
checkTables
public List<Database.CheckTableResult> checkTables(Collection<TableName> tableNames) throws IOException, SQLException Gets the table status on the master server.- Throws:
IOException
SQLException
-
checkTables
public List<Database.CheckTableResult> checkTables(MysqlReplication mysqlSlave, Collection<TableName> tableNames) throws IOException, SQLException Gets the table status on the master server or provided slave server.- Throws:
IOException
SQLException
-
isSafeName
Deprecated.Useinstead
Determines if a name is safe for use as a table/column name, the name identifier should be enclosed with backticks (`).
-