Ticket #269: Leverage Maven's source generation features to generate MyBatis mappings.

This commit is contained in:
Michael Jumper
2013-02-28 20:00:31 -08:00
parent 06b1d4df18
commit f8fec18909
35 changed files with 134 additions and 6700 deletions

View File

@@ -0,0 +1,15 @@
-- Create default user "guacadmin" with password "guacadmin"
insert into guacamole_user values(1, 'guacadmin',
x'CA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960', -- 'guacadmin'
x'FE24ADC5E11E2B25288D1704ABE67A79E342ECC26064CE69C5B3177795A82264');
-- Grant this user create permissions
insert into guacamole_system_permission values(1, 'CREATE_CONNECTION');
insert into guacamole_system_permission values(1, 'CREATE_USER');
-- Grant admin permission to read/update/administer self
insert into guacamole_user_permission values(1, 1, 'READ');
insert into guacamole_user_permission values(1, 1, 'UPDATE');
insert into guacamole_user_permission values(1, 1, 'ADMINISTER');

View File

@@ -0,0 +1,21 @@
<settings>
<!-- Profile defining the properties required for a MyBatis build -->
<profiles>
<profile>
<id>guacamole-mybatis</id>
<properties>
<guacamole.database.catalog>SCHEMA</guacamole.database.catalog>
<guacamole.database.schema>DATABASE</guacamole.database.schema>
<guacamole.database.user>USER</guacamole.database.user>
<guacamole.database.password>PASS</guacamole.database.password>
</properties>
</profile>
</profiles>
<!-- Activate by default -->
<activeProfiles>
<activeProfile>guacamole-mybatis</activeProfile>
</activeProfiles>
</settings>

View File

@@ -1,75 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- Location of MySQL jdbc driver. -->
<classPathEntry location="mysql-connector-java-5.1.23-bin.jar" />
<context id="guacamoleTables" targetRuntime="MyBatis3">
<!-- MySQL JDBC driver class. -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://127.0.0.1:3306"
userId="root"
password="root">
</jdbcConnection>
<!-- Set targetProject to the desired location for the generated model source. -->
<javaModelGenerator targetPackage="net.sourceforge.guacamole.net.auth.mysql.model" targetProject="/path/to/target/folder">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- Set targetProject to the desired location for the generated xml mapping files. -->
<!-- NOTE: These XML mapping files will need to be in the same package as the generated DAO -->
<!-- java source files, but in the /resources folder, not the /src folder. -->
<sqlMapGenerator targetPackage="net.sourceforge.guacamole.net.auth.mysql.dao" targetProject="/path/to/target/folder">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<!-- Set targetProject to the desired location for the generated acces object source. -->
<javaClientGenerator type="XMLMAPPER" targetPackage="net.sourceforge.guacamole.net.auth.mysql.dao" targetProject="/path/to/target/folder">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<!-- The guacamole authentication tables: If the names of the tables change, they have to be changed here as well. -->
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_connection" domainObjectName="Connection" >
<property name="useActualColumnNames" value="true"/>
</table>
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_connection_parameter" domainObjectName="ConnectionParameter" >
<property name="useActualColumnNames" value="true"/>
</table>
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_connection_permission" domainObjectName="ConnectionPermission" >
<property name="useActualColumnNames" value="true"/>
</table>
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_system_permission" domainObjectName="SystemPermission" >
<property name="useActualColumnNames" value="true"/>
</table>
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_user" domainObjectName="User" >
<property name="useActualColumnNames" value="true"/>
</table>
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_user_permission" domainObjectName="UserPermission" >
<property name="useActualColumnNames" value="true"/>
</table>
<!-- Set catalog to the name of the database that contains the guacamole authentication tables. -->
<table catalog="guacamole" tableName="guacamole_connection_history" domainObjectName="ConnectionHistory" >
<property name="useActualColumnNames" value="true"/>
</table>
</context>
</generatorConfiguration>