ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/9] incubator-ignite git commit: # IGNITE-411 Fixed compatibility with java 8. Removed dependency from ignite-core.
Date Mon, 16 Mar 2015 08:36:09 GMT
# IGNITE-411 Fixed compatibility with java 8. Removed dependency from ignite-core.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8749696c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8749696c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8749696c

Branch: refs/heads/ignite-gg-9858
Commit: 8749696c12202d4d0dd403266bddf478e3bf07c6
Parents: 6f5944c
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Mar 13 14:33:00 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Mar 13 14:33:00 2015 +0700

----------------------------------------------------------------------
 bin/ignite-schema-import.bat                    | 25 ++-------
 bin/ignite-schema-import.sh                     | 13 +----
 modules/schema-import/pom.xml                   |  6 ---
 .../schema-import/src/main/java/media/style.css |  1 +
 .../ignite/schema/generator/XmlGenerator.java   | 28 +++++-----
 .../apache/ignite/schema/model/IndexItem.java   | 54 ++++++++++++++++++++
 .../ignite/schema/model/PojoDescriptor.java     |  9 ++--
 .../ignite/schema/ui/SchemaImportApp.java       | 52 +++++++++++++------
 .../schema/test/AbstractSchemaImportTest.java   | 19 +++++--
 9 files changed, 130 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/bin/ignite-schema-import.bat
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.bat b/bin/ignite-schema-import.bat
index d5fa644..7cac917 100644
--- a/bin/ignite-schema-import.bat
+++ b/bin/ignite-schema-import.bat
@@ -70,37 +70,18 @@ set IGNITE_HOME=%IGNITE_HOME:~0,-1%
 goto checkIgniteHome2
 
 :checkIgniteHome3
-if exist "%IGNITE_HOME%\config" goto checkIgniteHome4
+if exist "%IGNITE_HOME%\config" goto run
     echo %0, ERROR: Ignite installation folder is not found or IGNITE_HOME environment variable
is not valid.
     echo Please create IGNITE_HOME environment variable pointing to location of
     echo Ignite installation folder.
     goto error_finish
 
-:checkIgniteHome4
-
-::
-:: Set SCRIPTS_HOME - base path to scripts.
-::
-set SCRIPTS_HOME=%IGNITE_HOME%\bin
-
-:: Remove trailing spaces
-for /l %%a in (1,1,31) do if /i "%SCRIPTS_HOME:~-1%" == " " set SCRIPTS_HOME=%SCRIPTS_HOME:~0,-1%
-
-if /i "%SCRIPTS_HOME%\" == "%~dp0" goto run
-    echo %0, WARN: IGNITE_HOME environment variable may be pointing to wrong folder: %IGNITE_HOME%
-
 :run
 
 ::
-:: Set IGNITE_LIBS
-::
-call "%SCRIPTS_HOME%\include\setenv.bat"
-call "%SCRIPTS_HOME%\include\target-classpath.bat" &:: Will be removed in release.
-
-::
-:: Set CLASS PATH
+:: Set CLASS PATH.
 ::
-set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_LIBS%;%IGNITE_HOME%\bin\include\schema-import\*
+set CP=%JAVA_HOME%\jre\lib\jfxrt.jar;%IGNITE_HOME%\bin\include\schema-import\*
 
 ::
 :: JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more
details.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/bin/ignite-schema-import.sh
----------------------------------------------------------------------
diff --git a/bin/ignite-schema-import.sh b/bin/ignite-schema-import.sh
index cac38c4..b4a062c 100644
--- a/bin/ignite-schema-import.sh
+++ b/bin/ignite-schema-import.sh
@@ -29,13 +29,6 @@ if [ "${IGNITE_HOME}" = "" ];
 fi
 
 #
-# Set SCRIPTS_HOME - base path to scripts.
-#
-SCRIPTS_HOME="${IGNITE_HOME_TMP}/bin"
-
-source "${SCRIPTS_HOME}"/include/functions.sh
-
-#
 # Discover path to Java executable and check it's version.
 #
 checkJava
@@ -46,11 +39,9 @@ checkJava
 setIgniteHome
 
 #
-# Set IGNITE_LIBS.
+# Set CLASS PATH.
 #
-. "${SCRIPTS_HOME}"/include/setenv.sh
-. "${SCRIPTS_HOME}"/include/target-classpath.sh # Will be removed in release.
-CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_LIBS}${SEP}${IGNITE_HOME}/bin/include/schema-import/*"
+CP="${JAVA_HOME}/jre/lib/jfxrt.jar${SEP}${IGNITE_HOME}/bin/include/schema-import/*"
 
 # Mac OS specific support to display correct name in the dock.
 osname=`uname`

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/pom.xml
----------------------------------------------------------------------
diff --git a/modules/schema-import/pom.xml b/modules/schema-import/pom.xml
index 8186fd3..3e8d32c 100644
--- a/modules/schema-import/pom.xml
+++ b/modules/schema-import/pom.xml
@@ -37,12 +37,6 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.apache.ignite</groupId>
-            <artifactId>ignite-core</artifactId>
-            <version>${ignite.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>com.h2database</groupId>
             <artifactId>h2</artifactId>
             <version>1.3.175</version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/src/main/java/media/style.css
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/media/style.css b/modules/schema-import/src/main/java/media/style.css
index 94ba240..1a7bf2a 100644
--- a/modules/schema-import/src/main/java/media/style.css
+++ b/modules/schema-import/src/main/java/media/style.css
@@ -58,6 +58,7 @@
 
 .table-view {
     -fx-focus-color: gray;
+    -fx-font-size: 14;
 }
 
 .table-view .table-row-cell:selected {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
index f062dc2..0c9e78f 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/XmlGenerator.java
@@ -17,8 +17,6 @@
 
 package org.apache.ignite.schema.generator;
 
-import org.apache.ignite.cache.*;
-import org.apache.ignite.lang.*;
 import org.apache.ignite.schema.model.*;
 import org.apache.ignite.schema.ui.*;
 import org.w3c.dom.*;
@@ -67,12 +65,12 @@ public class XmlGenerator {
      *
      * @param doc XML document.
      * @param parent Parent XML node.
-     * @param clazz Bean class.
+     * @param cls Bean class name.
      */
