if (!pmHome.exists())
{
throw new PackageManagerException("Package manager home " + pmHome + " does not exist!");
}
logger.info("Using Package Manager Home: " + packageManagerHome);
PackageManagerEnvironment env = new PackageManagerEnvironment(packageManagerHome);
// Run the setup script
String schemaSetupScript = (String) cmdLineParser.getOptionValue(schemaFileCmdOption);
if (schemaSetupScript != null)
{
File schemaFile = new File(schemaSetupScript);
if (!schemaFile.exists())
{
throw new PackageManagerException(
"Could not setup the database for package manager, because of non-existent schema file "
+ schemaSetupScript);
}
Connection conn = null;
// We use Derby Embedded which is file based (so point to the DB home).
// TODO: This should ideally be handled by the PackageDatabaseManager,
// or some central place which is aware of the DB type. Let's just
// do this here for now.
File dbHome = env.getDataDir();
// set the Derby system home property to point to the package manager db
System.setProperty("derby.system.home", dbHome.getAbsolutePath());
logger.info("Package manager DB home set to " + System.getProperty("derby.system.home"));
try