From 872ae6a9ce25ff0a293847470f24e055bd96c6be Mon Sep 17 00:00:00 2001
From: Guy Zana <guy@cloudius-systems.com>
Date: Tue, 7 May 2013 10:48:43 +0300
Subject: [PATCH] cli: make the JS scope variable public and static so it can
 be accessible

other classes may need to read/write global javascript objects, the run
command which is going to be commited in the next patch deals with it
---
 java/src/com/cloudius/main/RhinoCLI.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/java/src/com/cloudius/main/RhinoCLI.java b/java/src/com/cloudius/main/RhinoCLI.java
index 6ff352cc3..5ae242d16 100644
--- a/java/src/com/cloudius/main/RhinoCLI.java
+++ b/java/src/com/cloudius/main/RhinoCLI.java
@@ -11,6 +11,8 @@ public class RhinoCLI {
     
     public static Global global = new Global();
 
+    public static Scriptable _scope;
+
     //
     // Invoke the cli.js file take care of exposing all scriptable objects
     // such as the tests
@@ -20,11 +22,11 @@ public class RhinoCLI {
         try {
             
             global.init(cx);
-            Scriptable scope = ScriptableObject.getTopLevelScope(global);
-            ScriptableObject.defineClass(scope, TCPEchoServerTest.class);
+            _scope = ScriptableObject.getTopLevelScope(global);
+            ScriptableObject.defineClass(_scope, TCPEchoServerTest.class);
             
             FileReader cli_js = new FileReader("/console/cli.js");
-            cx.evaluateReader(scope, cli_js, "cli.js", 1, null);
+            cx.evaluateReader(_scope, cli_js, "cli.js", 1, null);
             
         } catch (Exception ex) {
             ex.printStackTrace();
-- 
GitLab