cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkazimirc...@apache.org
Subject [5/8] cayenne git commit: CAY-2051 | Applying new Reverse Engineering to the Modeler
Date Fri, 26 Feb 2016 08:40:54 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-skipRelationshipsLoading.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-skipRelationshipsLoading.xml b/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-skipRelationshipsLoading.xml
new file mode 100644
index 0000000..9eac789
--- /dev/null
+++ b/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-skipRelationshipsLoading.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+
+<reverseEngineering>
+    <skipRelationshipsLoading>true</skipRelationshipsLoading>
+</reverseEngineering>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-tableTypes.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-tableTypes.xml b/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-tableTypes.xml
new file mode 100644
index 0000000..f9ea8ca
--- /dev/null
+++ b/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering-tableTypes.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+
+<reverseEngineering>
+    <tableType>type1</tableType>
+
+    <tableType name="type2" />
+
+    <tableType>
+        <name>type3</name>
+    </tableType>
+</reverseEngineering>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering.xml
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering.xml b/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering.xml
new file mode 100644
index 0000000..d653564
--- /dev/null
+++ b/cayenne-server/src/test/resources/org/apache/cayenne/dbimport/reverseEngineering.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<reverseEngineering>
+</reverseEngineering>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
index ebbb7e8..36fe7f1 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
@@ -26,6 +26,17 @@ import org.apache.cayenne.configuration.server.DataSourceFactory;
 import org.apache.cayenne.configuration.server.DbAdapterFactory;
 import org.apache.cayenne.conn.DataSourceInfo;
 import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dbimport.AntNestedElement;
+import org.apache.cayenne.dbimport.Catalog;
+import org.apache.cayenne.dbimport.ExcludeColumn;
+import org.apache.cayenne.dbimport.ExcludeProcedure;
+import org.apache.cayenne.dbimport.ExcludeTable;
+import org.apache.cayenne.dbimport.FiltersConfigBuilder;
+import org.apache.cayenne.dbimport.IncludeColumn;
+import org.apache.cayenne.dbimport.IncludeProcedure;
+import org.apache.cayenne.dbimport.IncludeTable;
+import org.apache.cayenne.dbimport.ReverseEngineering;
+import org.apache.cayenne.dbimport.Schema;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.map.naming.DefaultNameGenerator;
@@ -33,16 +44,6 @@ import org.apache.cayenne.tools.configuration.ToolsModule;
 import org.apache.cayenne.tools.dbimport.DbImportAction;
 import org.apache.cayenne.tools.dbimport.DbImportConfiguration;
 import org.apache.cayenne.tools.dbimport.DbImportModule;
-import org.apache.cayenne.tools.dbimport.config.AntNestedElement;
-import org.apache.cayenne.tools.dbimport.config.Catalog;
-import org.apache.cayenne.tools.dbimport.config.ExcludeColumn;
-import org.apache.cayenne.tools.dbimport.config.ExcludeProcedure;
-import org.apache.cayenne.tools.dbimport.config.FiltersConfigBuilder;
-import org.apache.cayenne.tools.dbimport.config.IncludeColumn;
-import org.apache.cayenne.tools.dbimport.config.IncludeProcedure;
-import org.apache.cayenne.tools.dbimport.config.IncludeTable;
-import org.apache.cayenne.tools.dbimport.config.ReverseEngineering;
-import org.apache.cayenne.tools.dbimport.config.Schema;
 import org.apache.cayenne.util.Util;
 import org.apache.commons.logging.Log;
 import org.apache.tools.ant.BuildException;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/ExcludeTable.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/ExcludeTable.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/ExcludeTable.java
