]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-6336: Stub code to write DROP DATABASE commands to SQL script: initial, incomp...
authorAron Roberts <aron@socrates.berkeley.edu>
Sat, 15 Mar 2014 00:49:55 +0000 (17:49 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Sat, 15 Mar 2014 00:49:55 +0000 (17:49 -0700)
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java

index 4281c80956dd1f0e745e94a61abbadd8845209e3..27464141dd642cc8f29f967f7f6bb2528a3b8af5 100644 (file)
@@ -155,9 +155,17 @@ public class ServiceMain {
        \r
        // Please document this step\r
         propagateConfiguredProperties();\r
+        \r
+        // Create or update Nuxeo's per-repository configuration files.\r
         createOrUpdateNuxeoRepositoryConfigFiles();\r
-                \r
-       createNuxeoDatabases();\r
+        \r
+        // Create the Nuxeo-managed databases, along with the requisite\r
+        // access rights to each.\r
+       HashSet<String> dbsCheckedOrCreated = createNuxeoDatabases();\r
+        \r
+        // Update the SQL script that drops databases, so they can be\r
+        // reinitialized, to reflect each of the Nuxeo-managed databases.\r
+        updateInitializationScript(dbsCheckedOrCreated);\r
 \r
         //\r
         // Start up and initialize our embedded Nuxeo instance.\r
@@ -431,7 +439,7 @@ public class ServiceMain {
         * There may be only one, one per tenant, or something in between.\r
      * \r
      */\r
-    private void createNuxeoDatabases() throws Exception {\r
+    private HashSet<String> createNuxeoDatabases() throws Exception {\r
        final String DB_EXISTS_QUERY_PSQL = \r
                        "SELECT 1 AS result FROM pg_database WHERE datname=?";\r
        final String DB_EXISTS_QUERY_MYSQL = \r
@@ -524,6 +532,8 @@ public class ServiceMain {
                        se.printStackTrace();\r
                }\r
        }\r
+                \r
+        return nuxeoDBsChecked;\r
        \r
     }\r
     \r
@@ -856,4 +866,10 @@ public class ServiceMain {
                 String.format("%s Repository", repositoryName));\r
         return repoConfigDoc;\r
     }\r
+\r
+    private void updateInitializationScript(HashSet<String> dbsCheckedOrCreated) {\r
+        for (String dbName : dbsCheckedOrCreated) {\r
+            logger.debug("dbName=" + dbName);\r
+        }\r
+    }\r
 }\r