From: Patrick Schmitz Date: Fri, 14 Dec 2012 19:50:06 +0000 (-0800) Subject: Merge branch 'CSPACE-5761' X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=b9c5f3fbac6a66622fb83f7946ae6fae48d2fff1;p=tmp%2Fjakarta-migration.git Merge branch 'CSPACE-5761' Conflicts: services/JaxRsServiceProvider/src/main/webapp/META-INF/context.xml services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java services/common/src/main/java/org/collectionspace/services/common/storage/JDBCTools.java --- b9c5f3fbac6a66622fb83f7946ae6fae48d2fff1 diff --cc services/JaxRsServiceProvider/src/main/webapp/META-INF/context.xml index 3d0f5e317,e17b748c0..cc1e9fb7d --- a/services/JaxRsServiceProvider/src/main/webapp/META-INF/context.xml +++ b/services/JaxRsServiceProvider/src/main/webapp/META-INF/context.xml @@@ -34,42 -36,77 +34,71 @@@ For example java:comp/env/jdbc/nxsqldirectory This means you need to update corresponding JNDI bindings in nuxeo data source definitions in the config directory --> - - - - - - - - + + + + + + + + - - - + + + - + - - + + + + + + + - diff --cc services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index 6b20685f0,1bb8c5460..504a93715 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@@ -366,8 -356,24 +373,24 @@@ public class ServiceMain // cached in a static hash map of the JDBCTools class. This will speed up lookups as well as protect our // code from JNDI lookup problems -for example, if the JNDI context gets stepped on or corrupted. // - DataSource cspaceDataSource = JDBCTools.getDataSource(JDBCTools.CSPACE_REPOSITORY_NAME); - DataSource nuxeoDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME); + DataSource cspaceDataSource = JDBCTools.getDataSource(JDBCTools.CSPACE_DATASOURCE_NAME); + DataSource nuxeoDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_DATASOURCE_NAME); + DataSource nuxeoMgrDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_MANAGER_DATASOURCE_NAME); + DataSource nuxeoReaderDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_READER_DATASOURCE_NAME); + + // We need to fetch the user name and password from the nuxeoDataSource, to do grants below + org.apache.tomcat.dbcp.dbcp.BasicDataSource tomcatDataSource = + (org.apache.tomcat.dbcp.dbcp.BasicDataSource)nuxeoDataSource; + // Get the template URL value from the JNDI datasource and substitute the databaseName + String nuxeoUser = tomcatDataSource.getUsername(); + String nuxeoPW = tomcatDataSource.getPassword(); + // HACK - this should come from another DataSource + tomcatDataSource = + (org.apache.tomcat.dbcp.dbcp.BasicDataSource)nuxeoReaderDataSource; + // Get the template URL value from the JNDI datasource and substitute the databaseName + String readerUser = tomcatDataSource.getUsername(); + String readerPW = tomcatDataSource.getPassword(); + // // Set our AuthN's datasource to be the cspaceDataSource // diff --cc services/common/src/main/java/org/collectionspace/services/common/storage/JDBCTools.java index 614ab3a7b,82ba8f66b..f2a95aa9d --- a/services/common/src/main/java/org/collectionspace/services/common/storage/JDBCTools.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/JDBCTools.java @@@ -38,12 -41,11 +38,15 @@@ import java.util.HashMap */ public class JDBCTools { public static HashMap cachedDataSources = new HashMap(); - public static String CSPACE_REPOSITORY_NAME = "CspaceDS"; - public static String NUXEO_REPOSITORY_NAME = "NuxeoDS"; + public static String CSPACE_DATASOURCE_NAME = "CspaceDS"; + public static String NUXEO_DATASOURCE_NAME = "NuxeoDS"; + // Default database names + public static String DEFAULT_CSPACE_DATABASE_NAME = "cspace"; + public static String DEFAULT_NUXEO_REPOSITORY_NAME = "default"; + public static String DEFAULT_NUXEO_DATABASE_NAME = "nuxeo"; + public static String NUXEO_MANAGER_DATASOURCE_NAME = "NuxeoMgrDS"; + public static String NUXEO_READER_DATASOURCE_NAME = "NuxeoReaderDS"; + public static String NUXEO_USER_NAME = "nuxeo"; // // Private constants //