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: do not need java8 part.
Date Fri, 10 Jul 2015 15:27:30 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-964 eebdd6475 -> 84938ddca


#ignite-964: do not need java8 part.


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

Branch: refs/heads/ignite-964
Commit: 84938ddca47336b0590fb233f9eac81fe0defb52
Parents: eebdd64
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Jul 10 18:27:16 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Jul 10 18:27:16 2015 +0300

----------------------------------------------------------------------
 modules/core/pom.xml                            |  52 -----
 .../scripting/IgniteScriptingProcessor.java     |  58 +-----
 .../scripting/ScriptingObjectConverter.java     |  59 ------
 .../ScriptingObjectConverter8.java              | 202 -------------------
 .../http/jetty/GridJettyRestHandler.java        |   2 +-
 5 files changed, 12 insertions(+), 361 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index 85a5f76..6c5af02 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -248,58 +248,6 @@
 
     <profiles>
         <profile>
-            <id>java8-scripting</id>
-
-            <activation>
-                <jdk>[1.8,)</jdk>
-            </activation>
-
-            <build>
-                <plugins>
-                    <plugin>
-                        <artifactId>maven-compiler-plugin</artifactId>
-                        <configuration>
-                            <source>1.8</source>
-                            <target>1.8</target>
-                        </configuration>
-                    </plugin>
-
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>build-helper-maven-plugin</artifactId>
-                        <version>1.9.1</version>
-                        <executions>
-                            <execution>
-                                <id>add-sources</id>
-                                <phase>generate-sources</phase>
-                                <goals>
-                                    <goal>add-source</goal>
-                                </goals>
-                                <configuration>
-                                    <sources>
-                                        <source>src/main/java8</source>
-                                        <source>schema-import/src/main/java</source>
-                                    </sources>
-                                </configuration>
-                            </execution>
-                            <execution>
-                                <id>add-tests</id>
-                                <phase>generate-test-sources</phase>
-                                <goals>
-                                    <goal>add-test-source</goal>
-                                </goals>
-                                <configuration>
-                                    <sources>
-                                        <source>src/test/java8</source>
-                                    </sources>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-        <profile>
             <id>release</id>
             <activation>
                 <activeByDefault>true</activeByDefault>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
index 733fc10..52847ec 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/IgniteScriptingProcessor.java
@@ -20,6 +20,7 @@ package org.apache.ignite.internal.processors.scripting;
 import org.apache.ignite.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.*;
+import org.apache.ignite.json.*;
 
 import javax.script.*;
 
@@ -34,13 +35,6 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
     /** Javascript engine name. */
     public static final String JAVA_SCRIPT_ENGINE_NAME = "JavaScript";
 
-    /** Java8 scripting converter class. */
-    private static final String CONV_CLS_JAVA8 =
-        "org.apache.ignite.internal.processors.scripting.ScriptingObjectConverter8";
-
-    /** Script object converter. */
-    private ScriptingObjectConverter converter;
-
     /** Javascript engine. */
     private ScriptEngine jsEngine;
 
@@ -53,27 +47,9 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
 
     /** {@inheritDoc} */
     @Override public void start() throws IgniteCheckedException {
-        try {
-            Class<?> cls = Class.forName(CONV_CLS_JAVA8);
-
-            Constructor<?> ctor = cls.getConstructor();
-
-            converter = (ScriptingObjectConverter)ctor.newInstance();
-            System.out.println("JDK 8 is found!!!!");
-        }
-        catch (ClassNotFoundException ignored) {
-            System.out.println("JDK 8 is not found!!!!");
-            converter = new ScriptingObjectConverter();
-        }
-        catch (NoSuchMethodException | InvocationTargetException | InstantiationException
| IllegalAccessException e) {
-            throw new IgniteCheckedException("Failed to initialize HTTP REST protocol.",
e);
-        }
-
         ScriptEngineManager factory = new ScriptEngineManager();
 
-        System.out.println("ENGINE!!!!");
         jsEngine = factory.getEngineByName(JAVA_SCRIPT_ENGINE_NAME);
-        System.out.println("ENGINE FOUND!!!!");
 
         addBinding("ignite", new ScriptingJSIgnite(ctx.grid()));
 
@@ -164,11 +140,11 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
         }
         catch (ScriptException e) {
             throw new IgniteCheckedException("Function evaluation failed [funcName=" + src
+
-                    ", err= " + e.getMessage() + "].");
+                ", err= " + e.getMessage() + "].");
         }
         catch (NoSuchMethodException e) {
             throw new IgniteCheckedException("Cannot find function [func=__internalCall"
+
-                    ", err= " + e.getMessage() + "].");
+                ", err= " + e.getMessage() + "].");
         }
     }
 
