From bc01d1d67f4735700021ca3d9183f8a28b18235b Mon Sep 17 00:00:00 2001 From: Patrick Schmitz Date: Fri, 14 Dec 2012 15:15:20 -0800 Subject: [PATCH] CSPACE-5761 Fixed problems that emerged after the merge, including the naming of the lifesci repo. --- ...o-config.xml => lifesci_domain-repo-config.xml} | 14 +++++++------- .../tenants/lifesci/tenant-bindings.delta.xml | 2 +- .../services/common/ServiceMain.java | 12 ++++++++++-- src/main/resources/db/postgresql/init_nuxeo_db.sql | 1 + 4 files changed, 19 insertions(+), 10 deletions(-) rename 3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/{lifesci-domain-repo-config.xml => lifesci_domain-repo-config.xml} (98%) diff --git a/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/lifesci-domain-repo-config.xml b/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/lifesci_domain-repo-config.xml similarity index 98% rename from 3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/lifesci-domain-repo-config.xml rename to 3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/lifesci_domain-repo-config.xml index 279075a40..d8cf08210 100644 --- a/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/lifesci-domain-repo-config.xml +++ b/3rdparty/nuxeo/nuxeo-server/5.5-HF07/config/lifesci_domain-repo-config.xml @@ -1,17 +1,17 @@ - + - - + @XA_DATASOURCE@ - jdbc:postgresql://localhost:5432/lifesci-domain + jdbc:postgresql://localhost:5432/lifesci_domain @DB_SERVER_HOSTNAME@ - lifesci-domain + lifesci_domain @NUXEO_USER@ @NUXEO_PW@ @@ -413,7 +413,7 @@ - The lifesci-domain repository - + The lifesci_domain repository + diff --git a/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml index 2a972b97a..1beb3f4b0 100644 --- a/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/lifesci/tenant-bindings.delta.xml @@ -5,7 +5,7 @@ - + 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 cdea33f53..466e969cf 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 @@ -7,6 +7,11 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.*; import javax.naming.NamingException; @@ -23,6 +28,7 @@ import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; import org.collectionspace.services.common.init.AddIndices; import org.collectionspace.services.config.service.InitHandler.Params.Field; import org.collectionspace.services.common.init.IInitHandler; +import org.collectionspace.services.common.storage.DatabaseProductType; import org.collectionspace.services.common.storage.JDBCTools; import org.collectionspace.services.config.ClientType; import org.collectionspace.services.config.ServiceConfig; @@ -399,7 +405,9 @@ public class ServiceMain { // Get the NuxeoDS info and create the necessary databases. // Consider the tenant bindings to find and get the data sources for each tenant. // There may be only one, one per tenant, or something in between. - DatabaseProductType dbType = JDBCTools.getDatabaseProductType(); // only returns PG or MYSQL + DatabaseProductType dbType = JDBCTools.getDatabaseProductType( + JDBCTools.CSPACE_DATASOURCE_NAME, + JDBCTools.DEFAULT_CSPACE_DATABASE_NAME); // only returns PG or MYSQL String dbExistsQuery = (dbType==DatabaseProductType.POSTGRESQL)? DB_EXISTS_QUERY_PSQL : DB_EXISTS_QUERY_MYSQL; @@ -538,7 +546,7 @@ public class ServiceMain { // Postgres does not need passwords. String sql = "CREATE DATABASE "+dbName+" ENCODING 'UTF8' OWNER "+ownerName; stmt.executeUpdate(sql); - sql = "GRANT CONNECT ON DATABASE nuxeo TO "+readerName; + sql = "GRANT CONNECT ON DATABASE "+dbName+" TO "+readerName; stmt.executeUpdate(sql); if (logger.isDebugEnabled()) { logger.debug("Created db: '"+dbName+"' with owner: '"+ownerName+"'"); diff --git a/src/main/resources/db/postgresql/init_nuxeo_db.sql b/src/main/resources/db/postgresql/init_nuxeo_db.sql index c0b999c17..7120ad23b 100644 --- a/src/main/resources/db/postgresql/init_nuxeo_db.sql +++ b/src/main/resources/db/postgresql/init_nuxeo_db.sql @@ -1,5 +1,6 @@ -- drop all the objects before dropping roles DROP database IF EXISTS nuxeo; +DROP database IF EXISTS lifesci_domain; DROP USER IF EXISTS nuxeo; DROP USER IF EXISTS reader; -- 2.47.3