You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by se...@apache.org on 2015/07/17 15:05:46 UTC
[07/14] incubator-ignite git commit: #ignite-961: fix test.
#ignite-961: fix test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8a8b32a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8a8b32a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8a8b32a8
Branch: refs/heads/ignite-1121
Commit: 8a8b32a891411028b752df4688af23657e05bc05
Parents: 8ebb441
Author: ivasilinets <iv...@gridgain.com>
Authored: Fri Jul 17 13:19:47 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Fri Jul 17 13:19:47 2015 +0300
----------------------------------------------------------------------
.../http/jetty/GlassfishScriptingConverter.java | 68 ++++++++++++++++++++
1 file changed, 68 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8a8b32a8/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GlassfishScriptingConverter.java
----------------------------------------------------------------------
diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GlassfishScriptingConverter.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GlassfishScriptingConverter.java
new file mode 100644
index 0000000..dc56550
--- /dev/null
+++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GlassfishScriptingConverter.java
@@ -0,0 +1,68 @@
+/*
+ * 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.protocols.http.jetty;
+
+import org.apache.ignite.internal.processors.scripting.*;
+import org.apache.ignite.json.*;
+
+import javax.json.*;
+import java.util.*;
+
+/**
+ * Converter for glassfish objects.
+ */
+public class GlassFishScriptingConverter extends IgniteScriptingConverter {
+ /** {@inheritDoc} */
+ @Override public Object toJavaObject(Object o) {
+ if (o == null)
+ return null;
+
+ if (o instanceof Map) {
+ Map o1 = (Map)o;
+
+ JSONCacheObject res = new JSONCacheObject();
+
+ for (Object key : o1.keySet())
+ res.put(toJavaObject(key), toJavaObject(o1.get(key)));
+
+ return res;
+ }
+ else if (o instanceof List) {
+ List o1 = (List) o;
+
+ List<Object> val = new ArrayList<>();
+
+ for (Object v : o1)
+ val.add(toJavaObject(v));
+
+ return val;
+ }
+ else if (o instanceof JsonString)
+ return ((JsonString) o).getString();
+ else if (o instanceof JsonNumber)
+ return ((JsonNumber) o).intValue();
+ else if (o.equals(JsonValue.FALSE))
+ return false;
+ else if (o.equals(JsonValue.TRUE))
+ return true;
+ else if (o.equals(JsonValue.NULL))
+ return null;
+
+ return o;
+ }
+}