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 intaddDatabase(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 voidaddUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) Adds a PostgreSQL user.static intaddUserServer(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user, int postgresqlServer) Adds a PostgreSQL server user.static voidcheckAccessDatabase(DatabaseConnection conn, RequestSource source, String action, int database) static voidcheckAccessServer(DatabaseConnection conn, RequestSource source, String action, int postgresqlServer) static voidcheckAccessUser(DatabaseConnection conn, RequestSource source, String action, User.Name user) static voidcheckAccessUserServer(DatabaseConnection conn, RequestSource source, String action, int userServer) 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 PostgreSQL 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 PostgreSQL database name.static Account.NamegetAccountForDatabase(DatabaseConnection conn, int database) static Account.NamegetAccountForUserServer(DatabaseConnection conn, int userServer) static intgetDatdbaForDatabase(DatabaseConnection conn, int database) static intgetDisableLogForUser(DatabaseConnection conn, User.Name user) static intgetDisableLogForUserServer(DatabaseConnection conn, int userServer) static intgetLinuxServerForDatabase(DatabaseConnection conn, int database) static intgetLinuxServerForServer(DatabaseConnection conn, int postgresqlServer) static intgetLinuxServerForUserServer(DatabaseConnection conn, int userServer) static StringgetMinorVersionForServer(DatabaseConnection conn, int postgresqlServer) static Database.NamegetNameForDatabase(DatabaseConnection conn, int database) static intgetPackageForDatabase(DatabaseConnection conn, int database) static intgetPortForServer(DatabaseConnection conn, int postgresqlServer) static intgetServerForDatabase(DatabaseConnection conn, int database) static intgetServerForUserServer(DatabaseConnection conn, int userServer) static User.NamegetUserForUserServer(DatabaseConnection conn, int userServer) static IntListgetUserServersForUser(DatabaseConnection conn, User.Name user) static voidinvalidateTable(Table.TableId tableId) static booleanisDatabaseNameAvailable(DatabaseConnection conn, RequestSource source, Database.Name name, int postgresqlServer) Determines if a PostgreSQL database name is available.static booleanisServerNameAvailable(DatabaseConnection conn, RequestSource source, Server.Name name, int linuxServer) Determines if a PostgreSQL server name is available.static booleanisUser(DatabaseConnection conn, User.Name name) 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 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 postgresqlServer) static voidsetUserServerPassword(DatabaseConnection conn, RequestSource source, int userServer, String password) Sets a PostgreSQL password.static voidsetUserServerPredisablePassword(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, int userServer, String password) static voidstartServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) static voidstopServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) static voidwaitForDatabaseRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) static voidwaitForServerRebuild(DatabaseConnection conn, RequestSource source, int linuxServer) static voidwaitForUserRebuild(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:
IOExceptionSQLException
-
checkAccessServer
public static void checkAccessServer(DatabaseConnection conn, RequestSource source, String action, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkAccessUserServer
public static void checkAccessUserServer(DatabaseConnection conn, RequestSource source, String action, int userServer) 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 postgresqlServer, int datdba, int encoding, boolean enablePostgis) throws IOException, SQLException Adds a PostgreSQL database to the system.- Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
addUser
public static void addUser(DatabaseConnection conn, RequestSource source, InvalidateList invalidateList, User.Name user) throws IOException, SQLException Adds a PostgreSQL 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 PostgreSQL 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 PostgreSQL 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
-
getNameForDatabase
public static Database.Name getNameForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getUserServersForUser
public static IntList getUserServersForUser(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
-
invalidateTable
-
isUserServerDisabled
public static boolean isUserServerDisabled(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
isUser
public static boolean isUser(DatabaseConnection conn, User.Name name) 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 postgresqlServer) throws IOException, SQLException Determines if a PostgreSQL database name is available.- Throws:
IOExceptionSQLException
-
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:
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
-
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 PostgreSQL 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 - 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 - Throws:
IOExceptionSQLException
-
getAccountForDatabase
public static Account.Name getAccountForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getPackageForDatabase
public static int getPackageForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getAccountForUserServer
public static Account.Name getAccountForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getLinuxServerForServer
public static int getLinuxServerForServer(DatabaseConnection conn, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getPortForServer
public static int getPortForServer(DatabaseConnection conn, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getMinorVersionForServer
public static String getMinorVersionForServer(DatabaseConnection conn, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getServerForDatabase
public static int getServerForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getServerForUserServer
public static int getServerForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getLinuxServerForDatabase
public static int getLinuxServerForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getDatdbaForDatabase
public static int getDatdbaForDatabase(DatabaseConnection conn, int database) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getLinuxServerForUserServer
public static int getLinuxServerForUserServer(DatabaseConnection conn, int userServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
restartServer
public static void restartServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
startServer
public static void startServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
stopServer
public static void stopServer(DatabaseConnection conn, RequestSource source, int postgresqlServer) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
