Package com.aoindustries.aoserv.master
Class PostgresqlHandler
java.lang.Object
com.aoindustries.aoserv.master.PostgresqlHandler
The
PostgresHandler
handles all the accesses to the PostgreSQL tables.- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
addDatabase
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, Database.Name name, int postgresqlServer, int datdba, int encoding, boolean enablePostgis) Adds a PostgreSQL database to the system.static void
addUser
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) Adds a PostgreSQL user.static int
addUserServer
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user, int postgresqlServer) Adds a PostgreSQL server user.static void
checkAccessDatabase
(DatabaseConnection conn, RequestSource source, String action, int database) static void
checkAccessServer
(DatabaseConnection conn, RequestSource source, String action, int postgresqlServer) 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
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 PostgreSQL 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 PostgreSQL database name.static Account.Name
getAccountForDatabase
(DatabaseConnection conn, int database) static Account.Name
getAccountForUserServer
(DatabaseConnection conn, int userServer) static int
getDatdbaForDatabase
(DatabaseConnection conn, int database) static int
getDisableLogForUser
(DatabaseConnection conn, User.Name user) static int
getDisableLogForUserServer
(DatabaseConnection conn, int userServer) static int
getLinuxServerForDatabase
(DatabaseConnection conn, int database) static int
getLinuxServerForServer
(DatabaseConnection conn, int postgresqlServer) static int
getLinuxServerForUserServer
(DatabaseConnection conn, int userServer) static String
getMinorVersionForServer
(DatabaseConnection conn, int postgresqlServer) static Database.Name
getNameForDatabase
(DatabaseConnection conn, int database) static int
getPackageForDatabase
(DatabaseConnection conn, int database) static int
getPortForServer
(DatabaseConnection conn, int postgresqlServer) static int
getServerForDatabase
(DatabaseConnection conn, int database) static int
getServerForUserServer
(DatabaseConnection conn, int userServer) static User.Name
getUserForUserServer
(DatabaseConnection conn, int userServer) 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 postgresqlServer) Determines if a PostgreSQL database name is available.static boolean
isServerNameAvailable
(DatabaseConnection conn, RequestSource source, Server.Name name, int linuxServer) Determines if a PostgreSQL server name is available.static boolean
isUser
(DatabaseConnection conn, User.Name name) 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
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 postgresqlServer) static void
setUserServerPassword
(DatabaseConnection conn, RequestSource source, int userServer, String password) Sets a PostgreSQL password.static void
setUserServerPredisablePassword
(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer, String password) static void
startServer
(DatabaseConnection conn, RequestSource source, int postgresqlServer) static void
stopServer
(DatabaseConnection conn, RequestSource source, int postgresqlServer) static void
waitForDatabaseRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer) static void
waitForServerRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer) static void
waitForUserRebuild
(DatabaseConnection conn, RequestSource source, int linuxServer)
-
Method Details
-
checkAccessDatabase
public static void checkAccessDatabase(DatabaseConnection conn, RequestSource source, String action, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkAccessServer
public static void checkAccessServer(DatabaseConnection conn, RequestSource source, String action, int postgresqlServer) 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
-
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 postgresqlServer, int datdba, int encoding, boolean enablePostgis) throws IOException, SQLException Adds a PostgreSQL database to the system.- Throws:
IOException
SQLException
-
addUserServer
public static int addUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user, int postgresqlServer) throws IOException, SQLException Adds a PostgreSQL server user.- Throws:
IOException
SQLException
-
addUser
public static void addUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Adds a PostgreSQL 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 PostgreSQL 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 PostgreSQL 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
-
getNameForDatabase
public static Database.Name getNameForDatabase(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
-
getUserForUserServer
public static User.Name getUserForUserServer(DatabaseConnection conn, int userServer) 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 name) 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 postgresqlServer) throws IOException, SQLException Determines if a PostgreSQL database name is available.- Throws:
IOException
SQLException
-
isServerNameAvailable
public static boolean isServerNameAvailable(DatabaseConnection conn, RequestSource source, Server.Name name, int linuxServer) throws IOException, SQLException Determines if a PostgreSQL server 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
-
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 PostgreSQL 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 - 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 - Throws:
IOException
SQLException
-
getAccountForDatabase
public static Account.Name getAccountForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getPackageForDatabase
public static int getPackageForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getAccountForUserServer
public static Account.Name getAccountForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getLinuxServerForServer
public static int getLinuxServerForServer(DatabaseConnection conn, int postgresqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getPortForServer
public static int getPortForServer(DatabaseConnection conn, int postgresqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getMinorVersionForServer
public static String getMinorVersionForServer(DatabaseConnection conn, int postgresqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getServerForDatabase
public static int getServerForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getServerForUserServer
public static int getServerForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
getLinuxServerForDatabase
public static int getLinuxServerForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getDatdbaForDatabase
public static int getDatdbaForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOException
SQLException
-
getLinuxServerForUserServer
public static int getLinuxServerForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
restartServer
public static void restartServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
startServer
public static void startServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-
stopServer
public static void stopServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) throws IOException, SQLException - Throws:
IOException
SQLException
-