You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by iv...@apache.org on 2015/07/13 08:35:44 UTC

[43/50] [abbrv] incubator-ignite git commit: #ignite-964: remove unused functions.

#ignite-964: remove unused functions.


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

Branch: refs/heads/ignite-961
Commit: 7d4f378c62b21cb5a708e88fa41a78c88a6aa87e
Parents: 3ab0552
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 10 18:41:47 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 10 18:41:47 2015 +0300

----------------------------------------------------------------------
 examples/src/main/js/compute-run-example.js     | 82 ++++++++++++++++++++
 examples/src/main/js/run-cache-script.js        | 82 --------------------
 .../IgniteScriptingCommandHandler.java          |  2 +-
 .../scripting/IgniteScriptingProcessor.java     |  8 --
 .../processors/scripting/ScriptingJsCache.java  | 13 ++--
 5 files changed, 89 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/examples/src/main/js/compute-run-example.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/compute-run-example.js b/examples/src/main/js/compute-run-example.js
new file mode 100644
index 0000000..18d5452
--- /dev/null
+++ b/examples/src/main/js/compute-run-example.js
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+
+var apacheIgnite = require("apache-ignite");
+var Ignition = apacheIgnite.Ignition;
+
+/**
+  * This example demonstrates very basic operations on cache in functions for Compute.run.
+  * <p>
+  * Remote nodes should always be started with special configuration file which
+  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
+  * <p>
+  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
+  * start node with {@code examples/config/js/example-js-cache.xml} configuration.
+  */
+function main() {
+    /** Cache name. */
+    var cacheName = "RunCacheScriptCache";
+
+    /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
+    Ignition.start(['127.0.0.1:9095'], null, onConnect);
+
+    function onConnect(err, ignite) {
+        if (err !== null)
+            throw "Start remote node with config examples/config/js/example-js-cache.xml.";
+
+        console.log(">>> Run cache script example started.");
+
+        ignite.getOrCreateCache(cacheName, function(err, cache) { runCacheScript(ignite, cache); });
+    }
+
+    function runCacheScript(ignite, cache) {
+        var key = "John";
+        var person = {"firstName": "John", "lastName": "Doe", "salary" : 2000};
+
+        // Store person in the cache
+        cache.put(key, person, onPut);
+
+        function onPut(err) {
+            var job = function (args) {
+                print(">>> Hello node: " + ignite.name());
+
+                var cacheName = args[0];
+                var key = args[1];
+
+                /** Get cache with name. */
+                var cache = ignite.cache(cacheName);
+
+                /** Get person with name John. */
+                var val = cache.get(key);
+
+                return val.salary;
+            }
+
+            var onRun = function(err, salary) {
+               console.log(">>> " + key + "'s salary is " + salary);
+
+               // Destroying cache.
+               ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); });
+            }
+
+            /** Run remote job on server ignite node with arguments [cacheName, key]. */
+            ignite.compute().run(job, [cacheName, key], onRun);
+        }
+    }
+}
+
+main();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/examples/src/main/js/run-cache-script.js
----------------------------------------------------------------------
diff --git a/examples/src/main/js/run-cache-script.js b/examples/src/main/js/run-cache-script.js
deleted file mode 100644
index 18d5452..0000000
--- a/examples/src/main/js/run-cache-script.js
+++ /dev/null
@@ -1,82 +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.
- */
-
-var apacheIgnite = require("apache-ignite");
-var Ignition = apacheIgnite.Ignition;
-
-/**
-  * This example demonstrates very basic operations on cache in functions for Compute.run.
-  * <p>
-  * Remote nodes should always be started with special configuration file which
-  * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/js/example-js-cache.xml'}.
-  * <p>
-  * Alternatively you can run ExampleJsNodeStartup in another JVM which will
-  * start node with {@code examples/config/js/example-js-cache.xml} configuration.
-  */
-function main() {
-    /** Cache name. */
-    var cacheName = "RunCacheScriptCache";
-
-    /** Connect to node that started with {@code examples/config/js/example-js-cache.xml} configuration. */
-    Ignition.start(['127.0.0.1:9095'], null, onConnect);
-
-    function onConnect(err, ignite) {
-        if (err !== null)
-            throw "Start remote node with config examples/config/js/example-js-cache.xml.";
-
-        console.log(">>> Run cache script example started.");
-
-        ignite.getOrCreateCache(cacheName, function(err, cache) { runCacheScript(ignite, cache); });
-    }
-
-    function runCacheScript(ignite, cache) {
-        var key = "John";
-        var person = {"firstName": "John", "lastName": "Doe", "salary" : 2000};
-
-        // Store person in the cache
-        cache.put(key, person, onPut);
-
-        function onPut(err) {
-            var job = function (args) {
-                print(">>> Hello node: " + ignite.name());
-
-                var cacheName = args[0];
-                var key = args[1];
-
-                /** Get cache with name. */
-                var cache = ignite.cache(cacheName);
-
-                /** Get person with name John. */
-                var val = cache.get(key);
-
-                return val.salary;
-            }
-
-            var onRun = function(err, salary) {
-               console.log(">>> " + key + "'s salary is " + salary);
-
-               // Destroying cache.
-               ignite.destroyCache(cacheName, function(err) { console.log(">>> End of run cache script example."); });
-            }
-
-            /** Run remote job on server ignite node with arguments [cacheName, key]. */
-            ignite.compute().run(job, [cacheName, key], onRun);
-        }
-    }
-}
-
-main();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
index 088e6be..dbfda37 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/IgniteScriptingCommandHandler.java
@@ -214,7 +214,7 @@ public class IgniteScriptingCommandHandler extends GridRestCommandHandlerAdapter
         public JsCallFunctionJob(IgniteScriptingProcessor proc, String func, Object argv) {
             this.func = func;
 
-            this.argv = proc.toScriptingObject(proc.toJavaObject(argv));
+            this.argv = proc.toJavaObject(argv);
         }
 
         /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 52847ec..b38c4c3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -150,14 +150,6 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
 
     /**
      * @param o Object.
-     * @return Object for script.
-     */
-    public Object toScriptingObject(Object o) {
-        return o;
-    }
-
-    /**
-     * @param o Object.
      * @return  Object for Ignite cache.
      */
     public Object toJavaObject(Object o) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7d4f378c/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
