aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMW2009-02-26 20:01:20 +0000
committerMW2009-02-26 20:01:20 +0000
commit33e7c09b7b894551b35fb8ab29133c96a5d7b037 (patch)
treea21839dc38477c2679b9c94fcebc96cca8bcc26d /OpenSim/Framework
parentAttempt to fix the "region starts but doesn't load anything" issue (diff)
downloadopensim-SC_OLD-33e7c09b7b894551b35fb8ab29133c96a5d7b037.zip
opensim-SC_OLD-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.gz
opensim-SC_OLD-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.bz2
opensim-SC_OLD-33e7c09b7b894551b35fb8ab29133c96a5d7b037.tar.xz
Added IRegistryCore and RegistryCore to OpenSim.Framework.
Added a ApplicationRegistry to OpenSimBase. Changed LoadRegionsPlugin so it registers itself to that application registry. Added a event to LoadRegionsPlugin, that is triggered when it creates a new scene ,although maybe this event should actually be in opensimBase incase other plugins are creating regions (like the RemoteAdminPlugin).
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/IRegistryCore.cs13
-rw-r--r--OpenSim/Framework/RegistryCore.cs44
2 files changed, 57 insertions, 0 deletions
diff --git a/OpenSim/Framework/IRegistryCore.cs b/OpenSim/Framework/IRegistryCore.cs
new file mode 100644
index 0000000..486dee6
--- /dev/null
+++ b/OpenSim/Framework/IRegistryCore.cs
@@ -0,0 +1,13 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework
6{
7 public interface IRegistryCore
8 {
9 T Get<T>();
10 void RegisterInterface<T>(T iface);
11 bool TryGet<T>(out T iface);
12 }
13}
diff --git a/OpenSim/Framework/RegistryCore.cs b/OpenSim/Framework/RegistryCore.cs
new file mode 100644
index 0000000..06732f5
--- /dev/null
+++ b/OpenSim/Framework/RegistryCore.cs
@@ -0,0 +1,44 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework
6{
7 public class RegistryCore
8 {
9 protected Dictionary<Type, object> m_moduleInterfaces = new Dictionary<Type, object>();
10
11 /// <summary>
12 /// Register an Module interface.
13 /// </summary>
14 /// <typeparam name="T"></typeparam>
15 /// <param name="iface"></param>
16 public void RegisterInterface<T>(T iface)
17 {
18 lock (m_moduleInterfaces)
19 {
20 if (!m_moduleInterfaces.ContainsKey(typeof(T)))
21 {
22 m_moduleInterfaces.Add(typeof(T), iface);
23 }
24 }
25 }
26
27 public bool TryGet<T>(out T iface)
28 {
29 if (m_moduleInterfaces.ContainsKey(typeof(T)))
30 {
31 iface = (T)m_moduleInterfaces[typeof(T)];
32 return true;
33 }
34 iface = default(T);
35 return false;
36 }
37
38 public T Get<T>()
39 {
40 return (T)m_moduleInterfaces[typeof(T)];
41 }
42
43 }
44}