http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/examples/src/main/java/org/apache/ignite/examples/computegrid/ComputeTaskMapExample.java ----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/GridKernalContextImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/IgniteComponentType.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlIndexMetadata.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheSqlMetadata.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/top/GridTopologyCommandHandler.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java index c22b838,0000000..6c87259 mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/version/GridVersionNameCommandHandler.java @@@ -1,67 -1,0 +1,69 @@@ +/* + * 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.ignite.internal.processors.rest.handlers.version; + - import org.apache.ignite.internal.*; - import org.apache.ignite.internal.processors.rest.*; - import org.apache.ignite.internal.processors.rest.handlers.*; - import org.apache.ignite.internal.processors.rest.request.*; - import org.apache.ignite.internal.util.future.*; - import org.apache.ignite.internal.util.typedef.internal.*; ++import java.util.Collection; ++import org.apache.ignite.internal.GridKernalContext; ++import org.apache.ignite.internal.IgniteInternalFuture; ++import org.apache.ignite.internal.processors.rest.GridRestCommand; ++import org.apache.ignite.internal.processors.rest.GridRestResponse; ++import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandlerAdapter; ++import org.apache.ignite.internal.processors.rest.request.GridRestRequest; ++import org.apache.ignite.internal.util.future.GridFinishedFuture; ++import org.apache.ignite.internal.util.typedef.internal.U; + - import java.util.*; - - import static org.apache.ignite.internal.IgniteVersionUtils.*; - import static org.apache.ignite.internal.processors.rest.GridRestCommand.*; ++import static org.apache.ignite.internal.IgniteVersionUtils.VER_STR; ++import static org.apache.ignite.internal.processors.rest.GridRestCommand.NAME; ++import static org.apache.ignite.internal.processors.rest.GridRestCommand.VERSION; + +/** + * Handler for {@link GridRestCommand#VERSION} and {@link GridRestCommand#NAME} command. + */ +public class GridVersionNameCommandHandler extends GridRestCommandHandlerAdapter { + /** Supported commands. */ + private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(VERSION, NAME); + + /** + * @param ctx Context. + */ + public GridVersionNameCommandHandler(GridKernalContext ctx) { + super(ctx); + } + + /** {@inheritDoc} */ + @Override public Collection<GridRestCommand> supportedCommands() { + return SUPPORTED_COMMANDS; + } + + /** {@inheritDoc} */ + @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest req) { + assert req != null; + + assert SUPPORTED_COMMANDS.contains(req.command()); + + switch (req.command()){ + case VERSION: + return new GridFinishedFuture<>(new GridRestResponse(VER_STR)); + + case NAME: + return new GridFinishedFuture<>(new GridRestResponse(ctx.gridName())); + } + + return new GridFinishedFuture<>(); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestQueryRequest.java ---------------------------------------------------------------------- diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestQueryRequest.java index a719776,0000000..029b573 mode 100644,000000..100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestQueryRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestQueryRequest.java @@@ -1,175 -1,0 +1,173 @@@ +/* ++ * 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 + * - * * 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. ++ * 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.ignite.internal.processors.rest.request; + +/** + * Sql query request. + */ +public class RestQueryRequest extends GridRestRequest { + /** Sql query. */ + private String sqlQry; + + /** Sql query arguments. */ + private Object[] args; + + /** Page size. */ + private Integer pageSize; + + /** Cache name. */ + private String cacheName; + + /** Query id. */ + private Long qryId; + + /** Query type name. */ + private String typeName; + + /** Predicate class name for scan query. */ + private String className; + + /** Query type. */ + private QueryType type; + + /** + * @param sqlQry Sql query. + */ + public void sqlQuery(String sqlQry) { + this.sqlQry = sqlQry; + } + + /** + * @return Sql query. + */ + public String sqlQuery() { + return sqlQry; + } + + /** + * @param args Sql query arguments. + */ + public void arguments(Object[] args) { + this.args = args; + } + + /** + * @return Sql query arguments. + */ + public Object[] arguments() { + return args; + } + + /** + * @param pageSize Page size. + */ + public void pageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + /** + * @return Page size. + */ + public int pageSize() { + return pageSize; + } + + /** + * @param cacheName Cache name. + */ + public void cacheName(String cacheName) { + this.cacheName = cacheName; + } + + /** + * @return Cache name. + */ + public String cacheName() { + return cacheName; + } + + /** + * @param id Query id. + */ + public void queryId(Long id) { + this.qryId = id; + } + + /** + * @return Query id. + */ + public Long queryId() { + return qryId; + } + + /** + * @param typeName Query type name. + */ + public void typeName(String typeName) { + this.typeName = typeName; + } + + /** + * @return Query type name. + */ + public String typeName() { + return typeName; + } + + /** + * @return Predicate class name for scan query. + */ + public String className() { + return className; + } + + /** + * @param className Predicate class name for scan query. + */ + public void className(String className) { + this.className = className; + } + + /** + * @param type Query type. + */ + public void queryType(QueryType type) { + this.type = type; + } + + /** + * @return Query type. + */ + public QueryType queryType() { + return type; + } + + /** + * Supported query types. + */ + public enum QueryType { + /** Sql query. */ + SQL, + + /** Sql fields query. */ + SQL_FIELDS, + + /** Scan query. */ + SCAN + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/core/src/main/java/org/apache/ignite/internal/util/GridJavaProcess.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java ---------------------------------------------------------------------- diff --cc modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java index 8cd9cb4,60b44ee..39efe5e --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyJsonConfig.java @@@ -17,13 -17,10 +17,12 @@@ package org.apache.ignite.internal.processors.rest.protocols.http.jetty; - import net.sf.json.*; - import net.sf.json.processors.*; - import org.apache.ignite.internal.processors.cache.query.*; + import java.util.UUID; + import net.sf.json.JsonConfig; + import net.sf.json.processors.JsonValueProcessor; - import java.text.*; +import java.util.*; + /** * Jetty protocol json configuration. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java index 8b0c813,0000000..9a548f4 mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbColumn.java @@@ -1,76 -1,0 +1,76 @@@ +/* + * 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.ignite.schema.parser; + +/** + * Database table column. + */ +public class DbColumn { + /** Column name. */ + private final String name; + + /** Column JDBC type. */ + private final int type; + + /** Is this column belongs to primary key. */ + private final boolean key; + + /** Is {@code NULL} allowed for column in database. */ + private final boolean nullable; + + /** + * @param name Column name. + * @param type Column JDBC type. + * @param key {@code true} if this column belongs to primary key. + * @param nullable {@code true} if {@code NULL } allowed for column in database. + */ + public DbColumn(String name, int type, boolean key, boolean nullable) { + this.name = name; + this.type = type; + this.key = key; + this.nullable = nullable; + } + + /** + * @return Column name. + */ + public String name() { + return name; + } + + /** + * @return Column JDBC type. + */ + public int type() { + return type; + } + + /** + * @return {@code true} if this column belongs to primary key. + */ + public boolean key() { + return key; + } + + /** + * @return nullable {@code true} if {@code NULL } allowed for column in database. + */ + public boolean nullable() { + return nullable; + } - } ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java index 35c7d91,0000000..c54bfd8 mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/DbTable.java @@@ -1,105 -1,0 +1,107 @@@ +/* + * 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.ignite.schema.parser; + - import java.util.*; ++import java.util.Collection; ++import java.util.Map; ++import java.util.Set; + +/** + * Database table. + */ +public class DbTable { + /** Schema name. */ + private final String schema; + + /** Table name. */ + private final String tbl; + + /** Columns. */ + private final Collection<DbColumn> cols; + + /** Columns in ascending order. */ + private final Set<String> ascCols; + + /** Columns in descending order. */ + private final Set<String> descCols; + + /** Indexes. */ + private final Map<String, Map<String, Boolean>> idxs; + + /** + * Default columns. + * + * @param schema Schema name. + * @param tbl Table name. + * @param cols Columns. + * @param ascCols Columns in ascending order. + * @param descCols Columns in descending order. + * @param idxs Indexes; + */ + public DbTable(String schema, String tbl, Collection<DbColumn> cols, Set<String> ascCols, Set<String> descCols, + Map<String, Map<String, Boolean>> idxs) { + this.schema = schema; + this.tbl = tbl; + this.cols = cols; + this.ascCols = ascCols; + this.descCols = descCols; + this.idxs = idxs; + } + + /** + * @return Schema name. + */ + public String schema() { + return schema; + } + + /** + * @return Table name. + */ + public String table() { + return tbl; + } + + /** + * @return Columns. + */ + public Collection<DbColumn> columns() { + return cols; + } + + /** + * @return Fields in ascending order + */ + public Set<String> ascendingColumns() { + return ascCols; + } + + /** + * @return Fields in descending order + */ + public Set<String> descendingColumns() { + return descCols; + } + + /** + * @return Indexes. + */ + public Map<String, Map<String, Boolean>> indexes() { + return idxs; + } - } ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java index 15063e2,0000000..b191ec3 mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DB2MetadataDialect.java @@@ -1,31 -1,0 +1,33 @@@ +/* + * 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.ignite.schema.parser.dialect; + - import java.util.*; ++import java.util.Arrays; ++import java.util.HashSet; ++import java.util.Set; + +/** + * DB2 specific metadata dialect. + */ +public class DB2MetadataDialect extends JdbcMetadataDialect { + /** {@inheritDoc} */ + @Override public Set<String> systemSchemas() { + return new HashSet<>(Arrays.asList("SYSIBM", "SYSCAT", "SYSSTAT", "SYSTOOLS", "SYSFUN", "SYSIBMADM", + "SYSIBMINTERNAL", "SYSIBMTS", "SYSPROC", "SYSPUBLIC")); + } - } ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java index b801029,0000000..1d2d019 mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/DatabaseMetadataDialect.java @@@ -1,89 -1,0 +1,95 @@@ +/* + * 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.ignite.schema.parser.dialect; + - import org.apache.ignite.schema.parser.*; - - import java.sql.*; - import java.util.*; ++import java.sql.Connection; ++import java.sql.SQLException; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.HashSet; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import org.apache.ignite.schema.parser.DbColumn; ++import org.apache.ignite.schema.parser.DbTable; + +/** + * Base class for database metadata dialect. + */ +public abstract class DatabaseMetadataDialect { + /** + * Gets schemas from database. + * + * @param conn Database connection. + * @return Collection of schema descriptors. + * @throws SQLException If failed to get schemas. + */ + public abstract Collection<String> schemas(Connection conn) throws SQLException; + + /** + * Gets tables from database. + * + * @param conn Database connection. + * @param schemas Collention of schema names to load. + * @param tblsOnly If {@code true} then gets only tables otherwise gets tables and views. + * @return Collection of table descriptors. + * @throws SQLException If failed to get tables. + */ + public abstract Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly) + throws SQLException; + + /** + * @return Collection of database system schemas. + */ + public Set<String> systemSchemas() { + return Collections.singleton("INFORMATION_SCHEMA"); + } + + /** + * Create table descriptor. + * + * @param schema Schema name. + * @param tbl Table name. + * @param cols Table columns. + * @param idxs Table indexes. + * @return New {@code DbTable} instance. + */ + protected DbTable table(String schema, String tbl, Collection<DbColumn> cols, Map<String, Map<String, Boolean>>idxs) { + Set<String> ascCols = new HashSet<>(); + + Set<String> descCols = new HashSet<>(); + + for (Map<String, Boolean> idx : idxs.values()) { + if (idx.size() == 1) + for (Map.Entry<String, Boolean> idxCol : idx.entrySet()) { + String colName = idxCol.getKey(); + + Boolean desc = idxCol.getValue(); + + if (desc != null) { + if (desc) + descCols.add(colName); + else + ascCols.add(colName); + } + } + } + + return new DbTable(schema, tbl, cols, ascCols, descCols, idxs); + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java index 73785e8,0000000..f0ac434 mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/JdbcMetadataDialect.java @@@ -1,182 -1,0 +1,191 @@@ +/* + * 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.ignite.schema.parser.dialect; + - import org.apache.ignite.schema.parser.*; - - import java.sql.*; - import java.util.*; ++import java.sql.Connection; ++import java.sql.DatabaseMetaData; ++import java.sql.ResultSet; ++import java.sql.SQLException; ++import java.util.ArrayList; ++import java.util.Collection; ++import java.util.HashSet; ++import java.util.LinkedHashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import org.apache.ignite.schema.parser.DbColumn; ++import org.apache.ignite.schema.parser.DbTable; + +/** + * Metadata dialect that uses standard JDBC for reading metadata. + */ +public class JdbcMetadataDialect extends DatabaseMetadataDialect { + /** */ + private static final String[] TABLES_ONLY = {"TABLE"}; + + /** */ + private static final String[] TABLES_AND_VIEWS = {"TABLE", "VIEW"}; + + /** Schema catalog index. */ + private static final int TBL_CATALOG_IDX = 1; + + /** Schema name index. */ + private static final int TBL_SCHEMA_IDX = 2; + + /** Table name index. */ + private static final int TBL_NAME_IDX = 3; + + /** Primary key column name index. */ + private static final int PK_COL_NAME_IDX = 4; + + /** Column name index. */ + private static final int COL_NAME_IDX = 4; + + /** Column data type index. */ + private static final int COL_DATA_TYPE_IDX = 5; + + /** Column nullable index. */ + private static final int COL_NULLABLE_IDX = 11; + + /** Index name index. */ + private static final int IDX_NAME_IDX = 6; + + /** Index column name index. */ + private static final int IDX_COL_NAME_IDX = 9; + + /** Index column descend index. */ + private static final int IDX_ASC_OR_DESC_IDX = 10; + + /** {@inheritDoc} */ + @Override public Collection<String> schemas(Connection conn) throws SQLException { + Collection<String> schemas = new ArrayList<>(); + + ResultSet rs = conn.getMetaData().getSchemas(); + + Set<String> sys = systemSchemas(); + + while(rs.next()) { + String schema = rs.getString(1); + + // Skip system schemas. + if (sys.contains(schema)) + continue; + + schemas.add(schema); + } + + return schemas; + } + + /** + * @return If {@code true} use catalogs for table division. + */ + protected boolean useCatalog() { + return false; + } + + /** + * @return If {@code true} use schemas for table division. + */ + protected boolean useSchema() { + return true; + } + + /** {@inheritDoc} */ + @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly) + throws SQLException { + DatabaseMetaData dbMeta = conn.getMetaData(); + + Set<String> sys = systemSchemas(); + + Collection<DbTable> tbls = new ArrayList<>(); + + if (schemas.size() == 0) + schemas.add(null); + + for (String toSchema: schemas) { + try (ResultSet tblsRs = dbMeta.getTables(useCatalog() ? toSchema : null, useSchema() ? toSchema : null, "%", + tblsOnly ? TABLES_ONLY : TABLES_AND_VIEWS)) { + while (tblsRs.next()) { + String tblCatalog = tblsRs.getString(TBL_CATALOG_IDX); + String tblSchema = tblsRs.getString(TBL_SCHEMA_IDX); + String tblName = tblsRs.getString(TBL_NAME_IDX); + + // In case of MySql we should use catalog. + String schema = tblSchema != null ? tblSchema : tblCatalog; + + // Skip system schemas. + if (sys.contains(schema)) + continue; + + Set<String> pkCols = new HashSet<>(); + + try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) { + while (pkRs.next()) + pkCols.add(pkRs.getString(PK_COL_NAME_IDX)); + } + + List<DbColumn> cols = new ArrayList<>(); + + try (ResultSet colsRs = dbMeta.getColumns(tblCatalog, tblSchema, tblName, null)) { + while (colsRs.next()) { + String colName = colsRs.getString(COL_NAME_IDX); + + cols.add(new DbColumn( + colName, + colsRs.getInt(COL_DATA_TYPE_IDX), + pkCols.contains(colName), + colsRs.getInt(COL_NULLABLE_IDX) == DatabaseMetaData.columnNullable)); + } + } + + Map<String, Map<String, Boolean>> idxs = new LinkedHashMap<>(); + + try (ResultSet idxRs = dbMeta.getIndexInfo(tblCatalog, tblSchema, tblName, false, true)) { + while (idxRs.next()) { + String idxName = idxRs.getString(IDX_NAME_IDX); + + String colName = idxRs.getString(IDX_COL_NAME_IDX); + + if (idxName == null || colName == null) + continue; + + Map<String, Boolean> idx = idxs.get(idxName); + + if (idx == null) { + idx = new LinkedHashMap<>(); + + idxs.put(idxName, idx); + } + + String askOrDesc = idxRs.getString(IDX_ASC_OR_DESC_IDX); + + Boolean desc = askOrDesc != null ? "D".equals(askOrDesc) : null; + + idx.put(colName, desc); + } + } + + tbls.add(table(schema, tblName, cols, idxs)); + } + } + } + + return tbls; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java index e0f6fe9,0000000..dc7374f mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/MySQLMetadataDialect.java @@@ -1,57 -1,0 +1,61 @@@ +/* + * 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.ignite.schema.parser.dialect; + - import java.sql.*; - import java.util.*; ++import java.sql.Connection; ++import java.sql.ResultSet; ++import java.sql.SQLException; ++import java.util.ArrayList; ++import java.util.List; ++import java.util.Set; + +/** + * MySQL specific metadata dialect. + */ +public class MySQLMetadataDialect extends JdbcMetadataDialect { + /** {@inheritDoc} */ + @Override public Collection<String> schemas(Connection conn) throws SQLException { + List<String> schemas = new ArrayList<>(); + + ResultSet rs = conn.getMetaData().getCatalogs(); + + Set<String> sys = systemSchemas(); + + while(rs.next()) { + String schema = rs.getString(1); + + // Skip system schemas. + if (sys.contains(schema)) + continue; + + schemas.add(schema); + } + + return schemas; + } + + /** {@inheritDoc} */ + @Override protected boolean useCatalog() { + return true; + } + + /** {@inheritDoc} */ + @Override protected boolean useSchema() { + return false; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java ---------------------------------------------------------------------- diff --cc modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java index c569a29,0000000..2d4cf24 mode 100644,000000..100644 --- a/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java +++ b/modules/schema-import-db/src/main/java/org/apache/ignite/schema/parser/dialect/OracleMetadataDialect.java @@@ -1,327 -1,0 +1,355 @@@ +/* + * 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.ignite.schema.parser.dialect; + - import org.apache.ignite.schema.parser.*; - - import java.sql.*; - import java.util.*; - - import static java.sql.Types.*; ++import java.sql.Connection; ++import java.sql.PreparedStatement; ++import java.sql.ResultSet; ++import java.sql.SQLException; ++import java.sql.Statement; ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.HashSet; ++import java.util.LinkedHashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.Set; ++import org.apache.ignite.schema.parser.DbColumn; ++import org.apache.ignite.schema.parser.DbTable; ++ ++import static java.sql.Types.BIGINT; ++import static java.sql.Types.BLOB; ++import static java.sql.Types.BOOLEAN; ++import static java.sql.Types.CHAR; ++import static java.sql.Types.CLOB; ++import static java.sql.Types.DATE; ++import static java.sql.Types.DOUBLE; ++import static java.sql.Types.FLOAT; ++import static java.sql.Types.INTEGER; ++import static java.sql.Types.LONGVARBINARY; ++import static java.sql.Types.LONGVARCHAR; ++import static java.sql.Types.NUMERIC; ++import static java.sql.Types.OTHER; ++import static java.sql.Types.SMALLINT; ++import static java.sql.Types.TIMESTAMP; ++import static java.sql.Types.TINYINT; ++import static java.sql.Types.VARCHAR; + +/** + * Oracle specific metadata dialect. + */ +public class OracleMetadataDialect extends DatabaseMetadataDialect { + /** SQL to get columns metadata. */ + private static final String SQL_COLUMNS = "SELECT a.owner, a.table_name, a.column_name, a.nullable," + + " a.data_type, a.data_precision, a.data_scale " + + "FROM all_tab_columns a %s " + + " %s " + + " ORDER BY a.owner, a.table_name, a.column_id"; + + /** SQL to get list of PRIMARY KEYS columns. */ + private static final String SQL_PRIMARY_KEYS = "SELECT b.column_name" + + " FROM all_constraints a" + + " INNER JOIN all_cons_columns b ON a.owner = b.owner AND a.constraint_name = b.constraint_name" + + " WHERE a.owner = ? and a.table_name = ? AND a.constraint_type = 'P'"; + + /** SQL to get indexes metadata. */ + private static final String SQL_INDEXES = "SELECT i.index_name, u.column_expression, i.column_name, i.descend" + + " FROM all_ind_columns i" + + " LEFT JOIN user_ind_expressions u on u.index_name = i.index_name and i.table_name = u.table_name" + + " WHERE i.index_owner = ? and i.table_name = ?" + + " ORDER BY i.index_name, i.column_position"; + + /** Owner index. */ + private static final int OWNER_IDX = 1; + + /** Table name index. */ + private static final int TBL_NAME_IDX = 2; + + /** Column name index. */ + private static final int COL_NAME_IDX = 3; + + /** Nullable index. */ + private static final int NULLABLE_IDX = 4; + + /** Data type index. */ + private static final int DATA_TYPE_IDX = 5; + + /** Numeric precision index. */ + private static final int DATA_PRECISION_IDX = 6; + + /** Numeric scale index. */ + private static final int DATA_SCALE_IDX = 7; + + /** Index name index. */ + private static final int IDX_NAME_IDX = 1; + + /** Index name index. */ + private static final int IDX_EXPR_IDX = 2; + + /** Index column name index. */ + private static final int IDX_COL_NAME_IDX = 3; + + /** Index column sort order index. */ + private static final int IDX_COL_DESCEND_IDX = 4; + + /** {@inheritDoc} */ + @Override public Set<String> systemSchemas() { + return new HashSet<>(Arrays.asList("ANONYMOUS", "CTXSYS", "DBSNMP", "EXFSYS", "LBACSYS", "MDSYS", "MGMT_VIEW", + "OLAPSYS", "OWBSYS", "ORDPLUGINS", "ORDSYS", "OUTLN", "SI_INFORMTN_SCHEMA", "SYS", "SYSMAN", "SYSTEM", + "TSMSYS", "WK_TEST", "WKSYS", "WKPROXY", "WMSYS", "XDB", + + "APEX_040000", "APEX_PUBLIC_USER", "DIP", "FLOWS_30000", "FLOWS_FILES", "MDDATA", "ORACLE_OCM", + "SPATIAL_CSW_ADMIN_USR", "SPATIAL_WFS_ADMIN_USR", "XS$NULL", + + "BI", "HR", "OE", "PM", "IX", "SH")); + } + + /** {@inheritDoc} */ + @Override public List<String> schemas(Connection conn) throws SQLException { + List<String> schemas = new ArrayList<>(); + + ResultSet rs = conn.getMetaData().getSchemas(); + + Set<String> sysSchemas = systemSchemas(); + + while(rs.next()) { + String schema = rs.getString(1); + + if (!sysSchemas.contains(schema) && !schema.startsWith("FLOWS_")) + schemas.add(schema); + } + + return schemas; + } + + /** + * @param rs Result set with column type metadata from Oracle database. + * @return JDBC type. + * @throws SQLException If failed to decode type. + */ + private int decodeType(ResultSet rs) throws SQLException { + String type = rs.getString(DATA_TYPE_IDX); + + if (type.startsWith("TIMESTAMP")) + return TIMESTAMP; + else { + switch (type) { + case "CHAR": + case "NCHAR": + return CHAR; + + case "VARCHAR2": + case "NVARCHAR2": + return VARCHAR; + + case "LONG": + return LONGVARCHAR; + + case "LONG RAW": + return LONGVARBINARY; + + case "FLOAT": + return FLOAT; + + case "NUMBER": + int precision = rs.getInt(DATA_PRECISION_IDX); + int scale = rs.getInt(DATA_SCALE_IDX); + + if (scale > 0) { + if (scale < 4 && precision < 19) + return FLOAT; + + if (scale > 4 || precision > 19) + return DOUBLE; + + return NUMERIC; + } + else { + if (precision < 1) + return INTEGER; + + if (precision < 2) + return BOOLEAN; + + if (precision < 4) + return TINYINT; + + if (precision < 6) + return SMALLINT; + + if (precision < 11) + return INTEGER; + + if (precision < 20) + return BIGINT; + + return NUMERIC; + } + + case "DATE": + return DATE; + + case "BFILE": + case "BLOB": + return BLOB; + + case "CLOB": + case "NCLOB": + case "XMLTYPE": + return CLOB; + } + } + + return OTHER; + } + + /** + * Retrieve primary key columns. + * + * @param stmt Prepared SQL statement to execute. + * @param owner DB owner. + * @param tbl Table name. + * @return Primary key columns. + * @throws SQLException If failed to retrieve primary key columns. + */ + private Set<String> primaryKeys(PreparedStatement stmt, String owner, String tbl) throws SQLException { + Set<String> pkCols = new HashSet<>(); + + stmt.setString(1, owner); + stmt.setString(2, tbl); + + try (ResultSet pkRs = stmt.executeQuery()) { + while(pkRs.next()) + pkCols.add(pkRs.getString(1)); + } + + return pkCols; + } + + /** + * Retrieve index columns. + * + * @param stmt Prepared SQL statement to execute. + * @param owner DB owner. + * @param tbl Table name. + * @return Index columns. + * @throws SQLException If failed to retrieve indexes columns. + */ + private Map<String, Map<String, Boolean>> indexes(PreparedStatement stmt, String owner, String tbl) + throws SQLException { + Map<String, Map<String, Boolean>> idxs = new LinkedHashMap<>(); + + stmt.setString(1, owner); + stmt.setString(2, tbl); + + try (ResultSet idxsRs = stmt.executeQuery()) { + while (idxsRs.next()) { + String idxName = idxsRs.getString(IDX_NAME_IDX); + + Map<String, Boolean> idx = idxs.get(idxName); + + if (idx == null) { + idx = new LinkedHashMap<>(); + + idxs.put(idxName, idx); + } + + String expr = idxsRs.getString(IDX_EXPR_IDX); + + String col = expr == null ? idxsRs.getString(IDX_COL_NAME_IDX) : expr.replaceAll("\"", ""); + + idx.put(col, "DESC".equals(idxsRs.getString(IDX_COL_DESCEND_IDX))); + } + } + + return idxs; + } + + /** {@inheritDoc} */ + @Override public Collection<DbTable> tables(Connection conn, List<String> schemas, boolean tblsOnly) + throws SQLException { + Collection<DbTable> tbls = new ArrayList<>(); + + PreparedStatement pkStmt = conn.prepareStatement(SQL_PRIMARY_KEYS); + + PreparedStatement idxStmt = conn.prepareStatement(SQL_INDEXES); + + if (schemas.size() == 0) + schemas.add(null); + + Set<String> sysSchemas = systemSchemas(); + + try (Statement colsStmt = conn.createStatement()) { + for (String schema: schemas) { + if (systemSchemas().contains(schema) || (schema != null && schema.startsWith("FLOWS_"))) + continue; + + Collection<DbColumn> cols = new ArrayList<>(); + + Set<String> pkCols = Collections.emptySet(); + Map<String, Map<String, Boolean>> idxs = Collections.emptyMap(); + + String sql = String.format(SQL_COLUMNS, + tblsOnly ? "INNER JOIN all_tables b on a.table_name = b.table_name and a.owner = b.owner" : "", + schema != null ? String.format(" WHERE a.owner = '%s' ", schema) : ""); + + try (ResultSet colsRs = colsStmt.executeQuery(sql)) { + String prevSchema = ""; + String prevTbl = ""; + + boolean first = true; + + while (colsRs.next()) { + String owner = colsRs.getString(OWNER_IDX); + String tbl = colsRs.getString(TBL_NAME_IDX); + + if (sysSchemas.contains(owner) || (schema != null && schema.startsWith("FLOWS_"))) + continue; + + boolean changed = !owner.equals(prevSchema) || !tbl.equals(prevTbl); + + if (changed) { + if (first) + first = false; + else + tbls.add(table(prevSchema, prevTbl, cols, idxs)); + + prevSchema = owner; + prevTbl = tbl; + cols = new ArrayList<>(); + pkCols = primaryKeys(pkStmt, owner, tbl); + idxs = indexes(idxStmt, owner, tbl); + } + + String colName = colsRs.getString(COL_NAME_IDX); + + cols.add(new DbColumn(colName, decodeType(colsRs), pkCols.contains(colName), + !"N".equals(colsRs.getString(NULLABLE_IDX)))); + } + + if (!cols.isEmpty()) + tbls.add(table(prevSchema, prevTbl, cols, idxs)); + } + } + } + + return tbls; + } - } ++} http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java ---------------------------------------------------------------------- diff --cc modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java index 126d2ab,3ecee53..940fd04 --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/parser/DatabaseMetadataParser.java @@@ -17,12 -17,27 +17,31 @@@ package org.apache.ignite.schema.parser; - import javafx.collections.*; - import org.apache.ignite.schema.model.*; + import java.sql.Connection; + import java.sql.SQLException; + import java.util.ArrayList; + import java.util.Collection; + import java.util.Collections; + import java.util.Comparator; + import java.util.HashMap; + import java.util.List; + import java.util.Map; + import java.util.logging.Level; + import java.util.logging.Logger; + import javafx.collections.FXCollections; + import javafx.collections.ObservableList; + import org.apache.ignite.schema.model.PojoDescriptor; + import org.apache.ignite.schema.model.SchemaDescriptor; + import org.apache.ignite.schema.parser.dialect.DB2MetadataDialect; + import org.apache.ignite.schema.parser.dialect.DatabaseMetadataDialect; + import org.apache.ignite.schema.parser.dialect.JdbcMetadataDialect; + import org.apache.ignite.schema.parser.dialect.MySQLMetadataDialect; + import org.apache.ignite.schema.parser.dialect.OracleMetadataDialect; +import java.sql.*; +import java.util.*; ++import java.util.logging.*; + /** * Database metadata parser. */ http://git-wip-us.apache.org/repos/asf/ignite/blob/c220bd72/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java ---------------------------------------------------------------------- diff --cc modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java index 810fec5,4f419e6..80a9bbf --- a/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java +++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java @@@ -17,31 -17,99 +17,79 @@@ package org.apache.ignite.schema.ui; - import javafx.application.*; - import javafx.beans.value.*; - import javafx.collections.*; - import javafx.concurrent.*; - import javafx.event.*; - import javafx.geometry.*; - import javafx.scene.*; - import javafx.scene.control.*; - import javafx.scene.layout.*; - import javafx.stage.*; - import javafx.util.*; - import org.apache.ignite.internal.util.typedef.internal.*; - import org.apache.ignite.schema.generator.*; - import org.apache.ignite.schema.model.*; - import org.apache.ignite.schema.parser.*; + import java.io.BufferedInputStream; + import java.io.File; + import java.io.FileInputStream; + import java.io.FileOutputStream; + import java.io.IOException; + import java.net.URL; + import java.net.URLClassLoader; + import java.sql.Connection; + import java.sql.Driver; + import java.sql.SQLException; + import java.util.ArrayList; + import java.util.Collection; + import java.util.HashMap; + import java.util.List; + import java.util.Map; + import java.util.Properties; + import java.util.concurrent.ExecutorService; + import java.util.concurrent.Executors; + import java.util.concurrent.ThreadFactory; + import java.util.logging.Level; + import java.util.logging.Logger; + import javafx.application.Application; + import javafx.application.Platform; + import javafx.beans.value.ChangeListener; + import javafx.beans.value.ObservableValue; + import javafx.collections.FXCollections; + import javafx.collections.ObservableList; + import javafx.concurrent.Task; + import javafx.event.ActionEvent; + import javafx.event.EventHandler; + import javafx.geometry.Insets; + import javafx.geometry.Pos; + import javafx.geometry.VPos; + import javafx.scene.Node; + import javafx.scene.control.Button; + import javafx.scene.control.CheckBox; + import javafx.scene.control.ComboBox; + import javafx.scene.control.Label; + import javafx.scene.control.ListView; + import javafx.scene.control.PasswordField; + import javafx.scene.control.ProgressIndicator; + import javafx.scene.control.TableCell; + import javafx.scene.control.TableColumn; + import javafx.scene.control.TableRow; + import javafx.scene.control.TableView; + import javafx.scene.control.TextField; + import javafx.scene.control.TitledPane; + import javafx.scene.layout.BorderPane; + import javafx.scene.layout.HBox; + import javafx.scene.layout.Pane; + import javafx.scene.layout.Priority; + import javafx.scene.layout.StackPane; + import javafx.stage.DirectoryChooser; + import javafx.stage.FileChooser; + import javafx.stage.Screen; + import javafx.stage.Stage; + import javafx.util.Callback; + import org.apache.ignite.internal.util.typedef.internal.U; + import org.apache.ignite.schema.generator.CodeGenerator; + import org.apache.ignite.schema.generator.XmlGenerator; + import org.apache.ignite.schema.model.PojoDescriptor; + import org.apache.ignite.schema.model.PojoField; + import org.apache.ignite.schema.model.SchemaDescriptor; + import org.apache.ignite.schema.parser.DatabaseMetadataParser; -import static javafx.embed.swing.SwingFXUtils.fromFXImage; -import static org.apache.ignite.schema.ui.Controls.booleanColumn; -import static org.apache.ignite.schema.ui.Controls.borderPane; -import static org.apache.ignite.schema.ui.Controls.button; -import static org.apache.ignite.schema.ui.Controls.buttonsPane; -import static org.apache.ignite.schema.ui.Controls.checkBox; -import static org.apache.ignite.schema.ui.Controls.comboBox; -import static org.apache.ignite.schema.ui.Controls.customColumn; -import static org.apache.ignite.schema.ui.Controls.hBox; -import static org.apache.ignite.schema.ui.Controls.image; -import static org.apache.ignite.schema.ui.Controls.imageView; -import static org.apache.ignite.schema.ui.Controls.label; -import static org.apache.ignite.schema.ui.Controls.list; -import static org.apache.ignite.schema.ui.Controls.paneEx; -import static org.apache.ignite.schema.ui.Controls.passwordField; -import static org.apache.ignite.schema.ui.Controls.progressIndicator; -import static org.apache.ignite.schema.ui.Controls.scene; -import static org.apache.ignite.schema.ui.Controls.splitPane; -import static org.apache.ignite.schema.ui.Controls.stackPane; -import static org.apache.ignite.schema.ui.Controls.tableColumn; -import static org.apache.ignite.schema.ui.Controls.tableView; -import static org.apache.ignite.schema.ui.Controls.text; -import static org.apache.ignite.schema.ui.Controls.textColumn; -import static org.apache.ignite.schema.ui.Controls.textField; -import static org.apache.ignite.schema.ui.Controls.titledPane; -import static org.apache.ignite.schema.ui.Controls.tooltip; -import static org.apache.ignite.schema.ui.Controls.vBox; +import java.io.*; ++import java.net.*; +import java.sql.*; +import java.util.*; ++import java.util.List; +import java.util.concurrent.*; +import java.util.logging.*; - import static javafx.embed.swing.SwingFXUtils.*; - import static org.apache.ignite.schema.ui.Controls.*; - /** * Schema Import utility application. */
