Package org.pgcodekeeper.core.api
Class DatabaseFactory
java.lang.Object
org.pgcodekeeper.core.api.DatabaseFactory
Factory class for loading database schemas from various sources.
This class provides methods to create AbstractDatabase instances
from different sources: JDBC connections, project directories, and database dumps.
Some loading method supports optional schema filtering through ignore lists.
-
Constructor Summary
ConstructorsConstructorDescriptionDatabaseFactory(ISettings settings) Constructor with default argumentsDatabaseFactory(ISettings settings, boolean ignoreErrors, boolean needAnalyze) Constructor with default progress monitorDatabaseFactory(ISettings settings, boolean ignoreErrors, boolean needAnalyze, IMonitor monitor) -
Method Summary
Modifier and TypeMethodDescriptionloadFromDump(String dumpPath) Loads database from a database dump file and monitoring.loadFromJdbc(String url) Loads database from a JDBC connection.loadFromJdbc(String url, String ignoreSchemaListPath) Loads database from a JDBC connection with schema filtering and monitoring.loadFromProject(String projectPath) Loads database from a project directory with schema filtering.loadFromProject(String projectPath, String ignoreSchemaListPath) Loads database from a project directory with schema filtering and monitoring.
-
Constructor Details
-
DatabaseFactory
Constructor with default arguments- Parameters:
settings- configuration settings
-
DatabaseFactory
Constructor with default progress monitor- Parameters:
settings- configuration settingsignoreErrors- behavior on parsing errorsneedAnalyze- if true, then after loading all database objects, an analysis will be run to find dependencies
-
DatabaseFactory
public DatabaseFactory(ISettings settings, boolean ignoreErrors, boolean needAnalyze, IMonitor monitor) - Parameters:
settings- configuration settingsignoreErrors- behavior on parsing errorsneedAnalyze- if true, then after loading all database objects, an analysis will be run to find dependenciesmonitor- progress monitor for tracking the operation
-
-
Method Details
-
loadFromJdbc
public AbstractDatabase loadFromJdbc(String url) throws IOException, PgCodekeeperException, InterruptedException Loads database from a JDBC connection.- Parameters:
url- the JDBC connection URL- Returns:
- the loaded database
- Throws:
IOException- if I/O operations failPgCodekeeperException- if parsing errors occurInterruptedException- if operation is cancelled
-
loadFromJdbc
public AbstractDatabase loadFromJdbc(String url, String ignoreSchemaListPath) throws IOException, PgCodekeeperException, InterruptedException Loads database from a JDBC connection with schema filtering and monitoring.- Parameters:
url- the JDBC connection URLignoreSchemaListPath- path to file containing schemas to ignore, or null for no filtering- Returns:
- the loaded database
- Throws:
IOException- if I/O operations failPgCodekeeperException- if parsing errors occurInterruptedException- if operation is cancelled
-
loadFromProject
public AbstractDatabase loadFromProject(String projectPath) throws PgCodekeeperException, IOException, InterruptedException Loads database from a project directory with schema filtering.- Parameters:
projectPath- path to the project directory containing SQL files- Returns:
- the loaded database
- Throws:
PgCodekeeperException- if parsing errors occurIOException- if I/O operations failInterruptedException- if operation is cancelled
-
loadFromProject
public AbstractDatabase loadFromProject(String projectPath, String ignoreSchemaListPath) throws PgCodekeeperException, IOException, InterruptedException Loads database from a project directory with schema filtering and monitoring.- Parameters:
projectPath- path to the project directory containing SQL filesignoreSchemaListPath- path to file containing schemas to ignore, or null for no filtering- Returns:
- the loaded database
- Throws:
PgCodekeeperException- if parsing errors occurIOException- if I/O operations failInterruptedException- if operation is cancelled
-
loadFromDump
public AbstractDatabase loadFromDump(String dumpPath) throws IOException, PgCodekeeperException, InterruptedException Loads database from a database dump file and monitoring.- Parameters:
dumpPath- path to the database dump file- Returns:
- the loaded database
- Throws:
IOException- if I/O operations failPgCodekeeperException- if parsing errors occurInterruptedException- if operation is cancelled
-