]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Merge branch 'CSPACE-5761'
authorPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 14 Dec 2012 19:50:06 +0000 (11:50 -0800)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Fri, 14 Dec 2012 19:50:06 +0000 (11:50 -0800)
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

1  2 
services/JaxRsServiceProvider/src/main/webapp/META-INF/context.xml
services/common/pom.xml
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java
services/common/src/main/java/org/collectionspace/services/common/storage/JDBCTools.java

index 3d0f5e317d791754c587b1906e4069d6920f2780,e17b748c07fca0fc6e4979c3df2cc793c40a061a..cc1e9fb7dfe118dfb0c4032d7b74777515cc7a16
      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 -->
  
 -  <ResourceLink name="jdbc/nxsqldirectory" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/nxrelations-default-jena" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/comment-relations" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/nxaudit-logs" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/nxjbpm" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/placeful_service_ds" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/nxwebwidgets" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 -  <ResourceLink name="jdbc/nxuidsequencer" global="jdbc/nuxeo" type="javax.sql.DataSource" />
 +    <ResourceLink name="jdbc/nxsqldirectory" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/nxrelations-default-jena" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/comment-relations" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/nxaudit-logs" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/nxjbpm" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/placeful_service_ds" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/nxwebwidgets" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
 +    <ResourceLink name="jdbc/nxuidsequencer" global="jdbc/nuxeo" type="javax.sql.DataSource"/>
  
 -  <Resource name="TransactionManager" auth="Container"
 -    type="javax.transaction.TransactionManager" factory="org.nuxeo.runtime.jtajca.NuxeoTransactionManagerFactory"
 -    transactionTimeoutSeconds="300" />
 -  <Transaction factory="org.nuxeo.runtime.jtajca.NuxeoUserTransactionFactory" />
 -  <Resource name="NuxeoConnectionManager" auth="Container"
 -    type="javax.resource.spi.ConnectionManager" factory="org.nuxeo.runtime.jtajca.NuxeoConnectionManagerFactory"
 -    minPoolSize="0" maxPoolSize="20"
 -    idleTimeoutMinutes="0" />
 +    <Resource name="TransactionManager" auth="Container" type="javax.transaction.TransactionManager"
 +        factory="org.nuxeo.runtime.jtajca.NuxeoTransactionManagerFactory"
 +        transactionTimeoutSeconds="300"/>
 +    <Transaction factory="org.nuxeo.runtime.jtajca.NuxeoUserTransactionFactory"/>
 +    <Resource name="NuxeoConnectionManager" auth="Container"
 +        type="javax.resource.spi.ConnectionManager"
 +        factory="org.nuxeo.runtime.jtajca.NuxeoConnectionManagerFactory" minPoolSize="0"
 +        maxPoolSize="20" idleTimeoutMinutes="0"/>
  
 -  <Resource auth="Container" name="Mail" type="javax.mail.Session"
 -      mail.store.protocol="pop3"
 -      mail.pop3.host="pop3.nosuchhost.nosuchdomain.com"
 -      mail.pop3.user="nobody"
 -      mail.transport.protocol="smtp"
 -      mail.smtp.host="localhost" mail.smtp.port="25"
 -      mail.smtp.starttls.enable="false"
 -      mail.smtp.auth="false"
 -      mail.smtp.user="anonymous"
 -      password="password" mail.from="noreply@nuxeo.com"
 -      mail.debug="false" />
 +    <Resource auth="Container" name="Mail" type="javax.mail.Session" mail.store.protocol="pop3"
 +        mail.pop3.host="pop3.nosuchhost.nosuchdomain.com" mail.pop3.user="nobody"
 +        mail.transport.protocol="smtp" mail.smtp.host="localhost" mail.smtp.port="25"
 +        mail.smtp.starttls.enable="false" mail.smtp.auth="false" mail.smtp.user="anonymous"
 +        password="password" mail.from="noreply@nuxeo.com" mail.debug="false"/>
  
 -      <!-- 
 +    <!-- 
                For CollectionSpace services
         -->
-     <Resource name="jdbc/CspaceDS" auth="Container" type="javax.sql.DataSource"
-         username="${db.user}" password="${db.user.password}"
-         driverClassName="${db.jdbc.driver.class}"
-         url="jdbc:${db}://${db.host}:${db.port}/cspace"
-         maxActive="8" maxIdle="4"/>
+     <Resource name="jdbc/CspaceDS"
+            auth="Container"
+            type="javax.sql.DataSource"
+            username="${db.user}"
+            password="${db.user.password}"
+            driverClassName="${db.jdbc.driver.class}"
+            url="jdbc:${db}://${db.host}:${db.port}/cspace"
+            maxActive="8"
+            maxIdle="4"/>
+               
+       <Resource name="jdbc/NuxeoDS"
+            auth="Container"
+            type="javax.sql.DataSource"
+            username="${db.nuxeo.user}"
+            password="${db.nuxeo.user.password}"
+            driverClassName="${db.jdbc.driver.class}"
 -           url="jdbc:${db}://${db.host}:${db.port}/nuxeo"
