Class Database
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.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
A
PostgresDatabase
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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Represents a name that may be used for a PostgreSQL database. -
Field Summary
Modifier and TypeFieldDescriptionstatic final Database.Name
AO Platform Components.static final Database.Name
AO Platform Components.static final Database.Name
AO Platform Components.static final Database.Name
AO Platform Components.static final Charset
The character set used by the dumps.static final String
The classname of the JDBC driver used for thePostgresDatabase
.static final Database.Name
Monitoring.static final Database.Name
Templates.static final Database.Name
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
ConstructorDescriptionDatabase()
Deprecated.Only required for implementation, do not use directly. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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) int
boolean
Indicates that PostGIS should be enabled for this database.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.getName()
int
void
Initializes this object from the raw database contents.boolean
static boolean
isSpecial
(Database.Name name) Special PostgreSQL databases may not be added or removed.boolean
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
-
JDBC_DRIVER
The classname of the JDBC driver used for thePostgresDatabase
.- See Also:
-
TEMPLATE0
Templates. -
TEMPLATE1
Templates. -
POSTGRESMON
Monitoring. -
AOINDUSTRIES
AO Platform Components. -
AOSERV
AO Platform Components. -
AOSERV_MASTER
AO Platform Components. -
AOWEB
AO Platform Components. -
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 PostgreSQL databases may not be added or removed. -
allowsConnections
public boolean allowsConnections() -
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
-
getEnablePostgis
public boolean getEnablePostgis()Indicates that PostGIS should be enabled for this database. -
getColumnImpl
- Specified by:
getColumnImpl
in classAoservObject<Integer,
Database>
-
getDatdba_id
public int getDatdba_id() -
getDatdba
- Throws:
SQLException
IOException
-
getJdbcDriver
Description copied from interface:JdbcProvider
Gets the classname of the driver used to contact the server.- Specified by:
getJdbcDriver
in interfaceJdbcProvider
-
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
-
getName
-
isSpecial
public boolean isSpecial() -
getPostgresEncoding
- Throws:
SQLException
IOException
-
getPostgresServer_bind_id
public int getPostgresServer_bind_id() -
getPostgresServer
- Throws:
SQLException
IOException
-
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
-
isTemplate
public boolean isTemplate() -
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
-