Index: OperationsFactoryBase.java
===================================================================
--- OperationsFactoryBase.java	(revision 44057)
+++ OperationsFactoryBase.java	(revision 44058)
@@ -2,6 +2,7 @@
 
 import java.util.Iterator;
 import java.util.List;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.cresques.cts.IProjection;
 import org.gvsig.fmap.dal.exception.DataException;
@@ -10,6 +11,8 @@
 import org.gvsig.fmap.dal.feature.FeatureType;
 import org.gvsig.fmap.dal.SQLBuilder;
 import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices;
+import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters;
+import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters;
 import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters;
 import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper;
 import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory;
@@ -17,6 +20,62 @@
 
 public class OperationsFactoryBase implements OperationsFactory {
 
+    protected class DefaultTableReference implements TableReference {
+
+        private final String database;
+        private final String schema;
+        private final String table;
+        private final String subquery;
+
+        public DefaultTableReference(String database, String schema, String table, String subquery) {
+            this.database = StringUtils.defaultIfBlank(database, null);
+            this.schema = StringUtils.defaultIfBlank(schema, null);
+            this.table = StringUtils.defaultIfBlank(table, null);
+            this.subquery = StringUtils.defaultIfBlank(subquery, null);
+        }
+        
+        @Override
+        public String getDatabase() {
+            return this.database;
+        }
+
+        @Override
+        public String getSchema() {
+            return this.schema;
+        }
+
+        @Override
+        public String getTable() {
+            return this.table;
+        }
+
+        @Override
+        public String getSubquery() {
+            return this.subquery;
+        }
+
+        @Override
+        public boolean hasDatabase() {
+            return this.database != null;
+        }
+        
+        @Override
+        public boolean hasSchema() {
+            return this.schema != null;
+        }
+        
+        @Override
+        public boolean hasTable() {
+            return this.table != null;
+        }
+        
+        @Override
+        public boolean hasSubquery() {
+            return this.subquery != null;
+        }
+        
+    }
+    
     protected final JDBCHelper helper;
 
     public OperationsFactoryBase(JDBCHelper helper) {
@@ -24,112 +83,110 @@
     }
 
     @Override
+    public TableReference createTableReference(JDBCStoreParameters params) {
+        TableReference t = new DefaultTableReference(
+                params.getDBName(),
+                params.getSchema(),
+                params.getTable(),
+                params.getSQL()
+        );
+        return t;
+    }
+
+    @Override
+    public TableReference createTableReference(JDBCNewStoreParameters params) {
+        TableReference t = new DefaultTableReference(
+                params.getDBName(),
+                params.getSchema(),
+                params.getTable(),
+                null
+        );
+        return t;
+    }
+
+    @Override
+    public TableReference createTableReference(String database, String schema, String table, String subquery) {
+        TableReference t = new DefaultTableReference(database, schema, table, subquery);
+        return t;
+    }
+
+    
+    @Override
     public FetchFeatureTypeOperation createFetchFeatureType(
             EditableFeatureType type, 
-            String database,
-            String schema, 
-            String table, 
+            TableReference table, 
             List<String> primaryKeys, 
             String defaultGeometryField, 
             IProjection crs
         ) {
-        return new FetchFeatureTypeOperation(helper, type, database, schema, table, 
+        return new FetchFeatureTypeOperation(helper, type, table, 
                 primaryKeys, defaultGeometryField, crs);
     }
     
-//    @Override
-//    public FetchFeatureTypeOperation createFetchFeatureType(
-//            EditableFeatureType type, 
-//            String defaultGeometryField, 
-//            IProjection crs
-//        ) {
-//        return new FetchFeatureTypeOperation(helper, type, defaultGeometryField, crs);
-//    }
-
     @Override
     public FetchFeatureProviderByReferenceOperation createFetchFeatureProviderByReference(
             FeatureReferenceProviderServices reference, 
             FeatureType featureType, 
-            String database,
-            String schema, 
-            String table
+            TableReference table
         ) {
         return new FetchFeatureProviderByReferenceOperation(helper, reference, 
-                featureType, database, schema, table);
+                featureType, table);
     }
 
     @Override
     public CalculateEnvelopeOfColumnOperation createCalculateEnvelopeOfColumn(
-            String subquery, 
-            String database,
-            String schema, 
-            String table, 
+            TableReference table, 
             String columnName, 
             String baseFilter, 
             Envelope workingArea, 
             IProjection crs
         ) {
-        return new CalculateEnvelopeOfColumnOperation(helper, subquery, database, schema, 
+        return new CalculateEnvelopeOfColumnOperation(helper, 
                 table, columnName, baseFilter, workingArea, crs);
     }
 
     @Override
     public PerformChangesOperation createPerformChanges(
-            String database,
-            String schema, 
-            String table, 
+            TableReference table, 
             FeatureType type, 
             Iterator deleteds, 
             Iterator inserteds, 
             Iterator updateds, 
             Iterator featureTypesChanged
         ) {
-        return new PerformChangesOperation(helper, database,schema, table, type, 
+        return new PerformChangesOperation(helper, table, type, 
                 deleteds, inserteds, updateds, featureTypesChanged);
     }
 
     @Override
     public AppendOperation createAppend(
-            String database,
-            String schema, 
-            String table, 
+            TableReference table, 
             FeatureType type
         ) {
-        return new AppendOperation(helper, database,schema, table, type);
+        return new AppendOperation(helper, table, type);
     }
 
     @Override
     public CountOperation createCount(
-            String database,
-            String schema, 
-            String table, 
-            String sql, 
+            TableReference table, 
             String baseFilter, 
             String filter
         ) {
-        return new CountOperation(helper, database, schema, table, sql, 
-                baseFilter, filter);
+        return new CountOperation(helper, table, baseFilter, filter);
     }
 
     @Override
     public TableIsEmptyOperation createTableIsEmpty(
-            String database,
-            String schema, 
-            String table,
-            String sql, 
+            TableReference table,
             String baseFilter, 
             String filter
         ) {
-        return new TableIsEmptyOperation(helper, database, schema, table, sql, 
-                baseFilter, filter);
+        return new TableIsEmptyOperation(helper, table, baseFilter, filter);
     }
 
     @Override
     public ResultSetForSetProviderOperation createResultSetForSetProvider(
-            String database,
-            String schema, 
-            String table, 
-            String subquery, 
+            TableReference table, 
             String baseFilter, 
             String baseOrder, 
             FeatureQuery query, 
@@ -139,8 +196,8 @@
             long offset, 
             int fetchSize
         ) {
-        return new ResultSetForSetProviderOperation(helper, database, schema, table, 
-                subquery, baseFilter, baseOrder, query, storeType, setType, 
+        return new ResultSetForSetProviderOperation(helper, table, 
+                baseFilter, baseOrder, query, storeType, setType, 
                 limit, offset, fetchSize);
     }
 
@@ -156,24 +213,20 @@
     
     @Override
     public DropTableOperation createDropTable( 
-            String dbName,
-            String schemaName,
-            String tableName            
+            TableReference tableName            
         ) {
-        return new DropTableOperation(helper, dbName, schemaName, tableName);
+        return new DropTableOperation(helper, tableName);
     }
     
     @Override
     public CreateTableOperation createTable(
-            String dbName,
-            String schemaName, 
-            String tableName, 
+            TableReference table, 
             FeatureType type, 
             List<Pair<String, SQLBuilder.Privilege>> userAndPrivileges, 
             List<String> additionalSQLs
         ) throws DataException {
         return new CreateTableOperation(
-                helper, dbName, schemaName, tableName, type, 
+                helper, table, type, 
                 userAndPrivileges, additionalSQLs
         );
     }
@@ -185,20 +238,16 @@
 
     @Override
     public UpdateTableStatisticsOperation createUpdateTableStatistics(
-            String dbName,
-            String schemaName, 
-            String tableName
+            TableReference table
         ) {
-        return new UpdateTableStatisticsOperation(helper, dbName, schemaName, tableName);
+        return new UpdateTableStatisticsOperation(helper, table);
     }
     
     @Override
     public CanModifyTableOperation createCanModifyTableOperation(
-            String dbName,
-            String schemaName, 
-            String tableName
+            TableReference table
         ) {
-        return new CanModifyTableOperation(helper, dbName, schemaName, tableName);
+        return new CanModifyTableOperation(helper, table);
     }
     
     @Override
