Class Database
- java.lang.Object
-
- com.aoindustries.aoserv.client.AoservObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<Database>
-
- com.aoindustries.aoserv.client.postgresql.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 Dumpable, Removable, JdbcProvider
APostgresDatabase
corresponds to a unique PostgreSQL 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:
Encoding
,UserServer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Database.Name
Represents a name that may be used for a PostgreSQL database.
-
Field Summary
Fields Modifier and Type Field Description static Database.Name
AOINDUSTRIES
AO Platform Components.static Database.Name
AOSERV
AO Platform Components.static Database.Name
AOSERV_MASTER
AO Platform Components.static Database.Name
AOWEB
AO Platform Components.static Charset
DUMP_ENCODING
The character set used by the dumps.static String
JDBC_DRIVER
The classname of the JDBC driver used for thePostgresDatabase
.static Database.Name
POSTGRESMON
Monitoring.static Database.Name
TEMPLATE0
Templates.static Database.Name
TEMPLATE1
Templates.-
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
Constructors Constructor Description Database()
Deprecated.Only required for implementation, do not use directly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowsConnections()
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
dump(Writer out)
Dumps the database into textual representation, not gzipped.List<CannotRemoveReason<Database>>
getCannotRemoveReasons()
Lists the reasons an object may not be removed.protected Object
getColumnImpl(int i)
UserServer
getDatdba()
int
getDatdba_id()
boolean
getEnablePostgis()
Indicates that PostGIS should be enabled for this database.String
getJdbcDocumentationUrl()
Gets the URL of the JDBC documentation.String
getJdbcDriver()
Gets the classname of the driver used to contact the server.String
getJdbcUrl(boolean ipOnly)
Gets the URL that should be used for JDBC connections.Database.Name
getName()
Encoding
getPostgresEncoding()
Server
getPostgresServer()
int
getPostgresServer_bind_id()
Table.TableId
getTableId()
void
init(ResultSet result)
Initializes this object from the raw database contents.boolean
isSpecial()
static boolean
isSpecial(Database.Name name)
Special PostgreSQL databases may not be added or removed.boolean
isTemplate()
void
read(StreamableInput in, AoservProtocol.Version protocolVersion)
void
remove()
Removes this object, and all dependant objects, from the system.String
toStringImpl()
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 Detail
-
JDBC_DRIVER
public static final String JDBC_DRIVER
The classname of the JDBC driver used for thePostgresDatabase
.- See Also:
- Constant Field Values
-
TEMPLATE0
public static final Database.Name TEMPLATE0
Templates.
-
TEMPLATE1
public static final Database.Name TEMPLATE1
Templates.
-
POSTGRESMON
public static final Database.Name POSTGRESMON
Monitoring.
-
AOINDUSTRIES
public static final Database.Name AOINDUSTRIES
AO Platform Components.
-
AOSERV
public static final Database.Name AOSERV
AO Platform Components.
-
AOSERV_MASTER
public static final Database.Name AOSERV_MASTER
AO Platform Components.
-
AOWEB
public static final Database.Name AOWEB
AO Platform Components.
-
DUMP_ENCODING
public static final Charset DUMP_ENCODING
The character set used by the dumps.
-
-
Constructor Detail
-
Database
@Deprecated public Database()
Deprecated.Only required for implementation, do not use directly.
-
-
Method Detail
-
isSpecial
public static boolean isSpecial(Database.Name name)
Special PostgreSQL databases may not be added or removed.
-
allowsConnections
public boolean allowsConnections()
-
dump
public void dump(PrintWriter out) throws IOException, SQLException
Dumps the contents of this object into aPrintWriter
.- Specified by:
dump
in interfaceDumpable
- Throws:
IOException
SQLException
- See Also:
dump(java.io.Writer)
-
dump
public void dump(Writer out) throws IOException, SQLException
Dumps the database into textual representation, not gzipped.- Throws:
IOException
SQLException
-
dump
public void dump(boolean gzip, StreamHandler streamHandler) throws IOException, SQLException
Dumps the database inDUMP_ENCODING
encoding into binary form, optionally gzipped.- Throws:
IOException
SQLException
-
getEnablePostgis
public boolean getEnablePostgis()
Indicates that PostGIS should be enabled for this database.
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImpl
in classAoservObject<Integer,Database>
-
getDatdba_id
public int getDatdba_id()
-
getDatdba
public UserServer getDatdba() throws SQLException, IOException
- Throws:
SQLException
IOException
-
getJdbcDriver
public String getJdbcDriver()
Description copied from interface:JdbcProvider
Gets the classname of the driver used to contact the server.- Specified by:
getJdbcDriver
in interfaceJdbcProvider
-
getJdbcUrl
public String getJdbcUrl(boolean ipOnly) throws SQLException, IOException
Description copied from interface:JdbcProvider
Gets the URL that should be used for JDBC connections.- Specified by:
getJdbcUrl
in interfaceJdbcProvider
- Throws:
SQLException
IOException
-
getJdbcDocumentationUrl
public String getJdbcDocumentationUrl() throws SQLException, IOException
Description copied from interface:JdbcProvider
Gets the URL of the JDBC documentation.- Specified by:
getJdbcDocumentationUrl
in interfaceJdbcProvider
- Throws:
SQLException
IOException
-
getName
public Database.Name getName()
-
isSpecial
public boolean isSpecial()
-
getPostgresEncoding
public Encoding getPostgresEncoding() throws SQLException, IOException
- Throws:
SQLException
IOException
-
getPostgresServer_bind_id
public int getPostgresServer_bind_id()
-
getPostgresServer
public Server getPostgresServer() throws SQLException, IOException
- Throws:
SQLException
IOException
-
getTableId
public Table.TableId getTableId()
- Specified by:
getTableId
in classAoservObject<Integer,Database>
-
init
public void init(ResultSet result) throws SQLException
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
-
isTemplate
public boolean isTemplate()
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
read
in interfaceAoservReadable
- Specified by:
read
in interfaceAoservStreamable
- Specified by:
read
in classAoservObject<Integer,Database>
- Throws:
IOException
-
getCannotRemoveReasons
public List<CannotRemoveReason<Database>> getCannotRemoveReasons() throws SQLException, IOException
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
public void remove() throws IOException, SQLException
Description copied from interface:Removable
Removes this object, and all dependant objects, from the system.- Specified by:
remove
in interfaceRemovable
- Throws:
IOException
SQLException
-
toStringImpl
public String 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
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
write
in interfaceAoservStreamable
- Specified by:
write
in interfaceAoservWritable
- Specified by:
write
in classAoservObject<Integer,Database>
- Throws:
IOException
-
-