diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/OpenSim.RegionServer/Grid.cs | 117 |
1 files changed, 0 insertions, 117 deletions
diff --git a/OpenSim/OpenSim.RegionServer/Grid.cs b/OpenSim/OpenSim.RegionServer/Grid.cs deleted file mode 100644 index 844bb71..0000000 --- a/OpenSim/OpenSim.RegionServer/Grid.cs +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using System.Reflection; | ||
32 | using OpenSim.Framework.Interfaces; | ||
33 | using OpenSim.UserServer; | ||
34 | |||
35 | namespace OpenSim.RegionServer | ||
36 | { | ||
37 | public class Grid | ||
38 | { | ||
39 | public IAssetServer AssetServer; | ||
40 | public IGridServer GridServer; | ||
41 | public IUserServer UserServer; | ||
42 | public string AssetDll = ""; | ||
43 | public string GridDll = ""; | ||
44 | |||
45 | public Grid() | ||
46 | { | ||
47 | } | ||
48 | |||
49 | public virtual void Initialise() | ||
50 | { | ||
51 | //load the dlls | ||
52 | this.AssetServer = this.LoadAssetDll(this.AssetDll); | ||
53 | this.GridServer = this.LoadGridDll(this.GridDll); | ||
54 | } | ||
55 | public virtual void Close() | ||
56 | { | ||
57 | this.AssetServer.Close(); | ||
58 | this.GridServer.Close(); | ||
59 | } | ||
60 | |||
61 | private IAssetServer LoadAssetDll(string dllName) | ||
62 | { | ||
63 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
64 | IAssetServer 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("IAssetPlugin", true); | ||
73 | |||
74 | if (typeInterface != null) | ||
75 | { | ||
76 | IAssetPlugin plug = (IAssetPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
77 | server = plug.GetAssetServer(); | ||
78 | break; | ||
79 | } | ||
80 | |||
81 | typeInterface = null; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | pluginAssembly = null; | ||
86 | return server; | ||
87 | } | ||
88 | |||
89 | private IGridServer LoadGridDll(string dllName) | ||
90 | { | ||
91 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
92 | IGridServer server = null; | ||
93 | |||
94 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
95 | { | ||
96 | if (pluginType.IsPublic) | ||
97 | { | ||
98 | if (!pluginType.IsAbstract) | ||
99 | { | ||
100 | Type typeInterface = pluginType.GetInterface("IGridPlugin", true); | ||
101 | |||
102 | if (typeInterface != null) | ||
103 | { | ||
104 | IGridPlugin plug = (IGridPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
105 | server = plug.GetGridServer(); | ||
106 | break; | ||
107 | } | ||
108 | |||
109 | typeInterface = null; | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | pluginAssembly = null; | ||
114 | return server; | ||
115 | } | ||
116 | } | ||
117 | } | ||