index e6c271c..a38a5b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingJsCache.java
@@ -58,7 +58,7 @@ public class ScriptingJsCache {
     public Object get(Object key) {
         Object cacheKey = proc.toJavaObject(key);
 
-        return proc.toScriptingObject(cache.get(cacheKey));
+        return cache.get(cacheKey);
     }
 
     /**
@@ -93,8 +93,7 @@ public class ScriptingJsCache {
         List<Object> res = new ArrayList<>();
 
         for (Map.Entry<Object, Object> e : entries.entrySet())
-            res.add(proc.createScriptingEntry(proc.toScriptingObject(e.getKey()),
-                proc.toScriptingObject(e.getValue())));
+            res.add(proc.createScriptingEntry(e.getKey(), e.getValue()));
 
         return res;
     }
@@ -131,7 +130,7 @@ public class ScriptingJsCache {
         Object cacheKey = proc.toJavaObject(key);
         Object cacheVal = proc.toJavaObject(val);
 
-        return proc.toScriptingObject(cache.getAndPut(cacheKey, cacheVal));
+        return cache.getAndPut(cacheKey, cacheVal);
     }
 
     /**
@@ -143,7 +142,7 @@ public class ScriptingJsCache {
         Object cacheKey = proc.toJavaObject(key);
         Object cacheVal = proc.toJavaObject(val);
 
-        Object o = proc.toScriptingObject(cache.getAndReplace(cacheKey, cacheVal));
+        Object o = cache.getAndReplace(cacheKey, cacheVal);
 
         return o;
     }
@@ -157,7 +156,7 @@ public class ScriptingJsCache {
         Object cacheKey = proc.toJavaObject(key);
         Object cacheVal = proc.toJavaObject(val);
 
-        return proc.toScriptingObject(cache.getAndPutIfAbsent(cacheKey, cacheVal));
+        return cache.getAndPutIfAbsent(cacheKey, cacheVal);
     }
 
     /**
@@ -167,7 +166,7 @@ public class ScriptingJsCache {
     public Object getAndRemove(Object key) {
         Object cacheKey = proc.toJavaObject(key);
 
-        return proc.toScriptingObject(cache.getAndRemove(cacheKey));
+        return cache.getAndRemove(cacheKey);
     }
 
     /**