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/06/25 17:58:18 UTC
[1/4] incubator-ignite git commit: #ignite-964: add function
cache.query.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-964 [created] fb182ab17
#ignite-964: add function cache.query.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3d36a186
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3d36a186
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3d36a186
Branch: refs/heads/ignite-964
Commit: 3d36a18610e5e0e1d586f6d327f5b5fbc1634f45
Parents: 57f0ac3
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jun 25 17:41:07 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jun 25 17:41:07 2015 +0300
----------------------------------------------------------------------
modules/nodejs/src/main/js/cache.js | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3d36a186/modules/nodejs/src/main/js/cache.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js
index 86eb22a..ae76dab 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -128,6 +128,10 @@ Cache.prototype.getAll = function(keys, callback) {
this._server.runCommand("getall", params, callback);
}
+Cache.prototype.query = function(qry, callback) {
+ this._server.runCommand("sqlqry", [Server.pair("qry", qry)])
+}
+
/**
* Concatenate all parameters
*
[4/4] incubator-ignite git commit: #ignite-964: wip.
Posted by sb...@apache.org.
#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/fb182ab1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fb182ab1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fb182ab1
Branch: refs/heads/ignite-964
Commit: fb182ab17a13ee5ef29d3d6f079759e6cfd5d168
Parents: 414022e
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jun 25 18:58:06 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jun 25 18:58:06 2015 +0300
----------------------------------------------------------------------
.../handlers/query/QueryCommandHandler.java | 76 ++++++++++++++++++++
.../http/jetty/GridJettyRestHandler.java | 6 ++
2 files changed, 82 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fb182ab1/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
new file mode 100644
index 0000000..3f5c8bb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/query/QueryCommandHandler.java
@@ -0,0 +1,76 @@
+/*
+ * 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.processors.rest.handlers.query;
+
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.rest.*;
+import org.apache.ignite.internal.processors.rest.handlers.*;
+import org.apache.ignite.internal.processors.rest.request.*;
+import org.apache.ignite.internal.util.future.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.lang.*;
+
+import java.util.*;
+
+import static org.apache.ignite.internal.processors.rest.GridRestCommand.*;
+
+/**
+ * Query command handler.
+ */
+public class QueryCommandHandler extends GridRestCommandHandlerAdapter {
+ /** Supported commands. */
+ private static final Collection<GridRestCommand> SUPPORTED_COMMANDS = U.sealList(EXECUTE_SQL_QUERY);
+
+ /**
+ * @param ctx Context.
+ */
+ public QueryCommandHandler(GridKernalContext ctx) {
+ super(ctx);
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<GridRestCommand> supportedCommands() {
+ return SUPPORTED_COMMANDS;
+ }
+
+ /** {@inheritDoc} */
+ @Override public IgniteInternalFuture<GridRestResponse> handleAsync(GridRestRequest req) {
+ assert req != null;
+
+ assert SUPPORTED_COMMANDS.contains(req.command());
+
+ switch (req.command()) {
+ case EXECUTE_SQL_QUERY: {
+ assert req instanceof RestSqlQueryRequest : "Invalid type of query request.";
+
+ return ctx.closure().callAsync(new IgniteClosure<RestSqlQueryRequest, GridRestResponse>() {
+ @Override public GridRestResponse apply(RestSqlQueryRequest req) {
+ try {
+ return new GridRestResponse(); //TODO
+ }
+ catch (Exception e) {
+ return new GridRestResponse(GridRestResponse.STATUS_FAILED, e.getMessage());
+ }
+ }
+ }, (RestSqlQueryRequest)req, Collections.singleton(ctx.grid().localNode()));
+ }
+ }
+
+ return new GridFinishedFuture<>();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fb182ab1/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 8b2c79c..65eaa3c 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
@@ -474,6 +474,12 @@ public class GridJettyRestHandler extends AbstractHandler {
case EXECUTE_SQL_QUERY: {
RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+ restReq0.sqlQuery((String)params.get("qry"));
+ restReq0.arguments((Object[]) params.get("arg"));
+
+ restReq = restReq0;
+
+ break;
}
default:
[2/4] incubator-ignite git commit: Merge branch 'ignite-961' into
ignite-964
Posted by sb...@apache.org.
Merge branch 'ignite-961' into ignite-964
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1c3d4066
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1c3d4066
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1c3d4066
Branch: refs/heads/ignite-964
Commit: 1c3d4066534939d2c3323bdada8b2a08035b3898
Parents: 3d36a18 04459d2
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jun 25 17:46:01 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jun 25 17:46:01 2015 +0300
----------------------------------------------------------------------
.../internal/processors/scripting/IgniteJS.java | 31 --------------------
.../scripting/IgniteScriptProcessor.java | 2 +-
modules/nodejs/src/test/js/test-compute.js | 4 +--
3 files changed, 3 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
[3/4] incubator-ignite git commit: #ignite-964: wip.
Posted by sb...@apache.org.
#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/414022ed
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/414022ed
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/414022ed
Branch: refs/heads/ignite-964
Commit: 414022edfb12760ae7c6a72ed81c2cc46c6b2541
Parents: 1c3d406
Author: ivasilinets <iv...@gridgain.com>
Authored: Thu Jun 25 17:55:25 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Thu Jun 25 17:55:25 2015 +0300
----------------------------------------------------------------------
.../processors/rest/GridRestCommand.java | 5 +-
.../rest/request/RestSqlQueryRequest.java | 57 ++++++++++++++++++++
modules/nodejs/src/main/js/cache.js | 11 +++-
.../http/jetty/GridJettyRestHandler.java | 5 ++
4 files changed, 75 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
index f4d92b7..dcc1699 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestCommand.java
@@ -103,7 +103,10 @@ public enum GridRestCommand {
RUN_SCRIPT("runscript"),
/** Execute map reduce script. */
- EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce");
+ EXECUTE_MAP_REDUCE_SCRIPT("excmapreduce"),
+
+ /** Execute sql query. */
+ EXECUTE_SQL_QUERY("sqlqry");
/** Enum values. */
private static final GridRestCommand[] VALS = values();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
new file mode 100644
index 0000000..4d74626
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/request/RestSqlQueryRequest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.processors.rest.request;
+
+/**
+ * Sql query request.
+ */
+public class RestSqlQueryRequest extends GridRestRequest {
+ /** Sql query. */
+ private String sqlQry;
+
+ /** Sql query arguments. */
+ private Object[] args;
+
+ /**
+ * @param sqlQry Sql query.
+ */
+ public void sqlQuery(String sqlQry) {
+ this.sqlQry = sqlQry;
+ }
+
+ /**
+ * @return Sql query.
+ */
+ public String sqlQuery() {
+ return sqlQry;
+ }
+
+ /**
+ * @param args Sql query arguments.
+ */
+ public void arguments(Object[] args) {
+ this.args = args;
+ }
+
+ /**
+ * @return Sql query arguments.
+ */
+ public Object[] arguments() {
+ return args;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/modules/nodejs/src/main/js/cache.js
----------------------------------------------------------------------
diff --git a/modules/nodejs/src/main/js/cache.js b/modules/nodejs/src/main/js/cache.js
index ae76dab..9333254 100644
--- a/modules/nodejs/src/main/js/cache.js
+++ b/modules/nodejs/src/main/js/cache.js
@@ -128,8 +128,15 @@ Cache.prototype.getAll = function(keys, callback) {
this._server.runCommand("getall", params, callback);
}
-Cache.prototype.query = function(qry, callback) {
- this._server.runCommand("sqlqry", [Server.pair("qry", qry)])
+/**
+ * Execute sql query
+ *
+ * @param {string} qry Query
+ * @param {string[]} arg Arguments
+ * @param {onGet} callback Callback.
+ */
+Cache.prototype.query = function(qry, arg, callback) {
+ this._server.runCommand("sqlqry", [Server.pair("qry", qry), Server.pair("arg", arg)], callback);
}
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/414022ed/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 b669bdd..8b2c79c 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
@@ -471,6 +471,11 @@ public class GridJettyRestHandler extends AbstractHandler {
break;
}
+ case EXECUTE_SQL_QUERY: {
+ RestSqlQueryRequest restReq0 = new RestSqlQueryRequest();
+
+ }
+
default:
throw new IgniteCheckedException("Invalid command: " + cmd);
}