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/17 09:30:57 UTC
incubator-ignite git commit: #ignite-961:
JettyRestProcessorAbstractSelfTest fix tests.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-961 b893af8ff -> e1aca64fc
#ignite-961: JettyRestProcessorAbstractSelfTest fix tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e1aca64f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e1aca64f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e1aca64f
Branch: refs/heads/ignite-961
Commit: e1aca64fcb4db462847076e82b3fb180f2b1a0a3
Parents: b893af8
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 17 10:30:51 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 17 10:30:51 2015 +0300
----------------------------------------------------------------------
.../http/jetty/GridJettyRestHandler.java | 36 ++++++++++----------
.../http/jetty/GridJettyRestProtocol.java | 2 +-
2 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1aca64f/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
index 1d40cbd..577a5e5 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestHandler.java
@@ -20,10 +20,10 @@ package org.apache.ignite.internal.processors.rest.protocols.http.jetty;
import net.sf.json.*;
import net.sf.json.processors.*;
import org.apache.ignite.*;
+import org.apache.ignite.internal.*;
import org.apache.ignite.internal.processors.rest.*;
import org.apache.ignite.internal.processors.rest.client.message.*;
import org.apache.ignite.internal.processors.rest.request.*;
-import org.apache.ignite.internal.processors.scripting.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
@@ -72,18 +72,18 @@ public class GridJettyRestHandler extends AbstractHandler {
/** Authentication checker. */
private final IgniteClosure<String, Boolean> authChecker;
- /** Ignite scripting processor. */
- IgniteScriptingProcessor proc;
+ /** Grid context. */
+ GridKernalContext ctx;
/**
* Creates new HTTP requests handler.
*
- * @param proc Scripting processor.
+ * @param ctx Grid context.
* @param hnd Handler.
* @param authChecker Authentication checking closure.
* @param log Logger.
*/
- GridJettyRestHandler(IgniteScriptingProcessor proc, GridRestProtocolHandler hnd,
+ GridJettyRestHandler(GridKernalContext ctx, GridRestProtocolHandler hnd,
IgniteClosure<String, Boolean> authChecker, IgniteLogger log) {
assert hnd != null;
assert log != null;
@@ -91,7 +91,7 @@ public class GridJettyRestHandler extends AbstractHandler {
this.hnd = hnd;
this.log = log;
this.authChecker = authChecker;
- this.proc = proc;
+ this.ctx = ctx;
// Init default page and favicon.
try {
@@ -338,7 +338,7 @@ public class GridJettyRestHandler extends AbstractHandler {
List<Object> res = new ArrayList<>();
for (Object k : o.keySet())
- res.add(proc.createScriptingEntry(k, o.get(k)));
+ res.add(ctx.scripting().createScriptingEntry(k, o.get(k)));
cmdRes.setResponse(res);
@@ -415,17 +415,17 @@ public class GridJettyRestHandler extends AbstractHandler {
String cacheName = (String)params.get("cacheName");
if (req.getHeader("JSONObject") != null) {
- Object o = proc.toJavaObject(parseRequest(req));
+ Object o = ctx.scripting().toJavaObject(parseRequest(req));
Map<Object, Object> map = new HashMap<>();
switch (cmd) {
case CACHE_PUT_ALL: {
- List entries = (List)proc.getField("entries", o);
+ List entries = (List)ctx.scripting().getField("entries", o);
for (Object entry : entries) {
- Object key = proc.getField("key", entry);
- Object val = proc.getField("value", entry);
+ Object key = ctx.scripting().getField("key", entry);
+ Object val = ctx.scripting().getField("value", entry);
map.put(key, val);
}
@@ -440,9 +440,9 @@ public class GridJettyRestHandler extends AbstractHandler {
case CACHE_GET_ALL:
case CACHE_REMOVE_ALL:
case CACHE_CONTAINS_KEYS: {
- Object cacheObj = proc.toJavaObject(o);
+ Object cacheObj = ctx.scripting().toJavaObject(o);
- List keys = (List)proc.getField("keys", cacheObj);
+ List keys = (List)ctx.scripting().getField("keys", cacheObj);
for (Object key : keys)
map.put(key, null);
@@ -466,13 +466,13 @@ public class GridJettyRestHandler extends AbstractHandler {
case CACHE_REPLACE:
case CACHE_GET_AND_REPLACE:
case CACHE_REPLACE_VALUE: {
- Object cacheObj = proc.toJavaObject(o);
+ Object cacheObj = ctx.scripting().toJavaObject(o);
restReq0.cacheName(F.isEmpty(cacheName) ? null : cacheName);
- restReq0.key(proc.getField("key", cacheObj));
- restReq0.value(proc.getField("val", cacheObj));
- restReq0.value2(proc.getField("oldVal", cacheObj));
+ restReq0.key(ctx.scripting().getField("key", cacheObj));
+ restReq0.value(ctx.scripting().getField("val", cacheObj));
+ restReq0.value2(ctx.scripting().getField("oldVal", cacheObj));
break;
}
@@ -595,7 +595,7 @@ public class GridJettyRestHandler extends AbstractHandler {
JSONObject o = parseRequest(req);
restReq0.argument(o.get("arg"));
- Object cacheObj = proc.toJavaObject(o.get("key"));
+ Object cacheObj = ctx.scripting().toJavaObject(o.get("key"));
restReq0.affinityKey(cacheObj);
restReq = restReq0;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e1aca64f/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
index 7051fb6..15b6342 100644
--- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GridJettyRestProtocol.java
@@ -116,7 +116,7 @@ public class GridJettyRestProtocol extends GridRestProtocolAdapter {
System.setProperty(IGNITE_JETTY_HOST, locHost.getHostAddress());
- jettyHnd = new GridJettyRestHandler(ctx.scripting(), hnd, new C1<String, Boolean>() {
+ jettyHnd = new GridJettyRestHandler(ctx, hnd, new C1<String, Boolean>() {
@Override public Boolean apply(String tok) {
return F.isEmpty(secretKey) || authenticate(tok);
}