aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/Grid.cs
diff options
context:
space:
mode:
authorgareth2007-03-22 10:11:15 +0000
committergareth2007-03-22 10:11:15 +0000
commit7daa3955bc3a1918e40962851f9e8d38597a245e (patch)
treebee3e1372a7eed0c1b220a8a49f7bee7d29a6b91 /OpenSim.RegionServer/Grid.cs
parentLoad XML for neighbourinfo from grid (diff)
downloadopensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.zip
opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.gz
opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.bz2
opensim-SC-7daa3955bc3a1918e40962851f9e8d38597a245e.tar.xz
brought zircon branch into trunk
Diffstat (limited to 'OpenSim.RegionServer/Grid.cs')
-rw-r--r--OpenSim.RegionServer/Grid.cs89
1 files changed, 89 insertions, 0 deletions
diff --git a/OpenSim.RegionServer/Grid.cs b/OpenSim.RegionServer/Grid.cs
new file mode 100644
index 0000000..b0df6a8
--- /dev/null
+++ b/OpenSim.RegionServer/Grid.cs
@@ -0,0 +1,89 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Reflection;
5using OpenSim.Framework.Interfaces;
6using OpenSim.UserServer;
7
8namespace OpenSim
9{
10 public class Grid
11 {
12 public IAssetServer AssetServer;
13 public IGridServer GridServer;
14 public string AssetDll = "";
15 public string GridDll = "";
16
17 public Grid()
18 {
19 }
20
21 public virtual void Initialise()
22 {
23 //load the dlls
24 this.AssetServer = this.LoadAssetDll(this.AssetDll);
25 this.GridServer = this.LoadGridDll(this.GridDll);
26 }
27 public virtual void Close()
28 {
29 this.AssetServer.Close();
30 this.GridServer.Close();
31 }
32
33 private IAssetServer LoadAssetDll(string dllName)
34 {
35 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
36 IAssetServer server = null;
37
38 foreach (Type pluginType in pluginAssembly.GetTypes())
39 {
40 if (pluginType.IsPublic)
41 {
42 if (!pluginType.IsAbstract)
43 {
44 Type typeInterface = pluginType.GetInterface("IAssetPlugin", true);
45
46 if (typeInterface != null)
47 {
48 IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
49 server = plug.GetAssetServer();
50 break;
51 }
52
53 typeInterface = null;
54 }
55 }
56 }
57 pluginAssembly = null;
58 return server;
59 }
60
61 private IGridServer LoadGridDll(string dllName)
62 {
63 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
64 IGridServer server = null;
65
66 foreach (Type pluginType in pluginAssembly.GetTypes())
67 {
68 if (pluginType.IsPublic)
69 {
70 if (!pluginType.IsAbstract)
71 {
72 Type typeInterface = pluginType.GetInterface("IGridPlugin", true);
73
74 if (typeInterface != null)
75 {
76 IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
77 server = plug.GetGridServer();
78 break;
79 }
80
81 typeInterface = null;
82 }
83 }
84 }
85 pluginAssembly = null;
86 return server;
87 }
88 }
89}