private void validateDbImportConfiguration(DbImportConfiguration config, Injector injector) throws MojoExecutionException { DataNodeDescriptor dataNodeDescriptor = config.createDataNodeDescriptor(); DataSource dataSource = null; DbAdapter adapter = null; try { dataSource = injector.getInstance(DataSourceFactory.class).getDataSource(dataNodeDescriptor); adapter = injector .getInstance(DbAdapterFactory.class) .createAdapter(dataNodeDescriptor, dataSource); if (!adapter.supportsCatalogsOnReverseEngineering() && reverseEngineering.getCatalogs() != null && !reverseEngineering.getCatalogs().isEmpty()) { String message = "Your database does not support catalogs on reverse engineering. " + "It allows to connect to only one at the moment. Please don't note catalogs as param."; throw new MojoExecutionException(message); } } catch (Exception e) { throw new MojoExecutionException( "Error creating DataSource (" + dataSource + ") or DbAdapter (" + adapter + ") for DataNodeDescriptor (" + dataNodeDescriptor + ")", e); } }
DbImportConfiguration toParameters() { if (config != null) { return config; } config = new DbImportConfiguration(); config.setAdapter(adapter); config.setDefaultPackage(defaultPackage); config.setDriver(driver); config.setDataMapFile(map); config.setMeaningfulPkTables(meaningfulPkTables); config.setNamingStrategy(namingStrategy); config.setOverwrite(overwrite); config.setPassword(password); config.setUrl(url); config.setUsername(username); config.setUsePrimitives(usePrimitives); config.setFiltersConfig( new FiltersConfigBuilder(reverseEngineering).add(filterBuilder).filtersConfig()); config.setSkipRelationshipsLoading(reverseEngineering.getSkipRelationshipsLoading()); config.setSkipPrimaryKeyLoading(reverseEngineering.getSkipPrimaryKeyLoading()); config.setTableTypes(reverseEngineering.getTableTypes()); return config; }
public void setSchema(Schema schema) { if (schema.isEmptyContainer()) { filterBuilder.schema(schema.getName()); } else { reverseEngineering.addSchema(schema); } }
public void addCatalog(Catalog catalog) { if (catalog != null) { if (catalog.isEmptyContainer()) { filterBuilder.catalog(catalog.getName()); } else { reverseEngineering.addCatalog(catalog); } } }
public void addSchema(Schema schema) { reverseEngineering.addSchema(schema); }