++           url="jdbc:${db}://${db.host}:${db.port}/${DatabaseName}"
+            maxActive="8"
+            maxIdle="4"/>      
+   <Resource name="jdbc/NuxeoMgrDS"
+     auth="Container"
+     type="javax.sql.DataSource"
+     username="${db.user}"
+     password="${db.user.password}"
+     driverClassName="${db.jdbc.driver.class}"
+     url="jdbc:${db}://${db.host}:${db.port}"
+     maxActive="8"
+     maxIdle="4"/>     
+   
+   <Resource name="jdbc/NuxeoReaderDS"
+            auth="Container"
+            type="javax.sql.DataSource"
+            username="reader"
+            password="read"
+            driverClassName="${db.jdbc.driver.class}"
 -           url="jdbc:${db}://${db.host}:${db.port}/nuxeo"
++           url="jdbc:${db}://${db.host}:${db.port}/${DatabaseName}"
+            maxActive="8"
+            maxIdle="4"/>      
  
-     <Resource name="jdbc/NuxeoDS" auth="Container" type="javax.sql.DataSource"
-       username="${db.user}" password="${db.user.password}"
-       driverClassName="${db.jdbc.driver.class}"
-         url="jdbc:${db}://${db.host}:${db.port}/${DatabaseName}"
-         maxActive="8" maxIdle="4"/>
  </Context>
Simple merge
index 6b20685f055a2471bbe0bcf013d01d27b380799e,1bb8c546008cc216bd7145a3aa1bf50cfa6f75c2..504a9371547033c08869c2cf7aab23eb5062847a
@@@ -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\r
        // code from JNDI lookup problems -for example, if the JNDI context gets stepped on or corrupted.\r
        //\r
 -      DataSource cspaceDataSource = JDBCTools.getDataSource(JDBCTools.CSPACE_REPOSITORY_NAME);\r
 -      DataSource nuxeoDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME);\r
 +      DataSource cspaceDataSource = JDBCTools.getDataSource(JDBCTools.CSPACE_DATASOURCE_NAME);\r
 +      DataSource nuxeoDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_DATASOURCE_NAME);\r
+       DataSource nuxeoMgrDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_MANAGER_DATASOURCE_NAME);\r
+       DataSource nuxeoReaderDataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_READER_DATASOURCE_NAME);\r
+       \r
+       // We need to fetch the user name and password from the nuxeoDataSource, to do grants below\r
+       org.apache.tomcat.dbcp.dbcp.BasicDataSource tomcatDataSource =\r
+                       (org.apache.tomcat.dbcp.dbcp.BasicDataSource)nuxeoDataSource;\r
+       // Get the template URL value from the JNDI datasource and substitute the databaseName\r
+       String nuxeoUser = tomcatDataSource.getUsername();\r
+       String nuxeoPW = tomcatDataSource.getPassword();\r
+       // HACK - this should come from another DataSource\r
+       tomcatDataSource =\r
+                       (org.apache.tomcat.dbcp.dbcp.BasicDataSource)nuxeoReaderDataSource;\r
+       // Get the template URL value from the JNDI datasource and substitute the databaseName\r
+       String readerUser = tomcatDataSource.getUsername();\r
+       String readerPW = tomcatDataSource.getPassword();\r
+       \r
        //\r
        // Set our AuthN's datasource to be the cspaceDataSource\r
        //\r
index 614ab3a7b249e8f209f596830e06c044556441aa,82ba8f66bc6e853c72b56e1a3ea1e0b5811efd10..f2a95aa9db18af5dc8960ba8fb12ca9d064bc27f
@@@ -38,12 -41,11 +38,15 @@@ import java.util.HashMap
   */\r
  public class JDBCTools {\r
        public static HashMap<String, DataSource> cachedDataSources = new HashMap<String, DataSource>();\r
 -    public static String CSPACE_REPOSITORY_NAME = "CspaceDS";\r
 -    public static String NUXEO_REPOSITORY_NAME = "NuxeoDS";\r
 +    public static String CSPACE_DATASOURCE_NAME = "CspaceDS";\r
 +    public static String NUXEO_DATASOURCE_NAME = "NuxeoDS";\r
 +    // Default database names\r
 +    public static String DEFAULT_CSPACE_DATABASE_NAME = "cspace";\r
 +    public static String DEFAULT_NUXEO_REPOSITORY_NAME = "default";\r
 +    public static String DEFAULT_NUXEO_DATABASE_NAME = "nuxeo";\r
+     public static String NUXEO_MANAGER_DATASOURCE_NAME = "NuxeoMgrDS";\r
+     public static String NUXEO_READER_DATASOURCE_NAME = "NuxeoReaderDS";\r
+     public static String NUXEO_USER_NAME = "nuxeo";\r
      //\r
      // Private constants\r
      //\r