aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorCharles Krinke2008-07-11 02:04:02 +0000
committerCharles Krinke2008-07-11 02:04:02 +0000
commitcda526939145d92794eb14554ef43badaf06c149 (patch)
treeb152e13ae8925f5d7ec850bdfac847a0fe472ab9 /OpenSim/Framework
parentMantis#1541. Thank you kindly, Phrearch for a patch that: (diff)
downloadopensim-SC_OLD-cda526939145d92794eb14554ef43badaf06c149.zip
opensim-SC_OLD-cda526939145d92794eb14554ef43badaf06c149.tar.gz
opensim-SC_OLD-cda526939145d92794eb14554ef43badaf06c149.tar.bz2
opensim-SC_OLD-cda526939145d92794eb14554ef43badaf06c149.tar.xz
Mantis#1682. Revert temporarily, Sempuki's mono addins patch
while he studies the issues in Windows a little bit.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/PluginLoader.cs59
1 files changed, 24 insertions, 35 deletions
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs
index cfc1d7c..9104958 100644
--- a/OpenSim/Framework/PluginLoader.cs
+++ b/OpenSim/Framework/PluginLoader.cs
@@ -55,7 +55,6 @@ namespace OpenSim.Framework
55 } 55 }
56 56
57 /// <summary> 57 /// <summary>
58
59 /// Generic Plugin Loader 58 /// Generic Plugin Loader
60 /// </summary> 59 /// </summary>
61 public class PluginLoader <T> : IDisposable where T : IPlugin 60 public class PluginLoader <T> : IDisposable where T : IPlugin
@@ -67,17 +66,16 @@ namespace OpenSim.Framework
67 private PluginInitialiserBase initialiser; 66 private PluginInitialiserBase initialiser;
68 private Dictionary<string,IPluginConstraint> constraints 67 private Dictionary<string,IPluginConstraint> constraints
69 = new Dictionary<string,IPluginConstraint>(); 68 = new Dictionary<string,IPluginConstraint>();
70 69
71 private static bool runonce = false;
72 private static readonly ILog log 70 private static readonly ILog log
73 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 71 = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74 72
75 public PluginInitialiserBase Initialiser 73 public PluginInitialiserBase Initialiser
76 { 74 {
77 set { initialiser = value; } 75 set { initialiser = value; }
78 get { return initialiser; } 76 get { return initialiser; }
79 } 77 }
80 78
81 public List<T> Plugins 79 public List<T> Plugins
82 { 80 {
83 get { return loaded; } 81 get { return loaded; }
@@ -86,19 +84,25 @@ namespace OpenSim.Framework
86 public PluginLoader () 84 public PluginLoader ()
87 { 85 {
88 Initialiser = new PluginInitialiserBase(); 86 Initialiser = new PluginInitialiserBase();
89 initialise_plugin_dir_ (".");
90 } 87 }
91 88
92 public PluginLoader (PluginInitialiserBase init) 89 public PluginLoader (PluginInitialiserBase init)
93 { 90 {
94 Initialiser = init; 91 Initialiser = init;
95 initialise_plugin_dir_ (".");
96 } 92 }
97 93
98 public PluginLoader (PluginInitialiserBase init, string dir) 94 public PluginLoader (PluginInitialiserBase init, string dir)
99 { 95 {
100 Initialiser = init; 96 Initialiser = init;
101 initialise_plugin_dir_ (dir); 97 AddPluginDir (dir);
98 }
99
100 public void AddPluginDir (string dir)
101 {
102 suppress_console_output_ (true);
103 AddinManager.Initialize (dir);
104 AddinManager.Registry.Update (null);
105 suppress_console_output_ (false);
102 } 106 }
103 107
104 public void AddExtensionPoint (string extpoint) 108 public void AddExtensionPoint (string extpoint)
@@ -110,21 +114,22 @@ namespace OpenSim.Framework
110 { 114 {
111 constraints.Add (extpoint, cons); 115 constraints.Add (extpoint, cons);
112 } 116 }
113 117
114 public void Load (string extpoint) 118 public void Load (string extpoint, string dir)
115 { 119 {
120 AddPluginDir (dir);
116 AddExtensionPoint (extpoint); 121 AddExtensionPoint (extpoint);
117 Load(); 122 Load();
118 } 123 }
119 124
120 public void Load () 125 public void Load ()
121 { 126 {
122 log.Info("[PLUGINS]: Begin Loading " + AddinManager.Registry.RegistryPath); 127 suppress_console_output_ (true);
128 AddinManager.Registry.Update (null);
129 suppress_console_output_ (false);
123 130
124 foreach (string ext in extpoints) 131 foreach (string ext in extpoints)
125 { 132 {
126 log.Info("[PLUGINS]: Loading extension point " + ext);
127
128 if (constraints.ContainsKey (ext)) 133 if (constraints.ContainsKey (ext))
129 { 134 {
130 IPluginConstraint cons = constraints [ext]; 135 IPluginConstraint cons = constraints [ext];
@@ -150,25 +155,9 @@ namespace OpenSim.Framework
150 p.Dispose (); 155 p.Dispose ();
151 } 156 }
152 157
153 private void initialise_plugin_dir_ (string dir) 158 public void ClearCache()
154 {
155 if (runonce == true)
156 return;
157
158 log.Info("[PLUGINS]: Initialzing " + dir);
159
160 clear_registry_();
161 suppress_console_output_ (true);
162 AddinManager.Initialize (dir);
163 AddinManager.Registry.Update (null);
164 suppress_console_output_ (false);
165 runonce = true;
166 }
167
168 private void clear_registry_ ()
169 { 159 {
170 // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) 160 // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) occasionally seems to corrupt its addin cache
171 // occasionally seems to corrupt its addin cache
172 // Hence, as a temporary solution we'll remove it before each startup 161 // Hence, as a temporary solution we'll remove it before each startup
173 if (Directory.Exists("addin-db-000")) 162 if (Directory.Exists("addin-db-000"))
174 Directory.Delete("addin-db-000", true); 163 Directory.Delete("addin-db-000", true);
@@ -236,7 +225,7 @@ namespace OpenSim.Framework
236 public PluginFilenameConstraint (string name) 225 public PluginFilenameConstraint (string name)
237 { 226 {
238 filename = name; 227 filename = name;
239 228
240 } 229 }
241 230
242 public string Message 231 public string Message
@@ -256,7 +245,7 @@ namespace OpenSim.Framework
256 string[] path = ns[0].Path.Split('/'); 245 string[] path = ns[0].Path.Split('/');
257 if (path [path.Length-1] == filename) 246 if (path [path.Length-1] == filename)
258 return false; 247 return false;
259 248
260 return true; 249 return true;
261 } 250 }
262 } 251 }