@@ -177,7 +153,7 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
      * @return Object for script.
      */
     public Object toScriptingObject(Object o) {
-        return converter.toScriptingObject(o);
+        return o;
     }
 
     /**
@@ -185,7 +161,7 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
      * @return  Object for Ignite cache.
      */
     public Object toJavaObject(Object o) {
-        return converter.toJavaObject(o);
+        return JSONCacheObject.toSimpleObject(o);
     }
 
     /**
@@ -193,15 +169,10 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
      * @return Object to store in cache.
      */
     public Object getField(String key, Object o) {
-        return converter.getField(key, o);
-    }
+        if (o instanceof JSONCacheObject)
+            return ((JSONCacheObject)o).getField(key);
 
-    /**
-     * @param o Object from script.
-     * @return Object to store in cache.
-     */
-    public Object getFields(Object o) {
-        return converter.getFields(o);
+        return null;
     }
 
     /**
@@ -210,7 +181,7 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
      * @return Scripting entry.
      */
     public Object createScriptingEntry(Object key, Object val) {
-        return new ScriptingCacheEntry(getFields(key), getFields(val));
+        return new ScriptingCacheEntry(key, val);
     }
 
     /**
@@ -228,15 +199,8 @@ public class IgniteScriptingProcessor extends GridProcessorAdapter {
          * @param val Value.
          */
         public ScriptingCacheEntry(Object key, Object val) {
-            if (key instanceof ScriptingObjectConverter)
-                this.key = key;
-            else
-                this.key = key;
-
-            if (val instanceof ScriptingObjectConverter)
-                this.val = val;
-            else
-                this.val = val;
+            this.key = key;
+            this.val = val;
         }
 
         /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
