ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivasilin...@apache.org
Subject incubator-ignite git commit: #ignite-964: wip
Date Thu, 02 Jul 2015 21:20:48 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-964-1 a8e42e97a -> 1c2fc8975


#ignite-964: wip


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

Branch: refs/heads/ignite-964-1
Commit: 1c2fc89750fd4f9a4f91b7d21ff5a81186fef1c6
Parents: a8e42e9
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Jul 3 00:20:50 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Jul 3 00:20:50 2015 +0300

----------------------------------------------------------------------
 modules/core/pom.xml                            |   6 --
 .../handlers/scripting/JSONCacheObject.java     | 108 ++++++++++++++++++-
 .../rest/handlers/scripting/NodeJsCache.java    |   9 +-
 modules/nodejs/src/test/js/test-compute.js      |  24 +++--
 4 files changed, 122 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c2fc897/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 09263ed..c7cb953 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -55,12 +55,6 @@
         </dependency>
 
         <dependency>
-            <groupId>javax.json</groupId>
-            <artifactId>javax.json-api</artifactId>
-            <version>1.0</version>
-        </dependency>
-
-        <dependency>
             <groupId>commons-cli</groupId>
             <artifactId>commons-cli</artifactId>
             <version>1.2</version>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c2fc897/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
index 6f0e2f8..ec19c50 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/JSONCacheObject.java
@@ -17,14 +17,15 @@
 
 package org.apache.ignite.internal.processors.rest.handlers.scripting;
 
+import jdk.nashorn.api.scripting.JSObject;
 
-import javax.json.*;
 import java.util.*;
 
 /**
  * Json cache object.
  */
-public class JSONCacheObject extends HashMap<Object, Object> {
+public class JSONCacheObject implements JSObject {
+    Map <Object, Object> fields = new HashMap<Object, Object>();
     /**
      * Empty constructor.
      */
@@ -39,12 +40,22 @@ public class JSONCacheObject extends HashMap<Object, Object> {
             addField(toSimpleObject(key), toSimpleObject(o.get(key)));
     }
 
+    @Override public int hashCode() {
+        return fields.hashCode();
+    }
+
+    @Override public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof JSONCacheObject))
+            return false;
+        return fields.equals(((JSONCacheObject)obj).fields);
+    }
+
     /**
      * @param key Field name.
      * @param val Field value.
      */
     public void addField(Object key, Object val) {
-        put(key, val);
+        fields.put(key, val);
     }
 
     /**
@@ -52,7 +63,7 @@ public class JSONCacheObject extends HashMap<Object, Object> {
      * @return Field value.
      */
     public Object getField(Object key) {
-        return get(key);
+        return fields.get(key);
     }
 
     /**
@@ -85,4 +96,93 @@ public class JSONCacheObject extends HashMap<Object, Object> {
 
         return o;
     }
+
+    @Override public Object call(Object o, Object... objects) {
+        return null;
+    }
+
+    @Override public Object newObject(Object... objects) {
+        return null;
+    }
+
+    @Override public Object eval(String s) {
+        return null;
+    }
+
+    @Override public Object getMember(String s) {
+        return fields.get(s);
+    }
+
+    @Override public Object getSlot(int i) {
+        return null;
+    }
+
+    @Override public boolean hasMember(String s) {
+        return fields.containsKey(s);
+    }
+
+    @Override
+    public boolean hasSlot(int i) {
+        return false;
+    }
+
+    @Override
+    public void removeMember(String s) {
+
+    }
+
+    @Override
+    public void setMember(String s, Object o) {
+
+    }
+
+    @Override
+    public void setSlot(int i, Object o) {
+
+    }
+
+    @Override
+    public Set<String> keySet() {
+        return null;
+    }
+
+    @Override
+    public Collection<Object> values() {
+        return fields.values();
+    }
+
+    @Override
+    public boolean isInstance(Object o) {
+        return false;
+    }
+
+    @Override
+    public boolean isInstanceOf(Object o) {
+        return false;
+    }
+
+    @Override
+    public String getClassName() {
+        return null;
+    }
+
+    @Override
+    public boolean isFunction() {
+        return false;
+    }
+
+    @Override
+    public boolean isStrictFunction() {
+        return false;
+    }
+
+    @Override
+    public boolean isArray() {
+        return false;
+    }
+
+    @Override
+    public double toNumber() {
+        return 0;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c2fc897/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
index 2941e7e..7717feb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/scripting/NodeJsCache.java
@@ -19,8 +19,6 @@ package org.apache.ignite.internal.processors.rest.handlers.scripting;
 
 import org.apache.ignite.*;
 
-import javax.json.*;
-
 /**
  * Node js cache.
  */
@@ -52,10 +50,7 @@ public class NodeJsCache {
     public Object get(Object key) {
         Object cacheKey = JSONCacheObject.toSimpleObject(key);
 
-        cache.get(cacheKey);
-
-
-        JsonObject value = Json.createObjectBuilder().add("BBB", "a").build();
-        return value;
+        Object res =  cache.get(cacheKey);
+        return res;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1c2fc897/modules/nodejs/src/test/js/test-compute.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/test/js/test-compute.js b/modules/nodejs/src/test/js/test-compute.js
index 41773f6..1cd17ad 100644
--- a/modules/nodejs/src/test/js/test-compute.js
+++ b/modules/nodejs/src/test/js/test-compute.js
@@ -141,24 +141,32 @@ function computeCacheExecute(error, ignite) {
     assert(error == null, "Error on put:" + error);
 
     var map = function(nodes, args) {
-        for (var i = 0; i < nodes.length; i++) {
+        for (var i = 0; i < 1; i++) {
             var f = function (args1) {
-                ignite.cache("mycache").put({"1": "1"}, 2);
+                print("IN FUNCTION");
+
+                ignite.cache("mycache").put({"1": "1"},  2);
+
+                print("PUT 1:1");
 
                 var val = ignite.cache("mycache").get({"1": "1"});
 
-                println("GET 1,1 = " + val);
+
+                print("Get 1:1");
+
+
+                print("GET 1,1 = " + val);
 
                 var val1 = ignite.cache("mycache").get(args1.get(0));
 
-                println("GET 1,2 = " + val1);
-                println("GET TYPE=" + (typeof val1));
-                println("GET TYPE=" + (Object.keys(val1)));
+                print("GET 1,2 = " + val1);
+                print("GET TYPE=" + (typeof val1));
 
-                println("GET TYPE=" + (val1.get("age")));
+                print("GET TYPE AGE=" + (val1["age"]));
+                print("GET TYPE AGE2=" + (val1.age));
 
                 var jsArgs = JSON.parse(args1);
-                println("!!!!jsArgs " + JSON.stringify(jsArgs[0]));
+                print("!!!!jsArgs " + JSON.stringify(jsArgs[0]));
                 println("ARG0=" + args1.get(0));
                 var cacheO = new org.apache.ignite.internal.processors.rest.protocols.http.jetty.JSONCacheObject(args1.get(0));
                 println("CACHE OBJ= " + cacheO);


Mime
View raw message