You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/03/01 13:40:21 UTC

[28/37] incubator-ignite git commit: review ignite-311

review ignite-311


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

Branch: refs/heads/ignite-239
Commit: 9fb1eeb55e8eadf9190d0d675f65e5020543ad39
Parents: 2ef2271
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Feb 27 19:09:27 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Feb 27 19:09:27 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/GridProperties.java  | 79 --------------------
 .../ignite/internal/GridUpdateNotifier.java     |  2 +-
 .../apache/ignite/internal/IgniteKernal.java    |  2 +-
 .../ignite/internal/IgniteProperties.java       | 79 ++++++++++++++++++++
 .../ignite/internal/IgniteVersionUtils.java     |  8 +-
 .../plugin/IgnitePluginProcessor.java           | 37 +++------
 .../internal/GridUpdateNotifierSelfTest.java    |  2 +-
 7 files changed, 98 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/main/java/org/apache/ignite/internal/GridProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridProperties.java b/modules/core/src/main/java/org/apache/ignite/internal/GridProperties.java
deleted file mode 100644
index 89110af..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridProperties.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.ignite.internal;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * Ignite properties holder.
- */
-public class GridProperties {
-    /** Properties file path. */
-    private static final String FILE_PATH = "ignite.properties";
-
-    /** Properties. */
-    private static final Properties PROPS;
-
-    /**
-     *
-     */
-    static {
-        PROPS = new Properties();
-
-        readProperties(FILE_PATH, PROPS, true);
-    }
-
-    /**
-     * @param path Path.
-     * @param props Properties.
-     * @param throwExc Flag indicating whether to throw an exception or not.
-     */
-    public static void readProperties(String path, Properties props, boolean throwExc) {
-        try (InputStream is = IgniteVersionUtils.class.getClassLoader().getResourceAsStream(path)) {
-            if (is == null) {
-                if (throwExc)
-                    throw new RuntimeException("Failed to find properties file: " + path);
-                else
-                    return;
-            }
-
-            props.load(is);
-        }
-        catch (IOException e) {
-            throw new RuntimeException("Failed to read properties file: " + path, e);
-        }
-    }
-
-    /**
-     * Gets property value.
-     *
-     * @param key Property key.
-     * @return Property value (possibly empty string, but never {@code null}).
-     */
-    public static String get(String key) {
-        return PROPS.getProperty(key, "");
-    }
-
-    /**
-     *
-     */
-    private GridProperties() {
-        // No-op.
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java
index d1436a9..830481f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/GridUpdateNotifier.java
@@ -42,7 +42,7 @@ import static java.net.URLEncoder.*;
  */
 class GridUpdateNotifier {
     /** Access URL to be used to access latest version data. */
-    private static final String UPD_STATUS_PARAMS = GridProperties.get("ignite.update.status.params");
+    private static final String UPD_STATUS_PARAMS = IgniteProperties.get("ignite.update.status.params");
 
     /** Throttling for logging out. */
     private static final long THROTTLE_PERIOD = 24 * 60 * 60 * 1000; // 1 day.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index c21ceb3..9c92edd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -100,7 +100,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
     private static final long serialVersionUID = 0L;
 
     /** Compatible versions. */
-    private static final String COMPATIBLE_VERS = GridProperties.get("ignite.compatible.vers");
+    private static final String COMPATIBLE_VERS = IgniteProperties.get("ignite.compatible.vers");
 
     /** Ignite site that is shown in log messages. */
     static final String SITE = "www.gridgain.com";

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java
new file mode 100644
index 0000000..74c0ce4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteProperties.java
@@ -0,0 +1,79 @@
+/*
+ * 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;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ * Ignite properties holder.
+ */
+public class IgniteProperties {
+    /** Properties file path. */
+    private static final String FILE_PATH = "ignite.properties";
+
+    /** Properties. */
+    private static final Properties PROPS;
+
+    /**
+     *
+     */
+    static {
+        PROPS = new Properties();
+
+        readProperties(FILE_PATH, PROPS, true);
+    }
+
+    /**
+     * @param path Path.
+     * @param props Properties.
+     * @param throwExc Flag indicating whether to throw an exception or not.
+     */
+    public static void readProperties(String path, Properties props, boolean throwExc) {
+        try (InputStream is = IgniteVersionUtils.class.getClassLoader().getResourceAsStream(path)) {
+            if (is == null) {
+                if (throwExc)
+                    throw new RuntimeException("Failed to find properties file: " + path);
+                else
+                    return;
+            }
+
+            props.load(is);
+        }
+        catch (IOException e) {
+            throw new RuntimeException("Failed to read properties file: " + path, e);
+        }
+    }
+
+    /**
+     * Gets property value.
+     *
+     * @param key Property key.
+     * @return Property value (possibly empty string, but never {@code null}).
+     */
+    public static String get(String key) {
+        return PROPS.getProperty(key, "");
+    }
+
+    /**
+     *
+     */
+    private IgniteProperties() {
+        // No-op.
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
index 51668b6..3c47f23 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteVersionUtils.java
@@ -54,13 +54,13 @@ public class IgniteVersionUtils {
      * Static initializer.
      */
     static {
-        VER_STR = GridProperties.get("ignite.version");
+        VER_STR = IgniteProperties.get("ignite.version");
 
-        BUILD_TSTAMP = Long.valueOf(GridProperties.get("ignite.build"));
+        BUILD_TSTAMP = Long.valueOf(IgniteProperties.get("ignite.build"));
         BUILD_TSTAMP_STR = new SimpleDateFormat("yyyyMMdd").format(new Date(BUILD_TSTAMP * 1000));
 
-        REV_HASH_STR = GridProperties.get("ignite.revision");
-        RELEASE_DATE_STR = GridProperties.get("ignite.rel.date");
+        REV_HASH_STR = IgniteProperties.get("ignite.revision");
+        RELEASE_DATE_STR = IgniteProperties.get("ignite.rel.date");
 
         String rev = REV_HASH_STR.length() > 8 ? REV_HASH_STR.substring(0, 8) : REV_HASH_STR;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
index aca8fb8..05f227b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/plugin/IgnitePluginProcessor.java
@@ -42,9 +42,6 @@ public class IgnitePluginProcessor extends GridProcessorAdapter {
     /** */
     private volatile Map<Class<?>, Object[]> extensions;
 
-    /** Plugin information. */
-    public static final String PLUGIN_INFO = "Configured plugins: ";
-
     /**
      *
      * @param ctx Kernal context.
@@ -206,32 +203,22 @@ public class IgnitePluginProcessor extends GridProcessorAdapter {
     }
 
     /**
-     * Plugin information.
-     */
-    private String pluginInfo() {
-        Collection<PluginProvider> plugins = ctx.plugins().allProviders();
-
-        if (plugins.size() == 0)
-            return U.nl() + ">>>    " + PLUGIN_INFO + "none";
-
-        String info = U.nl() + ">>>    " + PLUGIN_INFO + U.nl();
-
-        for (PluginProvider plugin : plugins)
-            info += ">>>    " + plugin.name() + " " + plugin.version() + U.nl() +
-                ">>>    " + plugin.copyright();
-
-        return info;
-    }
-
-    /**
      * Print plugin information.
      */
     private void ackPluginsInfo() {
-        if (log.isQuiet())
-            U.quiet(false, pluginInfo().split(U.nl() + ">>> "));
+        U.quietAndInfo(log, "Configured plugins:");
 
-        if (log.isInfoEnabled())
-            log.info(pluginInfo());
+        if (plugins.isEmpty()) {
+            U.quietAndInfo(log, "  ^-- None");
+            U.quietAndInfo(log, "");
+        }
+        else {
+            for (PluginProvider plugin : plugins.values()) {
+                U.quietAndInfo(log, "  ^-- " + plugin.name() + " " + plugin.version());
+                U.quietAndInfo(log, "  ^-- " + plugin.copyright());
+                U.quietAndInfo(log, "");
+            }
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9fb1eeb5/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
index 8cc0b28..07bcf48 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
@@ -36,7 +36,7 @@ public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest {
      * @throws Exception If failed.
      */
     public void testNotifier() throws Exception {
-        GridUpdateNotifier ntf = new GridUpdateNotifier(null, GridProperties.get("ignite.version"),
+        GridUpdateNotifier ntf = new GridUpdateNotifier(null, IgniteProperties.get("ignite.version"),
             IgniteKernal.SITE, TEST_GATEWAY, false);
 
         ntf.checkForNewVersion(new SelfExecutor(), log);