diff options
author | Melanie Thielker | 2008-11-08 02:24:34 +0000 |
---|---|---|
committer | Melanie Thielker | 2008-11-08 02:24:34 +0000 |
commit | 833f5e8bed5b36501c4579859e380038400ecb75 (patch) | |
tree | c785b4178baa18f49490e572f3013e531921e349 /OpenSim/Region/ScriptEngine/Shared | |
parent | * Correct catch changed on last commit, since I just realized I started makin... (diff) | |
download | opensim-SC-833f5e8bed5b36501c4579859e380038400ecb75.zip opensim-SC-833f5e8bed5b36501c4579859e380038400ecb75.tar.gz opensim-SC-833f5e8bed5b36501c4579859e380038400ecb75.tar.bz2 opensim-SC-833f5e8bed5b36501c4579859e380038400ecb75.tar.xz |
Refactor IEventReceiver back into IScriptEngine
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
8 files changed, 42 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index c828d69..71a8d0f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -48,24 +48,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
48 | private static int cmdHandlerThreadCycleSleepms; | 48 | private static int cmdHandlerThreadCycleSleepms; |
49 | 49 | ||
50 | private static List<IScene> m_Scenes = new List<IScene>(); | 50 | private static List<IScene> m_Scenes = new List<IScene>(); |
51 | private static List<IEventReceiver> m_ScriptEngines = | 51 | private static List<IScriptEngine> m_ScriptEngines = |
52 | new List<IEventReceiver>(); | 52 | new List<IScriptEngine>(); |
53 | 53 | ||
54 | public IEventReceiver m_ScriptEngine; | 54 | public IScriptEngine m_ScriptEngine; |
55 | private IScene m_Scene; | 55 | private IScene m_Scene; |
56 | 56 | ||
57 | private static Dictionary<IEventReceiver, Dataserver> m_Dataserver = | 57 | private static Dictionary<IScriptEngine, Dataserver> m_Dataserver = |
58 | new Dictionary<IEventReceiver, Dataserver>(); | 58 | new Dictionary<IScriptEngine, Dataserver>(); |
59 | private static Dictionary<IEventReceiver, Timer> m_Timer = | 59 | private static Dictionary<IScriptEngine, Timer> m_Timer = |
60 | new Dictionary<IEventReceiver, Timer>(); | 60 | new Dictionary<IScriptEngine, Timer>(); |
61 | private static Dictionary<IEventReceiver, Listener> m_Listener = | 61 | private static Dictionary<IScriptEngine, Listener> m_Listener = |
62 | new Dictionary<IEventReceiver, Listener>(); | 62 | new Dictionary<IScriptEngine, Listener>(); |
63 | private static Dictionary<IEventReceiver, HttpRequest> m_HttpRequest = | 63 | private static Dictionary<IScriptEngine, HttpRequest> m_HttpRequest = |
64 | new Dictionary<IEventReceiver, HttpRequest>(); | 64 | new Dictionary<IScriptEngine, HttpRequest>(); |
65 | private static Dictionary<IEventReceiver, SensorRepeat> m_SensorRepeat = | 65 | private static Dictionary<IScriptEngine, SensorRepeat> m_SensorRepeat = |
66 | new Dictionary<IEventReceiver, SensorRepeat>(); | 66 | new Dictionary<IScriptEngine, SensorRepeat>(); |
67 | private static Dictionary<IEventReceiver, XmlRequest> m_XmlRequest = | 67 | private static Dictionary<IScriptEngine, XmlRequest> m_XmlRequest = |
68 | new Dictionary<IEventReceiver, XmlRequest>(); | 68 | new Dictionary<IScriptEngine, XmlRequest>(); |
69 | 69 | ||
70 | public Dataserver DataserverPlugin | 70 | public Dataserver DataserverPlugin |
71 | { | 71 | { |
@@ -97,12 +97,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
97 | get { return m_XmlRequest[m_ScriptEngine]; } | 97 | get { return m_XmlRequest[m_ScriptEngine]; } |
98 | } | 98 | } |
99 | 99 | ||
100 | public IEventReceiver[] ScriptEngines | 100 | public IScriptEngine[] ScriptEngines |
101 | { | 101 | { |
102 | get { return m_ScriptEngines.ToArray(); } | 102 | get { return m_ScriptEngines.ToArray(); } |
103 | } | 103 | } |
104 | 104 | ||
105 | public AsyncCommandManager(IEventReceiver _ScriptEngine) | 105 | public AsyncCommandManager(IScriptEngine _ScriptEngine) |
106 | { | 106 | { |
107 | m_ScriptEngine = _ScriptEngine; | 107 | m_ScriptEngine = _ScriptEngine; |
108 | m_Scene = m_ScriptEngine.World; | 108 | m_Scene = m_ScriptEngine.World; |
@@ -202,7 +202,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
202 | // Check XMLRPCRequests | 202 | // Check XMLRPCRequests |
203 | m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests(); | 203 | m_XmlRequest[m_ScriptEngines[0]].CheckXMLRPCRequests(); |
204 | 204 | ||
205 | foreach (IEventReceiver s in m_ScriptEngines) | 205 | foreach (IScriptEngine s in m_ScriptEngines) |
206 | { | 206 | { |
207 | // Check Listeners | 207 | // Check Listeners |
208 | m_Listener[s].CheckListeners(); | 208 | m_Listener[s].CheckListeners(); |
@@ -223,7 +223,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
223 | /// </summary> | 223 | /// </summary> |
224 | /// <param name="localID"></param> | 224 | /// <param name="localID"></param> |
225 | /// <param name="itemID"></param> | 225 | /// <param name="itemID"></param> |
226 | public static void RemoveScript(IEventReceiver engine, uint localID, UUID itemID) | 226 | public static void RemoveScript(IScriptEngine engine, uint localID, UUID itemID) |
227 | { | 227 | { |
228 | // Remove a specific script | 228 | // Remove a specific script |
229 | 229 | ||
@@ -250,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | public static Object[] GetSerializationData(IEventReceiver engine, UUID itemID) | 253 | public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) |
254 | { | 254 | { |
255 | List<Object> data = new List<Object>(); | 255 | List<Object> data = new List<Object>(); |
256 | 256 | ||
@@ -281,7 +281,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
281 | return data.ToArray(); | 281 | return data.ToArray(); |
282 | } | 282 | } |
283 | 283 | ||
284 | public static void CreateFromData(IEventReceiver engine, uint localID, | 284 | public static void CreateFromData(IScriptEngine engine, uint localID, |
285 | UUID itemID, UUID hostID, Object[] data) | 285 | UUID itemID, UUID hostID, Object[] data) |
286 | { | 286 | { |
287 | int idx = 0; | 287 | int idx = 0; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 123f98f..59f5ccd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
66 | /// </summary> | 66 | /// </summary> |
67 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi | 67 | public class LSL_Api : MarshalByRefObject, ILSL_Api, IScriptApi |
68 | { | 68 | { |
69 | protected IEventReceiver m_ScriptEngine; | 69 | protected IScriptEngine m_ScriptEngine; |
70 | protected SceneObjectPart m_host; | 70 | protected SceneObjectPart m_host; |
71 | protected uint m_localID; | 71 | protected uint m_localID; |
72 | protected UUID m_itemID; | 72 | protected UUID m_itemID; |
@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
80 | 80 | ||
81 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 81 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
82 | 82 | ||
83 | public void Initialize(IEventReceiver ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 83 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
84 | { | 84 | { |
85 | m_ScriptEngine = ScriptEngine; | 85 | m_ScriptEngine = ScriptEngine; |
86 | m_host = host; | 86 | m_host = host; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 787d951..f9302e9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
99 | [Serializable] | 99 | [Serializable] |
100 | public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi | 100 | public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi |
101 | { | 101 | { |
102 | internal IEventReceiver m_ScriptEngine; | 102 | internal IScriptEngine m_ScriptEngine; |
103 | internal ILSL_Api m_LSL_Api; // get a reference to the LSL API so we can call methods housed there | 103 | internal ILSL_Api m_LSL_Api; // get a reference to the LSL API so we can call methods housed there |
104 | internal SceneObjectPart m_host; | 104 | internal SceneObjectPart m_host; |
105 | internal uint m_localID; | 105 | internal uint m_localID; |
@@ -110,7 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
110 | internal float m_ScriptDistanceFactor = 1.0f; | 110 | internal float m_ScriptDistanceFactor = 1.0f; |
111 | internal Dictionary<string, List<UUID> > m_FunctionPerms = new Dictionary<string, List<UUID> >(); | 111 | internal Dictionary<string, List<UUID> > m_FunctionPerms = new Dictionary<string, List<UUID> >(); |
112 | 112 | ||
113 | public void Initialize(IEventReceiver ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) | 113 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) |
114 | { | 114 | { |
115 | m_ScriptEngine = ScriptEngine; | 115 | m_ScriptEngine = ScriptEngine; |
116 | m_host = host; | 116 | m_host = host; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs index 0c77a9d..f5a965b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/HttpRequest.cs | |||
@@ -77,7 +77,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
77 | new LSL_Types.LSLString(httpInfo.response_body) | 77 | new LSL_Types.LSLString(httpInfo.response_body) |
78 | }; | 78 | }; |
79 | 79 | ||
80 | foreach (IEventReceiver e in m_CmdManager.ScriptEngines) | 80 | foreach (IScriptEngine e in m_CmdManager.ScriptEngines) |
81 | { | 81 | { |
82 | if (e.PostObjectEvent(httpInfo.localID, | 82 | if (e.PostObjectEvent(httpInfo.localID, |
83 | new EventParams("http_response", | 83 | new EventParams("http_response", |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 59d5060..b72d17c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
67 | new LSL_Types.LSLString(lInfo.GetMessage()) | 67 | new LSL_Types.LSLString(lInfo.GetMessage()) |
68 | }; | 68 | }; |
69 | 69 | ||
70 | foreach (IEventReceiver e in m_CmdManager.ScriptEngines) | 70 | foreach (IScriptEngine e in m_CmdManager.ScriptEngines) |
71 | { | 71 | { |
72 | e.PostScriptEvent( | 72 | e.PostScriptEvent( |
73 | lInfo.GetItemID(), new EventParams( | 73 | lInfo.GetItemID(), new EventParams( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs index 1c1ea0b..a7699a1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/XmlRequest.cs | |||
@@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
71 | new LSL_Types.LSLString(rInfo.GetStrVal()) | 71 | new LSL_Types.LSLString(rInfo.GetStrVal()) |
72 | }; | 72 | }; |
73 | 73 | ||
74 | foreach (IEventReceiver e in m_CmdManager.ScriptEngines) | 74 | foreach (IScriptEngine e in m_CmdManager.ScriptEngines) |
75 | { | 75 | { |
76 | if (e.PostScriptEvent( | 76 | if (e.PostScriptEvent( |
77 | rInfo.GetItemID(), new EventParams( | 77 | rInfo.GetItemID(), new EventParams( |
@@ -100,7 +100,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
100 | new LSL_Types.LSLString(srdInfo.sdata) | 100 | new LSL_Types.LSLString(srdInfo.sdata) |
101 | }; | 101 | }; |
102 | 102 | ||
103 | foreach (IEventReceiver e in m_CmdManager.ScriptEngines) | 103 | foreach (IScriptEngine e in m_CmdManager.ScriptEngines) |
104 | { | 104 | { |
105 | if (e.PostScriptEvent( | 105 | if (e.PostScriptEvent( |
106 | srdInfo.m_itemID, new EventParams( | 106 | srdInfo.m_itemID, new EventParams( |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index c6026fb..bc75ed5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -83,8 +83,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
83 | // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files | 83 | // private static int instanceID = new Random().Next(0, int.MaxValue); // Unique number to use on our compiled files |
84 | private static UInt64 scriptCompileCounter = 0; // And a counter | 84 | private static UInt64 scriptCompileCounter = 0; // And a counter |
85 | 85 | ||
86 | public IEventReceiver m_scriptEngine; | 86 | public IScriptEngine m_scriptEngine; |
87 | public Compiler(IEventReceiver scriptEngine) | 87 | public Compiler(IScriptEngine scriptEngine) |
88 | { | 88 | { |
89 | m_scriptEngine = scriptEngine; | 89 | m_scriptEngine = scriptEngine; |
90 | ReadConfig(); | 90 | ReadConfig(); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 98d7bbe..30f03ac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -848,5 +848,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
848 | 848 | ||
849 | return e.ToString(); | 849 | return e.ToString(); |
850 | } | 850 | } |
851 | |||
852 | public string GetAssemblyName() | ||
853 | { | ||
854 | return m_Assembly; | ||
855 | } | ||
856 | |||
857 | public string GetXMLState() | ||
858 | { | ||
859 | Stop(100); | ||
860 | return ScriptSerializer.Serialize(this); | ||
861 | } | ||
851 | } | 862 | } |
852 | } | 863 | } |