aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-20 19:52:55 +0000
committerJustin Clarke Casey2008-11-20 19:52:55 +0000
commitb9c07730f5216e8baa61185437cc5023d8c70200 (patch)
tree2da8bfe0144f3b29a056ed76edc223106ad3ca39 /OpenSim/Region
parent* Allow physics dlls to be loaded separately, rather than just the contents o... (diff)
downloadopensim-SC_OLD-b9c07730f5216e8baa61185437cc5023d8c70200.zip
opensim-SC_OLD-b9c07730f5216e8baa61185437cc5023d8c70200.tar.gz
opensim-SC_OLD-b9c07730f5216e8baa61185437cc5023d8c70200.tar.bz2
opensim-SC_OLD-b9c07730f5216e8baa61185437cc5023d8c70200.tar.xz
* refactor: change some method names and doc in the physics plugin manager
* move the directory choice for plugins outside into RegionApplicationBase
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs26
3 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index cac4591..61edae5 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.IO;
29using System.Net; 30using System.Net;
30using System.Reflection; 31using System.Reflection;
31using OpenMetaverse; 32using OpenMetaverse;
@@ -102,7 +103,8 @@ namespace OpenSim.Region.ClientStack
102 { 103 {
103 PhysicsPluginManager physicsPluginManager; 104 PhysicsPluginManager physicsPluginManager;
104 physicsPluginManager = new PhysicsPluginManager(); 105 physicsPluginManager = new PhysicsPluginManager();
105 physicsPluginManager.LoadPlugins(); 106 physicsPluginManager.LoadPluginsFromAssemblies("Physics");
107
106 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config); 108 return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config);
107 } 109 }
108 110
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
index 289bf87..31fe0b6 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
63 testScene.LandChannel = new TestLandChannel(); 63 testScene.LandChannel = new TestLandChannel();
64 64
65 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); 65 PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
66 physicsPluginManager.LoadPlugin("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 66 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
67 testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource); 67 testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource);
68 68
69 return testScene; 69 return testScene;
diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
index 71fad02..428a586 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs
@@ -104,26 +104,26 @@ namespace OpenSim.Region.Physics.Manager
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// Load all built-in 'plugins' and those in the bin/Physics diretory 107 /// Load all plugins in assemblies at the given path
108 /// </summary> 108 /// </summary>
109 public void LoadPlugins() 109 /// <param name="pluginsPath"></param>
110 public void LoadPluginsFromAssemblies(string assembliesPath)
110 { 111 {
111 // And now walk all assemblies (DLLs effectively) and see if they are home 112 // Walk all assemblies (DLLs effectively) and see if they are home
112 // of a plugin that is of interest for us 113 // of a plugin that is of interest for us
113 string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Physics"); 114 string[] pluginFiles = Directory.GetFiles(assembliesPath, "*.dll");
114 string[] pluginFiles = Directory.GetFiles(path, "*.dll");
115 115
116 for (int i = 0; i < pluginFiles.Length; i++) 116 for (int i = 0; i < pluginFiles.Length; i++)
117 { 117 {
118 LoadPlugin(pluginFiles[i]); 118 LoadPluginsFromAssembly(pluginFiles[i]);
119 } 119 }
120 } 120 }
121 121
122 /// <summary> 122 /// <summary>
123 /// Load plugins from a dll at the given path 123 /// Load plugins from an assembly at the given path
124 /// </summary> 124 /// </summary>
125 /// <param name="dllPath"></param> 125 /// <param name="assemblyPath"></param>
126 public void LoadPlugin(string dllPath) 126 public void LoadPluginsFromAssembly(string assemblyPath)
127 { 127 {
128 // TODO / NOTE 128 // TODO / NOTE
129 // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from 129 // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from
@@ -138,11 +138,11 @@ namespace OpenSim.Region.Physics.Manager
138 138
139 try 139 try
140 { 140 {
141 pluginAssembly = Assembly.LoadFrom(dllPath); 141 pluginAssembly = Assembly.LoadFrom(assemblyPath);
142 } 142 }
143 catch (Exception ex) 143 catch (Exception ex)
144 { 144 {
145 m_log.Error("[PHYSICS]: Failed to load plugin from " + dllPath, ex); 145 m_log.Error("[PHYSICS]: Failed to load plugin from " + assemblyPath, ex);
146 } 146 }
147 147
148 if (pluginAssembly != null) 148 if (pluginAssembly != null)
@@ -153,12 +153,12 @@ namespace OpenSim.Region.Physics.Manager
153 } 153 }
154 catch (ReflectionTypeLoadException ex) 154 catch (ReflectionTypeLoadException ex)
155 { 155 {
156 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath + ": " + 156 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath + ": " +
157 ex.LoaderExceptions[0].Message, ex); 157 ex.LoaderExceptions[0].Message, ex);
158 } 158 }
159 catch (Exception ex) 159 catch (Exception ex)
160 { 160 {
161 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + dllPath, ex); 161 m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + assemblyPath, ex);
162 } 162 }
163 163
164 if (types != null) 164 if (types != null)