deleted file mode 100644
index 779a9fa..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/ExcludeTable.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools;
-
-import org.apache.cayenne.tools.dbimport.config.PatternParam;
-
-/**
- * @since 4.0.
- */
-public class ExcludeTable extends PatternParam {
-    public ExcludeTable() {
-    }
-
-    public ExcludeTable(String pattern) {
-        super(pattern);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
index 2683d97..f70e83c 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
@@ -18,257 +18,11 @@
  */
 package org.apache.cayenne.tools.dbimport;
 
-import static org.apache.commons.lang.StringUtils.isBlank;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.sql.Connection;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.sql.DataSource;
-
-import org.apache.cayenne.access.DbLoader;
-import org.apache.cayenne.configuration.ConfigurationTree;
-import org.apache.cayenne.configuration.DataNodeDescriptor;
-import org.apache.cayenne.configuration.server.DataSourceFactory;
-import org.apache.cayenne.configuration.server.DbAdapterFactory;
-import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.map.DataMap;
-import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.map.MapLoader;
-import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.map.ObjRelationship;
-import org.apache.cayenne.merge.AbstractToModelToken;
-import org.apache.cayenne.merge.AddRelationshipToDb;
-import org.apache.cayenne.merge.DbMerger;
-import org.apache.cayenne.merge.ExecutingMergerContext;
-import org.apache.cayenne.merge.MergerContext;
-import org.apache.cayenne.merge.MergerFactory;
-import org.apache.cayenne.merge.MergerToken;
-import org.apache.cayenne.merge.ModelMergeDelegate;
-import org.apache.cayenne.merge.ProxyModelMergeDelegate;
-import org.apache.cayenne.project.Project;
-import org.apache.cayenne.project.ProjectSaver;
-import org.apache.cayenne.resource.URLResource;
-import org.apache.cayenne.validation.SimpleValidationFailure;
-import org.apache.cayenne.validation.ValidationFailure;
-import org.apache.cayenne.validation.ValidationResult;
-import org.apache.commons.logging.Log;
-import org.xml.sax.InputSource;
-
 /**
- * A thin wrapper around {@link DbLoader} that encapsulates DB import logic for
- * the benefit of Ant and Maven db importers.
- * 
  * @since 4.0
  */
-public class DbImportAction {
-
-	private final ProjectSaver projectSaver;
-	private final Log logger;
-	private final DataSourceFactory dataSourceFactory;
-	private final DbAdapterFactory adapterFactory;
-	private final MapLoader mapLoader;
-
-	public DbImportAction(@Inject Log logger, @Inject ProjectSaver projectSaver,
-			@Inject DataSourceFactory dataSourceFactory, @Inject DbAdapterFactory adapterFactory,
-			@Inject MapLoader mapLoader) {
-		this.logger = logger;
-		this.projectSaver = projectSaver;
-		this.dataSourceFactory = dataSourceFactory;
-		this.adapterFactory = adapterFactory;
-		this.mapLoader = mapLoader;
-	}
-
-	public void execute(DbImportConfiguration config) throws Exception {
-
-		if (logger.isDebugEnabled()) {
-			logger.debug("DB connection: " + config.getDataSourceInfo());
-		}
-
-		if (logger.isDebugEnabled()) {
-			logger.debug(config);
-		}
-
-		DataNodeDescriptor dataNodeDescriptor = config.createDataNodeDescriptor();
-		DataSource dataSource = dataSourceFactory.getDataSource(dataNodeDescriptor);
-		DbAdapter adapter = adapterFactory.createAdapter(dataNodeDescriptor, dataSource);
-
-		DataMap loadedFomDb;
-		try (Connection c = dataSource.getConnection()) {
-			loadedFomDb = load(config, adapter, c);
-		}
-
-		if (loadedFomDb == null) {
-			logger.info("Nothing was loaded from db.");
-			return;
-		}
-
-		DataMap existing = loadExistingDataMap(config.getDataMapFile());
-		if (existing == null) {
-			logger.info("");
-			File file = config.getDataMapFile();
-			logger.info("Map file does not exist. Loaded db model will be saved into '"
-					+ (file == null ? "null" : file.getAbsolutePath() + "'"));
-
-			saveLoaded(config.initializeDataMap(loadedFomDb));
-		} else {
-			MergerFactory mergerFactory = adapter.mergerFactory();
-
-			List<MergerToken> mergeTokens = new DbMerger(mergerFactory).createMergeTokens(existing, loadedFomDb,
-					config.getDbLoaderConfig());
-			if (mergeTokens.isEmpty()) {
-				logger.info("");
-				logger.info("Detected changes: No changes to import.");
-				return;
-			}
-
-			if (!isBlank(config.getDefaultPackage())) {
-				existing.setDefaultPackage(config.getDefaultPackage());
-			}
-
-			final Collection<ObjEntity> loadedObjEntities = new LinkedList<ObjEntity>();
-			DataMap executed = execute(new ProxyModelMergeDelegate(config.createMergeDelegate()) {
-				@Override
-				public void objEntityAdded(ObjEntity ent) {
-					loadedObjEntities.add(ent);
-
-					super.objEntityAdded(ent);
-				}
-
-			}, existing, log(sort(reverse(mergerFactory, mergeTokens))));
-
-			DbLoader.flattenManyToManyRelationships(executed, loadedObjEntities, config.getNameGenerator());
-
-			relationshipsSanity(executed);
-
-			saveLoaded(executed);
-		}
-	}
-
-	private void relationshipsSanity(DataMap executed) {
-		for (ObjEntity objEntity : executed.getObjEntities()) {
-
-			List<ObjRelationship> rels = new LinkedList<ObjRelationship>(objEntity.getRelationships());
-			for (ObjRelationship rel : rels) {
-				if (rel.getSourceEntity() == null || rel.getTargetEntity() == null) {
-					logger.error("Incorrect obj relationship source or target entity is null: " + rel);
-
-					objEntity.removeRelationship(rel.getName());
-				}
-			}
-		}
-	}
-
-	protected static List<MergerToken> sort(List<MergerToken> reverse) {
-		Collections.sort(reverse, new Comparator<MergerToken>() {
-			@Override
-			public int compare(MergerToken o1, MergerToken o2) {
-				if (o1 instanceof AddRelationshipToDb && o2 instanceof AddRelationshipToDb) {
-					return 0;
-				}
-
-				if (!(o1 instanceof AddRelationshipToDb || o2 instanceof AddRelationshipToDb)) {
-					return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
-				}
-
-				return o1 instanceof AddRelationshipToDb ? 1 : -1;
-			}
-		});
-
-		return reverse;
-	}
-
-	private Collection<MergerToken> log(List<MergerToken> tokens) {
-		logger.info("");
-		if (tokens.isEmpty()) {
-			logger.info("Detected changes: No changes to import.");
-			return tokens;
-		}
-
-		logger.info("Detected changes: ");
-		for (MergerToken token : tokens) {
-			logger.info(String.format("    %-20s %s", token.getTokenName(), token.getTokenValue()));
-		}
-		logger.info("");
-
-		return tokens;
-	}
-
-	private DataMap loadExistingDataMap(File dataMapFile) throws IOException {
-		if (dataMapFile != null && dataMapFile.exists() && dataMapFile.canRead()) {
-			DataMap dataMap = mapLoader.loadDataMap(new InputSource(dataMapFile.getCanonicalPath()));
-			dataMap.setNamespace(new EntityResolver(Collections.singleton(dataMap)));
-			dataMap.setConfigurationSource(new URLResource(dataMapFile.toURI().toURL()));
-
-			return dataMap;
-		}
-
-		return null;
-	}
-
-	private List<MergerToken> reverse(MergerFactory mergerFactory, Iterable<MergerToken> mergeTokens)
-			throws IOException {
-		List<MergerToken> tokens = new LinkedList<MergerToken>();
-		for (MergerToken token : mergeTokens) {
-			if (token instanceof AbstractToModelToken) {
-				continue;
-			}
-			tokens.add(token.createReverse(mergerFactory));
-		}
-		return tokens;
-	}
-
-	/**
-	 * Performs configured schema operations via DbGenerator.
-	 */
-	private DataMap execute(ModelMergeDelegate mergeDelegate, DataMap dataMap, Collection<MergerToken> tokens) {
-		MergerContext mergerContext = new ExecutingMergerContext(dataMap, null, null, mergeDelegate);
-
-		for (MergerToken tok : tokens) {
-			try {
-				tok.execute(mergerContext);
-			} catch (Throwable th) {
-				String message = "Migration Error. Can't apply changes from token: " + tok.getTokenName() + " ("
-						+ tok.getTokenValue() + ")";
-
-				logger.error(message, th);
-				mergerContext.getValidationResult().addFailure(new SimpleValidationFailure(th, message));
-			}
-		}
-
-		ValidationResult failures = mergerContext.getValidationResult();
-		if (failures == null || !failures.hasFailures()) {
-			logger.info("Migration Complete Successfully.");
-		} else {
-			logger.info("Migration Complete.");
-			logger.warn("Migration finished. The following problem(s) were ignored.");
-			for (ValidationFailure failure : failures.getFailures()) {
-				logger.warn(failure.toString());
-			}
-		}
-
-		return dataMap;
-	}
-
-	void saveLoaded(DataMap dataMap) throws FileNotFoundException {
-		ConfigurationTree<DataMap> projectRoot = new ConfigurationTree<DataMap>(dataMap);
-		Project project = new Project(projectRoot);
-		projectSaver.save(project);
-	}
-
-	private DataMap load(DbImportConfiguration config, DbAdapter adapter, Connection connection) throws Exception {
-		DataMap dataMap = config.createDataMap();
-
-		DbLoader loader = config.createLoader(adapter, connection, config.createLoaderDelegate());
-		loader.load(dataMap, config.getDbLoaderConfig());
-
-		return dataMap;
-	}
+public interface DbImportAction {
+	
+    void execute(DbImportConfiguration config) throws Exception;
+	
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportActionDefault.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportActionDefault.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportActionDefault.java
new file mode 100644
index 0000000..aa58e56
--- /dev/null
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportActionDefault.java
@@ -0,0 +1,281 @@
+/*
+ * 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.cayenne.tools.dbimport;
+
+import org.apache.cayenne.access.DbLoader;
+import org.apache.cayenne.configuration.ConfigurationTree;
+import org.apache.cayenne.configuration.DataNodeDescriptor;
+import org.apache.cayenne.configuration.server.DataSourceFactory;
+import org.apache.cayenne.configuration.server.DbAdapterFactory;
+import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.di.Inject;
+import org.apache.cayenne.map.DataMap;
+import org.apache.cayenne.map.EntityResolver;
+import org.apache.cayenne.map.MapLoader;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.map.ObjRelationship;
+import org.apache.cayenne.merge.AbstractToModelToken;
+import org.apache.cayenne.merge.AddRelationshipToDb;
+import org.apache.cayenne.merge.DbMerger;
+import org.apache.cayenne.merge.ExecutingMergerContext;
+import org.apache.cayenne.merge.MergerContext;
+import org.apache.cayenne.merge.MergerFactory;
+import org.apache.cayenne.merge.MergerToken;
+import org.apache.cayenne.merge.ModelMergeDelegate;
+import org.apache.cayenne.merge.ProxyModelMergeDelegate;
+import org.apache.cayenne.project.Project;
+import org.apache.cayenne.project.ProjectSaver;
+import org.apache.cayenne.resource.URLResource;
+import org.apache.cayenne.validation.SimpleValidationFailure;
+import org.apache.cayenne.validation.ValidationFailure;
+import org.apache.cayenne.validation.ValidationResult;
+import org.apache.commons.logging.Log;
+import org.xml.sax.InputSource;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.sql.Connection;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+
+import static org.apache.commons.lang.StringUtils.isBlank;
+
+/**
+ * A thin wrapper around {@link DbLoader} that encapsulates DB import logic for
+ * the benefit of Ant and Maven db importers.
+ *
+ * @since 4.0
+ */
+public class DbImportActionDefault implements DbImportAction {
+
+    private final ProjectSaver projectSaver;
+    private final Log logger;
+    private final DataSourceFactory dataSourceFactory;
+    private final DbAdapterFactory adapterFactory;
+    private final MapLoader mapLoader;
+
+    public DbImportActionDefault(@Inject Log logger,
+                                 @Inject ProjectSaver projectSaver,
+                                 @Inject DataSourceFactory dataSourceFactory,
+                                 @Inject DbAdapterFactory adapterFactory,
+                                 @Inject MapLoader mapLoader) {
+        this.logger = logger;
+        this.projectSaver = projectSaver;
+        this.dataSourceFactory = dataSourceFactory;
+        this.adapterFactory = adapterFactory;
+        this.mapLoader = mapLoader;
+    }
+
+    public void execute(DbImportConfiguration config) throws Exception {
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("DB connection: " + config.getDataSourceInfo());
+        }
+
+        if (logger.isDebugEnabled()) {
+            logger.debug(config);
+        }
+
+        DataNodeDescriptor dataNodeDescriptor = config.createDataNodeDescriptor();
+        DataSource dataSource = dataSourceFactory.getDataSource(dataNodeDescriptor);
+        DbAdapter adapter = adapterFactory.createAdapter(dataNodeDescriptor, dataSource);
+
+        DataMap loadedFomDb = load(config, adapter, dataSource.getConnection());
+        if (loadedFomDb == null) {
+            logger.info("Nothing was loaded from db.");
+            return;
+        }
+
+        DataMap existing = loadExistingDataMap(config.getDataMapFile());
+        if (existing == null) {
+            logger.info("");
+            File file = config.getDataMapFile();
+            logger.info("Map file does not exist. Loaded db model will be saved into '"
+                    + (file == null ? "null" : file.getAbsolutePath() + "'"));
+
+            saveLoaded(config.initializeDataMap(loadedFomDb));
+        } else {
+            MergerFactory mergerFactory = adapter.mergerFactory();
+
+            List<MergerToken> mergeTokens = new DbMerger(mergerFactory)
+                    .createMergeTokens(existing, loadedFomDb, config.getDbLoaderConfig());
+            if (mergeTokens.isEmpty()) {
+                logger.info("");
+                logger.info("Detected changes: No changes to import.");
+                return;
+            }
+
+            if (!isBlank(config.getDefaultPackage())) {
+                existing.setDefaultPackage(config.getDefaultPackage());
+            }
+
+            final Collection<ObjEntity> loadedObjEntities = new LinkedList<>();
+            DataMap executed = execute(new ProxyModelMergeDelegate(config.createMergeDelegate()) {
+                @Override
+                public void objEntityAdded(ObjEntity ent) {
+                    loadedObjEntities.add(ent);
+
+                    super.objEntityAdded(ent);
+                }
+
+            }, existing, log(sort(reverse(mergerFactory, mergeTokens))));
+
+            DbLoader.flattenManyToManyRelationships(executed, loadedObjEntities, config.getNameGenerator());
+
+            relationshipsSanity(executed);
+
+
+            saveLoaded(executed);
+        }
+    }
+
+    private void relationshipsSanity(DataMap executed) {
+        for (ObjEntity objEntity : executed.getObjEntities()) {
+            List<ObjRelationship> rels = new LinkedList<>(objEntity.getRelationships());
+            for (ObjRelationship rel : rels) {
+                if (rel.getSourceEntity() == null || rel.getTargetEntity() == null) {
+                    logger.error("Incorrect obj relationship source or target entity is null: " + rel);
+
+                    objEntity.removeRelationship(rel.getName());
+                }
+            }
+        }
+    }
+
+    protected static List<MergerToken> sort(List<MergerToken> reverse) {
+        Collections.sort(reverse, new Comparator<MergerToken>() {
+            @Override
+            public int compare(MergerToken o1, MergerToken o2) {
+                if (o1 instanceof AddRelationshipToDb && o2 instanceof AddRelationshipToDb) {
+                    return 0;
+                }
+
+                if (!(o1 instanceof AddRelationshipToDb || o2 instanceof AddRelationshipToDb)) {
+                    return o1.getClass().getSimpleName().compareTo(o2.getClass().getSimpleName());
+                }
+
+                return o1 instanceof AddRelationshipToDb ? 1 : -1;
+            }
+        });
+
+        return reverse;
+    }
+
+    private Collection<MergerToken> log(List<MergerToken> tokens) {
+        logger.info("");
+        if (tokens.isEmpty()) {
+            logger.info("Detected changes: No changes to import.");
+            return tokens;
+        }
+
+        logger.info("Detected changes: ");
+        for (MergerToken token : tokens) {
+            logger.info(String.format("    %-20s %s", token.getTokenName(), token.getTokenValue()));
+        }
+        logger.info("");
+
+        return tokens;
+    }
+
+    protected DataMap loadExistingDataMap(File dataMapFile) throws IOException {
+        if (dataMapFile != null && dataMapFile.exists() && dataMapFile.canRead()) {
+            DataMap dataMap = mapLoader.loadDataMap(new InputSource(dataMapFile.getCanonicalPath()));
+            dataMap.setNamespace(new EntityResolver(Collections.singleton(dataMap)));
+            dataMap.setConfigurationSource(new URLResource(dataMapFile.toURI().toURL()));
+
+            return dataMap;
+        }
+
+        return null;
+    }
+
+    private List<MergerToken> reverse(MergerFactory mergerFactory, Iterable<MergerToken> mergeTokens) throws IOException {
+        List<MergerToken> tokens = new LinkedList<>();
+        for (MergerToken token : mergeTokens) {
+            if (token instanceof AbstractToModelToken) {
+                continue;
+            }
+            tokens.add(token.createReverse(mergerFactory));
+        }
+        return tokens;
+    }
+
+    /**
+     * Performs configured schema operations via DbGenerator.
+     */
+    private DataMap execute(ModelMergeDelegate mergeDelegate, DataMap dataMap, Collection<MergerToken> tokens) {
+        MergerContext mergerContext = new ExecutingMergerContext(
+                dataMap, null, null, mergeDelegate);
+
+        for (MergerToken tok : tokens) {
+            try {
+                tok.execute(mergerContext);
+            } catch (Throwable th) {
+                String message = "Migration Error. Can't apply changes from token: " + tok.getTokenName()
+                        + " (" + tok.getTokenValue() + ")";
+
+                logger.error(message, th);
+                mergerContext.getValidationResult().addFailure(new SimpleValidationFailure(th, message));
+            }
+        }
+
+        ValidationResult failures = mergerContext.getValidationResult();
+        if (failures == null || !failures.hasFailures()) {
+            logger.info("Migration Complete Successfully.");
+        } else {
+            logger.info("Migration Complete.");
+            logger.warn("Migration finished. The following problem(s) were ignored.");
+            for (ValidationFailure failure : failures.getFailures()) {
+                logger.warn(failure.toString());
+            }
+        }
+
+        return dataMap;
+    }
+
+    private DbLoader getLoader(DbImportConfiguration config, DbAdapter adapter, Connection connection) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        return config.createLoader(adapter, connection, config.createLoaderDelegate());
+    }
+
+    protected void saveLoaded(DataMap dataMap) throws FileNotFoundException {
+        ConfigurationTree<DataMap> projectRoot = new ConfigurationTree<>(dataMap);
+        Project project = new Project(projectRoot);
+        projectSaver.save(project);
+    }
+
+    protected DataMap load(DbImportConfiguration config, DbAdapter adapter, Connection connection) throws Exception {
+        DataMap dataMap = config.createDataMap();
+
+        try {
+            DbLoader loader = config.createLoader(adapter, connection, config.createLoaderDelegate());
+            loader.load(dataMap, config.getDbLoaderConfig());
+        } finally {
+            if (connection != null) {
+                connection.close();
+            }
+        }
+
+        return dataMap;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportModule.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportModule.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportModule.java
index f99a1b2..1b4505a 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportModule.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportModule.java
@@ -19,9 +19,7 @@
 package org.apache.cayenne.tools.dbimport;
 
 import org.apache.cayenne.configuration.ConfigurationNameMapper;
-import org.apache.cayenne.configuration.DataMapLoader;
 import org.apache.cayenne.configuration.DefaultConfigurationNameMapper;
-import org.apache.cayenne.configuration.XMLDataMapLoader;
 import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.map.MapLoader;
@@ -38,7 +36,7 @@ import org.apache.cayenne.tools.configuration.ToolsModule;
 public class DbImportModule implements Module {
 
     public void configure(Binder binder) {
-        binder.bind(DbImportAction.class).to(DbImportAction.class);
+        binder.bind(DbImportAction.class).to(DbImportActionDefault.class);
         binder.bind(ProjectSaver.class).to(FileProjectSaver.class);
         binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
         binder.bind(MapLoader.class).to(MapLoader.class);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/AntNestedElement.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/AntNestedElement.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/AntNestedElement.java
deleted file mode 100644
index c8a801b..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/AntNestedElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-/**
- * Additional class to handle <name> element under <catalog> and <schema>
- *      required for ant configuration
- *
- * @since 4.0.
- */
-public class AntNestedElement {
-
-    private String name;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void addText(String str) {
-        name = str;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
deleted file mode 100644
index 904d41b..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/Catalog.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * @since 4.0.
- */
-public class Catalog extends FilterContainer {
-
-    private String name;
-
-    private Collection<Schema> schemas = new LinkedList<Schema>();
-
-    public Catalog() {
-    }
-
-    public Catalog(String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public Collection<Schema> getSchemas() {
-        return schemas;
-    }
-
-    public void setSchemas(Collection<Schema> schemas) {
-        this.schemas = schemas;
-    }
-
-    public void addSchema(Schema schema) {
-        this.schemas.add(schema);
-    }
-
-    public void set(String name) {
-        setName(name);
-    }
-
-    public void addConfiguredName(AntNestedElement name) {
-        setName(name.getName());
-    }
-
-    public void addText(String name) {
-        if (name.trim().isEmpty()) {
-            return;
-        }
-
-        setName(name);
-    }
-
-    public Catalog schema(Schema name) {
-        addSchema(name);
-        return this;
-    }
-
-    @Override
-    public boolean isEmptyContainer() {
-        if (!super.isEmptyContainer()) {
-            return false;
-        }
-
-        if (schemas.isEmpty()) {
-            return true;
-        }
-
-        for (Schema schema : schemas) {
-            if (!schema.isEmptyContainer()) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    public StringBuilder toString(StringBuilder res, String prefix) {
-        res.append(prefix).append("Catalog: ").append(name).append("\n");
-
-        if (!isBlank(schemas)) {
-            for (Schema schema : schemas) {
-                schema.toString(res, prefix + "  ");
-            }
-        }
-
-        return super.toString(res, prefix + "  ");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
deleted file mode 100644
index 807b7ff..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/DefaultReverseEngineeringLoader.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.cayenne.tools.ExcludeTable;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.resource.Resource;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * @since 4.0.
- */
-public class DefaultReverseEngineeringLoader implements ReverseEngineeringLoader {
-
-    private static final Log LOG = LogFactory.getLog(ReverseEngineeringLoader.class);
-
-    @Override
-    public ReverseEngineering load(Resource configurationResource) throws CayenneRuntimeException {
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-
-        try {
-            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-            Document doc = dBuilder.parse(configurationResource.getURL().openStream());
-
-            ReverseEngineering engineering = new ReverseEngineering();
-
-            Element root = doc.getDocumentElement();
-            engineering.setSkipRelationshipsLoading(loadBoolean(root, "skipRelationshipsLoading"));
-            engineering.setSkipPrimaryKeyLoading(loadBoolean(root, "skipPrimaryKeyLoading"));
-            engineering.setTableTypes(loadTableTypes(root));
-
-            engineering.setCatalogs(loadCatalogs(root));
-            engineering.setSchemas(loadSchemas(root));
-            engineering.setIncludeTables(loadIncludeTables(root));
-            engineering.setExcludeTables(loadExcludeTables(root));
-            engineering.setIncludeColumns(loadIncludeColumns(root));
-            engineering.setExcludeColumns(loadExcludeColumns(root));
-            engineering.setIncludeProcedures(loadIncludeProcedures(root));
-            engineering.setExcludeProcedures(loadExcludeProcedures(root));
-
-            return engineering;
-        } catch (ParserConfigurationException e) {
-            LOG.info(e.getMessage(), e);
-        } catch (SAXException e) {
-            LOG.info(e.getMessage(), e);
-        } catch (IOException e) {
-            LOG.info(e.getMessage(), e);
-        }
-
-
-        return null;
-    }
-
-    private Boolean loadBoolean(Element root, String name) {
-        return Boolean.valueOf(loadByName(root, name));
-    }
-
-    private Collection<ExcludeProcedure> loadExcludeProcedures(Node parent) {
-        return loadPatternParams(ExcludeProcedure.class, getElementsByTagName(parent, "excludeProcedure"));
-    }
-
-    private Collection<IncludeProcedure> loadIncludeProcedures(Node parent) {
-        return loadPatternParams(IncludeProcedure.class, getElementsByTagName(parent, "includeProcedure"));
-    }
-
-    private Collection<ExcludeColumn> loadExcludeColumns(Node parent) {
-        return loadPatternParams(ExcludeColumn.class, getElementsByTagName(parent, "excludeColumn"));
-    }
-
-    private Collection<IncludeColumn> loadIncludeColumns(Node parent) {
-        return loadPatternParams(IncludeColumn.class, getElementsByTagName(parent, "includeColumn"));
-    }
-
-    private Collection<ExcludeTable> loadExcludeTables(Node parent) {
-        return loadPatternParams(ExcludeTable.class, getElementsByTagName(parent, "excludeTable"));
-    }
-
-    private Collection<IncludeTable> loadIncludeTables(Node parent) {
-        List<Node> includeTables = getElementsByTagName(parent, "includeTable");
-        Collection<IncludeTable> res = new LinkedList<IncludeTable>();
-        for (Node node : includeTables) {
-            IncludeTable includeTable = new IncludeTable();
-
-            includeTable.setPattern(loadPattern(node));
-            includeTable.setIncludeColumns(loadIncludeColumns(node));
-            includeTable.setExcludeColumns(loadExcludeColumns(node));
-            res.add(includeTable);
-        }
-        return res;
-    }
-
-    private Collection<Schema> loadSchemas(Node parent) {
-        List<Node> schemas = getElementsByTagName(parent, "schema");
-        Collection<Schema> res = new LinkedList<Schema>();
-        for (Node schemaNode : schemas) {
-            Schema schema = new Schema();
-
-            schema.setName(loadName(schemaNode));
-            schema.setIncludeTables(loadIncludeTables(schemaNode));
-            schema.setExcludeTables(loadExcludeTables(schemaNode));
-            schema.setIncludeColumns(loadIncludeColumns(schemaNode));
-            schema.setExcludeColumns(loadExcludeColumns(schemaNode));
-            schema.setIncludeProcedures(loadIncludeProcedures(schemaNode));
-            schema.setExcludeProcedures(loadExcludeProcedures(schemaNode));
-            res.add(schema);
-        }
-
-        return res;
-    }
-
-    private Collection<Catalog> loadCatalogs(Node parent) {
-        List<Node> catalogs = getElementsByTagName(parent, "catalog");
-        Collection<Catalog> res = new LinkedList<Catalog>();
-        for (Node catalogNode : catalogs) {
-            Catalog catalog = new Catalog();
-
-            catalog.setName(loadName(catalogNode));
-            catalog.setSchemas(loadSchemas(catalogNode));
-            catalog.setIncludeTables(loadIncludeTables(catalogNode));
-            catalog.setExcludeTables(loadExcludeTables(catalogNode));
-            catalog.setIncludeColumns(loadIncludeColumns(catalogNode));
-            catalog.setExcludeColumns(loadExcludeColumns(catalogNode));
-            catalog.setIncludeProcedures(loadIncludeProcedures(catalogNode));
-            catalog.setExcludeProcedures(loadExcludeProcedures(catalogNode));
-
-            res.add(catalog);
-        }
-
-        return res;
-    }
-
-    private Collection<String> loadTableTypes(Node parent) {
-        List<Node> types = getElementsByTagName(parent, "tableType");
-        Collection<String> res = new LinkedList<String>();
-        for (Node typeNode : types) {
-            res.add(loadName(typeNode));
-        }
-
-        return res;
-    }
-
-    private String loadName(Node catalogNode) {
-        return loadByName(catalogNode, "name");
-    }
-
-    private String loadPattern(Node catalogNode) {
-        return loadByName(catalogNode, "pattern");
-    }
-
-    private String loadByName(Node node, String attrName) {
-        Node name = node.getAttributes().getNamedItem(attrName);
-        if (name != null) {
-            return name.getTextContent();
-        }
-
-        String content = node.getTextContent().trim();
-        if (!content.isEmpty()) {
-            return content;
-        }
-
-        List<Node> names = getElementsByTagName(node, attrName);
-        if (names.isEmpty()) {
-            return null;
-        }
-
-        return names.get(0).getTextContent();
-    }
-
-    private <T extends PatternParam> Collection<T> loadPatternParams(Class<T> clazz, List<Node> nodes) {
-        Collection<T> res = new LinkedList<T>();
-        for (Node node : nodes) {
-            try {
-                T obj = clazz.newInstance();
-                obj.setPattern(loadPattern(node));
-
-                res.add(obj);
-            } catch (InstantiationException e) {
-                LOG.info(e.getMessage(), e);
-            } catch (IllegalAccessException e) {
-                LOG.info(e.getMessage(), e);
-            }
-        }
-        return res;
-    }
-
-    private List<Node> getElementsByTagName(Node catalogNode, String name) {
-        List<Node> nodes = new LinkedList<Node>();
-        NodeList childNodes = catalogNode.getChildNodes();
-        for (int i = 0; i < childNodes.getLength(); i++) {
-            Node item = childNodes.item(i);
-            if (name.equals(item.getNodeName())) {
-                nodes.add(item);
-            }
-        }
-
-        return nodes;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeColumn.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeColumn.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeColumn.java
deleted file mode 100644
index 94ed854..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeColumn.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-/**
- * @since 4.0.
- */
-public class ExcludeColumn extends PatternParam {
-    public ExcludeColumn() {
-    }
-
-    public ExcludeColumn(String pattern) {
-        super(pattern);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeProcedure.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeProcedure.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeProcedure.java
deleted file mode 100644
index f0b060e..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ExcludeProcedure.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-/**
- * @since 4.0.
- */
-public class ExcludeProcedure extends PatternParam {
-    public ExcludeProcedure() {
-    }
-
-    public ExcludeProcedure(String pattern) {
-        super(pattern);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
deleted file mode 100644
index 57da6ab..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FilterContainer.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-import org.apache.cayenne.tools.ExcludeTable;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * @since 4.0.
- */
-public abstract class FilterContainer {
-
-    private Collection<IncludeTable> includeTables = new LinkedList<IncludeTable>();
-    private Collection<ExcludeTable> excludeTables = new LinkedList<ExcludeTable>();
-    private Collection<IncludeColumn> includeColumns = new LinkedList<IncludeColumn>();
-    private Collection<ExcludeColumn> excludeColumns = new LinkedList<ExcludeColumn>();
-    private Collection<IncludeProcedure> includeProcedures = new LinkedList<IncludeProcedure>();
-    private Collection<ExcludeProcedure> excludeProcedures = new LinkedList<ExcludeProcedure>();
-
-    public Collection<IncludeTable> getIncludeTables() {
-        return includeTables;
-    }
-
-    public void setIncludeTables(Collection<IncludeTable> includeTables) {
-        this.includeTables = includeTables;
-    }
-
-    public Collection<ExcludeTable> getExcludeTables() {
-        return excludeTables;
-    }
-
-    public void setExcludeTables(Collection<ExcludeTable> excludeTables) {
-        this.excludeTables = excludeTables;
-    }
-
-    public Collection<IncludeColumn> getIncludeColumns() {
-        return includeColumns;
-    }
-
-    public void setIncludeColumns(Collection<IncludeColumn> includeColumns) {
-        this.includeColumns = includeColumns;
-    }
-
-    public Collection<ExcludeColumn> getExcludeColumns() {
-        return excludeColumns;
-    }
-
-    public void setExcludeColumns(Collection<ExcludeColumn> excludeColumns) {
-        this.excludeColumns = excludeColumns;
-    }
-
-    public Collection<IncludeProcedure> getIncludeProcedures() {
-        return includeProcedures;
-    }
-
-    public void setIncludeProcedures(Collection<IncludeProcedure> includeProcedures) {
-        this.includeProcedures = includeProcedures;
-    }
-
-    public Collection<ExcludeProcedure> getExcludeProcedures() {
-        return excludeProcedures;
-    }
-
-    public void setExcludeProcedures(Collection<ExcludeProcedure> excludeProcedures) {
-        this.excludeProcedures = excludeProcedures;
-    }
-
-
-    public void addIncludeColumn(IncludeColumn includeColumn) {
-        this.includeColumns.add(includeColumn);
-    }
-
-    public void addExcludeColumn(ExcludeColumn excludeColumn) {
-        this.excludeColumns.add(excludeColumn);
-    }
-
-    public void addIncludeTable(IncludeTable includeTable) {
-        this.includeTables.add(includeTable);
-    }
-
-    public void addExcludeTable(ExcludeTable excludeTable) {
-        this.excludeTables.add(excludeTable);
-    }
-
-    public void addIncludeProcedure(IncludeProcedure includeProcedure) {
-        this.includeProcedures.add(includeProcedure);
-    }
-
-    public void addExcludeProcedure(ExcludeProcedure excludeProcedure) {
-        this.excludeProcedures.add(excludeProcedure);
-    }
-
-    public boolean isEmptyContainer() {
-        return includeColumns.isEmpty()    && excludeColumns.isEmpty()
-            && includeTables.isEmpty()     && excludeTables.isEmpty()
-            && includeProcedures.isEmpty() && excludeProcedures.isEmpty();
-    }
-
-    public static boolean isBlank(Collection<?> collection) {
-        return collection == null || collection.isEmpty();
-    }
-
-    @Override
-    public String toString() {
-        return toString(new StringBuilder(), "").toString();
-    }
-
-    public StringBuilder toString(StringBuilder res, String prefix) {
-        appendCollection(res, prefix, includeTables);
-        appendCollection(res, prefix, excludeTables);
-        appendCollection(res, prefix, includeColumns);
-        appendCollection(res, prefix, excludeColumns);
-        appendCollection(res, prefix, includeProcedures);
-        appendCollection(res, prefix, excludeProcedures);
-
-        return res;
-    }
-
-    protected void appendCollection(StringBuilder res, String prefix, Collection<? extends PatternParam> collection) {
-        if (!isBlank(collection)) {
-            for (PatternParam item : collection) {
-                item.toString(res, prefix);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FiltersConfigBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FiltersConfigBuilder.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FiltersConfigBuilder.java
deleted file mode 100644
index b26c9e6..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/FiltersConfigBuilder.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-import org.apache.cayenne.access.loader.filters.OldFilterConfigBridge;
-import org.apache.cayenne.access.loader.filters.CatalogFilter;
-import org.apache.cayenne.access.loader.filters.IncludeTableFilter;
-import org.apache.cayenne.access.loader.filters.SchemaFilter;
-import org.apache.cayenne.access.loader.filters.TableFilter;
-import org.apache.cayenne.access.loader.filters.FiltersConfig;
-import org.apache.cayenne.access.loader.filters.PatternFilter;
-import org.apache.cayenne.tools.ExcludeTable;
-
-import java.util.Collection;
-import java.util.SortedSet;
-import java.util.TreeSet;
-import java.util.regex.Pattern;
-
-import static org.apache.commons.lang.StringUtils.isBlank;
-
-/**
-* @since 4.0.
-*/
-public final class FiltersConfigBuilder {
-
-    private final ReverseEngineering engineering;
-
-    public FiltersConfigBuilder(ReverseEngineering engineering) {
-        this.engineering = engineering;
-    }
-
-    public FiltersConfig filtersConfig() {
-        compact();
-
-        return new FiltersConfig(transformCatalogs(engineering.getCatalogs()));
-    }
-
-    private CatalogFilter[] transformCatalogs(Collection<Catalog> catalogs) {
-        CatalogFilter[] catalogFilters = new CatalogFilter[catalogs.size()];
-        int i = 0;
-        for (Catalog catalog : catalogs) {
-            catalogFilters[i] = new CatalogFilter(catalog.getName(), transformSchemas(catalog.getSchemas()));
-            i++;
-        }
-        
-        return catalogFilters;
-    }
-
-    private SchemaFilter[] transformSchemas(Collection<Schema> schemas) {
-        SchemaFilter[] schemaFilters = new SchemaFilter[schemas.size()];
-        int i = 0;
-        for (Schema schema : schemas) {
-            schemaFilters[i] = new SchemaFilter(schema.getName(),
-                    new TableFilter(transformIncludeTable(schema.getIncludeTables()),
-                                    transformExcludeTable(schema.getExcludeTables())),
-                    transform(schema.getIncludeProcedures(), schema.getExcludeProcedures()));
-            i++;
-        }
-
-        return schemaFilters;
-    }
-
-    private SortedSet<Pattern> transformExcludeTable(Collection<ExcludeTable> excludeTables) {
-        SortedSet<Pattern> res = new TreeSet<Pattern>(PatternFilter.PATTERN_COMPARATOR);
-        for (ExcludeTable exclude : excludeTables) {
-            res.add(PatternFilter.pattern(exclude.getPattern()));
-        }
-        return res;
-    }
-
-    private SortedSet<IncludeTableFilter> transformIncludeTable(Collection<IncludeTable> includeTables) {
-        SortedSet<IncludeTableFilter> includeTableFilters = new TreeSet<IncludeTableFilter>();
-        for (IncludeTable includeTable : includeTables) {
-            includeTableFilters.add(new IncludeTableFilter(includeTable.getPattern(),
-                    transform(includeTable.getIncludeColumns(), includeTable.getExcludeColumns())));
-        }
-
-        return includeTableFilters;
-    }
-
-    private PatternFilter transform(Collection<? extends PatternParam> include,
-                                    Collection<? extends PatternParam> exclude) {
-        PatternFilter filter = new PatternFilter();
-
-        for (PatternParam patternParam : include) {
-            filter.include(patternParam.getPattern());
-        }
-
-        for (PatternParam patternParam : exclude) {
-            filter.exclude(patternParam.getPattern());
-        }
-
-        return filter;
-
-    }
-
-    /**
-     * Goal of this method transform ReverseEngineering config into more regular form
-     * From
-     *      ReverseEngineering
-     *          Catalog
-     *              Schema
-     *                  IncludeTable
-     *                      IncludeColumn
-     *                      ExcludeColumn
-     *                  ExcludeTable
-     *                  IncludeProcedures
-     *                  ExcludeProcedures
-     *                  IncludeColumn
-     *                  ExcludeColumn
-     *              IncludeTable
-     *                  IncludeColumn
-     *                  ExcludeColumn
-     *              ExcludeTable
-     *              IncludeProcedures
-     *              ExcludeProcedures
-     *              IncludeColumn
-     *              ExcludeColumn
-     *          Schema
-     *              IncludeTable
-     *                  IncludeColumn
-     *                  ExcludeColumn
-     *              ExcludeTable
-     *              IncludeProcedures
-     *              ExcludeProcedures
-     *              IncludeColumn
-     *              ExcludeColumn
-     *          IncludeTable
-     *              IncludeColumn
-     *              ExcludeColumn
-     *          ExcludeTable
-     *          IncludeProcedures
-     *          ExcludeProcedures
-     *          IncludeColumn
-     *          ExcludeColumn
-     *
-     * Into
-     *      ReverseEngineering
-     *          Catalog
-     *              Schema
-     *                  IncludeTable
-     *                      IncludeColumn
-     *                      ExcludeColumn
-     *                  ExcludeTable
-     *                  IncludeProcedures
-     *                  ExcludeProcedures
-     *
-     *
-     * */
-    public void compact() {
-        addEmptyElements();
-
-        compactColumnFilters();
-        compactTableFilter();
-        compactProcedureFilter();
-        compactSchemas();
-    }
-
-    private void compactSchemas() {
-        for (Catalog catalog : engineering.getCatalogs()) {
-            catalog.getSchemas().addAll(engineering.getSchemas());
-        }
-        engineering.setSchemas(null);
-    }
-
-    private void compactProcedureFilter() {
-        Collection<IncludeProcedure> engIncludeProcedures = engineering.getIncludeProcedures();
-        Collection<ExcludeProcedure> engExcludeProcedures = engineering.getExcludeProcedures();
-
-        engineering.setIncludeProcedures(null);
-        engineering.setExcludeProcedures(null);
-
-        for (Catalog catalog : engineering.getCatalogs()) {
-            Collection<IncludeProcedure> catalogIncludeProcedures = catalog.getIncludeProcedures();
-            Collection<ExcludeProcedure> catalogExcludeProcedures = catalog.getExcludeProcedures();
-
-            catalog.setIncludeProcedures(null);
-            catalog.setExcludeProcedures(null);
-
-            for (Schema schema : catalog.getSchemas()) {
-                schema.getIncludeProcedures().addAll(engIncludeProcedures);
-                schema.getIncludeProcedures().addAll(catalogIncludeProcedures);
-
-                schema.getExcludeProcedures().addAll(engExcludeProcedures);
-                schema.getExcludeProcedures().addAll(catalogExcludeProcedures);
-            }
-        }
-
-        for (Schema schema : engineering.getSchemas()) {
-            schema.getIncludeProcedures().addAll(engIncludeProcedures);
-            schema.getExcludeProcedures().addAll(engExcludeProcedures);
-        }
-    }
-
-    private void compactTableFilter() {
-        Collection<IncludeTable> engIncludeTables = engineering.getIncludeTables();
-        Collection<ExcludeTable> engExcludeTables = engineering.getExcludeTables();
-
-        engineering.setIncludeTables(null);
-        engineering.setExcludeTables(null);
-
-        for (Catalog catalog : engineering.getCatalogs()) {
-            Collection<IncludeTable> catalogIncludeTables = catalog.getIncludeTables();
-            Collection<ExcludeTable> catalogExcludeTables = catalog.getExcludeTables();
-
-            catalog.setIncludeTables(null);
-            catalog.setExcludeTables(null);
-
-            for (Schema schema : catalog.getSchemas()) {
-                schema.getIncludeTables().addAll(engIncludeTables);
-                schema.getIncludeTables().addAll(catalogIncludeTables);
-                
-                schema.getExcludeTables().addAll(engExcludeTables);
-                schema.getExcludeTables().addAll(catalogExcludeTables);
-            }
-        }
-
-        for (Schema schema : engineering.getSchemas()) {
-            schema.getIncludeTables().addAll(engIncludeTables);
-            schema.getExcludeTables().addAll(engExcludeTables);
-        }
-    }
-
-    private void compactColumnFilters() {
-        Collection<IncludeColumn> engIncludeColumns = engineering.getIncludeColumns();
-        Collection<ExcludeColumn> engExcludeColumns = engineering.getExcludeColumns();
-
-        engineering.setIncludeColumns(null);
-        engineering.setExcludeColumns(null);
-
-        for (Catalog catalog : engineering.getCatalogs()) {
-            Collection<IncludeColumn> catalogIncludeColumns = catalog.getIncludeColumns();
-            Collection<ExcludeColumn> catalogExcludeColumns = catalog.getExcludeColumns();
-
-            catalog.setIncludeColumns(null);
-            catalog.setExcludeColumns(null);
-
-            for (Schema schema : catalog.getSchemas()) {
-                Collection<IncludeColumn> schemaIncludeColumns = schema.getIncludeColumns();
-                Collection<ExcludeColumn> schemaExcludeColumns = schema.getExcludeColumns();
-
-                schema.setIncludeColumns(null);
-                schema.setExcludeColumns(null);
-
-                for (IncludeTable includeTable : schema.getIncludeTables()) {
-                    includeTable.getIncludeColumns().addAll(engIncludeColumns);
-                    includeTable.getIncludeColumns().addAll(catalogIncludeColumns);
-                    includeTable.getIncludeColumns().addAll(schemaIncludeColumns);
-
-                    includeTable.getExcludeColumns().addAll(engExcludeColumns);
-                    includeTable.getExcludeColumns().addAll(catalogExcludeColumns);
-                    includeTable.getExcludeColumns().addAll(schemaExcludeColumns);
-                }
-            }
-
-            for (IncludeTable includeTable : catalog.getIncludeTables()) {
-                includeTable.getIncludeColumns().addAll(engIncludeColumns);
-                includeTable.getIncludeColumns().addAll(catalogIncludeColumns);
-
-                includeTable.getExcludeColumns().addAll(engExcludeColumns);
-                includeTable.getExcludeColumns().addAll(catalogExcludeColumns);
-            }
-        }
-
-        for (Schema schema : engineering.getSchemas()) {
-            Collection<IncludeColumn> schemaIncludeColumns = schema.getIncludeColumns();
-            Collection<ExcludeColumn> schemaExcludeColumns = schema.getExcludeColumns();
-
-            schema.setIncludeColumns(null);
-            schema.setExcludeColumns(null);
-
-            for (IncludeTable includeTable : schema.getIncludeTables()) {
-                includeTable.getIncludeColumns().addAll(engIncludeColumns);
-                includeTable.getIncludeColumns().addAll(schemaIncludeColumns);
-
-                includeTable.getExcludeColumns().addAll(engExcludeColumns);
-                includeTable.getExcludeColumns().addAll(schemaExcludeColumns);
-            }
-        }
-
-        for (IncludeTable includeTable : engineering.getIncludeTables()) {
-            includeTable.getIncludeColumns().addAll(engIncludeColumns);
-            includeTable.getExcludeColumns().addAll(engExcludeColumns);
-        }
-    }
-
-    private void addEmptyElements() {
-        if (engineering.getCatalogs().isEmpty()) {
-            engineering.addCatalog(new Catalog());
-        }
-
-        for (Catalog catalog : engineering.getCatalogs()) {
-            if (catalog.getSchemas().isEmpty()
-                    && engineering.getSchemas().isEmpty()) {
-                catalog.addSchema(new Schema());
-            }
-
-            for (Schema schema : catalog.getSchemas()) {
-                if (schema.getIncludeTables().isEmpty()
-                        && catalog.getIncludeTables().isEmpty()
-                        && engineering.getIncludeTables().isEmpty()) {
-
-                    schema.addIncludeTable(new IncludeTable());
-                }
-            }
-        }
-
-        for (Schema schema : engineering.getSchemas()) {
-            if (schema.getIncludeTables().isEmpty()
-                    && engineering.getIncludeTables().isEmpty()) {
-
-                schema.addIncludeTable(new IncludeTable());
-            }
-        }
-    }
-
-    public FiltersConfigBuilder add(OldFilterConfigBridge build) {
-        if (!isBlank(build.catalog())) {
-            engineering.addCatalog(new Catalog(build.catalog()));
-        }
-
-        if (!isBlank(build.schema())) {
-            engineering.addSchema(new Schema(build.schema()));
-        }
-
-        if (!isBlank(build.getIncludeTableFilters())) {
-            engineering.addIncludeTable(new IncludeTable(build.getIncludeTableFilters()));
-        }
-        if (!isBlank(build.getExcludeTableFilters())) {
-            engineering.addExcludeTable(new ExcludeTable(build.getExcludeTableFilters()));
-        }
-        
-        if (!isBlank(build.getIncludeColumnFilters())) {
-            engineering.addIncludeColumn(new IncludeColumn(build.getIncludeColumnFilters()));
-        }
-        if (!isBlank(build.getExcludeColumnFilters())) {
-            engineering.addExcludeColumn(new ExcludeColumn(build.getExcludeColumnFilters()));
-        }
-
-        if (build.isLoadProcedures()) {
-            if (!isBlank(build.getIncludeProceduresFilters())) {
-                engineering.addIncludeProcedure(new IncludeProcedure(build.getIncludeProceduresFilters()));
-            }
-            if (!isBlank(build.getExcludeProceduresFilters())) {
-                engineering.addExcludeProcedure(new ExcludeProcedure(build.getExcludeProceduresFilters()));
-            }
-        }
-
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeColumn.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeColumn.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeColumn.java
deleted file mode 100644
index ba4362b..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeColumn.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-/**
- * @since 4.0.
- */
-public class IncludeColumn extends PatternParam {
-    public IncludeColumn() {
-    }
-
-    public IncludeColumn(String pattern) {
-        super(pattern);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeProcedure.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeProcedure.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeProcedure.java
deleted file mode 100644
index 404e4f2..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeProcedure.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-/**
- * @since 4.0.
- */
-public class IncludeProcedure extends PatternParam {
-    public IncludeProcedure() {
-    }
-
-    public IncludeProcedure(String pattern) {
-        super(pattern);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeTable.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeTable.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeTable.java
deleted file mode 100644
index 8d0d1ab..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/IncludeTable.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-import static org.apache.commons.lang.StringUtils.isBlank;
-import static org.apache.commons.lang.StringUtils.join;
-
-/**
- * @since 4.0.
- */
-public class IncludeTable extends PatternParam {
-
-    private Collection<IncludeColumn> includeColumns = new LinkedList<IncludeColumn>();
-    private Collection<ExcludeColumn> excludeColumns = new LinkedList<ExcludeColumn>();
-
-    public IncludeTable() {
-    }
-
-    public IncludeTable(String pattern) {
-        super(pattern);
-    }
-
-    public Collection<IncludeColumn> getIncludeColumns() {
-        return includeColumns;
-    }
-
-    public void setIncludeColumns(Collection<IncludeColumn> includeColumns) {
-        this.includeColumns = includeColumns;
-    }
-
-    public Collection<ExcludeColumn> getExcludeColumns() {
-        return excludeColumns;
-    }
-
-    public void setExcludeColumns(Collection<ExcludeColumn> excludeColumns) {
-        this.excludeColumns = excludeColumns;
-    }
-
-    public void addIncludeColumn(IncludeColumn includeColumn) {
-        this.includeColumns.add(includeColumn);
-    }
-
-    public void addExcludeColumn(ExcludeColumn excludeColumn) {
-        this.excludeColumns.add(excludeColumn);
-    }
-
-    @Override
-    public StringBuilder toString(StringBuilder res, String s) {
-        super.toString(res, s);
-
-        String prefix = s + "  ";
-        if (includeColumns != null && !includeColumns.isEmpty()) {
-            for (IncludeColumn includeColumn : includeColumns) {
-                includeColumn.toString(res, prefix);
-            }
-        }
-
-        if (excludeColumns != null && !excludeColumns.isEmpty()) {
-            for (ExcludeColumn excludeColumn : excludeColumns) {
-                excludeColumn.toString(res, prefix);
-            }
-        }
-
-        return res;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/PatternParam.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/PatternParam.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/PatternParam.java
deleted file mode 100644
index 53b26cc..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/PatternParam.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-/**
- * @since 4.0.
- */
-public class PatternParam {
-
-    private String pattern;
-
-    public PatternParam() {
-    }
-
-    public PatternParam(String pattern) {
-        this.pattern = pattern;
-    }
-
-    public String getPattern() {
-        return pattern;
-    }
-
-    public void setPattern(String pattern) {
-        this.pattern = pattern;
-    }
-
-    /**
-     * used my maven
-     *
-     * @param pattern
-     */
-    public void set(String pattern) {
-        setPattern(pattern);
-    }
-
-
-    /**
-     * used my ant
-     *
-     * @param pattern
-     */
-    public void addText(String pattern) {
-        if (pattern.trim().isEmpty()) {
-            return;
-        }
-
-        setPattern(pattern);
-    }
-
-    public void addConfiguredPattern(AntNestedElement pattern) {
-        set(pattern.getName());
-    }
-
-    @Override
-    public String toString() {
-        return toString(new StringBuilder(), "").toString();
-    }
-
-    public StringBuilder toString(StringBuilder res, String s) {
-        res.append(s).append(getClass().getSimpleName()).append(": ").append(pattern).append("\n");
-        return res;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
deleted file mode 100644
index 07f1795..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineering.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * @since 4.0.
- */
-public class ReverseEngineering extends FilterContainer {
-
-    private Boolean skipRelationshipsLoading;
-
-    private Boolean skipPrimaryKeyLoading;
-
-    /*
-     * Typical types are "TABLE",
-     * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
-     * "LOCAL TEMPORARY", "ALIAS", "SYNONYM"., etc.
-     */
-    private Collection<String> tableTypes = new LinkedList<String>();
-
-    private Collection<Catalog> catalogs = new LinkedList<Catalog>();
-    private Collection<Schema> schemas = new LinkedList<Schema>();
-
-    public ReverseEngineering() {
-    }
-
-    public Boolean getSkipRelationshipsLoading() {
-        return skipRelationshipsLoading;
-    }
-
-    public void setSkipRelationshipsLoading(Boolean skipRelationshipsLoading) {
-        this.skipRelationshipsLoading = skipRelationshipsLoading;
-    }
-
-    public Boolean getSkipPrimaryKeyLoading() {
-        return skipPrimaryKeyLoading;
-    }
-
-    public void setSkipPrimaryKeyLoading(Boolean skipPrimaryKeyLoading) {
-        this.skipPrimaryKeyLoading = skipPrimaryKeyLoading;
-    }
-
-    public Collection<Catalog> getCatalogs() {
-        return catalogs;
-    }
-
-    public void setCatalogs(Collection<Catalog> catalogs) {
-        this.catalogs = catalogs;
-    }
-
-    public Collection<Schema> getSchemas() {
-        return schemas;
-    }
-
-    public void setSchemas(Collection<Schema> schemas) {
-        this.schemas = schemas;
-    }
-
-    public String[] getTableTypes() {
-        return tableTypes.toArray(new String[tableTypes.size()]);
-    }
-
-    /*
-     * Typical types are "TABLE",
-     * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
-     * "LOCAL TEMPORARY", "ALIAS", "SYNONYM"., etc.
-     */
-    public void setTableTypes(Collection<String> tableTypes) {
-        this.tableTypes = tableTypes;
-    }
-
-    /*
-     * Typical types are "TABLE",
-     * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
-     * "LOCAL TEMPORARY", "ALIAS", "SYNONYM"., etc.
-     */
-    public void addTableType(String type) {
-        this.tableTypes.add(type);
-    }
-
-    public void addSchema(Schema schema) {
-        this.schemas.add(schema);
-    }
-
-    public void addCatalog(Catalog catalog) {
-        this.catalogs.add(catalog);
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder res = new StringBuilder();
-        res.append("ReverseEngineering: ").append("\n");
-
-        if (!isBlank(catalogs)) {
-            for (Catalog catalog : catalogs) {
-                catalog.toString(res, "  ");
-            }
-        }
-
-        if (!isBlank(schemas)) {
-            for (Schema schema : schemas) {
-                schema.toString(res, "  ");
-            }
-        }
-
-        if (skipRelationshipsLoading != null && skipRelationshipsLoading) {
-            res.append("\n").append("        Skip Relationships Loading");
-        }
-        if (skipPrimaryKeyLoading != null && skipPrimaryKeyLoading) {
-            res.append("\n").append("        Skip PrimaryKey Loading");
-        }
-
-        return super.toString(res, "  ").toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/fe82b47e/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineeringLoader.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineeringLoader.java b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineeringLoader.java
deleted file mode 100644
index 241b3d2..0000000
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/config/ReverseEngineeringLoader.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*****************************************************************
- *   Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- ****************************************************************/
-package org.apache.cayenne.tools.dbimport.config;
-
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.resource.Resource;
-
-/**
- * @since 4.0.
- */
-public interface ReverseEngineeringLoader {
-
-    ReverseEngineering load(Resource configurationResource) throws CayenneRuntimeException;
-
-}


Mime
View raw message