svn commit: r1613848 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/ jetspeed-installer/etc/ant-installer/ jetspeed-installer/etc/database/

[email protected]
Newsgroups gmane.comp.jakarta.jetspeed.devel
Message-ID <[email protected]>
Author: taylor
Date: Sun Jul 27 21:36:17 2014
New Revision: 1613848

URL: http://svn.apache.org/r1613848
Log:
JS2-1301: add Derby as valid migration source (Network only) in installer

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java
    portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/ant-installer/antinstall-config.xml
    portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/database/build.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java?rev=1613848&r1=1613847&r2=1613848&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java Sun Jul 27 21:36:17 2014
@@ -16,16 +16,6 @@
  */
 package org.apache.jetspeed.components.datasource;
 
-import java.io.CharArrayWriter;
-import java.io.PrintWriter;
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.sql.DataSource;
-
 import org.apache.commons.dbcp.ConnectionFactory;
 import org.apache.commons.dbcp.DriverManagerConnectionFactory;
 import org.apache.commons.dbcp.PoolableConnectionFactory;
@@ -35,6 +25,15 @@ import org.apache.commons.pool.impl.Gene
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.sql.DataSource;
+import java.io.CharArrayWriter;
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
 /**
  * <p>
  * DBCPDatasourceComponent
@@ -151,7 +150,17 @@ public class DBCPDatasourceComponent imp
             // Validate the connection before we go any further
             try
             {
-                Connection conn = DriverManager.getConnection(connectURI, user, password);
+                Connection conn = null;
+                if (user == null || user.trim().isEmpty()) {
+                    System.out.println("***** connecting without user...");
+                    conn = DriverManager.getConnection(connectURI);
+                }
+                else {
+                    if (password == null)
+                        password = "";
+                    conn = DriverManager.getConnection(connectURI, user, password);
+                }
+
                 conn.close();
             }
             catch(Exception e)
@@ -161,9 +170,16 @@ public class DBCPDatasourceComponent imp
             }
             
             ObjectPool connectionPool = new GenericObjectPool(null, maxActive, whenExhausted, maxWait);
-            
-            ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, user, password);
-            
+
+            ConnectionFactory connectionFactory = null;
+            if (user == null || user.trim().isEmpty()) {
+                connectionFactory = new DriverManagerConnectionFactory(connectURI, new Properties());
+            }
+            else {
+                if (password == null)
+                    password = "";
+                connectionFactory = new DriverManagerConnectionFactory(connectURI, user, password);
+            }
             dsConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, autoCommit);
             
             dataSource = new PoolingDataSource(connectionPool);            

Modified: portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/ant-installer/antinstall-config.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/ant-installer/antinstall-config.xml?rev=1613848&r1=1613847&r2=1613848&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/ant-installer/antinstall-config.xml (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/ant-installer/antinstall-config.xml Sun Jul 27 21:36:17 2014
@@ -137,6 +137,7 @@
       <option text="Oracle 9" value="oracle9" />
       <option text="Oracle 10 or higher" value="oracle10" />
       <option text="SapDB" value="sapdb" />
+      <option text="Derby" value="derby2" />
     </select>
   </page>
 
@@ -273,6 +274,26 @@
           displayText="JDBC driver" checkExists="true" />
   </page>
 
+    <page type="input" name="sourceDerby" displayText="Derby Database connection parameters"
+          ifProperty="(${operation}=migratedb) AND (${source.dbName}=derby2)">
+        <hidden property="source.checkdb" value="true" />
+        <hidden property="source.dbvalid" value="true" />
+        <hidden property="source.dbDisplayName" value="Derby"/>
+
+        <comment displayText="Please fill in the fields below for connecting to the Derby network database." />
+
+        <text property="source.dbUser" displayText="Database User Name" defaultValue="" />
+        <text property="source.dbPassword" displayText="Database Password" defaultValue="" />
+
+        <text property="source.jdbcUrl" displayText="JDBC Connection String"
+              defaultValue="jdbc:derby://localhost/productiondb" />
+        <text property="source.jdbcDriverClass" displayText="JDBC Driver Classname" defaultValue="org.apache.derby.jdbc.ClientDriver" />
+
+        <file property="source.jdbcDriverJar"
+              defaultValue="${java.user.home}${java.file.separator}derbyclient.jar" displayText="JDBC driver"
+              checkExists="true" />
+    </page>
+
   <page type="input" name="sourceNoDBCheck" displayText="Skipping source database connection check"
     ifProperty="(${operation}=migratedb) AND (${source.checkdb}=false)">
     <hidden property="abort" value="false" />

Modified: portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/database/build.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/database/build.xml?rev=1613848&r1=1613847&r2=1613848&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/database/build.xml (original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-installer/etc/database/build.xml Sun Jul 27 21:36:17 2014
@@ -217,7 +217,8 @@
 
     </target>
 
-    <target name="migrateDB" depends="checkSourceOrTargetDerby" unless="_derby" >
+    <!-- <target name="migrateDB" depends="checkSourceOrTargetDerby" unless="_derby" > -->
+    <target name="migrateDB"  >
 
         <echo>Migrate Jetspeed database from ${_source.jdbc.url} to ${_jdbc.url}</echo>
         <java classname="org.apache.jetspeed.tools.migration.JetspeedMigrationApplication" fork="yes" maxmemory="${jvmMaxMemory}" failonerror="yes">
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.