http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractColumnsFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractColumnsFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractColumnsFactory.java
new file mode 100644
index 0000000..c67e8a8
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractColumnsFactory.java
@@ -0,0 +1,44 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.factories.ColumnsFactory;
+import 
org.apache.polygene.library.sql.generator.grammar.query.ColumnReferenceByName;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractColumnsFactory extends SQLFactoryBase
+    implements ColumnsFactory
+{
+
+    protected AbstractColumnsFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public ColumnReferenceByName colName( String colName )
+    {
+        return this.colName( null, colName );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDataTypeFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDataTypeFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDataTypeFactory.java
new file mode 100644
index 0000000..f4944dd
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDataTypeFactory.java
@@ -0,0 +1,109 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.Decimal;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.Numeric;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLChar;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLFloat;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLTime;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLTimeStamp;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.DataTypeFactory;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractDataTypeFactory extends SQLFactoryBase
+    implements DataTypeFactory
+{
+
+    protected AbstractDataTypeFactory( SQLVendor vendor, 
SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public Decimal decimal()
+    {
+        return this.decimal( null, null );
+    }
+
+    public Decimal decimal( Integer precision )
+    {
+        return this.decimal( precision, null );
+    }
+
+    public Numeric numeric()
+    {
+        return this.numeric( null, null );
+    }
+
+    public Numeric numeric( Integer precision )
+    {
+        return this.numeric( precision, null );
+    }
+
+    public SQLChar sqlChar()
+    {
+        return this.sqlChar( null );
+    }
+
+    public SQLFloat sqlFloat()
+    {
+        return this.sqlFloat( null );
+    }
+
+    public SQLChar sqlVarChar()
+    {
+        return this.sqlVarChar( null );
+    }
+
+    public SQLTime time()
+    {
+        return this.time( null, null );
+    }
+
+    public SQLTime time( Boolean withTimeZone )
+    {
+        return this.time( null, withTimeZone );
+    }
+
+    public SQLTime time( Integer precision )
+    {
+        return this.time( precision, null );
+    }
+
+    public SQLTimeStamp timeStamp()
+    {
+        return this.timeStamp( null, null );
+    }
+
+    public SQLTimeStamp timeStamp( Boolean withTimeZone )
+    {
+        return this.timeStamp( null, withTimeZone );
+    }
+
+    public SQLTimeStamp timeStamp( Integer precision )
+    {
+        return this.timeStamp( precision, null );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDefinitionFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDefinitionFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDefinitionFactory.java
new file mode 100644
index 0000000..dcccb79
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractDefinitionFactory.java
@@ -0,0 +1,90 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.AutoGenerationPolicy;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.ColumnDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.ConstraintCharacteristics;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraint;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraintDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.DefinitionFactory;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractDefinitionFactory extends SQLFactoryBase
+    implements DefinitionFactory
+{
+
+    protected AbstractDefinitionFactory( SQLVendor vendor, 
SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public ColumnDefinition createColumnDefinition( String columnName, 
SQLDataType columnDataType )
+    {
+        return this.createColumnDefinition( columnName, columnDataType, null, 
true );
+    }
+
+    public ColumnDefinition createColumnDefinition( String columnName, 
SQLDataType columnDataType, Boolean mayBeNull )
+    {
+        return this.createColumnDefinition( columnName, columnDataType, null, 
mayBeNull );
+    }
+
+    public ColumnDefinition createColumnDefinition( String columnName, 
SQLDataType columnDataType, String columnDefault )
+    {
+        return this.createColumnDefinition( columnName, columnDataType, 
columnDefault, true );
+    }
+
+    public ColumnDefinition createColumnDefinition( String columnName, 
SQLDataType columnDataType,
+                                                    String columnDefault, 
Boolean mayBeNull )
+    {
+        return this.createColumnDefinition( columnName, columnDataType, 
columnDefault, mayBeNull, null );
+    }
+
+    public ColumnDefinition createColumnDefinition( String columnName, 
SQLDataType columnDataType, Boolean mayBeNull,
+                                                    AutoGenerationPolicy 
autoGenerationPolicy )
+    {
+        return this.createColumnDefinition( columnName, columnDataType, null, 
mayBeNull, autoGenerationPolicy );
+    }
+
+    public TableConstraintDefinition createTableConstraintDefinition( String 
name, TableConstraint constraint )
+    {
+        return this.createTableConstraintDefinition( name, constraint, null );
+    }
+
+    public TableConstraintDefinition createTableConstraintDefinition( 
TableConstraint constraint )
+    {
+        return this.createTableConstraintDefinition( null, constraint, null );
+    }
+
+    public TableConstraintDefinition createTableConstraintDefinition( 
TableConstraint constraint,
+                                                                      
ConstraintCharacteristics characteristics )
+    {
+        return this.createTableConstraintDefinition( null, constraint, 
characteristics );
+    }
+
+    protected abstract ColumnDefinition createColumnDefinition( String 
columnName, SQLDataType columnDataType,
+                                                                String 
columnDefault, Boolean mayBeNull, AutoGenerationPolicy autoGenerationPolicy );
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractModificationFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractModificationFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractModificationFactory.java
new file mode 100644
index 0000000..cc7dc33
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractModificationFactory.java
@@ -0,0 +1,52 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.ModificationFactory;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.ColumnSourceByQuery;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.TargetTable;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractModificationFactory extends SQLFactoryBase
+    implements ModificationFactory
+{
+
+    protected AbstractModificationFactory( SQLVendor vendor, 
SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public TargetTable createTargetTable( TableNameDirect tableName )
+    {
+        return this.createTargetTable( tableName, false );
+    }
+
+    public ColumnSourceByQuery columnSourceByQuery( QueryExpression query )
+    {
+        return this.columnSourceByQuery( null, query );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractQueryFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractQueryFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractQueryFactory.java
new file mode 100644
index 0000000..af2df2a
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractQueryFactory.java
@@ -0,0 +1,60 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.ColumnsBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.QueryBuilder;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.QueryFactory;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral;
+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.implementation.grammar.builders.query.ColumnsBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractQueryFactory extends SQLFactoryBase
+    implements QueryFactory
+{
+
+    protected AbstractQueryFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public QueryBuilder queryBuilder()
+    {
+        return this.queryBuilder( 
QueryExpressionBody.EmptyQueryExpressionBody.INSTANCE );
+    }
+
+    public ColumnsBuilder columnsBuilder()
+    {
+        return new ColumnsBuilderImpl( this.getProcessor(), SetQuantifier.ALL 
);
+    }
+
+    public QueryExpression callFunction( SQLFunctionLiteral function )
+    {
+        return this.callFunction( null, function );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractTableRefFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractTableRefFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractTableRefFactory.java
new file mode 100644
index 0000000..3865fef
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/AbstractTableRefFactory.java
@@ -0,0 +1,71 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import org.apache.polygene.library.sql.generator.grammar.common.TableName;
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameFunction;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.TableReferenceFactory;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.TableAlias;
+import 
org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByName;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public abstract class AbstractTableRefFactory extends SQLFactoryBase
+    implements TableReferenceFactory
+{
+
+    protected AbstractTableRefFactory( SQLVendor vendor, 
SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public TableReferenceByName table( TableName tableName )
+    {
+        return this.table( tableName, null );
+    }
+
+    public TableNameDirect tableName( String tableName )
+    {
+        return this.tableName( null, tableName );
+    }
+
+    public TableAlias tableAlias( String tableNameAlias )
+    {
+        return this.tableAliasWithCols( tableNameAlias );
+    }
+
+    public TableReferenceByExpression table( QueryExpression query )
+    {
+        return this.table( query, null );
+    }
+
+    public TableNameFunction tableName( SQLFunctionLiteral function )
+    {
+        return this.tableName( null, function );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultBooleanFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultBooleanFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultBooleanFactory.java
new file mode 100644
index 0000000..bd5e159
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultBooleanFactory.java
@@ -0,0 +1,209 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.BetweenPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.booleans.BooleanTest;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.BooleanTest.TestType;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.BooleanTest.TruthValue;
+import org.apache.polygene.library.sql.generator.grammar.booleans.Conjunction;
+import org.apache.polygene.library.sql.generator.grammar.booleans.Disjunction;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.EqualsPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.ExistsPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.GreaterOrEqualPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.GreaterThanPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.IsNotNullPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.IsNullPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.LessOrEqualPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.LessThanPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.LikePredicate;
+import org.apache.polygene.library.sql.generator.grammar.booleans.Negation;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.NotBetweenPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.NotEqualsPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.NotInPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.NotLikePredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.NotRegexpPredicate;
+import org.apache.polygene.library.sql.generator.grammar.booleans.Predicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.RegexpPredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.UniquePredicate;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.booleans.BooleanBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.booleans.InBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.BetweenPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.BooleanTestImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.ConjunctionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.DisjunctionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.EqualsPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.ExistsPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.GreaterOrEqualPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.GreaterThanPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.IsNotNullPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.IsNullPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.LessOrEqualPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.LessThanPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.LikePredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.NegationImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.NotBetweenPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.NotEqualsPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.NotInPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.NotLikePredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.NotRegexpPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.RegexpPredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.booleans.UniquePredicateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.booleans.BooleanBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.booleans.InBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultBooleanFactory extends AbstractBooleanFactory
+{
+
+    public DefaultBooleanFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public EqualsPredicate eq( NonBooleanExpression left, NonBooleanExpression 
right )
+    {
+        return new EqualsPredicateImpl( this.getProcessor(), left, right );
+    }
+
+    public NotEqualsPredicate neq( NonBooleanExpression left, 
NonBooleanExpression right )
+    {
+        return new NotEqualsPredicateImpl( this.getProcessor(), left, right );
+    }
+
+    public LessThanPredicate lt( NonBooleanExpression left, 
NonBooleanExpression right )
+    {
+        return new LessThanPredicateImpl( this.getProcessor(), left, right );
+    }
+
+    public LessOrEqualPredicate leq( NonBooleanExpression left, 
NonBooleanExpression right )
+    {
+        return new LessOrEqualPredicateImpl( this.getProcessor(), left, right 
);
+    }
+
+    public GreaterThanPredicate gt( NonBooleanExpression left, 
NonBooleanExpression right )
+    {
+        return new GreaterThanPredicateImpl( this.getProcessor(), left, right 
);
+    }
+
+    public GreaterOrEqualPredicate geq( NonBooleanExpression left, 
NonBooleanExpression right )
+    {
+        return new GreaterOrEqualPredicateImpl( this.getProcessor(), left, 
right );
+    }
+
+    public IsNullPredicate isNull( NonBooleanExpression what )
+    {
+        return new IsNullPredicateImpl( this.getProcessor(), what );
+    }
+
+    public IsNotNullPredicate isNotNull( NonBooleanExpression what )
+    {
+        return new IsNotNullPredicateImpl( this.getProcessor(), what );
+    }
+
+    public Negation not( BooleanExpression what )
+    {
+        return new NegationImpl( this.getProcessor(), what );
+    }
+
+    public Conjunction and( BooleanExpression left, BooleanExpression right )
+    {
+        return new ConjunctionImpl( this.getProcessor(), left, right );
+    }
+
+    public Disjunction or( BooleanExpression left, BooleanExpression right )
+    {
+        return new DisjunctionImpl( this.getProcessor(), left, right );
+    }
+
+    public BetweenPredicate between( NonBooleanExpression left, 
NonBooleanExpression minimum,
+                                     NonBooleanExpression maximum )
+    {
+        return new BetweenPredicateImpl( this.getProcessor(), left, minimum, 
maximum );
+    }
+
+    public NotBetweenPredicate notBetween( NonBooleanExpression left, 
NonBooleanExpression minimum,
+                                           NonBooleanExpression maximum )
+    {
+        return new NotBetweenPredicateImpl( this.getProcessor(), left, 
minimum, maximum );
+    }
+
+    public InBuilder inBuilder( NonBooleanExpression what )
+    {
+        return new InBuilderImpl( this.getProcessor(), what );
+    }
+
+    public NotInPredicate notIn( NonBooleanExpression what, 
NonBooleanExpression... values )
+    {
+        return new NotInPredicateImpl( this.getProcessor(), what, values );
+    }
+
+    public LikePredicate like( NonBooleanExpression what, NonBooleanExpression 
pattern )
+    {
+        return new LikePredicateImpl( this.getProcessor(), what, pattern );
+    }
+
+    public NotLikePredicate notLike( NonBooleanExpression what, 
NonBooleanExpression pattern )
+    {
+        return new NotLikePredicateImpl( this.getProcessor(), what, pattern );
+    }
+
+    public RegexpPredicate regexp( NonBooleanExpression what, 
NonBooleanExpression pattern )
+    {
+        return new RegexpPredicateImpl( this.getProcessor(), what, pattern );
+    }
+
+    public NotRegexpPredicate notRegexp( NonBooleanExpression what, 
NonBooleanExpression pattern )
+    {
+        return new NotRegexpPredicateImpl( this.getProcessor(), what, pattern 
);
+    }
+
+    public ExistsPredicate exists( QueryExpression query )
+    {
+        return new ExistsPredicateImpl( this.getProcessor(), query );
+    }
+
+    public UniquePredicate unique( QueryExpression query )
+    {
+        return new UniquePredicateImpl( this.getProcessor(), query );
+    }
+
+    public BooleanTest test( BooleanExpression expression, TestType testType, 
TruthValue truthValue )
+    {
+        return new BooleanTestImpl( this.getProcessor(), expression, testType, 
truthValue );
+    }
+
+    public BooleanBuilder booleanBuilder( BooleanExpression first )
+    {
+        return new BooleanBuilderImpl( this.getProcessor(), this, 
this.transformNullToEmpty( first ) );
+    }
+
+    private final BooleanExpression transformNullToEmpty( BooleanExpression 
expression )
+    {
+        return expression == null ? Predicate.EmptyPredicate.INSTANCE : 
expression;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultColumnsFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultColumnsFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultColumnsFactory.java
new file mode 100644
index 0000000..2e1258b
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultColumnsFactory.java
@@ -0,0 +1,71 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import java.util.Collection;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.ColumnsBuilder;
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import 
org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.query.ColumnReferenceByExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.query.ColumnReferenceByName;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.ColumnsBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.ColumnNameListImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.ColumnReferenceByExpressionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.ColumnReferenceByNameImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultColumnsFactory extends AbstractColumnsFactory
+{
+
+    public DefaultColumnsFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public ColumnsBuilder columnsBuilder( SetQuantifier setQuantifier )
+    {
+        return new ColumnsBuilderImpl( this.getProcessor(), setQuantifier );
+    }
+
+    public ColumnReferenceByName colName( String tableName, String colName )
+    {
+        return new ColumnReferenceByNameImpl( this.getProcessor(), tableName, 
colName );
+    }
+
+    public ColumnReferenceByExpression colExp( ValueExpression expression )
+    {
+        return new ColumnReferenceByExpressionImpl( this.getProcessor(), 
expression );
+    }
+
+    public ColumnNameList colNames( String... names )
+    {
+        return new ColumnNameListImpl( this.getProcessor(), names );
+    }
+
+    public ColumnNameList colNames( Collection<String> names )
+    {
+        return new ColumnNameListImpl( this.getProcessor(), names );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDataTypeFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDataTypeFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDataTypeFactory.java
new file mode 100644
index 0000000..a934d18
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDataTypeFactory.java
@@ -0,0 +1,235 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import java.util.Objects;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.BigInt;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.Decimal;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.DoublePrecision;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.IntervalDataType;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.Numeric;
+import org.apache.polygene.library.sql.generator.grammar.common.datatypes.Real;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLBoolean;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLChar;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDate;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLFloat;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLInteger;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLInterval;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLTime;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLTimeStamp;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SmallInt;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.UserDefinedType;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.BigIntImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.DecimalImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.DoublePrecisionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.NumericImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.RealImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLBooleanImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLCharImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLDateImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLFloatImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLIntegerImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLIntervalImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLTimeImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SQLTimeStampImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.SmallIntImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.datatypes.UserDefinedTypeImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultDataTypeFactory extends AbstractDataTypeFactory
+{
+
+    public DefaultDataTypeFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public BigInt bigInt()
+    {
+        return BigIntImpl.INSTANCE;
+    }
+
+    public Decimal decimal( Integer precision, Integer scale )
+    {
+        return precision == null ? DecimalImpl.PLAIN_DECIMAL : new 
DecimalImpl( precision, scale );
+    }
+
+    public DoublePrecision doublePrecision()
+    {
+        return DoublePrecisionImpl.INSTANCE;
+    }
+
+    public Numeric numeric( Integer precision, Integer scale )
+    {
+        return precision == null ? NumericImpl.PLAIN_NUMERIC : new 
NumericImpl( precision, scale );
+    }
+
+    public Real real()
+    {
+        return RealImpl.INSTANCE;
+    }
+
+    public SmallInt smallInt()
+    {
+        return SmallIntImpl.INSTANCE;
+    }
+
+    public SQLBoolean sqlBoolean()
+    {
+        return SQLBooleanImpl.INSTANCE;
+    }
+
+    public SQLChar sqlChar( Integer length )
+    {
+        return length == null ? SQLCharImpl.PLAIN_FIXED : new SQLCharImpl( 
false, length );
+    }
+
+    public SQLChar sqlVarChar( Integer length )
+    {
+        return length == null ? SQLCharImpl.PLAIN_VARYING : new SQLCharImpl( 
true, length );
+    }
+
+    public SQLDate date()
+    {
+        return SQLDateImpl.INSTANCE;
+    }
+
+    public SQLFloat sqlFloat( Integer precision )
+    {
+        return precision == null ? SQLFloatImpl.PLAIN_FLOAT : new 
SQLFloatImpl( precision );
+    }
+
+    public SQLInteger integer()
+    {
+        return SQLIntegerImpl.INSTANCE;
+    }
+
+    public SQLInterval yearMonthInterval( IntervalDataType startField, Integer 
startFieldPrecision,
+                                          IntervalDataType endField )
+    {
+        Objects.requireNonNull( startField, "Start field" );
+
+        SQLInterval result = null;
+        if( ( startField == IntervalDataType.YEAR || startField == 
IntervalDataType.MONTH )
+            && ( endField == null || endField == IntervalDataType.YEAR || 
endField == IntervalDataType.MONTH ) )
+        {
+            result = new SQLIntervalImpl( startField, startFieldPrecision, 
endField, null );
+        }
+        else
+        {
+            throw new IllegalArgumentException( "The interval data types must 
be either YEAR or MONTH." );
+        }
+
+        return result;
+    }
+
+    public SQLInterval dayTimeInterval( IntervalDataType startField, Integer 
startFieldPrecision,
+                                        IntervalDataType endField, Integer 
secondFracs )
+    {
+        Objects.requireNonNull( startField, "Start field" );
+        SQLInterval result = null;
+        if( startField != IntervalDataType.YEAR
+            && startField != IntervalDataType.MONTH
+            && ( endField == null || ( endField != IntervalDataType.YEAR && 
endField != IntervalDataType.MONTH && startField != IntervalDataType.SECOND ) ) 
)
+        {
+            if( secondFracs != null
+                && ( startField != IntervalDataType.SECOND || ( endField != 
null && endField != IntervalDataType.SECOND ) ) )
+            {
+                // Trying to set second fractionals, even when not needed
+                secondFracs = null;
+            }
+
+            if( endField == null && secondFracs != null && startFieldPrecision 
== null )
+            {
+                throw new IllegalArgumentException(
+                    "When specifying second fracs for single day-time 
intervals, the start field precision must be specified also." );
+            }
+
+            result = new SQLIntervalImpl( startField, startFieldPrecision, 
endField, secondFracs );
+        }
+        else
+        {
+            throw new IllegalArgumentException(
+                "The interval data types must be either DAY, HOUR, MINUTE, or 
SECOND. For single day-time intervals, the start field must not be SECOND if 
end field is non-null." );
+        }
+        return result;
+    }
+
+    public SQLTime time( Integer precision, Boolean withTimeZone )
+    {
+        SQLTime result = null;
+        if( precision == null )
+        {
+            if( withTimeZone == null )
+            {
+                result = SQLTimeImpl.PLAIN_TIME;
+            }
+            else if( withTimeZone )
+            {
+                result = SQLTimeImpl.PLAIN_TIME_WITH_TZ;
+            }
+            else
+            {
+                result = SQLTimeImpl.PLAIN_TIME_WITHOUT_TZ;
+            }
+        }
+        else
+        {
+            result = new SQLTimeImpl( precision, withTimeZone );
+        }
+
+        return result;
+    }
+
+    public SQLTimeStamp timeStamp( Integer precision, Boolean withTimeZone )
+    {
+        SQLTimeStamp result = null;
+        if( precision == null )
+        {
+            if( withTimeZone == null )
+            {
+                result = SQLTimeStampImpl.PLAIN_TIMESTAMP;
+            }
+            else if( withTimeZone )
+            {
+                result = SQLTimeStampImpl.PLAIN_TIMESTAMP_WITH_TZ;
+            }
+            else
+            {
+                result = SQLTimeStampImpl.PLAIN_TIMESTAMP_WITHOUT_TZ;
+            }
+        }
+        else
+        {
+            result = new SQLTimeStampImpl( precision, withTimeZone );
+        }
+
+        return result;
+    }
+
+    public UserDefinedType userDefined( String textualContent )
+    {
+        return new UserDefinedTypeImpl( textualContent );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDefinitionFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDefinitionFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDefinitionFactory.java
new file mode 100644
index 0000000..9c5805b
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultDefinitionFactory.java
@@ -0,0 +1,122 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.definition.ForeignKeyConstraintBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.definition.SchemaDefinitionBuilder;
+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.builders.definition.UniqueConstraintBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.definition.ViewDefinitionBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import 
org.apache.polygene.library.sql.generator.grammar.common.datatypes.SQLDataType;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.AutoGenerationPolicy;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.CheckConstraint;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.ColumnDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.ConstraintCharacteristics;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.LikeClause;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraint;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraintDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.view.RegularViewSpecification;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.definition.ForeignKeyConstraintBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.definition.SchemaDefinitionBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.definition.TableDefinitionBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.definition.TableElementListBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.definition.UniqueConstraintBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.definition.ViewDefinitionBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.definition.table.CheckConstraintImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.definition.table.ColumnDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.definition.table.LikeClauseImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.definition.table.TableConstraintDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.definition.view.RegularViewSpecificationImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultDefinitionFactory extends AbstractDefinitionFactory
+{
+    public DefaultDefinitionFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public SchemaDefinitionBuilder createSchemaDefinitionBuilder()
+    {
+        return new SchemaDefinitionBuilderImpl( this.getProcessor() );
+    }
+
+    public TableDefinitionBuilder createTableDefinitionBuilder()
+    {
+        return new TableDefinitionBuilderImpl( this.getProcessor() );
+    }
+
+    public TableElementListBuilder createTableElementListBuilder()
+    {
+        return new TableElementListBuilderImpl( this.getProcessor() );
+    }
+
+    @Override
+    protected ColumnDefinition createColumnDefinition( String columnName, 
SQLDataType columnDataType,
+                                                       String columnDefault, 
Boolean mayBeNull, AutoGenerationPolicy autoGenerationPolicy )
+    {
+        return new ColumnDefinitionImpl( this.getProcessor(), columnName, 
columnDataType, columnDefault, mayBeNull,
+                                         autoGenerationPolicy );
+    }
+
+    public LikeClause createLikeClause( TableNameDirect tableName )
+    {
+        return new LikeClauseImpl( this.getProcessor(), tableName );
+    }
+
+    public TableConstraintDefinition createTableConstraintDefinition( String 
name, TableConstraint constraint,
+                                                                      
ConstraintCharacteristics characteristics )
+    {
+        return new TableConstraintDefinitionImpl( this.getProcessor(), name, 
constraint, characteristics );
+    }
+
+    public CheckConstraint createCheckConstraint( BooleanExpression check )
+    {
+        return new CheckConstraintImpl( this.getProcessor(), check );
+    }
+
+    public UniqueConstraintBuilder createUniqueConstraintBuilder()
+    {
+        return new UniqueConstraintBuilderImpl( this.getProcessor(), 
this.getVendor().getColumnsFactory() );
+    }
+
+    public ForeignKeyConstraintBuilder createForeignKeyConstraintBuilder()
+    {
+        return new ForeignKeyConstraintBuilderImpl( this.getProcessor(), 
this.getVendor().getColumnsFactory() );
+    }
+
+    public ViewDefinitionBuilder createViewDefinitionBuilder()
+    {
+        return new ViewDefinitionBuilderImpl( this.getProcessor() );
+    }
+
+    public RegularViewSpecification createRegularViewSpecification( String... 
columnNames )
+    {
+        return new RegularViewSpecificationImpl( this.getProcessor(), 
this.getVendor().getColumnsFactory()
+                                                                          
.colNames( columnNames ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultLiteralFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultLiteralFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultLiteralFactory.java
new file mode 100644
index 0000000..eb096e4
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultLiteralFactory.java
@@ -0,0 +1,85 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import java.sql.Timestamp;
+import org.apache.polygene.library.sql.generator.grammar.common.SQLConstants;
+import 
org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.LiteralFactory;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.DirectLiteral;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.NumericLiteral;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.StringLiteral;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.TimestampTimeLiteral;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.literals.DirectLiteralImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.literals.NumericLiteralImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.literals.SQLFunctionLiteralImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.literals.StringLiteralImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.literals.TimestampLiteralImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultLiteralFactory extends SQLFactoryBase
+    implements LiteralFactory
+{
+
+    private final DirectLiteral _param;
+
+    public DefaultLiteralFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+
+        this._param = new DirectLiteralImpl( this.getProcessor(), 
SQLConstants.QUESTION_MARK );
+    }
+
+    public DirectLiteral l( String literalContents )
+    {
+        return new DirectLiteralImpl( this.getProcessor(), literalContents );
+    }
+
+    public DirectLiteral param()
+    {
+        return _param;
+    }
+
+    public StringLiteral s( String literal )
+    {
+        return new StringLiteralImpl( this.getProcessor(), literal );
+    }
+
+    public TimestampTimeLiteral dt( Timestamp date )
+    {
+        return new TimestampLiteralImpl( this.getProcessor(), date );
+    }
+
+    public NumericLiteral n( Number number )
+    {
+        return new NumericLiteralImpl( this.getProcessor(), number );
+    }
+
+    public SQLFunctionLiteral func( String name, ValueExpression... parameters 
)
+    {
+        return new SQLFunctionLiteralImpl( this.getProcessor(), name, 
parameters );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultManipulationFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultManipulationFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultManipulationFactory.java
new file mode 100644
index 0000000..66596e6
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultManipulationFactory.java
@@ -0,0 +1,122 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.ColumnDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.definition.table.TableConstraintDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.factories.ManipulationFactory;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.AddColumnDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.AddTableConstraintDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.AlterColumnAction;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.AlterColumnDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.AlterTableAction;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.AlterTableStatement;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.DropBehaviour;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.DropColumnDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.DropSchemaStatement;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.DropTableConstraintDefinition;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.DropTableOrViewStatement;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.ObjectType;
+import 
org.apache.polygene.library.sql.generator.grammar.manipulation.SetColumnDefault;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.SQLFactoryBase;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.AddColumnDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.AddTableConstraintDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.AlterColumnDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.AlterTableStatementImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.DropColumnDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.DropSchemaStatementImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.DropTableConstraintDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.DropTableOrViewStatementImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.manipulation.SetColumnDefaultImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultManipulationFactory extends SQLFactoryBase
+    implements ManipulationFactory
+{
+
+    public DefaultManipulationFactory( SQLVendor vendor, 
SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public AlterTableStatement createAlterTableStatement( TableNameDirect 
tableName, AlterTableAction action )
+    {
+        return new AlterTableStatementImpl( this.getProcessor(), tableName, 
action );
+    }
+
+    public AddColumnDefinition createAddColumnDefinition( ColumnDefinition 
definition )
+    {
+        return new AddColumnDefinitionImpl( this.getProcessor(), definition );
+    }
+
+    public AddTableConstraintDefinition createAddTableConstraintDefinition(
+        TableConstraintDefinition constraintDefinition )
+    {
+        return new AddTableConstraintDefinitionImpl( this.getProcessor(), 
constraintDefinition );
+    }
+
+    public AlterColumnDefinition createAlterColumnDefinition( String 
columnName, AlterColumnAction action )
+    {
+        return new AlterColumnDefinitionImpl( this.getProcessor(), columnName, 
action );
+    }
+
+    public SetColumnDefault createSetColumnDefault( String newDefault )
+    {
+        return new SetColumnDefaultImpl( this.getProcessor(), newDefault );
+    }
+
+    public DropColumnDefinition createDropColumnDefinition( String columnName, 
DropBehaviour dropBehaviour )
+    {
+        return new DropColumnDefinitionImpl( this.getProcessor(), columnName, 
dropBehaviour );
+    }
+
+    public DropTableConstraintDefinition createDropTableConstraintDefinition( 
String constraintName,
+                                                                              
DropBehaviour dropBehaviour )
+    {
+        return new DropTableConstraintDefinitionImpl( this.getProcessor(), 
constraintName, dropBehaviour );
+    }
+
+    public DropSchemaStatement createDropSchemaStatement( String schemaName, 
DropBehaviour dropBehaviour )
+    {
+        return new DropSchemaStatementImpl( this.getProcessor(), 
dropBehaviour, schemaName );
+    }
+
+    public DropTableOrViewStatement createDropTableOrViewStatement( 
TableNameDirect tableName, ObjectType theType,
+                                                                    
DropBehaviour dropBehaviour )
+    {
+        DropTableOrViewStatement result = null;
+        if( theType == ObjectType.TABLE || theType == ObjectType.VIEW )
+        {
+            result = new DropTableOrViewStatementImpl( this.getProcessor(), 
theType, dropBehaviour, tableName );
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Object type " + theType
+                                                + " is not a valid type for 
DROP TABLE or DROP VIEW statement." );
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultModificationFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultModificationFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultModificationFactory.java
new file mode 100644
index 0000000..e519918
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultModificationFactory.java
@@ -0,0 +1,98 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.builders.modification.ColumnSourceByValuesBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.modification.DeleteBySearchBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.modification.InsertStatementBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.modification.UpdateBySearchBuilder;
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import 
org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.ColumnSourceByQuery;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.SetClause;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.TargetTable;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.UpdateSource;
+import 
org.apache.polygene.library.sql.generator.grammar.modification.UpdateSourceByExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.modification.ColumnSourceByValuesBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.modification.DeleteBySearchBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.modification.InsertStatementBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.modification.UpdateBySearchBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.modification.ColumnSourceByQueryImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.modification.SetClauseImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.modification.TargetTableImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.modification.UpdateSourceByExpressionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultModificationFactory extends AbstractModificationFactory
+{
+
+    public DefaultModificationFactory( SQLVendor vendor, 
SQLProcessorAggregator processor )
+    {
+        super( vendor, processor );
+    }
+
+    public ColumnSourceByValuesBuilder columnSourceByValues()
+    {
+        return new ColumnSourceByValuesBuilderImpl( this.getProcessor() );
+    }
+
+    public ColumnSourceByQuery columnSourceByQuery( ColumnNameList 
columnNames, QueryExpression query )
+    {
+        return new ColumnSourceByQueryImpl( this.getProcessor(), columnNames, 
query );
+    }
+
+    public DeleteBySearchBuilder deleteBySearch()
+    {
+        return new DeleteBySearchBuilderImpl( this.getProcessor(), 
this.getVendor().getBooleanFactory()
+                                                                       
.booleanBuilder() );
+    }
+
+    public InsertStatementBuilder insert()
+    {
+        return new InsertStatementBuilderImpl( this.getProcessor() );
+    }
+
+    public UpdateBySearchBuilder updateBySearch()
+    {
+        return new UpdateBySearchBuilderImpl( this.getProcessor(), 
this.getVendor().getBooleanFactory()
+                                                                       
.booleanBuilder() );
+    }
+
+    public TargetTable createTargetTable( TableNameDirect tableName, Boolean 
isOnly )
+    {
+        return new TargetTableImpl( this.getProcessor(), isOnly, tableName );
+    }
+
+    public UpdateSourceByExpression updateSourceByExp( ValueExpression 
expression )
+    {
+        return new UpdateSourceByExpressionImpl( this.getProcessor(), 
expression );
+    }
+
+    public SetClause setClause( String updateTarget, UpdateSource updateSource 
)
+    {
+        return new SetClauseImpl( this.getProcessor(), updateTarget, 
updateSource );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultQueryFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultQueryFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultQueryFactory.java
new file mode 100644
index 0000000..fe5f64e
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultQueryFactory.java
@@ -0,0 +1,156 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import java.util.Arrays;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.ColumnsBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.FromBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.GroupByBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.OrderByBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.QueryBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.QuerySpecificationBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.SimpleQueryBuilder;
+import 
org.apache.polygene.library.sql.generator.grammar.common.NonBooleanExpression;
+import org.apache.polygene.library.sql.generator.grammar.common.SetQuantifier;
+import 
org.apache.polygene.library.sql.generator.grammar.common.ValueExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral;
+import 
org.apache.polygene.library.sql.generator.grammar.query.LimitSpecification;
+import 
org.apache.polygene.library.sql.generator.grammar.query.OffsetSpecification;
+import org.apache.polygene.library.sql.generator.grammar.query.Ordering;
+import 
org.apache.polygene.library.sql.generator.grammar.query.OrdinaryGroupingSet;
+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.RowDefinition;
+import org.apache.polygene.library.sql.generator.grammar.query.RowSubQuery;
+import 
org.apache.polygene.library.sql.generator.grammar.query.RowValueConstructor;
+import 
org.apache.polygene.library.sql.generator.grammar.query.SortSpecification;
+import 
org.apache.polygene.library.sql.generator.grammar.query.TableValueConstructor;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.ColumnsBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.FromBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.GroupByBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.OrderByBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.QueryBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.QuerySpecificationBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.SimpleQueryBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.LimitSpecificationImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.OffsetSpecificationImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.OrdinaryGroupingSetImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.QueryExpressionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.RowDefinitionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.RowSubQueryImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.SortSpecificationImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.TableValueConstructorImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultQueryFactory extends AbstractQueryFactory
+{
+
+    public DefaultQueryFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public QueryExpression createQuery( QueryExpressionBody body )
+    {
+        return new QueryExpressionImpl( this.getProcessor(), body );
+    }
+
+    public QuerySpecificationBuilder querySpecificationBuilder()
+    {
+        return new QuerySpecificationBuilderImpl( this.getProcessor(), this, 
this.columnsBuilder(), this.fromBuilder(),
+                                                  
this.getVendor().getBooleanFactory().booleanBuilder(), this.groupByBuilder(), 
this.getVendor()
+                                                                               
                                                     
.getBooleanFactory().booleanBuilder(), this.orderByBuilder() );
+    }
+
+    public ColumnsBuilder columnsBuilder( SetQuantifier setQuantifier )
+    {
+        return new ColumnsBuilderImpl( this.getProcessor(), setQuantifier );
+    }
+
+    public QueryBuilder queryBuilder( QueryExpressionBody query )
+    {
+        return new QueryBuilderImpl( this.getProcessor(), query );
+    }
+
+    public GroupByBuilder groupByBuilder()
+    {
+        return new GroupByBuilderImpl( this.getProcessor() );
+    }
+
+    public OrdinaryGroupingSet groupingElement( NonBooleanExpression... 
expressions )
+    {
+        return new OrdinaryGroupingSetImpl( this.getProcessor(), expressions );
+    }
+
+    public FromBuilder fromBuilder()
+    {
+        return new FromBuilderImpl( this.getProcessor() );
+    }
+
+    public OrderByBuilder orderByBuilder()
+    {
+        return new OrderByBuilderImpl( this.getProcessor() );
+    }
+
+    public SortSpecification sortSpec( ValueExpression expression, Ordering 
ordering )
+    {
+        return new SortSpecificationImpl( this.getProcessor(), expression, 
ordering );
+    }
+
+    public SimpleQueryBuilder simpleQueryBuilder()
+    {
+        return new SimpleQueryBuilderImpl( this.getProcessor(), 
this.getVendor() );
+    }
+
+    public TableValueConstructor values( RowValueConstructor... rows )
+    {
+        return new TableValueConstructorImpl( this.getProcessor(), 
Arrays.asList( rows ) );
+    }
+
+    public RowSubQuery rowSubQuery( QueryExpression subQuery )
+    {
+        return new RowSubQueryImpl( this.getProcessor(), subQuery );
+    }
+
+    public RowDefinition row( ValueExpression... elements )
+    {
+        return new RowDefinitionImpl( this.getProcessor(), Arrays.asList( 
elements ) );
+    }
+
+    public QueryExpression callFunction( String schemaName, SQLFunctionLiteral 
function )
+    {
+        return this.simpleQueryBuilder().selectAllColumns()
+                   .from( 
this.getVendor().getTableReferenceFactory().tableName( schemaName, function ) 
).createExpression();
+    }
+
+    public LimitSpecification limit( NonBooleanExpression count )
+    {
+        return new LimitSpecificationImpl( this.getProcessor(), count );
+    }
+
+    public OffsetSpecification offset( NonBooleanExpression offset )
+    {
+        return new OffsetSpecificationImpl( this.getProcessor(), offset );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a36086b6/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultTableRefFactory.java
----------------------------------------------------------------------
diff --git 
a/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultTableRefFactory.java
 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultTableRefFactory.java
new file mode 100644
index 0000000..612c9f4
--- /dev/null
+++ 
b/libraries/sql-generator/src/main/java/org/apache/polygene/library/sql/generator/implementation/grammar/factories/DefaultTableRefFactory.java
@@ -0,0 +1,103 @@
+/*
+ *  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.
+ *
+ *
+ */
+package 
org.apache.polygene.library.sql.generator.implementation.grammar.factories;
+
+import 
org.apache.polygene.library.sql.generator.grammar.booleans.BooleanExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.builders.query.TableReferenceBuilder;
+import org.apache.polygene.library.sql.generator.grammar.common.ColumnNameList;
+import org.apache.polygene.library.sql.generator.grammar.common.TableName;
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameDirect;
+import 
org.apache.polygene.library.sql.generator.grammar.common.TableNameFunction;
+import 
org.apache.polygene.library.sql.generator.grammar.literals.SQLFunctionLiteral;
+import org.apache.polygene.library.sql.generator.grammar.query.QueryExpression;
+import org.apache.polygene.library.sql.generator.grammar.query.TableAlias;
+import 
org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByExpression;
+import 
org.apache.polygene.library.sql.generator.grammar.query.TableReferenceByName;
+import 
org.apache.polygene.library.sql.generator.grammar.query.TableReferencePrimary;
+import 
org.apache.polygene.library.sql.generator.grammar.query.joins.JoinCondition;
+import 
org.apache.polygene.library.sql.generator.grammar.query.joins.NamedColumnsJoin;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.builders.query.TableReferenceBuilderImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.TableNameDirectImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.common.TableNameFunctionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.TableAliasImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.TableReferenceByExpressionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.TableReferenceByNameImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.joins.JoinConditionImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.grammar.query.joins.NamedColumnsJoinImpl;
+import 
org.apache.polygene.library.sql.generator.implementation.transformation.spi.SQLProcessorAggregator;
+import org.apache.polygene.library.sql.generator.vendor.SQLVendor;
+
+/**
+ * @author Stanislav Muhametsin
+ */
+public class DefaultTableRefFactory extends AbstractTableRefFactory
+{
+
+    public DefaultTableRefFactory( SQLVendor vendor, SQLProcessorAggregator 
processor )
+    {
+        super( vendor, processor );
+    }
+
+    public JoinCondition jc( BooleanExpression condition )
+    {
+        return new JoinConditionImpl( this.getProcessor(), condition );
+    }
+
+    public NamedColumnsJoin nc( ColumnNameList columnNames )
+    {
+        return new NamedColumnsJoinImpl( this.getProcessor(), columnNames );
+    }
+
+    public TableReferenceByName table( TableName tableName, TableAlias alias )
+    {
+        return new TableReferenceByNameImpl( this.getProcessor(), tableName, 
alias );
+    }
+
+    public TableNameDirect tableName( String schemaName, String tableName )
+    {
+        return new TableNameDirectImpl( this.getProcessor(), schemaName, 
tableName );
+    }
+
+    public TableNameFunction tableName( String schemaName, SQLFunctionLiteral 
function )
+    {
+        return new TableNameFunctionImpl( this.getProcessor(), schemaName, 
function );
+    }
+
+    public TableAlias tableAliasWithCols( String tableNameAlias, String... 
colNames )
+    {
+        ColumnNameList colNameList = null;
+        if( colNames.length > 0 )
+        {
+            colNameList = this.getVendor().getColumnsFactory().colNames( 
colNames );
+        }
+
+        return new TableAliasImpl( this.getProcessor(), tableNameAlias, 
colNameList );
+    }
+
+    public TableReferenceByExpression table( QueryExpression query, TableAlias 
alias )
+    {
+        return new TableReferenceByExpressionImpl( this.getProcessor(), query, 
alias );
+    }
+
+    public TableReferenceBuilder tableBuilder( TableReferencePrimary 
firstTable )
+    {
+        return new TableReferenceBuilderImpl( this.getProcessor(), firstTable 
);
+    }
+}

Reply via email to