diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/CommunicationsManager.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/InventoryServiceBase.cs | 19 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 32 | ||||
-rw-r--r-- | OpenSim/Framework/PluginLoader.cs | 103 |
4 files changed, 92 insertions, 63 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 3f46776..bcf9bed 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs | |||
@@ -110,7 +110,6 @@ namespace OpenSim.Framework.Communications | |||
110 | /// </summary> | 110 | /// </summary> |
111 | protected IUserServiceAdmin m_userServiceAdmin; | 111 | protected IUserServiceAdmin m_userServiceAdmin; |
112 | 112 | ||
113 | |||
114 | public BaseHttpServer HttpServer | 113 | public BaseHttpServer HttpServer |
115 | { | 114 | { |
116 | get { return m_httpServer; } | 115 | get { return m_httpServer; } |
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 5841151..777e15b 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs | |||
@@ -48,20 +48,29 @@ namespace OpenSim.Framework.Communications | |||
48 | #region Plugin methods | 48 | #region Plugin methods |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Adds a new user server plugin - plugins will be requested in the order they were loaded. | 51 | /// Add a new inventory data plugin - plugins will be requested in the order they were added. |
52 | /// </summary> | 52 | /// </summary> |
53 | /// <param name="provider">The filename to the user server plugin DLL</param> | 53 | /// <param name="plugin">The plugin that will provide data</param> |
54 | public void AddPlugin(IInventoryDataPlugin plugin) | ||
55 | { | ||
56 | m_plugins.Add(plugin); | ||
57 | } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Adds a new inventory data plugin - plugins will be requested in the order they were loaded. | ||
61 | /// </summary> | ||
62 | /// <param name="provider">The filename of the inventory server plugin DLL</param> | ||
54 | public void AddPlugin(string provider, string connect) | 63 | public void AddPlugin(string provider, string connect) |
55 | { | 64 | { |
56 | PluginLoader<IInventoryDataPlugin> loader = | 65 | PluginLoader<IInventoryDataPlugin> loader = |
57 | new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser (connect)); | 66 | new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser(connect)); |
58 | 67 | ||
59 | // loader will try to load all providers (MySQL, MSSQL, etc) | 68 | // loader will try to load all providers (MySQL, MSSQL, etc) |
60 | // unless it is constrainted to the correct "Provider" entry in the addin.xml | 69 | // unless it is constrainted to the correct "Provider" entry in the addin.xml |
61 | loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter (provider)); | 70 | loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider)); |
62 | loader.Load(); | 71 | loader.Load(); |
63 | 72 | ||
64 | m_plugins = loader.Plugins; | 73 | m_plugins.AddRange(loader.Plugins); |
65 | } | 74 | } |
66 | 75 | ||
67 | #endregion | 76 | #endregion |
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 2a66260..a929317 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -48,12 +48,24 @@ namespace OpenSim.Framework.Communications | |||
48 | private static readonly ILog m_log | 48 | private static readonly ILog m_log |
49 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | /// <value> | ||
52 | /// List of plugins to search for user data | ||
53 | /// </value> | ||
51 | private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); | 54 | private List<IUserDataPlugin> _plugins = new List<IUserDataPlugin>(); |
55 | |||
56 | /// <summary> | ||
57 | /// Add a new user data plugin - plugins will be requested in the order they were added. | ||
58 | /// </summary> | ||
59 | /// <param name="plugin">The plugin that will provide user data</param> | ||
60 | public void AddPlugin(IUserDataPlugin plugin) | ||
61 | { | ||
62 | _plugins.Add(plugin); | ||
63 | } | ||
52 | 64 | ||
53 | /// <summary> | 65 | /// <summary> |
54 | /// Adds a new user server plugin - user servers will be requested in the order they were loaded. | 66 | /// Add a new user data plugin - plugins will be requested in the order they were added. |
55 | /// </summary> | 67 | /// </summary> |
56 | /// <param name="provider">The filename to the user server plugin DLL</param> | 68 | /// <param name="provider">The filename to the user data plugin DLL</param> |
57 | /// <param name="connect"></param> | 69 | /// <param name="connect"></param> |
58 | public void AddPlugin(string provider, string connect) | 70 | public void AddPlugin(string provider, string connect) |
59 | { | 71 | { |
@@ -65,7 +77,7 @@ namespace OpenSim.Framework.Communications | |||
65 | loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); | 77 | loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); |
66 | loader.Load(); | 78 | loader.Load(); |
67 | 79 | ||
68 | _plugins = loader.Plugins; | 80 | _plugins.AddRange(loader.Plugins); |
69 | } | 81 | } |
70 | 82 | ||
71 | #region Get UserProfile | 83 | #region Get UserProfile |
@@ -637,7 +649,7 @@ namespace OpenSim.Framework.Communications | |||
637 | } | 649 | } |
638 | catch (Exception e) | 650 | catch (Exception e) |
639 | { | 651 | { |
640 | m_log.Info("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")"); | 652 | m_log.Error("[USERSTORAGE]: Unable to add user via " + plugin.Name + "(" + e.ToString() + ")"); |
641 | } | 653 | } |
642 | } | 654 | } |
643 | 655 | ||
@@ -696,8 +708,11 @@ namespace OpenSim.Framework.Communications | |||
696 | return false; | 708 | return false; |
697 | } | 709 | } |
698 | 710 | ||
699 | /// Appearance | 711 | /// <summary> |
700 | /// TODO: stubs for now to get us to a compiling state gently | 712 | /// Get avatar appearance information |
713 | /// </summary> | ||
714 | /// <param name="user"></param> | ||
715 | /// <returns></returns> | ||
701 | public AvatarAppearance GetUserAppearance(UUID user) | 716 | public AvatarAppearance GetUserAppearance(UUID user) |
702 | { | 717 | { |
703 | foreach (IUserDataPlugin plugin in _plugins) | 718 | foreach (IUserDataPlugin plugin in _plugins) |
@@ -714,6 +729,11 @@ namespace OpenSim.Framework.Communications | |||
714 | return null; | 729 | return null; |
715 | } | 730 | } |
716 | 731 | ||
732 | /// <summary> | ||
733 | /// Update avatar appearance information | ||
734 | /// </summary> | ||
735 | /// <param name="user"></param> | ||
736 | /// <param name="appearance"></param> | ||
717 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) | 737 | public void UpdateUserAppearance(UUID user, AvatarAppearance appearance) |
718 | { | 738 | { |
719 | foreach (IUserDataPlugin plugin in _plugins) | 739 | foreach (IUserDataPlugin plugin in _plugins) |
diff --git a/OpenSim/Framework/PluginLoader.cs b/OpenSim/Framework/PluginLoader.cs index 440e0d5..baf9c57 100644 --- a/OpenSim/Framework/PluginLoader.cs +++ b/OpenSim/Framework/PluginLoader.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Framework | |||
51 | public interface IPluginConstraint | 51 | public interface IPluginConstraint |
52 | { | 52 | { |
53 | string Message { get; } | 53 | string Message { get; } |
54 | bool Apply (string extpoint); | 54 | bool Apply(string extpoint); |
55 | } | 55 | } |
56 | 56 | ||
57 | /// <summary> | 57 | /// <summary> |
@@ -60,7 +60,7 @@ namespace OpenSim.Framework | |||
60 | /// </summary> | 60 | /// </summary> |
61 | public interface IPluginFilter | 61 | public interface IPluginFilter |
62 | { | 62 | { |
63 | bool Apply (PluginExtensionNode plugin); | 63 | bool Apply(PluginExtensionNode plugin); |
64 | } | 64 | } |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
@@ -99,89 +99,90 @@ namespace OpenSim.Framework | |||
99 | get { return (loaded.Count == 1)? loaded [0] : default (T); } | 99 | get { return (loaded.Count == 1)? loaded [0] : default (T); } |
100 | } | 100 | } |
101 | 101 | ||
102 | public PluginLoader () | 102 | public PluginLoader() |
103 | { | 103 | { |
104 | Initialiser = new PluginInitialiserBase(); | 104 | Initialiser = new PluginInitialiserBase(); |
105 | initialise_plugin_dir_ ("."); | 105 | initialise_plugin_dir_("."); |
106 | } | 106 | } |
107 | 107 | ||
108 | public PluginLoader (PluginInitialiserBase init) | 108 | public PluginLoader(PluginInitialiserBase init) |
109 | { | 109 | { |
110 | Initialiser = init; | 110 | Initialiser = init; |
111 | initialise_plugin_dir_ ("."); | 111 | initialise_plugin_dir_("."); |
112 | } | 112 | } |
113 | 113 | ||
114 | public PluginLoader (PluginInitialiserBase init, string dir) | 114 | public PluginLoader(PluginInitialiserBase init, string dir) |
115 | { | 115 | { |
116 | Initialiser = init; | 116 | Initialiser = init; |
117 | initialise_plugin_dir_ (dir); | 117 | initialise_plugin_dir_(dir); |
118 | } | 118 | } |
119 | 119 | ||
120 | public void Add (string extpoint) | 120 | public void Add(string extpoint) |
121 | { | 121 | { |
122 | if (extpoints.Contains (extpoint)) | 122 | if (extpoints.Contains(extpoint)) |
123 | return; | 123 | return; |
124 | 124 | ||
125 | extpoints.Add (extpoint); | 125 | extpoints.Add(extpoint); |
126 | } | 126 | } |
127 | 127 | ||
128 | public void Add (string extpoint, IPluginConstraint cons) | 128 | public void Add(string extpoint, IPluginConstraint cons) |
129 | { | 129 | { |
130 | Add (extpoint); | 130 | Add(extpoint); |
131 | AddConstraint (extpoint, cons); | 131 | AddConstraint(extpoint, cons); |
132 | } | 132 | } |
133 | 133 | ||
134 | public void Add (string extpoint, IPluginFilter filter) | 134 | public void Add(string extpoint, IPluginFilter filter) |
135 | { | 135 | { |
136 | Add (extpoint); | 136 | Add(extpoint); |
137 | AddFilter (extpoint, filter); | 137 | AddFilter(extpoint, filter); |
138 | } | 138 | } |
139 | 139 | ||
140 | public void AddConstraint (string extpoint, IPluginConstraint cons) | 140 | public void AddConstraint(string extpoint, IPluginConstraint cons) |
141 | { | 141 | { |
142 | constraints.Add (extpoint, cons); | 142 | constraints.Add(extpoint, cons); |
143 | } | 143 | } |
144 | 144 | ||
145 | public void AddFilter (string extpoint, IPluginFilter filter) | 145 | public void AddFilter(string extpoint, IPluginFilter filter) |
146 | { | 146 | { |
147 | filters.Add (extpoint, filter); | 147 | filters.Add(extpoint, filter); |
148 | } | 148 | } |
149 | 149 | ||
150 | public void Load (string extpoint) | 150 | public void Load(string extpoint) |
151 | { | 151 | { |
152 | Add (extpoint); | 152 | Add(extpoint); |
153 | Load(); | 153 | Load(); |
154 | } | 154 | } |
155 | 155 | ||
156 | public void Load () | 156 | public void Load() |
157 | { | 157 | { |
158 | foreach (string ext in extpoints) | 158 | foreach (string ext in extpoints) |
159 | { | 159 | { |
160 | log.Info("[PLUGINS]: Loading extension point " + ext); | 160 | log.Info("[PLUGINS]: Loading extension point " + ext); |
161 | 161 | ||
162 | if (constraints.ContainsKey (ext)) | 162 | if (constraints.ContainsKey(ext)) |
163 | { | 163 | { |
164 | IPluginConstraint cons = constraints [ext]; | 164 | IPluginConstraint cons = constraints[ext]; |
165 | if (cons.Apply (ext)) | 165 | if (cons.Apply(ext)) |
166 | log.Error ("[PLUGINS]: " + ext + " failed constraint: " + cons.Message); | 166 | log.Error("[PLUGINS]: " + ext + " failed constraint: " + cons.Message); |
167 | } | 167 | } |
168 | 168 | ||
169 | IPluginFilter filter = null; | 169 | IPluginFilter filter = null; |
170 | 170 | ||
171 | if (filters.ContainsKey (ext)) | 171 | if (filters.ContainsKey(ext)) |
172 | filter = filters [ext]; | 172 | filter = filters[ext]; |
173 | 173 | ||
174 | List<T> loadedPlugins = new List<T>(); | 174 | List<T> loadedPlugins = new List<T>(); |
175 | foreach (PluginExtensionNode node in AddinManager.GetExtensionNodes (ext)) | 175 | foreach (PluginExtensionNode node in AddinManager.GetExtensionNodes(ext)) |
176 | { | 176 | { |
177 | log.Info("[PLUGINS]: Trying plugin " + node.Path); | 177 | log.Info("[PLUGINS]: Trying plugin " + node.Path); |
178 | 178 | ||
179 | if ((filter != null) && (filter.Apply (node) == false)) | 179 | if ((filter != null) && (filter.Apply(node) == false)) |
180 | continue; | 180 | continue; |
181 | 181 | ||
182 | T plugin = (T) node.CreateInstance(); | 182 | T plugin = (T)node.CreateInstance(); |
183 | loadedPlugins.Add(plugin); | 183 | loadedPlugins.Add(plugin); |
184 | } | 184 | } |
185 | |||
185 | // We do Initialise() in a second loop after CreateInstance | 186 | // We do Initialise() in a second loop after CreateInstance |
186 | // So that modules who need init before others can do it | 187 | // So that modules who need init before others can do it |
187 | // Example: Script Engine Component System needs to load its components before RegionLoader starts | 188 | // Example: Script Engine Component System needs to load its components before RegionLoader starts |
@@ -193,28 +194,28 @@ namespace OpenSim.Framework | |||
193 | } | 194 | } |
194 | } | 195 | } |
195 | 196 | ||
196 | public void Dispose () | 197 | public void Dispose() |
197 | { | 198 | { |
198 | foreach (T plugin in Plugins) | 199 | foreach (T plugin in Plugins) |
199 | plugin.Dispose (); | 200 | plugin.Dispose(); |
200 | } | 201 | } |
201 | 202 | ||
202 | private void initialise_plugin_dir_ (string dir) | 203 | private void initialise_plugin_dir_(string dir) |
203 | { | 204 | { |
204 | if (AddinManager.IsInitialized == true) | 205 | if (AddinManager.IsInitialized == true) |
205 | return; | 206 | return; |
206 | 207 | ||
207 | log.Info("[PLUGINS]: Initializing"); | 208 | log.Info("[PLUGINS]: Initializing addin manager"); |
208 | 209 | ||
209 | AddinManager.AddinLoadError += on_addinloaderror_; | 210 | AddinManager.AddinLoadError += on_addinloaderror_; |
210 | AddinManager.AddinLoaded += on_addinloaded_; | 211 | AddinManager.AddinLoaded += on_addinloaded_; |
211 | 212 | ||
212 | clear_registry_(); | 213 | clear_registry_(); |
213 | 214 | ||
214 | suppress_console_output_ (true); | 215 | suppress_console_output_(true); |
215 | AddinManager.Initialize (dir); | 216 | AddinManager.Initialize(dir); |
216 | AddinManager.Registry.Update (null); | 217 | AddinManager.Registry.Update(null); |
217 | suppress_console_output_ (false); | 218 | suppress_console_output_(false); |
218 | } | 219 | } |
219 | 220 | ||
220 | private void on_addinloaded_(object sender, AddinEventArgs args) | 221 | private void on_addinloaded_(object sender, AddinEventArgs args) |
@@ -233,7 +234,7 @@ namespace OpenSim.Framework | |||
233 | + args.Exception.StackTrace); | 234 | + args.Exception.StackTrace); |
234 | } | 235 | } |
235 | 236 | ||
236 | private void clear_registry_ () | 237 | private void clear_registry_() |
237 | { | 238 | { |
238 | // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) | 239 | // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) |
239 | // occasionally seems to corrupt its addin cache | 240 | // occasionally seems to corrupt its addin cache |
@@ -259,7 +260,7 @@ namespace OpenSim.Framework | |||
259 | } | 260 | } |
260 | 261 | ||
261 | private static TextWriter prev_console_; | 262 | private static TextWriter prev_console_; |
262 | public void suppress_console_output_ (bool save) | 263 | public void suppress_console_output_(bool save) |
263 | { | 264 | { |
264 | if (save) | 265 | if (save) |
265 | { | 266 | { |
@@ -295,15 +296,15 @@ namespace OpenSim.Framework | |||
295 | return typeobj; | 296 | return typeobj; |
296 | 297 | ||
297 | if (type.Length == 0) | 298 | if (type.Length == 0) |
298 | throw new InvalidOperationException ("Type name not specified."); | 299 | throw new InvalidOperationException("Type name not specified."); |
299 | 300 | ||
300 | return typeobj = Addin.GetType (type, true); | 301 | return typeobj = Addin.GetType(type, true); |
301 | } | 302 | } |
302 | } | 303 | } |
303 | 304 | ||
304 | public object CreateInstance () | 305 | public object CreateInstance() |
305 | { | 306 | { |
306 | return Activator.CreateInstance (TypeObject); | 307 | return Activator.CreateInstance(TypeObject); |
307 | } | 308 | } |
308 | } | 309 | } |
309 | 310 | ||
@@ -315,13 +316,13 @@ namespace OpenSim.Framework | |||
315 | private int min; | 316 | private int min; |
316 | private int max; | 317 | private int max; |
317 | 318 | ||
318 | public PluginCountConstraint (int exact) | 319 | public PluginCountConstraint(int exact) |
319 | { | 320 | { |
320 | min = exact; | 321 | min = exact; |
321 | max = exact; | 322 | max = exact; |
322 | } | 323 | } |
323 | 324 | ||
324 | public PluginCountConstraint (int minimum, int maximum) | 325 | public PluginCountConstraint(int minimum, int maximum) |
325 | { | 326 | { |
326 | min = minimum; | 327 | min = minimum; |
327 | max = maximum; | 328 | max = maximum; |
@@ -338,10 +339,10 @@ namespace OpenSim.Framework | |||
338 | 339 | ||
339 | public bool Apply (string extpoint) | 340 | public bool Apply (string extpoint) |
340 | { | 341 | { |
341 | int count = AddinManager.GetExtensionNodes (extpoint).Count; | 342 | int count = AddinManager.GetExtensionNodes(extpoint).Count; |
342 | 343 | ||
343 | if ((count < min) || (count > max)) | 344 | if ((count < min) || (count > max)) |
344 | throw new PluginConstraintViolatedException (Message); | 345 | throw new PluginConstraintViolatedException(Message); |
345 | 346 | ||
346 | return true; | 347 | return true; |
347 | } | 348 | } |