From: Aron Roberts Date: Sat, 15 Mar 2014 00:49:55 +0000 (-0700) Subject: CSPACE-6336: Stub code to write DROP DATABASE commands to SQL script: initial, incomp... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=c91f3104e88c06e41714c3b59ca2355ea254553c;p=tmp%2Fjakarta-migration.git CSPACE-6336: Stub code to write DROP DATABASE commands to SQL script: initial, incomplete and as yet untested. --- diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index 4281c8095..27464141d 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@ -155,9 +155,17 @@ public class ServiceMain { // Please document this step propagateConfiguredProperties(); + + // Create or update Nuxeo's per-repository configuration files. createOrUpdateNuxeoRepositoryConfigFiles(); - - createNuxeoDatabases(); + + // Create the Nuxeo-managed databases, along with the requisite + // access rights to each. + HashSet dbsCheckedOrCreated = createNuxeoDatabases(); + + // Update the SQL script that drops databases, so they can be + // reinitialized, to reflect each of the Nuxeo-managed databases. + updateInitializationScript(dbsCheckedOrCreated); // // Start up and initialize our embedded Nuxeo instance. @@ -431,7 +439,7 @@ public class ServiceMain { * There may be only one, one per tenant, or something in between. * */ - private void createNuxeoDatabases() throws Exception { + private HashSet createNuxeoDatabases() throws Exception { final String DB_EXISTS_QUERY_PSQL = "SELECT 1 AS result FROM pg_database WHERE datname=?"; final String DB_EXISTS_QUERY_MYSQL = @@ -524,6 +532,8 @@ public class ServiceMain { se.printStackTrace(); } } + + return nuxeoDBsChecked; } @@ -856,4 +866,10 @@ public class ServiceMain { String.format("%s Repository", repositoryName)); return repoConfigDoc; } + + private void updateInitializationScript(HashSet dbsCheckedOrCreated) { + for (String dbName : dbsCheckedOrCreated) { + logger.debug("dbName=" + dbName); + } + } }