[
http://jira.jboss.com/jira/browse/JBSEAM-538?page=comments#action_12348065 ]
Gavin King commented on JBSEAM-538:
-----------------------------------
This patch is too big, and seems to duplicate functionality that already exists in the
current build. If we need this functionality, the existing build should be refactored, so
that there is no duplication.
Add the ability to regenerate the datasource
--------------------------------------------
Key: JBSEAM-538
URL:
http://jira.jboss.com/jira/browse/JBSEAM-538
Project: JBoss Seam
Issue Type: Feature Request
Components: Tools
Affects Versions: 1.1.0.CR1
Reporter: gregorypierce
Allows you to swap datasources from the current datasource to a new datasource. Why?
Because many times I will develop using HSQL and then later want to move to another
datasource. Note: You will also have to add overwrite="true" to the various
copy tasks or else they won't overwrite the existing datasource files.
<target name="new-datasource">
<!-- define the datasource -->
<condition property="database.type.default"
value="${database.type}">
<isset property="database.type"/>
</condition>
<property name="database.type.default" value="hsql"/>
<input addproperty="database.type.new"
message="What kind of database are you using?
[${database.type.default}] "
validargs="hsql,mysql,oracle,postgres,mssql,db2,sybase,enterprisedb"
defaultvalue="${database.type.default}"/>
<!-- if the database type did not change, default to the previous values -->
<condition property="hibernate.dialect.default"
value="${hibernate.dialect}">
<equals arg1="${database.type}"
arg2="${database.type.new}"/>
</condition>
<condition property="hibernate.connection.url.default"
value="${hibernate.connection.url}">
<equals arg1="${database.type}"
arg2="${database.type.new}"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="${hibernate.connection.driver_class}">
<equals arg1="${database.type}"
arg2="${database.type.new}"/>
</condition>
<!-- otherwise default to the defaults for the database type -->
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.HSQLDialect">
<equals arg1="${database.type.new}" arg2="hsql"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.MySQLDialect">
<equals arg1="${database.type.new}" arg2="mysql"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.OracleDialect">
<equals arg1="${database.type.new}" arg2="oracle"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.PostgreSQLDialect">
<equals arg1="${database.type.new}" arg2="postgres"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.PostgreSQLDialect">
<equals arg1="${database.type.new}"
arg2="enterprisedb"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.SQLServerDialect">
<equals arg1="${database.type.new}" arg2="mssql"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.DB2Dialect">
<equals arg1="${database.type.new}" arg2="db2"/>
</condition>
<condition property="hibernate.dialect.default"
value="org.hibernate.dialect.SybaseDialect">
<equals arg1="${database.type.new}" arg2="sybase"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="org.hsqldb.jdbcDriver">
<equals arg1="${database.type.new}" arg2="hsql"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="com.mysql.jdbc.Driver">
<equals arg1="${database.type.new}" arg2="mysql"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="oracle.jdbc.driver.OracleDriver">
<equals arg1="${database.type.new}" arg2="oracle"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="org.postgresql.Driver">
<equals arg1="${database.type.new}" arg2="postgres"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="com.edb.Driver">
<equals arg1="${database.type.new}"
arg2="enterprisedb"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
<equals arg1="${database.type.new}" arg2="mssql"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="COM.ibm.db2.jdbc.app.DB2Driver">
<equals arg1="${database.type.new}" arg2="db2"/>
</condition>
<condition property="hibernate.connection.driver_class.default"
value="com.sybase.jdbc2.jdbc.SybDriver">
<equals arg1="${database.type.new}" arg2="sybase"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:hsqldb:.">
<equals arg1="${database.type.new}" arg2="hsql"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:mysql:///test">
<equals arg1="${database.type.new}" arg2="mysql"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:oracle:thin:@localhost:1521:test">
<equals arg1="${database.type.new}" arg2="oracle"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:postgresql:template1">
<equals arg1="${database.type.new}" arg2="postgres"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:edb://localhost:5444/edb">
<equals arg1="${database.type.new}"
arg2="enterprisedb"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:sqlserver://localhost">
<equals arg1="${database.type.new}" arg2="mssql"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:db2:test">
<equals arg1="${database.type.new}" arg2="db2"/>
</condition>
<condition property="hibernate.connection.url.default"
value="jdbc:sybase:Tds:localhost:5000/test">
<equals arg1="${database.type.new}" arg2="sybase"/>
</condition>
<!-- finally, default them to HSQL -->
<property name="hibernate.dialect.default"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.connection.driver_class.default"
value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.url.default"
value="jdbc:hsqldb:."/>
<input addproperty="hibernate.dialect.new"
message="Enter the Hibernate dialect for your database
[${hibernate.dialect.default}]"
defaultvalue="${hibernate.dialect.default}"/>
<property name="driver.jar" value="hsqldb.jar"/>
<input addproperty="driver.jar.new"
message="Enter the filesystem path to the JDBC driver jar
[${driver.jar}]"
defaultvalue="${seamgen.home}/lib/${driver.jar}"/>
<input addproperty="hibernate.connection.driver_class.new"
message="Enter JDBC driver class for your database
[${hibernate.connection.driver_class.default}]"
defaultvalue="${hibernate.connection.driver_class.default}"/>
<input addproperty="hibernate.connection.url.new"
message="Enter the JDBC URL for your database
[${hibernate.connection.url.default}]"
defaultvalue="${hibernate.connection.url.default}"/>
<property name="hibernate.connection.username"
value="sa"/>
<input addproperty="hibernate.connection.username.new"
message="Enter database username
[${hibernate.connection.username}]"
defaultvalue="${hibernate.connection.username}"/>
<property name="hibernate.connection.password"
value=""/>
<input addproperty="hibernate.connection.password.new"
message="Enter database password
[${hibernate.connection.password}]"
defaultvalue="${hibernate.connection.password}"/>
<property name="database.exists" value="n"/>
<input addproperty="database.exists.new"
message="Are you working with tables that already exist in the
database? [${database.exists}] "
validargs="y,n,"
defaultvalue="${database.exists}"/>
<propertyfile file="${user.dir}/project.properties">
<entry key="basepackage.name" value="${basepackage.name}"
/>
<entry key="project.name"
value="${project.name}"/>
<entry key="project.home" value="${project.home}"
/>
<!-- package names -->
<entry key="action.package"
value="${action.package}"/>
<entry key="model.package"
value="${model.package}"/>
<entry key="test.package"
value="${test.package}"/>
<!-- project database information -->
<entry key="database.type"
value="${database.type.new}"/>
<entry key="database.exists"
value="${database.exists.new}"/>
<entry key="hibernate.dialect"
value="${hibernate.dialect.new}"/>
<entry key="hibernate.connection.driver_class"
value="${hibernate.connection.driver_class.new}"/>
<entry key="hibernate.connection.url"
value="${hibernate.connection.url.new}"/>
<entry key="hibernate.connection.username"
value="${hibernate.connection.username.new}"/>
<entry key="hibernate.connection.password"
value="${hibernate.connection.password.new}"/>
<entry key="driver.jar"
value="${driver.jar.new}"/>
<entry key="eclipse.wtp"
value="${eclipse.wtp.new}"/>
</propertyfile>
<property file="${user.dir}/project.properties" />
<property file="${seam.home}/seam.properties" />
<property file="${user.dir}/${project.name}/project.properties" />
<condition property="wtp">
<equals arg1="${eclipse.wtp}" arg2="y"/>
</condition>
<antcall target="file-copy" />
<echo message="Your project has been created." />
<echo message="Add the project from inside Eclipse (or type 'seam
explode') and go to
http://localhost:8080/${project.name}"/>
</target>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira