ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: # IGNITE-330 Removed %IGNITE_HOME% from schema-import.properties.
Date Mon, 23 Mar 2015 14:55:41 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-45 6e2dbd9c6 -> a34d786e3


# IGNITE-330 Removed %IGNITE_HOME% from schema-import.properties.


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

Branch: refs/heads/ignite-45
Commit: a34d786e3a52fe4e219d1d938433eee3100a70b4
Parents: 6e2dbd9
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Mar 23 21:55:44 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Mar 23 21:55:44 2015 +0700

----------------------------------------------------------------------
 .../schema-import/bin/schema-import.properties  |  4 +--
 .../ignite/schema/ui/SchemaImportApp.java       | 34 +++++++++++++-------
 2 files changed, 25 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a34d786e/examples/schema-import/bin/schema-import.properties
----------------------------------------------------------------------
diff --git a/examples/schema-import/bin/schema-import.properties b/examples/schema-import/bin/schema-import.properties
index c2ee5e9..5d31965 100644
--- a/examples/schema-import/bin/schema-import.properties
+++ b/examples/schema-import/bin/schema-import.properties
@@ -19,10 +19,10 @@
 #  Predefined properties for Ignite Schema Import Demo
 #
 jdbc.db.preset=0
-jdbc.driver.jar=%IGNITE_HOME%/libs/ignite-indexing/h2-1.3.175.jar
+jdbc.driver.jar=libs/ignite-indexing/h2-1.3.175.jar
 jdbc.driver.class=org.h2.Driver
 jdbc.url=jdbc:h2:tcp://localhost/~/schema-import/demo
 jdbc.user=sa
-out.folder=%IGNITE_HOME%/examples/schema-import/src/main/java
+out.folder=examples/schema-import/src/main/java
 pojo.package=org.apache.ignite.schema
 pojo.constructor=true

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a34d786e/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 8db54ad..3dfc471 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
@@ -29,7 +29,6 @@ import javafx.scene.control.*;
 import javafx.scene.layout.*;
 import javafx.stage.*;
 import javafx.util.*;
-import org.apache.ignite.internal.util.io.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.schema.generator.*;
 import org.apache.ignite.schema.model.*;
@@ -1305,6 +1304,26 @@ public class SchemaImportApp extends Application {
         prefs.put(key, String.valueOf(val));
     }
 
+    /**
+     * Resolve path.
+     *
+     * @param key Preferences key.
+     * @param dflt Default value.
+     * @return String with full file path or default value.
+     */
+    private String resolveFilePath(String key, String dflt) {
+        String path = prefs.getProperty(key);
+
+        if (path != null) {
+            File file = U.resolveIgnitePath(path);
+
+            if (file != null)
+                return file.getAbsolutePath();
+        }
+
+        return dflt;
+    }
+
     /** {@inheritDoc} */
     @Override public void start(Stage primaryStage) {
         owner = primaryStage;
@@ -1341,14 +1360,7 @@ public class SchemaImportApp extends Application {
                         log.log(Level.SEVERE, "Failed to load custom preferences.", e);
                     }
 
-                    String igniteHome = GridFilenameUtils.separatorsToUnix(U.getIgniteHome());
-
-                    for (Map.Entry<Object, Object> prop : customPrefs.entrySet()) {
-                        String key = prop.getKey().toString();
-                        String val = prop.getValue().toString().replaceAll("%IGNITE_HOME%",
igniteHome);
-
-                        prefs.setProperty(key, val);
-                    }
+                    prefs.putAll(customPrefs);
                 }
             }
         }
@@ -1413,13 +1425,13 @@ public class SchemaImportApp extends Application {
 
         // Restore connection pane settings.
         rdbmsCb.getSelectionModel().select(getIntProp(PREF_JDBC_DB_PRESET, 0));
-        jdbcDrvJarTf.setText(getStringProp(PREF_JDBC_DRIVER_JAR, "h2.jar"));
+        jdbcDrvJarTf.setText(resolveFilePath(PREF_JDBC_DRIVER_JAR, "h2.jar"));
         jdbcDrvClsTf.setText(getStringProp(PREF_JDBC_DRIVER_CLASS, "org.h2.Driver"));
         jdbcUrlTf.setText(getStringProp(PREF_JDBC_URL, "jdbc:h2:" + userHome + "/ignite-schema-import/db"));
         userTf.setText(getStringProp(PREF_JDBC_USER, "sa"));
 
         // Restore generation pane settings.
-        outFolderTf.setText(getStringProp(PREF_OUT_FOLDER, userHome + "/ignite-schema-import/out"));
+        outFolderTf.setText(resolveFilePath(PREF_OUT_FOLDER, userHome + "/ignite-schema-import/out"));
 
         pkgTf.setText(getStringProp(PREF_POJO_PACKAGE, "org.apache.ignite"));
         pojoIncludeKeysCh.setSelected(getBoolProp(PREF_POJO_INCLUDE, true));


Mime
View raw message