deleted file mode 100644
index d5c6dfd..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/scripting/ScriptingObjectConverter.java
+++ /dev/null
@@ -1,59 +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.scripting;
-
-import org.apache.ignite.json.*;
-
-/**
- * Script object converter.
- */
-public class ScriptingObjectConverter {
-    /**
-     * @param o Object to convert.
-     * @return Object to use in script.
-     */
-    public Object toScriptingObject(Object o) {
-        return o;
-    }
-
-    /**
-     * @param o Object from script.
-     * @return Object to store in cache.
-     */
-    public Object toJavaObject(Object o) {
-        return JSONCacheObject.toSimpleObject(o);
-    }
-
-    /**
-     * @param o Object from script.
-     * @return Object to store in cache.
-     */
-    public Object getField(String key, Object o) {
-        if (o instanceof JSONCacheObject)
-            return ((JSONCacheObject)o).getField(key);
-
-        return null;
-    }
-
-    /**
-     * @param o Object from script.
-     * @return Object to store in cache.
-     */
-    public Object getFields(Object o) {
-        return o;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
b/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
deleted file mode 100644
index ae4051e..0000000
--- a/modules/core/src/main/java8/org.apache.ignite.internal.processors.scripting/ScriptingObjectConverter8.java
+++ /dev/null
@@ -1,202 +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.scripting;
-
-import jdk.nashorn.api.scripting.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.json.*;
-
-import java.util.*;
-
-/**
- * Json cache object.
- */
-public class ScriptingObjectConverter8 extends ScriptingObjectConverter implements JSObject
{
-    /** Fields. */
-    private final JSONCacheObject fields;
-
-    /**
-     * Default constructor.
-     */
-    public ScriptingObjectConverter8() {
-        fields = null;
-    }
-
-    /**
-     * @param o JSON object.
-     */
-    private ScriptingObjectConverter8(JSONCacheObject o) {
-        fields = o;
-    }
-
-    /**
-     * @param o Object.
-     * @return Rest JSON cache object.
-     */
-    public static Object convertToRestObject(Object o) {
-        if (o instanceof JSONCacheObject)
-            return new ScriptingObjectConverter8((JSONCacheObject)o);
-
-        return o;
-    }
-
-    /**
-     * @return Fields.
-     */
-    public Map<Object, Object> getFields() {
-        return fields;
-    }
-
-    /** {@inheritDoc} */
-    @Override public Object toScriptingObject(Object o) {
-        return convertToRestObject(o);
-    }
-
-    /**
-     * @param key Field name.
-     * @return Field value.
-     */
-    public Object getField(Object key) {
-        return fields.get(key);
-    }
-
-    /**
-     * @param o Object from script.
-     * @return Object to store in cache.
-     */
-    public Object getField(String key, Object o) {
-        if (o instanceof JSONCacheObject)
-            return ((JSONCacheObject)o).getField(key);
-        if (o instanceof ScriptingObjectConverter8)
-            return ((ScriptingObjectConverter8)o).getField(key);
-
-        return null;
-    }
-
-    /**
-     * @param o Object from script.
-     * @return Object to store in cache.
-     */
-    public Object getFields(Object o) {
-        if (o instanceof ScriptingObjectConverter8)
-            return ((ScriptingObjectConverter8)o).getFields();
-
-        return o;
-    }
-
-    @Override public Object call(Object o, Object... objects) {
-        System.out.println("!!!!CALL");
-        return null;
-    }
-
-    @Override public Object newObject(Object... objects) {
-        System.out.println("!!!!newObject");
-        return null;
-    }
-
-    @Override public Object eval(String s) {
-        System.out.println("!!!!eval");
-        return null;
-    }
-
-    @Override public Object getMember(String s) {
-        System.out.println("!!!!getMember + " + s);
-        return fields.get(s);
-    }
-
-    @Override public Object getSlot(int i) {
-        System.out.println("!!!!getSlot");
-        return null;
-    }
-
-    @Override public boolean hasMember(String s) {
-        System.out.println("!!!!hasMember");
-        return fields.containsKey(s);
-    }
-
-    @Override public boolean hasSlot(int i) {
-        System.out.println("!!!!hasSlot");
-        return false;
-    }
-
-    @Override public void removeMember(String s) {
-        System.out.println("!!!!removeMember");
-        fields.remove(s);
-    }
-
-    @Override public void setMember(String s, Object o) {
-        System.out.println("!!!!setMember");
-        fields.put(s, o);
-    }
-
-    @Override public void setSlot(int i, Object o) {
-        System.out.println("!!!!setSlot");
-
-    }
-
-    @Override public Set<String> keySet() {
-        System.out.println("!!!!keySet");
-        Set<String> keys = new HashSet<>();
-
-        for (Object o : fields.keySet()) {
-            if (!(o instanceof ScriptingObjectConverter8))
-                keys.add(o.toString());
-        }
-
-        return keys;
-    }
-
-    @Override public Collection<Object> values() {
-        System.out.println("!!!!values");
-        return fields.values();
-    }
-
-    @Override public boolean isInstance(Object o) {
-        System.out.println("!!!!isInstance");
-        return false;
-    }
-
-    @Override public boolean isInstanceOf(Object o) {
-        System.out.println("!!!!isInstanceOf");
-        return false;
-    }
-
-    @Override public String getClassName() {
-        System.out.println("!!!!getClassName");
-        return U.getSimpleName(ScriptingObjectConverter8.class);
-    }
-
-    @Override public boolean isFunction() {
-        System.out.println("!!!!isFunction");
-        return false;
-    }
-
-    @Override public boolean isStrictFunction() {
-        System.out.println("!!!!isStrictFunction");
-        return false;
-    }
-
-    @Override public boolean isArray() {
-        System.out.println("!!!!isArray");
-        return false;
-    }
-
-    @Override public double toNumber() {
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/84938ddc/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 f576a3e..20f0a88 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
@@ -346,7 +346,7 @@ public class GridJettyRestHandler extends AbstractHandler {
         else {
             Object o = cmdRes.getResponse();
 
-            cmdRes.setResponse(proc.getFields(o));
+            cmdRes.setResponse(o);
         }
     }
 


Mime
View raw message