polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [01/19] polygene-java git commit: Bring in Stanislav's sql-generator from GutHub, after his consent in https://lists.apache.org/thread.html/797352ce2ad7aa7b755720a98f545a176e6050e35f56db113ba115fb@%3Cdev.polygene.apache.org%3E
Date Sat, 15 Apr 2017 08:25:52 GMT
Repository: polygene-java
Updated Branches:
  refs/heads/develop d64c585ab -> a36086b60


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.MySQLVendor
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.MySQLVendor b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.MySQLVendor
new file mode 100644
index 0000000..18018e7
--- /dev/null
+++ b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.MySQLVendor
@@ -0,0 +1 @@
+org.apache.polygene.library.sql.generator.implementation.vendor.mysql.MySQLVendorImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor
new file mode 100644
index 0000000..f39ddf4
--- /dev/null
+++ b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor
@@ -0,0 +1 @@
+org.apache.polygene.library.sql.generator.implementation.vendor.pgsql.PostgreSQLVendorImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLVendor
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLVendor b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLVendor
new file mode 100644
index 0000000..d9e4eb3
--- /dev/null
+++ b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLVendor
@@ -0,0 +1 @@
+org.apache.polygene.library.sql.generator.implementation.vendor.DefaultVendor
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLiteVendor
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLiteVendor b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLiteVendor
new file mode 100644
index 0000000..4330c13
--- /dev/null
+++ b/libraries/sql-generator/src/main/resources/META-INF/services/org.apache.polygene.library.sql.generator.vendor.SQLiteVendor
@@ -0,0 +1 @@
+org.apache.polygene.library.sql.generator.implementation.vendor.sqlite.SQLiteVendorImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractDataDefinitionTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractDataDefinitionTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractDataDefinitionTest.java
new file mode 100644
index 0000000..279c799
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractDataDefinitionTest.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.grammar.builders.definition.TableDefinitionBuilder;
+import org.apache.polygene.library.sql.generator.grammar.builders.definition.TableElementListBuilder;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.AutoGenerationPolicy;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.ConstraintCharacteristics;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.MatchType;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.ReferentialAction;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.TableDefinition;
+import org.apache.polygene.library.sql.generator.grammar.definition.table.UniqueSpecification;
+import org.apache.polygene.library.sql.generator.grammar.factories.DataTypeFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.DefinitionFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.TableReferenceFactory;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.junit.Test;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractDataDefinitionTest extends AbstractSQLSyntaxTest
+{
+
+    @Test
+    public void definition1()
+        throws Exception
+    {
+        // @formatter:off
+        /*
+         * CREATE TABLE qi4j_schema.qname_9
+         * (
+         * qname_id integer NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+         * entity_pk bigint NOT NULL,
+         * parent_qname integer,
+         * collection_path ltree NOT NULL,
+         * qname_value integer,
+         * PRIMARY KEY (qname_id, entity_pk),
+         * CONSTRAINT qname_9_parent_qname_fkey FOREIGN KEY (parent_qname, entity_pk)
+         * REFERENCES qi4j_schema.all_qnames (qname_id, entity_pk) MATCH SIMPLE
+         * ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+         * CONSTRAINT qname_9_qname_id_fkey FOREIGN KEY (qname_id, entity_pk)
+         * REFERENCES qi4j_schema.all_qnames (qname_id, entity_pk) MATCH SIMPLE
+         * ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+         * CONSTRAINT qname_9_qname_value_fkey FOREIGN KEY (qname_value)
+         * REFERENCES qi4j_schema.used_classes (used_class_id)
+         * ON UPDATE CASCADE ON DELETE RESTRICT
+         * )
+         */
+
+        SQLVendor vendor = this.getVendor();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+        DefinitionFactory d = vendor.getDefinitionFactory();
+        DataTypeFactory dt = vendor.getDataTypeFactory();
+        String schemaName = "qi4j_schema";
+
+        TableDefinitionBuilder builder = d.createTableDefinitionBuilder();
+        builder
+            .setTableName( t.tableName( schemaName, "qname_9" ) );
+
+        TableElementListBuilder cBuilder = d.createTableElementListBuilder();
+        cBuilder
+            .addTableElement( d.createColumnDefinition( "qname_id", dt.integer(), false, AutoGenerationPolicy.BY_DEFAULT ) )
+            .addTableElement( d.createColumnDefinition( "entity_pk", dt.bigInt(), false ) )
+            .addTableElement( d.createColumnDefinition( "parent_qname", dt.integer() ) )
+            .addTableElement( d.createColumnDefinition( "collection_path", dt.userDefined( "ltree" ), false ) )
+            .addTableElement( d.createColumnDefinition( "qname_value", dt.integer() ) )
+            .addTableElement( d.createTableConstraintDefinition(
+                d.createUniqueConstraintBuilder()
+                 .setUniqueness( UniqueSpecification.PRIMARY_KEY )
+                 .addColumns( "qname_id", "entity_pk" )
+                 .createExpression() )
+                            )
+            .addTableElement(
+                d.createTableConstraintDefinition(
+                    "qname_9_parent_qname_fkey",
+                    d.createForeignKeyConstraintBuilder()
+                     .addSourceColumns( "parent_qname", "entity_pk" )
+                     .setTargetTableName( t.tableName( schemaName, "all_qnames" ) )
+                     .addTargetColumns( "qname_id", "entity_pk" )
+                     .setMatchType( MatchType.SIMPLE )
+                     .setOnUpdate( ReferentialAction.CASCADE )
+                     .setOnDelete( ReferentialAction.CASCADE )
+                     .createExpression(),
+                    ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+                                                 )
+                            )
+            .addTableElement(
+                d.createTableConstraintDefinition(
+                    "qname_9_qname_id_fkey",
+                    d.createForeignKeyConstraintBuilder()
+                     .addSourceColumns( "qname_id", "entity_pk" )
+                     .setTargetTableName( t.tableName( schemaName, "all_qnames" ) )
+                     .addTargetColumns( "qname_id", "entity_pk" )
+                     .setMatchType( MatchType.SIMPLE )
+                     .setOnUpdate( ReferentialAction.CASCADE )
+                     .setOnDelete( ReferentialAction.CASCADE )
+                     .createExpression(),
+                    ConstraintCharacteristics.INITIALLY_DEFERRED_DEFERRABLE
+                                                 )
+                            )
+            .addTableElement(
+                d.createTableConstraintDefinition(
+                    "qname_9_qname_value_fkey",
+                    d.createForeignKeyConstraintBuilder()
+                     .addSourceColumns( "qname_value" )
+                     .setTargetTableName( t.tableName( schemaName, "used_classes" ) )
+                     .addTargetColumns( "used_class_id" )
+                     .setOnUpdate( ReferentialAction.CASCADE )
+                     .setOnDelete( ReferentialAction.RESTRICT )
+                     .createExpression()
+                                                 )
+                            );
+
+        builder.setTableContentsSource( cBuilder.createExpression() );
+
+        this.logStatement( "Table definition", vendor, builder.createExpression() );
+
+        // @formatter:on
+    }
+
+    @Test
+    public void definition2()
+        throws Exception
+    {
+        SQLVendor vendor = this.getVendor();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+        DefinitionFactory d = vendor.getDefinitionFactory();
+        DataTypeFactory dt = vendor.getDataTypeFactory();
+
+        String schemaName = "the_schema";
+        String tableName = "the_table";
+        String colPKName = "pk_column";
+        String colValueName = "value_column";
+
+        TableDefinition def = d
+            .createTableDefinitionBuilder()
+            .setTableName( t.tableName( schemaName, tableName ) )
+            .setTableContentsSource(
+                d.createTableElementListBuilder()
+                 .addTableElement( d.createColumnDefinition( colPKName, dt.integer(), false ) )
+                 .addTableElement( d.createColumnDefinition( colValueName, dt.sqlVarChar(), false ) )
+                 .addTableElement(
+                     d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+                                                         .setUniqueness( UniqueSpecification.PRIMARY_KEY ).addColumns( colPKName )
+                                                         .createExpression() ) )
+                 .addTableElement(
+                     d.createTableConstraintDefinition( d.createUniqueConstraintBuilder()
+                                                         .setUniqueness( UniqueSpecification.UNIQUE ).addColumns( colValueName ).createExpression() ) )
+                 .createExpression() ).createExpression();
+
+        this.logStatement( "Table definition", vendor, def );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractModificationTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractModificationTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractModificationTest.java
new file mode 100644
index 0000000..379da70
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractModificationTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.grammar.factories.LiteralFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.ModificationFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.QueryFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.TableReferenceFactory;
+import org.apache.polygene.library.sql.generator.grammar.modification.InsertStatement;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.junit.Test;
+
+public abstract class AbstractModificationTest extends AbstractSQLSyntaxTest
+{
+
+    @Test
+    public void modification1()
+    {
+        // INSERT INTO schema.table
+        // VALUES (5, 'String', SELECT column FROM schema.other_table);
+
+        SQLVendor vendor = this.getVendor();
+
+        QueryFactory q = vendor.getQueryFactory();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+        ModificationFactory m = vendor.getModificationFactory();
+        LiteralFactory l = vendor.getLiteralFactory();
+
+        InsertStatement insert = this.getVendor().getModificationFactory().insert()
+                                     .setTableName( t.tableName( "schema", "table" ) )
+                                     .setColumnSource(
+                                         m.columnSourceByValues().addValues(
+                                             l.n( 5 ),
+                                             l.s( "String" ),
+                                             q.simpleQueryBuilder()
+                                              .select( "column" )
+                                              .from( t.tableName( "schema", "other_table" ) )
+                                              .createExpression()
+                                                                           ).createExpression()
+                                                     )
+                                     .createExpression();
+
+        this.logStatement( "Table modification", vendor, insert );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractQueryTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractQueryTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractQueryTest.java
new file mode 100644
index 0000000..06c92e9
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractQueryTest.java
@@ -0,0 +1,364 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.builders.query.ColumnsBuilder;
+import org.apache.polygene.library.sql.generator.grammar.builders.query.QuerySpecificationBuilder;
+import org.apache.polygene.library.sql.generator.grammar.builders.query.TableReferenceBuilder;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import org.apache.polygene.library.sql.generator.grammar.factories.BooleanFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.ColumnsFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.LiteralFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.QueryFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.TableReferenceFactory;
+import org.apache.polygene.library.sql.generator.grammar.query.ColumnReferenceByName;
+import org.apache.polygene.library.sql.generator.grammar.query.Ordering;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpressionBody;
+import org.apache.polygene.library.sql.generator.grammar.query.joins.JoinType;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.junit.Test;
+
+/**
+ * Contains the tests for various queries to test functionality of parser.
+ * <p>
+ * TODO how to actually verify queries? Currently this only outputs them.
+ *
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractQueryTest extends AbstractSQLSyntaxTest
+{
+    protected void logQuery( SQLVendor vendor, QueryExpression query )
+    {
+        this.logStatement( "Query", vendor, query );
+    }
+
+    @Test
+    public void query1()
+        throws Exception
+    {
+        // @formatter:off
+        /*
+        
+          SELECT t0.entity_identity
+          FROM (
+          SELECT DISTINCT t0.entity_pk, t0.entity_identity
+            FROM qi4j.entities t0
+            JOIN qi4j.qname_6 t1 ON (t0.entity_pk = t1.entity_pk AND t1.parent_qname IS NULL)
+            JOIN qi4j.qname_14 t2 ON (t1.qname_id = t2.parent_qname AND t1.entity_pk = t2.entity_pk)
+            JOIN qi4j.qname_15 t3 ON (t2.qname_id = t3.parent_qname AND t2.entity_pk = t3.entity_pk)
+            WHERE t0.entity_type_id IN (3, 4) AND
+            ((t3.qname_value IS NOT NULL AND t3.qname_value = ?) )
+            ) AS t0
+         
+         */
+
+        SQLVendor vendor = this.getVendor();
+
+        QueryFactory q = vendor.getQueryFactory();
+        BooleanFactory b = vendor.getBooleanFactory();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+        LiteralFactory l = vendor.getLiteralFactory();
+        ColumnsFactory c = vendor.getColumnsFactory();
+
+        ColumnsBuilder innerSelectCols = q.columnsBuilder( SetQuantifier.DISTINCT ).addUnnamedColumns(
+            c.colName( "t0", "entity_pk" ), c.colName( "t0", "entity_identity" ) );
+
+        TableReferenceBuilder join = t.tableBuilder(
+            t.table( t.tableName( "qi4j", "entities" ), t.tableAlias( "t0" ) )
+                                                   ).addQualifiedJoin(
+            JoinType.INNER,
+            t.table( t.tableName( "qi4j", "qname_6" ), t.tableAlias( "t1" ) ),
+            t.jc(
+                b.booleanBuilder(
+                    b.eq( c.colName( "t0", "entity_pk" ), c.colName( "t1", "entity_pk" ) )
+                                ).and(
+                    b.isNull( c.colName( "t1", "parent_qname" ) )
+                                     ).createExpression()
+                )
+                                                                     ).addQualifiedJoin(
+            JoinType.INNER,
+            t.table( t.tableName( "qi4j", "qname_14" ), t.tableAlias( "t2" ) ),
+            t.jc(
+                b.booleanBuilder(
+                    b.eq( c.colName( "t1", "qname_id" ), c.colName( "t2", "parent_qname" ) )
+                                ).and(
+                    b.eq( c.colName( "t1", "entity_pk" ), c.colName( "t2", "entity_pk" ) )
+                                     ).createExpression()
+                )
+                                                                                       ).addQualifiedJoin(
+            JoinType.INNER,
+            t.table( t.tableName( "qi4j", "qname_15" ), t.tableAlias( "t3" ) ),
+            t.jc(
+                b.booleanBuilder(
+                    b.eq( c.colName( "t2", "qname_id" ), c.colName( "t3", "parent_qname" ) )
+                                ).and(
+                    b.eq( c.colName( "t2", "entity_pk" ), c.colName( "t3", "entity_pk" ) )
+                                     ).createExpression()
+                )
+                                                                                                         );
+
+        BooleanExpression innerWhere = b.booleanBuilder(
+            b.in( c.colName( "t0", "entity_type_id" ), l.n( 3 ), l.n( 4 ) )
+                                                       ).and( b.isNotNull( c.colName( "t3", "qname_value" ) )
+                                                            ).and( b.eq( c.colName( "t3", "qname_value" ), l.param() )
+                                                                 ).createExpression();
+
+        QuerySpecificationBuilder builder = q.querySpecificationBuilder();
+        builder.setSelect( innerSelectCols );
+        builder.getFrom().addTableReferences( join );
+        builder.getWhere().reset( innerWhere );
+
+        QuerySpecificationBuilder select =
+            q.querySpecificationBuilder();
+        select.getSelect().addUnnamedColumns( c.colName( "t0", "entity_identity" ) );
+        select.getFrom().addTableReferences( t.tableBuilder( t.table( q.createQuery( builder.createExpression() ), t.tableAlias( "t0" ) ) ) );
+
+        QueryExpression query = q.createQuery( q.queryBuilder( select.createExpression() ).createExpression() );
+
+        this.logQuery( vendor, query );
+
+        // @formatter:on
+
+    }
+
+    @Test
+    public void query2()
+        throws Exception
+    {
+        // @formatter:off
+        /*
+          SELECT t0.entity_identity
+          FROM (SELECT DISTINCT t0.entity_pk, t0.entity_identity
+            FROM qi4j.entities t0
+            WHERE t0.entity_type_id IN (3, 4)
+            EXCEPT
+            SELECT DISTINCT t0.entity_pk, t0.entity_identity
+            FROM qi4j.entities t0
+            JOIN qi4j.qname_6 t1 ON (t0.entity_pk = t1.entity_pk AND t1.parent_qname IS NULL)
+            JOIN qi4j.qname_11 t2 ON (t1.qname_id = t2.parent_qname AND t1.entity_pk = t2.entity_pk)
+            LEFT JOIN qi4j.qname_12 t3 ON (t2.qname_id = t3.parent_qname AND t2.entity_pk = t3.entity_pk)
+            LEFT JOIN qi4j.qname_13 t4 ON (t2.qname_id = t4.parent_qname AND t2.entity_pk = t4.entity_pk)
+            WHERE t0.entity_type_id IN (3, 4)
+            GROUP BY t0.entity_pk, t0.entity_identity
+            HAVING COUNT(t2.qname_value) >= 2
+            ORDER BY t0.entity_pk ASC
+          ) AS t0
+        */
+        // @formatter:on
+
+        SQLVendor vendor = this.getVendor();
+
+        QueryFactory q = vendor.getQueryFactory();
+        BooleanFactory b = vendor.getBooleanFactory();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+        LiteralFactory l = vendor.getLiteralFactory();
+        ColumnsFactory c = vendor.getColumnsFactory();
+
+        ColumnReferenceByName innerFirstCol = c.colName( "t0", "entity_pk" );
+        ColumnReferenceByName innerSecondCol = c.colName( "t0", "entity_identity" );
+        ColumnsBuilder innerSelectCols = q.columnsBuilder( SetQuantifier.DISTINCT ).addUnnamedColumns( innerFirstCol,
+                                                                                                       innerSecondCol );
+
+        BooleanExpression where = b.in( c.colName( "t0", "entity_type_id" ), l.n( 3 ), l.n( 4 ) );
+        QuerySpecificationBuilder firstInnerQuery = q.querySpecificationBuilder();
+        firstInnerQuery.setSelect( innerSelectCols );
+
+        firstInnerQuery.getFrom().addTableReferences(
+            t.tableBuilder( t.table( t.tableName( "qi4j", "entities" ), t.tableAlias( "t0" ) ) ) );
+
+        firstInnerQuery.getWhere().reset( where );
+
+        TableReferenceBuilder join = t
+            .tableBuilder( t.table( t.tableName( "qi4j", "entities" ), t.tableAlias( "t0" ) ) )
+            .addQualifiedJoin(
+                JoinType.INNER,
+                t.table( t.tableName( "qi4j", "qname_6" ), t.tableAlias( "t1" ) ),
+                t.jc( b.booleanBuilder( b.eq( c.colName( "t0", "entity_pk" ), c.colName( "t1", "entity_pk" ) ) )
+                       .and( b.isNull( c.colName( "t1", "parent_qname" ) ) ).createExpression() ) )
+            .addQualifiedJoin(
+                JoinType.INNER,
+                t.table( t.tableName( "qi4j", "qname_11" ), t.tableAlias( "t2" ) ),
+                t.jc( b.booleanBuilder( b.eq( c.colName( "t1", "qname_id" ), c.colName( "t2", "parent_qname" ) ) )
+                       .and( b.eq( c.colName( "t1", "entity_pk" ), c.colName( "t2", "entity_pk" ) ) ).createExpression() ) )
+            .addQualifiedJoin(
+                JoinType.LEFT_OUTER,
+                t.table( t.tableName( "qi4j", "qname_12" ), t.tableAlias( "t3" ) ),
+                t.jc( b.booleanBuilder( b.eq( c.colName( "t2", "qname_id" ), c.colName( "t3", "parent_qname" ) ) )
+                       .and( b.eq( c.colName( "t2", "entity_pk" ), c.colName( "t3", "entity_pk" ) ) ).createExpression() ) )
+            .addQualifiedJoin(
+                JoinType.LEFT_OUTER,
+                t.table( t.tableName( "qi4j", "qname_13" ), t.tableAlias( "t4" ) ),
+                t.jc( b.booleanBuilder( b.eq( c.colName( "t3", "qname_id" ), c.colName( "t4", "parent_qname" ) ) )
+                       .and( b.eq( c.colName( "t2", "entity_pk" ), c.colName( "t4", "entity_pk" ) ) ).createExpression() ) );
+
+        QuerySpecificationBuilder secondBuilder = q.querySpecificationBuilder();
+        secondBuilder.setSelect( innerSelectCols );
+        secondBuilder.getFrom().addTableReferences( join );
+        secondBuilder.getWhere().reset( where );
+        secondBuilder.getGroupBy().addGroupingElements( q.groupingElement( innerFirstCol ),
+                                                        q.groupingElement( innerSecondCol ) );
+        secondBuilder.getHaving().reset( b.geq( l.func( "COUNT", c.colName( "t2", "qname_value" ) ), l.n( 2 ) ) );
+        secondBuilder.getOrderBy().addSortSpecs( q.sortSpec( c.colName( "t0", "entity_pk" ), Ordering.ASCENDING ) );
+
+        QueryExpressionBody innerQuery = q.queryBuilder( firstInnerQuery.createExpression() )
+                                          .except( secondBuilder.createExpression() ).createExpression();
+
+        QuerySpecificationBuilder select = q.querySpecificationBuilder().setSelect(
+            q.columnsBuilder().addUnnamedColumns( c.colName( "t0", "entity_identity" ) ) );
+        select.getFrom().addTableReferences(
+            t.tableBuilder( t.table( q.createQuery( innerQuery ), t.tableAlias( "t0" ) ) ) );
+
+        QueryExpression query = q.createQuery( q.queryBuilder( select.createExpression() ).createExpression() );
+
+        this.logQuery( vendor, query );
+    }
+
+    @Test
+    public void query3()
+        throws Exception
+    {
+        // @formatter:off
+        // SELECT COUNT(firstCol), MAX(secondCol)
+        // FROM schema.table;
+        // @formatter:on
+
+        // This test is related to bug reported by Paul Merlin
+        // The simple query builder was iterating the columns in erroneus way,
+        // thus skipping all non-aliased columns
+        SQLVendor vendor = this.getVendor();
+
+        QueryFactory q = vendor.getQueryFactory();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+
+        String firstCol = "firstCol";
+        String secondCol = "secondCol";
+        String schemaName = "schema";
+        String tableName = "table";
+
+        QueryExpression query = q.simpleQueryBuilder().select( "COUNT(" + firstCol + ")", "MAX(" + secondCol + ")" )
+                                 .from( t.tableName( schemaName, tableName ) ).createExpression();
+
+        this.logQuery( vendor, query );
+    }
+
+    @Test
+    public void query4()
+        throws Exception
+    {
+        // @formatter:off
+        // SELECT * FROM schema.function_name(6, 'param2');
+        // @formatter:on
+
+        SQLVendor vendor = this.getVendor();
+        QueryFactory q = vendor.getQueryFactory();
+        LiteralFactory l = vendor.getLiteralFactory();
+
+        this.logQuery( vendor, q.callFunction( "schema", l.func( "function_name", l.n( 6 ), l.s( "param2" ) ) ) );
+    }
+
+    @Test
+    public void query5()
+        throws Exception
+    {
+        // @formatter:off
+        /*
+          SELECT *
+          FROM table
+          WHERE table.value = ?
+          ORDER BY 1 ASC
+          OFFSET 3 ROWS
+          FETCH FIRST 6 ROWS ONLY
+        */
+
+        SQLVendor vendor = this.getVendor();
+
+        BooleanFactory b = vendor.getBooleanFactory();
+        ColumnsFactory c = vendor.getColumnsFactory();
+
+        QueryExpression query = vendor.getQueryFactory().simpleQueryBuilder()
+                                      .selectAllColumns()
+                                      .from( vendor.getTableReferenceFactory().tableName( "table" ) )
+                                      .where( b.eq( c.colName( "table", "value" ), vendor.getLiteralFactory().param() ) )
+                                      .orderByAsc( "1" )
+                                      .limit( 6 )
+                                      .offset( 3 )
+                                      .createExpression();
+        // @formatter:on
+
+        this.logQuery( vendor, query );
+    }
+
+    @Test
+    public void query6()
+        throws Exception
+    {
+        // @formatter:off
+        /*
+          SELECT *
+          FROM table
+          WHERE table.value = ?
+          ORDER BY 1 ASC
+          OFFSET 3 ROWS
+        */
+
+        SQLVendor vendor = this.getVendor();
+
+        BooleanFactory b = vendor.getBooleanFactory();
+        ColumnsFactory c = vendor.getColumnsFactory();
+
+        QueryExpression query = vendor.getQueryFactory().simpleQueryBuilder()
+                                      .selectAllColumns()
+                                      .from( vendor.getTableReferenceFactory().tableName( "table" ) )
+                                      .where( b.eq( c.colName( "table", "value" ), vendor.getLiteralFactory().param() ) )
+                                      .orderByAsc( "1" )
+                                      .offset( 3 )
+                                      .createExpression();
+        // @formatter:on
+
+        this.logQuery( vendor, query );
+    }
+
+    @Test
+    public void query7()
+        throws Exception
+    {
+        // @formatter:off
+        /*
+          SELECT *
+          FROM table
+          WHERE table.value = ?
+          ORDER BY 1 ASC
+          FETCH FIRST 6 ROWS ONLY
+        */
+
+        SQLVendor vendor = this.getVendor();
+
+        BooleanFactory b = vendor.getBooleanFactory();
+        ColumnsFactory c = vendor.getColumnsFactory();
+
+        QueryExpression query = vendor.getQueryFactory().simpleQueryBuilder()
+                                      .selectAllColumns()
+                                      .from( vendor.getTableReferenceFactory().tableName( "table" ) )
+                                      .where( b.eq( c.colName( "table", "value" ), vendor.getLiteralFactory().param() ) )
+                                      .orderByAsc( "1" )
+                                      .limit( 6 )
+                                      .createExpression();
+        // @formatter:on
+
+        this.logQuery( vendor, query );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractSQLSyntaxTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractSQLSyntaxTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractSQLSyntaxTest.java
new file mode 100644
index 0000000..9bb8ab9
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/AbstractSQLSyntaxTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.grammar.common.SQLStatement;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractSQLSyntaxTest
+{
+
+    private SQLVendor _vendor;
+
+    protected void logStatement( String statementType, SQLVendor vendor, SQLStatement statement )
+    {
+        String stringStmt = vendor.toString( statement );
+        LoggerFactory.getLogger( this.getClass().getName() ).info( statementType + ":" + "\n" + stringStmt + "\n" );
+
+        Assert.assertEquals(
+            "Strings must be same from both SQLVendor.toString(...) and statement.toString() methods.", stringStmt,
+            statement.toString() );
+    }
+
+    @Before
+    public final void setUp()
+        throws Exception
+    {
+        this._vendor = this.loadVendor();
+    }
+
+    @After
+    public final void tearDown()
+    {
+        this._vendor = null;
+    }
+
+    protected final SQLVendor getVendor()
+    {
+        return this._vendor;
+    }
+
+    protected abstract SQLVendor loadVendor()
+        throws Exception;
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultDataDefinitionTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultDataDefinitionTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultDataDefinitionTest.java
new file mode 100644
index 0000000..2ff1329
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultDataDefinitionTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultDataDefinitionTest extends AbstractDataDefinitionTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( SQLVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultModificationTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultModificationTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultModificationTest.java
new file mode 100644
index 0000000..2a040f5
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultModificationTest.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+public class DefaultModificationTest extends AbstractModificationTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( SQLVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultSQLQueryTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultSQLQueryTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultSQLQueryTest.java
new file mode 100644
index 0000000..c8a0eba
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/DefaultSQLQueryTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultSQLQueryTest extends AbstractQueryTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( SQLVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2DataDefinitionTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2DataDefinitionTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2DataDefinitionTest.java
new file mode 100644
index 0000000..a034907
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2DataDefinitionTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2012 Paul Merlin.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.H2Vendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+public class H2DataDefinitionTest
+    extends AbstractDataDefinitionTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( H2Vendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2ModificationTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2ModificationTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2ModificationTest.java
new file mode 100644
index 0000000..752e827
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2ModificationTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.H2Vendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+public class H2ModificationTest extends AbstractModificationTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( H2Vendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2QueryTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2QueryTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2QueryTest.java
new file mode 100644
index 0000000..056b750
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/H2QueryTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2012 Paul Merlin.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.H2Vendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+public class H2QueryTest
+    extends AbstractQueryTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( H2Vendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLDataDefinitionTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLDataDefinitionTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLDataDefinitionTest.java
new file mode 100644
index 0000000..25daacb
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLDataDefinitionTest.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.MySQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class MySQLDataDefinitionTest extends AbstractDataDefinitionTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( MySQLVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLModificationTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLModificationTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLModificationTest.java
new file mode 100644
index 0000000..54c6f04
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLModificationTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.MySQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+public class MySQLModificationTest extends AbstractModificationTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( MySQLVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLQueryTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLQueryTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLQueryTest.java
new file mode 100644
index 0000000..953137e
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/MySQLQueryTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.MySQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+import org.junit.Test;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class MySQLQueryTest extends AbstractQueryTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( MySQLVendor.class );
+    }
+
+    @Test
+    public void mySQLQuery5()
+        throws Exception
+    {
+        ( (MySQLVendor) this.getVendor() ).setLegacyLimit( true );
+        super.query5();
+    }
+
+    @Test
+    public void mySQLQuery6()
+        throws Exception
+    {
+        ( (MySQLVendor) this.getVendor() ).setLegacyLimit( true );
+        super.query6();
+    }
+
+    @Test
+    public void mySQLQuery7()
+        throws Exception
+    {
+        ( (MySQLVendor) this.getVendor() ).setLegacyLimit( true );
+        super.query7();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLDataDefinitionTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLDataDefinitionTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLDataDefinitionTest.java
new file mode 100644
index 0000000..0a4a0f8
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLDataDefinitionTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class PostgreSQLDataDefinitionTest extends AbstractDataDefinitionTest
+{
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( PostgreSQLVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLModificationTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLModificationTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLModificationTest.java
new file mode 100644
index 0000000..7d605b8
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLModificationTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.grammar.builders.modification.pgsql.PgSQLInsertStatementBuilder;
+import org.apache.polygene.library.sql.generator.grammar.factories.ColumnsFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.LiteralFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.ModificationFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.QueryFactory;
+import org.apache.polygene.library.sql.generator.grammar.factories.TableReferenceFactory;
+import org.apache.polygene.library.sql.generator.grammar.modification.InsertStatement;
+import org.apache.polygene.library.sql.generator.grammar.modification.ValueSource;
+import org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+import org.junit.Test;
+
+public class PostgreSQLModificationTest extends AbstractModificationTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( PostgreSQLVendor.class );
+    }
+
+    @Test
+    public void pgInsert1()
+    {
+        // INSERT INTO some_schema.some_table
+        // VALUES (DEFAULT, "SomeString")
+        // RETURNING id_column;
+        SQLVendor vendor = this.getVendor();
+
+        QueryFactory q = vendor.getQueryFactory();
+        TableReferenceFactory t = vendor.getTableReferenceFactory();
+        ModificationFactory m = vendor.getModificationFactory();
+        LiteralFactory l = vendor.getLiteralFactory();
+        ColumnsFactory c = vendor.getColumnsFactory();
+
+        InsertStatement insert =
+            ( (PgSQLInsertStatementBuilder) m.insert() )
+                .setReturningClause(
+                    q.columnsBuilder().addUnnamedColumns( c.colName( "id_column" ) )
+                     .createExpression() )
+                .setTableName( t.tableName( "some_schema", "some_table" ) )
+                .setColumnSource(
+                    m.columnSourceByValues()
+                     .addValues( ValueSource.Default.INSTANCE, l.s( "SomeString" ) )
+                     .createExpression()
+                                ).createExpression();
+
+        logStatement( "PGSQL table modification", vendor, insert );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLQueryTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLQueryTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLQueryTest.java
new file mode 100644
index 0000000..ca4dc37
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/PostgreSQLQueryTest.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.PostgreSQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+import org.junit.Test;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class PostgreSQLQueryTest extends AbstractQueryTest
+{
+
+    @Override
+    protected PostgreSQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( PostgreSQLVendor.class );
+    }
+
+    @Test
+    public void pgQuery5()
+        throws Exception
+    {
+        ( (PostgreSQLVendor) this.getVendor() ).setLegacyOffsetAndLimit( true );
+        super.query5();
+    }
+
+    @Test
+    public void pgQuery6()
+        throws Exception
+    {
+        ( (PostgreSQLVendor) this.getVendor() ).setLegacyOffsetAndLimit( true );
+        super.query6();
+    }
+
+    @Test
+    public void pgQuery7()
+        throws Exception
+    {
+        ( (PostgreSQLVendor) this.getVendor() ).setLegacyOffsetAndLimit( true );
+        super.query7();
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteDataDefinitionTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteDataDefinitionTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteDataDefinitionTest.java
new file mode 100644
index 0000000..5e76755
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteDataDefinitionTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Paul Merlin.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+import org.apache.polygene.library.sql.generator.vendor.SQLiteVendor;
+
+public class SQLiteDataDefinitionTest
+    extends AbstractDataDefinitionTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( SQLiteVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteModificationTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteModificationTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteModificationTest.java
new file mode 100644
index 0000000..35db800
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteModificationTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Stanislav Muhametsin. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+import org.apache.polygene.library.sql.generator.vendor.SQLiteVendor;
+
+public class SQLiteModificationTest extends AbstractModificationTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( SQLiteVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteQueryTest.java
----------------------------------------------------------------------
diff --git a/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteQueryTest.java b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteQueryTest.java
new file mode 100644
index 0000000..4ab7ebb
--- /dev/null
+++ b/libraries/sql-generator/src/test/java/org/apache/polygene/library/sql/generator/SQLiteQueryTest.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2012, Paul Merlin.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.polygene.library.sql.generator;
+
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendorProvider;
+import org.apache.polygene.library.sql.generator.vendor.SQLiteVendor;
+
+public class SQLiteQueryTest
+    extends AbstractQueryTest
+{
+
+    @Override
+    protected SQLVendor loadVendor()
+        throws Exception
+    {
+        return SQLVendorProvider.createVendor( SQLiteVendor.class );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/sql/build.gradle b/libraries/sql/build.gradle
index adb28f6..9249981 100644
--- a/libraries/sql/build.gradle
+++ b/libraries/sql/build.gradle
@@ -27,9 +27,9 @@ jar { manifest { name = "Apache Polygene™ Library - SQL" } }
 dependencies {
   api polygene.core.bootstrap
   api polygene.library( 'circuitbreaker' )
+  api libraries.slf4j_api
 
   implementation polygene.library( 'jmx' )
-  implementation libraries.slf4j_api
 
   runtimeOnly polygene.core.runtime
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/manual/src/docs/userguide/tools.txt
----------------------------------------------------------------------
diff --git a/manual/src/docs/userguide/tools.txt b/manual/src/docs/userguide/tools.txt
index 9da85a3..2d14312 100644
--- a/manual/src/docs/userguide/tools.txt
+++ b/manual/src/docs/userguide/tools.txt
@@ -36,6 +36,7 @@ include::../../../../tools/src/docs/yeoman_polygene.txt[]
 
 :leveloffset: 2
 
-include::../../../../tools/envisage/src/docs/envisage.txt[]
+include::../../../../tools/src/docs/envisage.txt[]
+// include::../../../../tools/envisage/src/docs/envisage.txt[]
 
 :leveloffset: 2

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 808f937..0cee4a7 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -49,6 +49,7 @@ include 'core:api',
         'libraries:sql',
         'libraries:sql-bonecp',
         'libraries:sql-dbcp',
+        'libraries:sql-generator',
         'libraries:sql-liquibase',
         'libraries:uid',
         'libraries:uowfile',

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/tools/envisage/src/docs/envisage.txt
----------------------------------------------------------------------
diff --git a/tools/envisage/src/docs/envisage.txt b/tools/envisage/src/docs/envisage.txt
deleted file mode 100644
index 4aecf37..0000000
--- a/tools/envisage/src/docs/envisage.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-///////////////////////////////////////////////////////////////
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
-///////////////////////////////////////////////////////////////
-
-[[tools-envisage,Envisage Tool]]
-= Envisage =
-
-Envisage is a Swing based visualization tool for the Polygene™ Application model.
-Visualizations can be printed to PDFs.
-
-== Usage ==
-
-Envisage can be easily used directly and prior your Application activation:
-
-[snippet,java]
-----
-source=tools/envisage/src/test/java/org/apache/polygene/envisage/school/EnvisageSchoolSample.java
-tag=envisage
-----
-
-As you can see, Envisage operates on the ApplicationModel, this means that you
-can easily embed it in your own Applications too.
-
-From the sources you can run the `runEnvisageSample` or `runEnvisageSchoolSample` Gradle tasks
-to run interactive examples. See <<build-system>> if you need some guidance.
-
-== Screenshots ==
-
-image:tools-envisage-structure.png[width="800px"]
-
-image:tools-envisage-type.png[width="800px"]
-
-image:tools-envisage-stacked.png[width="800px"]
-
-image:tools-envisage-stacked-collapsed.png[width="800px"]
-
-== Embedd in your Application ==
-
-include::../../build/docs/buildinfo/artifact.txt[]
-

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/tools/generator-polygene/dev-status.xml
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/dev-status.xml b/tools/generator-polygene/dev-status.xml
new file mode 100644
index 0000000..dc6c0e6
--- /dev/null
+++ b/tools/generator-polygene/dev-status.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  ~
+  -->
+<module xmlns="http://polygene.apache.org/schemas/2008/dev-status/1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://polygene.apache.org/schemas/2008/dev-status/1
+        http://polygene.apache.org/schemas/2008/dev-status/1/dev-status.xsd">
+  <status>
+    <!--none,early,beta,stable,mature-->
+    <codebase>stable</codebase>
+
+    <!-- none, brief, good, complete -->
+    <documentation>good</documentation>
+
+    <!-- none, some, good, complete -->
+    <unittests>complete</unittests>
+
+  </status>
+  <licenses>
+    <license>ALv2</license>
+  </licenses>
+</module>

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/tools/src/docs/envisage.txt
----------------------------------------------------------------------
diff --git a/tools/src/docs/envisage.txt b/tools/src/docs/envisage.txt
new file mode 100644
index 0000000..4aecf37
--- /dev/null
+++ b/tools/src/docs/envisage.txt
@@ -0,0 +1,55 @@
+///////////////////////////////////////////////////////////////
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+///////////////////////////////////////////////////////////////
+
+[[tools-envisage,Envisage Tool]]
+= Envisage =
+
+Envisage is a Swing based visualization tool for the Polygene™ Application model.
+Visualizations can be printed to PDFs.
+
+== Usage ==
+
+Envisage can be easily used directly and prior your Application activation:
+
+[snippet,java]
+----
+source=tools/envisage/src/test/java/org/apache/polygene/envisage/school/EnvisageSchoolSample.java
+tag=envisage
+----
+
+As you can see, Envisage operates on the ApplicationModel, this means that you
+can easily embed it in your own Applications too.
+
+From the sources you can run the `runEnvisageSample` or `runEnvisageSchoolSample` Gradle tasks
+to run interactive examples. See <<build-system>> if you need some guidance.
+
+== Screenshots ==
+
+image:tools-envisage-structure.png[width="800px"]
+
+image:tools-envisage-type.png[width="800px"]
+
+image:tools-envisage-stacked.png[width="800px"]
+
+image:tools-envisage-stacked-collapsed.png[width="800px"]
+
+== Embedd in your Application ==
+
+include::../../build/docs/buildinfo/artifact.txt[]
+


Mime
View raw message