aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/scripting/Engines
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/scripting/Engines')
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs29
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs31
-rw-r--r--OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs1
3 files changed, 38 insertions, 23 deletions
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
new file mode 100644
index 0000000..1773156
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/JavaEngine.cs
@@ -0,0 +1,29 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5using OpenSim.Region.Environment.Scripting;
6using OpenSim.Scripting.EmbeddedJVM;
7
8namespace OpenSim.Region.Environment.Scripting
9{
10 public class JavaEngine : IScriptCompiler
11 {
12 public string FileExt()
13 {
14 return ".java";
15 }
16
17 public Dictionary<string, IScript> compile(string filename)
18 {
19 JVMScript script = new JVMScript();
20 Dictionary<string, IScript> returns = new Dictionary<string, IScript>();
21
22 script.LoadScript(filename);
23
24 returns.Add(filename, script);
25
26 return returns;
27 }
28 }
29}
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
index 7ed734b..aaa1609 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/OpenSimJVM.cs
@@ -38,7 +38,7 @@ using OpenSim.Region.Environment.Scenes;
38 38
39namespace OpenSim.Scripting.EmbeddedJVM 39namespace OpenSim.Scripting.EmbeddedJVM
40{ 40{
41 public class OpenSimJVM : IScript 41 public class JVMScript : IScript
42 { 42 {
43 private List<Thread> _threads = new List<Thread>(); 43 private List<Thread> _threads = new List<Thread>();
44 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>(); 44 private BlockingQueue<CompileInfo> CompileScripts = new BlockingQueue<CompileInfo>();
@@ -47,7 +47,7 @@ namespace OpenSim.Scripting.EmbeddedJVM
47 47
48 ScriptInfo scriptInfo; 48 ScriptInfo scriptInfo;
49 49
50 public OpenSimJVM() 50 public JVMScript()
51 { 51 {
52 52
53 } 53 }
@@ -55,37 +55,27 @@ namespace OpenSim.Scripting.EmbeddedJVM
55 public void Initialise(ScriptInfo info) 55 public void Initialise(ScriptInfo info)
56 { 56 {
57 scriptInfo = info; 57 scriptInfo = info;
58 }
59
60 public string getName()
61 {
62 return "JVM Scripting Engine";
63 }
64 58
65 public bool Init(Scene world)
66 {
67 Console.WriteLine("Creating OpenSim JVM scripting engine");
68 _mainMemory = new MainMemory(); 59 _mainMemory = new MainMemory();
69 Thread.GlobalMemory = this._mainMemory; 60 Thread.GlobalMemory = this._mainMemory;
70 Thread.World = world; 61 Thread.World = info.world;
71 compileThread = new System.Threading.Thread(new ThreadStart(CompileScript)); 62 compileThread = new System.Threading.Thread(new ThreadStart(CompileScript));
72 compileThread.IsBackground = true; 63 compileThread.IsBackground = true;
73 compileThread.Start(); 64 compileThread.Start();
74 return true; 65
75 } 66 }
76 67
77 public string GetName() 68 public string getName()
78 { 69 {
79 return "OpenSimJVM"; 70 return "JVM Scripting Engine";
80 } 71 }
81 72
82 public void LoadScript(string script, string scriptName, uint entityID) 73 public void LoadScript(string script)
83 { 74 {
84 Console.WriteLine("OpenSimJVM - loading new script: " + scriptName); 75 Console.WriteLine("OpenSimJVM - loading new script: " + script);
85 CompileInfo comp = new CompileInfo(); 76 CompileInfo comp = new CompileInfo();
86 comp.entityId = entityID;
87 comp.script = script; 77 comp.script = script;
88 comp.scriptName = scriptName; 78 comp.scriptName = script;
89 this.CompileScripts.Enqueue(comp); 79 this.CompileScripts.Enqueue(comp);
90 } 80 }
91 81
@@ -96,7 +86,6 @@ namespace OpenSim.Scripting.EmbeddedJVM
96 CompileInfo comp = this.CompileScripts.Dequeue(); 86 CompileInfo comp = this.CompileScripts.Dequeue();
97 string script = comp.script; 87 string script = comp.script;
98 string scriptName = comp.scriptName; 88 string scriptName = comp.scriptName;
99 uint entityID = comp.entityId;
100 try 89 try
101 { 90 {
102 //need to compile the script into a java class file 91 //need to compile the script into a java class file
@@ -127,7 +116,6 @@ namespace OpenSim.Scripting.EmbeddedJVM
127 116
128 Thread newThread = new Thread(); 117 Thread newThread = new Thread();
129 this._threads.Add(newThread); 118 this._threads.Add(newThread);
130 newThread.EntityId = entityID;
131 newThread.currentClass = class1; 119 newThread.currentClass = class1;
132 newThread.scriptInfo = scriptInfo; 120 newThread.scriptInfo = scriptInfo;
133 121
@@ -165,7 +153,6 @@ namespace OpenSim.Scripting.EmbeddedJVM
165 { 153 {
166 public string script; 154 public string script;
167 public string scriptName; 155 public string scriptName;
168 public uint entityId;
169 156
170 public CompileInfo() 157 public CompileInfo()
171 { 158 {
diff --git a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs
index 806f833..3993436 100644
--- a/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs
+++ b/OpenSim/Region/Environment/Scenes/scripting/Engines/JVMEngine/Thread.cs
@@ -50,7 +50,6 @@ namespace OpenSim.Scripting.EmbeddedJVM
50 private StackFrame currentFrame; 50 private StackFrame currentFrame;
51 public int excutionCounter = 0; 51 public int excutionCounter = 0;
52 public bool running = false; 52 public bool running = false;
53 public uint EntityId = 0;
54 53
55 public ScriptInfo scriptInfo; 54 public ScriptInfo scriptInfo;
56 55