diff options
author | Melanie Thielker | 2009-05-09 02:49:55 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-05-09 02:49:55 +0000 |
commit | c1e7352d75b62b6c97e79c4fdb37b9493aba697a (patch) | |
tree | 0bf2e2b12fafc2fc08dce9c50a0fa198b787979c /OpenSim/Servers/Base | |
parent | FInish basic asset server functionality on the new asset server (diff) | |
download | opensim-SC-c1e7352d75b62b6c97e79c4fdb37b9493aba697a.zip opensim-SC-c1e7352d75b62b6c97e79c4fdb37b9493aba697a.tar.gz opensim-SC-c1e7352d75b62b6c97e79c4fdb37b9493aba697a.tar.bz2 opensim-SC-c1e7352d75b62b6c97e79c4fdb37b9493aba697a.tar.xz |
Add the asset service connectors and sample config. READ WARNINGS!!!
Diffstat (limited to 'OpenSim/Servers/Base')
-rw-r--r-- | OpenSim/Servers/Base/ServerUtils.cs | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/OpenSim/Servers/Base/ServerUtils.cs b/OpenSim/Servers/Base/ServerUtils.cs index 58d2b2b..4e8f472 100644 --- a/OpenSim/Servers/Base/ServerUtils.cs +++ b/OpenSim/Servers/Base/ServerUtils.cs | |||
@@ -27,11 +27,12 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | ||
30 | using System.Xml; | 31 | using System.Xml; |
31 | using System.Xml.Serialization; | 32 | using System.Xml.Serialization; |
32 | using System.Text; | 33 | using System.Text; |
33 | 34 | ||
34 | namespace OpenSim.Servers.AssetServer | 35 | namespace OpenSim.Servers.Base |
35 | { | 36 | { |
36 | public static class ServerUtils | 37 | public static class ServerUtils |
37 | { | 38 | { |
@@ -92,5 +93,37 @@ namespace OpenSim.Servers.AssetServer | |||
92 | 93 | ||
93 | return ret; | 94 | return ret; |
94 | } | 95 | } |
96 | |||
97 | public static T LoadPlugin<T>(string dllName, Object[] args) where T:class | ||
98 | { | ||
99 | string interfaceName = typeof(T).ToString(); | ||
100 | |||
101 | try | ||
102 | { | ||
103 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
104 | |||
105 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
106 | { | ||
107 | if (pluginType.IsPublic) | ||
108 | { | ||
109 | Type typeInterface = | ||
110 | pluginType.GetInterface(interfaceName, true); | ||
111 | if (typeInterface != null) | ||
112 | { | ||
113 | T plug = (T)Activator.CreateInstance(pluginType, | ||
114 | args); | ||
115 | |||
116 | return plug; | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | |||
121 | return null; | ||
122 | } | ||
123 | catch (Exception e) | ||
124 | { | ||
125 | return null; | ||
126 | } | ||
127 | } | ||
95 | } | 128 | } |
96 | } | 129 | } |