aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Base/ServerUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs53
1 files changed, 28 insertions, 25 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 2e6d279..18a4266 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -41,7 +41,7 @@ using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Framework.Servers; 41using OpenSim.Framework.Servers;
42 42
43 43
44[assembly:AddinRoot("Robust", "0.1")] 44[assembly:AddinRoot("Robust", OpenSim.VersionInfo.VersionNumber)]
45namespace OpenSim.Server.Base 45namespace OpenSim.Server.Base
46{ 46{
47 [TypeExtensionPoint(Path="/Robust/Connector", Name="RobustConnector")] 47 [TypeExtensionPoint(Path="/Robust/Connector", Name="RobustConnector")]
@@ -89,9 +89,9 @@ namespace OpenSim.Server.Base
89 Config = config; 89 Config = config;
90 90
91 Registry = new AddinRegistry(registryPath, "."); 91 Registry = new AddinRegistry(registryPath, ".");
92 suppress_console_output_(true); 92 //suppress_console_output_(true);
93 AddinManager.Initialize(registryPath); 93 AddinManager.Initialize(registryPath);
94 suppress_console_output_(false); 94 //suppress_console_output_(false);
95 AddinManager.Registry.Update(); 95 AddinManager.Registry.Update();
96 CommandManager commandmanager = new CommandManager(Registry); 96 CommandManager commandmanager = new CommandManager(Registry);
97 AddinManager.AddExtensionNodeHandler("/Robust/Connector", OnExtensionChanged); 97 AddinManager.AddExtensionNodeHandler("/Robust/Connector", OnExtensionChanged);
@@ -138,17 +138,17 @@ namespace OpenSim.Server.Base
138 case ExtensionChange.Add: 138 case ExtensionChange.Add:
139 if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) 139 if (a.AddinFile.Contains(Registry.DefaultAddinsFolder))
140 { 140 {
141 m_log.InfoFormat("[SERVER]: Adding {0} from registry", a.Name); 141 m_log.InfoFormat("[SERVER UTILS]: Adding {0} from registry", a.Name);
142 connector.PluginPath = System.IO.Path.Combine(Registry.DefaultAddinsFolder,a.Name.Replace(',', '.')); } 142 connector.PluginPath = System.IO.Path.Combine(Registry.DefaultAddinsFolder,a.Name.Replace(',', '.')); }
143 else 143 else
144 { 144 {
145 m_log.InfoFormat("[SERVER]: Adding {0} from ./bin", a.Name); 145 m_log.InfoFormat("[SERVER UTILS]: Adding {0} from ./bin", a.Name);
146 connector.PluginPath = a.AddinFile; 146 connector.PluginPath = a.AddinFile;
147 } 147 }
148 LoadPlugin(connector); 148 LoadPlugin(connector);
149 break; 149 break;
150 case ExtensionChange.Remove: 150 case ExtensionChange.Remove:
151 m_log.InfoFormat("[SERVER]: Removing {0}", a.Name); 151 m_log.InfoFormat("[SERVER UTILS]: Removing {0}", a.Name);
152 UnloadPlugin(connector); 152 UnloadPlugin(connector);
153 break; 153 break;
154 } 154 }
@@ -166,13 +166,13 @@ namespace OpenSim.Server.Base
166 } 166 }
167 else 167 else
168 { 168 {
169 m_log.InfoFormat("[SERVER]: {0} Disabled.", connector.ConfigName); 169 m_log.InfoFormat("[SERVER UTILS]: {0} Disabled.", connector.ConfigName);
170 } 170 }
171 } 171 }
172 172
173 private void UnloadPlugin(IRobustConnector connector) 173 private void UnloadPlugin(IRobustConnector connector)
174 { 174 {
175 m_log.InfoFormat("[Server]: Unloading {0}", connector.ConfigName); 175 m_log.InfoFormat("[SERVER UTILS]: Unloading {0}", connector.ConfigName);
176 176
177 connector.Unload(); 177 connector.Unload();
178 } 178 }
@@ -196,17 +196,19 @@ namespace OpenSim.Server.Base
196 196
197 public static byte[] SerializeResult(XmlSerializer xs, object data) 197 public static byte[] SerializeResult(XmlSerializer xs, object data)
198 { 198 {
199 MemoryStream ms = new MemoryStream(); 199 using (MemoryStream ms = new MemoryStream())
200 XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8); 200 using (XmlTextWriter xw = new XmlTextWriter(ms, Util.UTF8))
201 xw.Formatting = Formatting.Indented; 201 {
202 xs.Serialize(xw, data); 202 xw.Formatting = Formatting.Indented;
203 xw.Flush(); 203 xs.Serialize(xw, data);
204 xw.Flush();
204 205
205 ms.Seek(0, SeekOrigin.Begin); 206 ms.Seek(0, SeekOrigin.Begin);
206 byte[] ret = ms.GetBuffer(); 207 byte[] ret = ms.GetBuffer();
207 Array.Resize(ref ret, (int)ms.Length); 208 Array.Resize(ref ret, (int)ms.Length);
208 209
209 return ret; 210 return ret;
211 }
210 } 212 }
211 213
212 /// <summary> 214 /// <summary>
@@ -266,7 +268,7 @@ namespace OpenSim.Server.Base
266 && pluginType.ToString() != pluginType.Namespace + "." + className) 268 && pluginType.ToString() != pluginType.Namespace + "." + className)
267 continue; 269 continue;
268 270
269 Type typeInterface = pluginType.GetInterface(interfaceName, true); 271 Type typeInterface = pluginType.GetInterface(interfaceName);
270 272
271 if (typeInterface != null) 273 if (typeInterface != null)
272 { 274 {
@@ -280,12 +282,13 @@ namespace OpenSim.Server.Base
280 { 282 {
281 if (!(e is System.MissingMethodException)) 283 if (!(e is System.MissingMethodException))
282 { 284 {
283 m_log.ErrorFormat("Error loading plugin {0} from {1}. Exception: {2}, {3}", 285 m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin {0} from {1}. Exception: {2}",
284 interfaceName, 286 interfaceName,
285 dllName, 287 dllName,
286 e.InnerException == null ? e.Message : e.InnerException.Message, 288 e.InnerException == null ? e.Message : e.InnerException.Message),
287 e.StackTrace); 289 e);
288 } 290 }
291 m_log.ErrorFormat("[SERVER UTILS]: Error loading plugin {0}: {1} args.Length {2}", dllName, e.Message, args.Length);
289 return null; 292 return null;
290 } 293 }
291 294
@@ -298,14 +301,14 @@ namespace OpenSim.Server.Base
298 } 301 }
299 catch (ReflectionTypeLoadException rtle) 302 catch (ReflectionTypeLoadException rtle)
300 { 303 {
301 m_log.Error(string.Format("Error loading plugin from {0}:\n{1}", dllName, 304 m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin from {0}:\n{1}", dllName,
302 String.Join("\n", Array.ConvertAll(rtle.LoaderExceptions, e => e.ToString()))), 305 String.Join("\n", Array.ConvertAll(rtle.LoaderExceptions, e => e.ToString()))),
303 rtle); 306 rtle);
304 return null; 307 return null;
305 } 308 }
306 catch (Exception e) 309 catch (Exception e)
307 { 310 {
308 m_log.Error(string.Format("Error loading plugin from {0}", dllName), e); 311 m_log.Error(string.Format("[SERVER UTILS]: Error loading plugin from {0}", dllName), e);
309 return null; 312 return null;
310 } 313 }
311 } 314 }
@@ -517,7 +520,7 @@ namespace OpenSim.Server.Base
517 public static IConfigSource LoadInitialConfig(string url) 520 public static IConfigSource LoadInitialConfig(string url)
518 { 521 {
519 IConfigSource source = new XmlConfigSource(); 522 IConfigSource source = new XmlConfigSource();
520 m_log.InfoFormat("[CONFIG]: {0} is a http:// URI, fetching ...", url); 523 m_log.InfoFormat("[SERVER UTILS]: {0} is a http:// URI, fetching ...", url);
521 524
522 // The ini file path is a http URI 525 // The ini file path is a http URI
523 // Try to read it 526 // Try to read it
@@ -529,7 +532,7 @@ namespace OpenSim.Server.Base
529 } 532 }
530 catch (Exception e) 533 catch (Exception e)
531 { 534 {
532 m_log.FatalFormat("[CONFIG]: Exception reading config from URI {0}\n" + e.ToString(), url); 535 m_log.FatalFormat("[SERVER UTILS]: Exception reading config from URI {0}\n" + e.ToString(), url);
533 Environment.Exit(1); 536 Environment.Exit(1);
534 } 537 }
535 538