#ignite-961: fix class
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7b793af9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7b793af9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7b793af9 Branch: refs/heads/ignite-1121 Commit: 7b793af9d74593abccb42b62cb5f30930a8079db Parents: 3d94e84 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Jul 17 13:39:10 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Jul 17 13:39:10 2015 +0300 ---------------------------------------------------------------------- .../http/jetty/GlassfishScriptingConverter.java | 68 -------------------- .../jetty/RestGlassFishScriptingConverter.java | 68 ++++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b793af9/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 deleted file mode 100644 index dc56550..0000000 --- a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/GlassfishScriptingConverter.java +++ /dev/null @@ -1,68 +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. - */ - -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; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7b793af9/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestGlassFishScriptingConverter.java ---------------------------------------------------------------------- diff --git a/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestGlassFishScriptingConverter.java b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestGlassFishScriptingConverter.java new file mode 100644 index 0000000..87e86c0 --- /dev/null +++ b/modules/rest-http/src/main/java/org/apache/ignite/internal/processors/rest/protocols/http/jetty/RestGlassFishScriptingConverter.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 RestGlassFishScriptingConverter 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; + } +}