<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.jaxio</groupId>
    <artifactId>myproject</artifactId>
    <packaging>jar</packaging>
    <version>1.0.0</version>
    <name>myproject</name>
    <description>Database Schema Extraction using the Springfuse maven plugin</description>
    <url>http://www.springfuse.com</url>

    <properties>    
        <!-- ====== PLEASE EDIT THESE 4 VALUES ======== -->
        <database.name>minimal</database.name>
        <database.host>localhost</database.host>
        <database.user>minimal</database.user>
        <database.password>minimal</database.password>
        <!-- =========================================== -->

        <!-- JDBC driver version -->       
        <mysql.version>5.1.6</mysql.version>
        <oracle.version>10.2.0.2.0</oracle.version>
        <postgresql.version>8.2-504.jdbc3</postgresql.version>
        <derby.version>10.4.1.3</derby.version>
        <h2database.version>1.1.105</h2database.version>
        <hsql.version>1.8.0.7</hsql.version>
        <!-- your database does not appear here ? Please
	     proceed by analogy and do not hesitate to send 
	     us your configuration so we can add it here -->    

        <!-- Oracle setting only: set it to true to retrieve remarks (can be pretty slow) -->
        <jdbc.retrieveRemarks>false</jdbc.retrieveRemarks>
            
        <maven.compiler.source>1.5</maven.compiler.source>
        <maven.compiler.target>1.5</maven.compiler.target>
    </properties>

    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <!--                         DB PROFILES                             -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <profiles>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Use postgresql                  -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>postgresql</id>
            <properties> 
                <jdbc.groupId>postgresql</jdbc.groupId>
                <jdbc.artifactId>postgresql</jdbc.artifactId>
                <jdbc.version>${postgresql.version}</jdbc.version> 
                <jdbc.type>postgresql</jdbc.type>
                <jdbc.driver>org.postgresql.Driver</jdbc.driver>
                <jdbc.url>jdbc:postgresql://${database.host}/${database.name}</jdbc.url>
                <jdbc.dialect>org.hibernate.dialect.PostgreSQLDialect</jdbc.dialect>
                <jdbc.user>${database.user}</jdbc.user>
                <jdbc.password>${database.password}</jdbc.password>
            </properties>
        </profile>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Use oracle                      -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>oracle</id>
            <properties>
                <jdbc.groupId>com.oracle</jdbc.groupId>
                <jdbc.artifactId>oracle</jdbc.artifactId>
                <jdbc.version>${oracle.version}</jdbc.version>
                <jdbc.type>oracle</jdbc.type>
                <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
                <jdbc.url>jdbc:oracle:thin:@${database.host}:1521:XE</jdbc.url>
                <jdbc.catalog>${database.name}</jdbc.catalog>
                <jdbc.dialect>org.hibernate.dialect.Oracle10gDialect</jdbc.dialect>
                <jdbc.user>${database.user}</jdbc.user>
                <jdbc.password>${database.password}</jdbc.password>
            </properties>
        </profile>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Use mysql                       -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>mysql</id>
            <properties>
                <jdbc.groupId>mysql</jdbc.groupId>
                <jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
                <jdbc.version>${mysql.version}</jdbc.version>
                <jdbc.type>mysql</jdbc.type>
                <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
                <jdbc.url>
                    jdbc:mysql://${database.host}/${database.name}?zeroDateTimeBehavior=convertToNull
                </jdbc.url><!-- see http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html -->
                <jdbc.catalog>${database.name}</jdbc.catalog>
                <jdbc.dialect>org.hibernate.dialect.MySQL5Dialect</jdbc.dialect>
                <jdbc.user>${database.user}</jdbc.user>
                <jdbc.password>${database.password}</jdbc.password>
            </properties>
        </profile>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Use hsql                      -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>hsql</id>
            <properties>
                <!-- driver dependency -->
                <jdbc.groupId>hsqldb</jdbc.groupId>
                <jdbc.artifactId>hsqldb</jdbc.artifactId>
                <jdbc.version>${hsql.version}</jdbc.version>
                <!-- jdbc settings -->
                <jdbc.type>hsqldb</jdbc.type>
                <jdbc.driver>org.hsqldb.jdbcDriver</jdbc.driver>
                <jdbc.url>jdbc:hsqldb:file:${database.name}</jdbc.url>
                <jdbc.dialect>org.hibernate.dialect.HSQLDialect</jdbc.dialect>
                <jdbc.user>${database.user}</jdbc.user>
                <jdbc.password>${database.password}</jdbc.password>
            </properties>
        </profile>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Use H2 Database                 -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>h2</id>
            <properties>
                <!-- maven driver -->
                <jdbc.groupId>com.h2database</jdbc.groupId>
                <jdbc.artifactId>h2</jdbc.artifactId>
                <jdbc.version>${h2database.version}</jdbc.version>
                <!-- jdbc -->
                <jdbc.type>h2</jdbc.type>
                <jdbc.driver>org.h2.Driver</jdbc.driver>
                <jdbc.dialect>org.hibernate.dialect.H2Dialect</jdbc.dialect>
                <jdbc.url>jdbc:h2:~/.h2/${database.name}</jdbc.url>
                <jdbc.user>${database.user}</jdbc.user>
                <jdbc.password>${database.password}</jdbc.password>
            </properties>
        </profile>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Use derby                      -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <profile>
            <id>derby</id>
            <properties>
                <!-- maven driver -->
                <jdbc.groupId>org.apache.derby</jdbc.groupId>
                <jdbc.artifactId>derby</jdbc.artifactId>
                <jdbc.version>${derby.version}</jdbc.version>
                <!-- jdbc -->
                <jdbc.type>postgresql</jdbc.type>
                <jdbc.driver>org.apache.derby.jdbc.EmbeddedDriver</jdbc.driver>
                <jdbc.url>jdbc:derby:${database.name};create=true</jdbc.url>
                <jdbc.dialect>org.hibernate.dialect.DerbyDialect</jdbc.dialect>
                <jdbc.user>${database.user}</jdbc.user>
                <jdbc.password>${database.password}</jdbc.password>
            </properties>
        </profile>

    </profiles>


    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <!--                          REPOSITORIES                           -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <pluginRepositories>
        <pluginRepository>
            <id>springfuse-repository</id>
            <url>http://maven2.springfuse.com</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <repositories>
        <repository>
            <id>springfuse-repository</id>
            <name>Springfuse Maven Repository</name>
            <url>http://maven2.springfuse.com</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>

    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <!--                          BUILD                                  -->
    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
    <build>
        <defaultGoal>springfuse:extract</defaultGoal>
        <plugins>
            <plugin>
                <groupId>com.jaxio</groupId>
                <artifactId>maven-springfuse-plugin</artifactId>
                <version>2.8.0</version>
                <configuration>
                    <jdbcTableNamePatterns>
                        <jdbcTableNamePattern>%</jdbcTableNamePattern>
                        <!-- 
                        you can also set the table one by one and/use wildcard 
                        <jdbc.tableNamePattern>MY_TABLE_A</jdbc.tableNamePattern>
                        <jdbc.tableNamePattern>OTHER_TABLE_%</jdbc.tableNamePattern>  
                        -->            
                    </jdbcTableNamePatterns>                     
                </configuration>                         
                <executions>                               
                    <execution>
                        <id>Extract Database Meta Data</id>
                        <goals>
                            <goal>extract</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <!-- lib for plugin -->
        <extensions>
            <extension>
                <groupId>${jdbc.groupId}</groupId>
                <artifactId>${jdbc.artifactId}</artifactId>
                <version>${jdbc.version}</version>
            </extension>
        </extensions>
    </build>
</project>