-    private static Element addBean(Document doc, Node parent, Class<?> clazz) {
+    private static Element addBean(Document doc, Node parent, String cls) {
         Element elem = doc.createElement("bean");
 
-        elem.setAttribute("class", clazz.getName());
+        elem.setAttribute("class", cls);
 
         parent.appendChild(elem);
 
@@ -156,7 +154,7 @@ public class XmlGenerator {
             Element list = addElement(doc, prop, "list");
 
             for (PojoField field : fields) {
-                Element item = addBean(doc, list, CacheTypeFieldMetadata.class);
+                Element item = addBean(doc, list, "org.apache.ignite.cache.CacheTypeFieldMetadata");
 
                 addProperty(doc, item, "databaseName", field.dbName());
                 Element dbType = addProperty(doc, item, "databaseType", null);
@@ -194,28 +192,28 @@ public class XmlGenerator {
      * @param groups Map with indexes.
      */
     private static void addQueryGroups(Document doc, Node parent,
-        Map<String, Map<String, IgniteBiTuple<String, Boolean>>> groups)
{
+        Map<String, Map<String, IndexItem>> groups) {
         if (!groups.isEmpty()) {
             Element prop = addProperty(doc, parent, "groups", null);
 
             Element map = addElement(doc, prop, "map");
 
-            for (Map.Entry<String, Map<String, IgniteBiTuple<String, Boolean>>>
group : groups.entrySet()) {
+            for (Map.Entry<String, Map<String, IndexItem>> group : groups.entrySet())
{
                 Element entry1 = addElement(doc, map, "entry", "key", group.getKey());
 
                 Element val1 = addElement(doc, entry1, "map");
 
-                Map<String, IgniteBiTuple<String, Boolean>> fields = group.getValue();
+                Map<String, IndexItem> fields = group.getValue();
 
-                for (Map.Entry<String, IgniteBiTuple<String, Boolean>> field
: fields.entrySet()) {
+                for (Map.Entry<String, IndexItem> field : fields.entrySet()) {
                     Element entry2 = addElement(doc, val1, "entry", "key", field.getKey());
 
-                    Element val2 = addBean(doc, entry2, IgniteBiTuple.class);
+                    Element val2 = addBean(doc, entry2, "org.apache.ignite.lang.IgniteBiTuple");
 
-                    IgniteBiTuple<String, Boolean> idx = field.getValue();
+                    IndexItem idx = field.getValue();
 
-                    addElement(doc, val2, "constructor-arg", null, null, "value", idx.get1());
-                    addElement(doc, val2, "constructor-arg", null, null, "value", String.valueOf(idx.get2()));
+                    addElement(doc, val2, "constructor-arg", null, null, "value", idx.name());
+                    addElement(doc, val2, "constructor-arg", null, null, "value", String.valueOf(idx.descending()));
                 }
             }
         }
@@ -231,7 +229,7 @@ public class XmlGenerator {
      */
     private static void addTypeMetadata(Document doc, Node parent, String pkg, PojoDescriptor
pojo,
         boolean includeKeys) {
-        Element bean = addBean(doc, parent, CacheTypeMetadata.class);
+        Element bean = addBean(doc, parent, "org.apache.ignite.cache.CacheTypeMetadata");
 
         addProperty(doc, bean, "databaseSchema", pojo.schema());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/src/main/java/org/apache/ignite/schema/model/IndexItem.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/IndexItem.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/IndexItem.java
new file mode 100644
index 0000000..1a0868d
--- /dev/null
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/IndexItem.java
@@ -0,0 +1,54 @@
+/*
+ * 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.model;
+
+/**
+ * Index item descriptor.
+ */
+public class IndexItem {
+    /** Column name. */
+    private final String name;
+
+    /** Sort direction. */
+    private final Boolean desc;
+
+    /**
+     * Constructor.
+     *
+     * @param name Column name.
+     * @param desc Sort direction.
+     */
+    public IndexItem(String name, Boolean desc) {
+        this.name = name;
+        this.desc = desc;
+    }
+
+    /**
+     * @return Column name.
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * @return Sort direction.
+     */
+    public Boolean descending() {
+        return desc;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
index 9f3322b..3807f4f 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/model/PojoDescriptor.java
@@ -20,7 +20,6 @@ package org.apache.ignite.schema.model;
 import javafx.beans.property.*;
 import javafx.beans.value.*;
 import javafx.collections.*;
-import org.apache.ignite.lang.*;
 import org.apache.ignite.schema.parser.*;
 
 import java.math.*;
@@ -306,24 +305,24 @@ public class PojoDescriptor {
     /**
      * Gets indexes groups.
      */
-    public Map<String, Map<String, IgniteBiTuple<String, Boolean>>> groups()
{
+    public Map<String, Map<String, IndexItem>> groups() {
         Map<String, Map<String, Boolean>> idxs = tbl.indexes();
 
-        Map<String, Map<String, IgniteBiTuple<String, Boolean>>> groups
= new LinkedHashMap<>(idxs.size());
+        Map<String, Map<String, IndexItem>> groups = new LinkedHashMap<>(idxs.size());
 
         for (Map.Entry<String, Map<String, Boolean>> idx : idxs.entrySet()) {
             String idxName = idx.getKey();
 
             Map<String, Boolean> idxCols = idx.getValue();
 
-            Map<String, IgniteBiTuple<String, Boolean>> grp = new LinkedHashMap<>();
+            Map<String, IndexItem> grp = new LinkedHashMap<>();
 
             groups.put(idxName, grp);
 
             for (Map.Entry<String, Boolean> idxCol : idxCols.entrySet()) {
                 PojoField fld = fieldsMap.get(idxCol.getKey());
 
-                grp.put(fld.javaName(), new IgniteBiTuple<>(fld.javaTypeName(), idxCol.getValue()));
+                grp.put(fld.javaName(), new IndexItem(fld.javaTypeName(), idxCol.getValue()));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/src/main/java/org/apache/ignite/schema/ui/SchemaImportApp.java
----------------------------------------------------------------------
diff --git 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
index 365ea07..bbd5f3f 100644
--- 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
@@ -1530,6 +1530,12 @@ public class SchemaImportApp extends Application {
             };
         }
 
+        /** Previous POJO bound to cell. */
+        private PojoDescriptor prevPojo;
+
+        /** Previous cell graphic. */
+        private Pane prevGraphic;
+
         /** {@inheritDoc} */
         @Override public void updateItem(Boolean item, boolean empty) {
             super.updateItem(item, empty);
@@ -1543,20 +1549,25 @@ public class SchemaImportApp extends Application {
                     final PojoDescriptor pojo = (PojoDescriptor)row.getItem();
 
                     if (pojo != null) {
-                        boolean isTbl = pojo.parent() != null;
+                        if (prevGraphic == null || pojo != prevPojo) {
+                            boolean isTbl = pojo.parent() != null;
 
-                        CheckBox ch = new CheckBox();
-                        ch.setAllowIndeterminate(false);
-                        ch.indeterminateProperty().bindBidirectional(pojo.indeterminate());
-                        ch.selectedProperty().bindBidirectional(pojo.useProperty());
+                            CheckBox ch = new CheckBox();
+                            ch.setAllowIndeterminate(false);
+                            ch.indeterminateProperty().bindBidirectional(pojo.indeterminate());
+                            ch.selectedProperty().bindBidirectional(pojo.useProperty());
 
-                        Label lb = new Label(isTbl ? pojo.table() : pojo.schema());
+                            Label lb = new Label(isTbl ? pojo.table() : pojo.schema());
 
-                        Pane pnl = new HBox(5);
-                        pnl.setPadding(new Insets(0, 0, 0, isTbl ? 25 : 5));
-                        pnl.getChildren().addAll(ch, lb);
+                            Pane pnl = new HBox(5);
+                            pnl.setPadding(new Insets(0, 0, 0, isTbl ? 25 : 5));
+                            pnl.getChildren().addAll(ch, lb);
+
+                            prevPojo = pojo;
+                            prevGraphic = pnl;
+                        }
 
-                        setGraphic(pnl);
+                        setGraphic(prevGraphic);
                     }
                 }
             }
@@ -1576,6 +1587,12 @@ public class SchemaImportApp extends Application {
             };
         }
 
+        /** Previous POJO field bound to cell. */
+        private PojoField prevField;
+
+        /** Previous cell graphic. */
+        private CheckBox prevGraphic;
+
         /** {@inheritDoc} */
         @Override public void updateItem(Boolean item, boolean empty) {
             super.updateItem(item, empty);
@@ -1589,13 +1606,18 @@ public class SchemaImportApp extends Application {
                     final PojoField field = (PojoField)row.getItem();
 
                     if (field != null) {
-                        setAlignment(Pos.CENTER);
+                        if (prevGraphic == null || prevField != field) {
+                            setAlignment(Pos.CENTER);
 
-                        CheckBox ch = new CheckBox();
-                        ch.setDisable(!field.nullable());
-                        ch.selectedProperty().bindBidirectional(field.useProperty());
+                            CheckBox ch = new CheckBox();
+                            ch.setDisable(!field.nullable());
+                            ch.selectedProperty().bindBidirectional(field.useProperty());
+
+                            prevField = field;
+                            prevGraphic = ch;
+                        }
 
-                        setGraphic(ch);
+                        setGraphic(prevGraphic);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8749696c/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
index 0c3ecb1..09b50c9 100644
--- a/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
+++ b/modules/schema-import/src/test/java/org/apache/ignite/schema/test/AbstractSchemaImportTest.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.schema.test;
 
 import junit.framework.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.schema.model.PojoDescriptor;
 import org.apache.ignite.schema.parser.DatabaseMetadataParser;
 import org.apache.ignite.schema.ui.*;
@@ -49,6 +48,20 @@ public abstract class AbstractSchemaImportTest extends TestCase {
     /** List of generated for test database POJO objects. */
     protected List<PojoDescriptor> pojos;
 
+    /**
+     * Quietly closes given resource ignoring possible checked exception.
+     *
+     * @param rsrc Resource to close.
+     */
+    private void closeQuiet(AutoCloseable rsrc) {
+        try {
+            rsrc.close();
+        }
+        catch (Exception ignored) {
+            // No-op.
+        }
+    }
+
     /** {@inheritDoc} */
     @Override public void setUp() throws Exception {
         Class.forName("org.h2.Driver");
@@ -91,11 +104,11 @@ public abstract class AbstractSchemaImportTest extends TestCase {
 
         conn.commit();
 
-        U.closeQuiet(stmt);
+        closeQuiet(stmt);
 
         pojos = DatabaseMetadataParser.parse(conn, false);
 
-        U.closeQuiet(conn);
+        closeQuiet(conn);
     }
 
     /**


Mime
View raw message