aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGUserServices.cs7
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs167
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs40
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs33
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs20
7 files changed, 87 insertions, 201 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
index fd831bf..7352e2d 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGUserServices.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Communications.Clients; 35using OpenSim.Framework.Communications.Clients;
36using OpenSim.Region.Communications.OGS1; 36using OpenSim.Region.Communications.OGS1;
37using OpenSim.Region.Communications.Local; 37using OpenSim.Region.Communications.Local;
38using OpenSim.Services.Interfaces;
38 39
39namespace OpenSim.Region.Communications.Hypergrid 40namespace OpenSim.Region.Communications.Hypergrid
40{ 41{
@@ -63,6 +64,12 @@ namespace OpenSim.Region.Communications.Hypergrid
63 m_localUserServices = local; 64 m_localUserServices = local;
64 } 65 }
65 66
67 public override void SetInventoryService(IInventoryService invService)
68 {
69 base.SetInventoryService(invService);
70 m_localUserServices.SetInventoryService(invService);
71 }
72
66 public override UUID AddUser( 73 public override UUID AddUser(
67 string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid) 74 string firstName, string lastName, string password, string email, uint regX, uint regY, UUID uuid)
68 { 75 {
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
deleted file mode 100644
index 6149822..0000000
--- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Reflection;
32using log4net;
33using Nini.Config;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Communications.Services;
40using Caps = OpenSim.Framework.Communications.Capabilities.Caps;
41using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers;
42using OpenSim.Framework.Servers;
43using OpenSim.Framework.Servers.HttpServer;
44using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.CoreModules.ServiceConnectors.Interregion;
47
48using OpenMetaverse.StructuredData;
49
50namespace OpenSim.Region.CoreModules.Hypergrid
51{
52 public class HGStandaloneInventoryModule : IRegionModule
53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private static bool initialized = false;
56 private static bool enabled = false;
57 private static bool safemode = false;
58
59 private bool m_doLookup = false;
60 Scene m_scene;
61 HGInventoryService m_inventoryService;
62 InventoryServiceBase m_inventoryBase;
63
64 public bool DoLookup
65 {
66 get { return m_doLookup; }
67 set { m_doLookup = value; }
68 }
69
70 #region IRegionModule interface
71
72 public void Initialise(Scene scene, IConfigSource config)
73 {
74 if (!initialized)
75 {
76 initialized = true;
77 m_scene = scene;
78
79 // This module is only on for standalones
80 enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false);
81 if (config.Configs["Hypergrid"] != null)
82 safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false);
83 }
84 }
85
86 public void PostInitialise()
87 {
88 if (enabled)
89 {
90 m_log.Info("[HGStandaloneInvModule]: Starting...");
91 //m_inventoryService = new InventoryService(m_scene);
92 m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService;
93
94 m_inventoryService = new HGInventoryService(m_inventoryBase, m_scene.AssetService,
95 (UserManagerBase)m_scene.CommsManager.UserAdminService, m_scene.CommsManager.HttpServer,
96 m_scene.CommsManager.NetworkServersInfo.InventoryURL);
97
98 AddHttpHandlers(m_scene.CommsManager.HttpServer);
99 m_inventoryService.AddHttpHandlers();
100 }
101 }
102
103 public void Close()
104 {
105 }
106
107 public string Name
108 {
109 get { return "HGStandaloneInventoryModule"; }
110 }
111
112 public bool IsSharedModule
113 {
114 get { return true; }
115 }
116
117 #endregion
118
119 public virtual void AddHttpHandlers(IHttpServer httpServer)
120 {
121 if (!safemode)
122 {
123 httpServer.AddStreamHandler(
124 new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
125 "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession));
126 httpServer.AddStreamHandler(
127 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
128 "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession));
129 httpServer.AddStreamHandler(
130 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
131 "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession));
132
133 httpServer.AddStreamHandler(
134 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
135 "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession));
136
137 httpServer.AddStreamHandler(
138 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
139 "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession));
140 }
141
142 httpServer.AddStreamHandler(
143 new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
144 "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession));
145
146 httpServer.AddStreamHandler(
147 new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
148 "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession));
149
150
151 }
152
153 /// <summary>
154 /// Check that the source of an inventory request for a particular agent is a current session belonging to
155 /// that agent.
156 /// </summary>
157 /// <param name="session_id"></param>
158 /// <param name="avatar_id"></param>
159 /// <returns></returns>
160 public bool CheckAuthSession(string session_id, string avatar_id)
161 {
162 return true;
163 }
164
165 }
166
167}
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index 9969ebe..10e2ec2 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -18,8 +18,11 @@
18 <RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.RemoteAssetServicesConnector" /> 18 <RegionModule id="RemoteAssetServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.RemoteAssetServicesConnector" />
19 <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" /> 19 <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Asset.HGAssetBroker" />
20 <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" /> 20 <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.CoreAssetCache" />
21 <RegionModule id="CoreAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" /> 21 <RegionModule id="GlynnTuckerAssetCache" type="OpenSim.Region.CoreModules.Asset.GlynnTuckerAssetCache" />
22 <RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/> 22 <RegionModule id="CenomeMemoryAssetCache" type="OpenSim.Region.CoreModules.Asset.CenomeMemoryAssetCache"/>
23 <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.LocalInventoryServicesConnector" />
24 <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.RemoteInventoryServicesConnector" />
25 <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectors.Inventory.HGInventoryBroker" />
23 <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" /> 26 <RegionModule id="UrlModule" type="OpenSim.Region.CoreModules.Scripting.LSLHttp.UrlModule" />
24 <RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" /> 27 <RegionModule id="Chat" type="OpenSim.Region.CoreModules.Avatar.Chat.ChatModule" />
25 </Extension> 28 </Extension>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
index 3a0011f..03b4873 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs
@@ -84,13 +84,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
84 if (localDll == String.Empty) 84 if (localDll == String.Empty)
85 { 85 {
86 m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); 86 m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService");
87 return; 87 //return;
88 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
88 } 89 }
89 90
90 if (HGDll == String.Empty) 91 if (HGDll == String.Empty)
91 { 92 {
92 m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); 93 m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService");
93 return; 94 //return;
95 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
94 } 96 }
95 97
96 Object[] args = new Object[] { source }; 98 Object[] args = new Object[] { source };
@@ -116,7 +118,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
116 m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty); 118 m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty);
117 119
118 m_Enabled = true; 120 m_Enabled = true;
119 m_log.Info("[HG INVENTORY CONNECTOR]: HG asset broker enabled"); 121 m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled");
120 } 122 }
121 } 123 }
122 } 124 }
@@ -139,6 +141,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
139 m_Scene = scene; 141 m_Scene = scene;
140 // HACK for now. Ugh! 142 // HACK for now. Ugh!
141 m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService; 143 m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
144 // ugh!
145 m_UserProfileService.SetInventoryService(this);
146 scene.CommsManager.UserService.SetInventoryService(this);
147
148 m_Initialized = true;
142 } 149 }
143 150
144 scene.RegisterModuleInterface<IInventoryService>(this); 151 scene.RegisterModuleInterface<IInventoryService>(this);
@@ -153,7 +160,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
153 if (!m_Enabled) 160 if (!m_Enabled)
154 return; 161 return;
155 162
156 m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName); 163 m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName);
157 164
158 } 165 }
159 166
@@ -161,10 +168,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
161 168
162 public bool CreateUserInventory(UUID userID) 169 public bool CreateUserInventory(UUID userID)
163 { 170 {
164 if (IsLocalGridUser(userID)) 171 return m_GridService.CreateUserInventory(userID);
165 return m_GridService.CreateUserInventory(userID);
166 else
167 return false;
168 } 172 }
169 173
170 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) 174 public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
@@ -187,7 +191,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
187 else 191 else
188 { 192 {
189 UUID sessionID = GetSessionID(userID); 193 UUID sessionID = GetSessionID(userID);
190 string uri = "http://" + GetUserInventoryURI(userID) + "/" + userID.ToString(); 194 string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
191 m_HGService.GetUserInventory(uri, sessionID, callback); 195 m_HGService.GetUserInventory(uri, sessionID, callback);
192 } 196 }
193 } 197 }
@@ -207,7 +211,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
207 else 211 else
208 { 212 {
209 UUID sessionID = GetSessionID(folder.Owner); 213 UUID sessionID = GetSessionID(folder.Owner);
210 string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 214 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
211 return m_HGService.AddFolder(uri, folder, sessionID); 215 return m_HGService.AddFolder(uri, folder, sessionID);
212 } 216 }
213 } 217 }
@@ -222,7 +226,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
222 else 226 else
223 { 227 {
224 UUID sessionID = GetSessionID(folder.Owner); 228 UUID sessionID = GetSessionID(folder.Owner);
225 string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 229 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
226 return m_HGService.UpdateFolder(uri, folder, sessionID); 230 return m_HGService.UpdateFolder(uri, folder, sessionID);
227 } 231 }
228 } 232 }
@@ -237,7 +241,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
237 else 241 else
238 { 242 {
239 UUID sessionID = GetSessionID(folder.Owner); 243 UUID sessionID = GetSessionID(folder.Owner);
240 string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 244 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
241 return m_HGService.MoveFolder(uri, folder, sessionID); 245 return m_HGService.MoveFolder(uri, folder, sessionID);
242 } 246 }
243 } 247 }
@@ -252,7 +256,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
252 else 256 else
253 { 257 {
254 UUID sessionID = GetSessionID(folder.Owner); 258 UUID sessionID = GetSessionID(folder.Owner);
255 string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 259 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
256 return m_HGService.PurgeFolder(uri, folder, sessionID); 260 return m_HGService.PurgeFolder(uri, folder, sessionID);
257 } 261 }
258 } 262 }
@@ -267,7 +271,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
267 else 271 else
268 { 272 {
269 UUID sessionID = GetSessionID(item.Owner); 273 UUID sessionID = GetSessionID(item.Owner);
270 string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 274 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
271 return m_HGService.AddItem(uri, item, sessionID); 275 return m_HGService.AddItem(uri, item, sessionID);
272 } 276 }
273 } 277 }
@@ -282,7 +286,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
282 else 286 else
283 { 287 {
284 UUID sessionID = GetSessionID(item.Owner); 288 UUID sessionID = GetSessionID(item.Owner);
285 string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 289 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
286 return m_HGService.UpdateItem(uri, item, sessionID); 290 return m_HGService.UpdateItem(uri, item, sessionID);
287 } 291 }
288 } 292 }
@@ -297,7 +301,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
297 else 301 else
298 { 302 {
299 UUID sessionID = GetSessionID(item.Owner); 303 UUID sessionID = GetSessionID(item.Owner);
300 string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 304 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
301 return m_HGService.DeleteItem(uri, item, sessionID); 305 return m_HGService.DeleteItem(uri, item, sessionID);
302 } 306 }
303 } 307 }
@@ -312,7 +316,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
312 else 316 else
313 { 317 {
314 UUID sessionID = GetSessionID(item.Owner); 318 UUID sessionID = GetSessionID(item.Owner);
315 string uri = "http://" + GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); 319 string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString();
316 return m_HGService.QueryItem(uri, item, sessionID); 320 return m_HGService.QueryItem(uri, item, sessionID);
317 } 321 }
318 } 322 }
@@ -327,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
327 else 331 else
328 { 332 {
329 UUID sessionID = GetSessionID(folder.Owner); 333 UUID sessionID = GetSessionID(folder.Owner);
330 string uri = "http://" + GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); 334 string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString();
331 return m_HGService.QueryFolder(uri, folder, sessionID); 335 return m_HGService.QueryFolder(uri, folder, sessionID);
332 } 336 }
333 } 337 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
index 6b72e9b..ce64d4d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs
@@ -27,6 +27,7 @@
27 27
28using log4net; 28using log4net;
29using Nini.Config; 29using Nini.Config;
30
30using System; 31using System;
31using System.Collections.Generic; 32using System.Collections.Generic;
32using System.Reflection; 33using System.Reflection;
@@ -38,10 +39,10 @@ using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 39using OpenSim.Services.Interfaces;
39using OpenMetaverse; 40using OpenMetaverse;
40 41
42
41namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory 43namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
42{ 44{
43 public class LocalInventoryServicesConnector : 45 public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService
44 ISharedRegionModule, IInventoryService
45 { 46 {
46 private static readonly ILog m_log = 47 private static readonly ILog m_log =
47 LogManager.GetLogger( 48 LogManager.GetLogger(
@@ -50,6 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
50 private IInventoryService m_InventoryService; 51 private IInventoryService m_InventoryService;
51 52
52 private bool m_Enabled = false; 53 private bool m_Enabled = false;
54 private bool m_Initialized = false;
53 55
54 public string Name 56 public string Name
55 { 57 {
@@ -64,15 +66,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
64 string name = moduleConfig.GetString("InventoryServices", ""); 66 string name = moduleConfig.GetString("InventoryServices", "");
65 if (name == Name) 67 if (name == Name)
66 { 68 {
67 IConfig assetConfig = source.Configs["InventoryService"]; 69 IConfig inventoryConfig = source.Configs["InventoryService"];
68 if (assetConfig == null) 70 if (inventoryConfig == null)
69 { 71 {
70 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); 72 m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini");
71 return; 73 return;
72 } 74 }
73 75
74 string serviceDll = assetConfig.GetString("LocalServiceModule", 76 string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty);
75 String.Empty);
76 77
77 if (serviceDll == String.Empty) 78 if (serviceDll == String.Empty)
78 { 79 {
@@ -81,14 +82,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
81 } 82 }
82 83
83 Object[] args = new Object[] { source }; 84 Object[] args = new Object[] { source };
84 m_InventoryService = 85 m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll);
85 ServerUtils.LoadPlugin<IInventoryService>(serviceDll, 86
86 args); 87 m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args);
87 88
88 if (m_InventoryService == null) 89 if (m_InventoryService == null)
89 { 90 {
90 m_log.Error("[INVENTORY CONNECTOR]: Can't load asset service"); 91 m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service");
91 return; 92 //return;
93 throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's");
92 } 94 }
93 95
94 //List<IInventoryDataPlugin> plugins 96 //List<IInventoryDataPlugin> plugins
@@ -121,7 +123,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
121 if (!m_Enabled) 123 if (!m_Enabled)
122 return; 124 return;
123 125
126 if (!m_Initialized)
127 {
128 // ugh!
129 scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
130 scene.CommsManager.UserService.SetInventoryService(this);
131 m_Initialized = true;
132 }
133
124 scene.RegisterModuleInterface<IInventoryService>(this); 134 scene.RegisterModuleInterface<IInventoryService>(this);
135
125 } 136 }
126 137
127 public void RemoveRegion(Scene scene) 138 public void RemoveRegion(Scene scene)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs
index b695fce..cd13c3d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs
@@ -40,12 +40,10 @@ using OpenMetaverse;
40 40
41namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory 41namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
42{ 42{
43 public class RemoteInventoryServicesConnector : 43 public class RemoteInventoryServicesConnector : ISharedRegionModule, IInventoryService
44 ISharedRegionModule, IInventoryService
45 { 44 {
46 private static readonly ILog m_log = 45 private static readonly ILog m_log =
47 LogManager.GetLogger( 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 MethodBase.GetCurrentMethod().DeclaringType);
49 47
50 private bool m_Enabled = false; 48 private bool m_Enabled = false;
51 private bool m_Initialized = false; 49 private bool m_Initialized = false;
@@ -57,6 +55,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
57 get { return "RemoteInventoryServicesConnector"; } 55 get { return "RemoteInventoryServicesConnector"; }
58 } 56 }
59 57
58 public RemoteInventoryServicesConnector()
59 {
60 }
61
60 public RemoteInventoryServicesConnector(IConfigSource source) 62 public RemoteInventoryServicesConnector(IConfigSource source)
61 { 63 {
62 Init(source); 64 Init(source);
@@ -100,7 +102,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory
100 return; 102 return;
101 103
102 if (!m_Initialized) 104 if (!m_Initialized)
105 {
103 m_Scene = scene; 106 m_Scene = scene;
107 // ugh!
108 scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
109 scene.CommsManager.UserService.SetInventoryService(this);
110 m_Initialized = true;
111 }
104 112
105 scene.RegisterModuleInterface<IInventoryService>(this); 113 scene.RegisterModuleInterface<IInventoryService>(this);
106 } 114 }
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d18af46..5349d87 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -146,6 +146,26 @@ namespace OpenSim.Region.Framework.Scenes
146 } 146 }
147 } 147 }
148 148
149 protected IInventoryService m_InventoryService = null;
150
151 public IInventoryService InventoryService
152 {
153 get
154 {
155 if (m_InventoryService == null)
156 {
157 m_InventoryService = RequestModuleInterface<IInventoryService>();
158
159 if (m_InventoryService == null)
160 {
161 throw new Exception("No IInventoryService available.");
162 }
163 }
164
165 return m_InventoryService;
166 }
167 }
168
149 protected IXMLRPC m_xmlrpcModule; 169 protected IXMLRPC m_xmlrpcModule;
150 protected IWorldComm m_worldCommModule; 170 protected IWorldComm m_worldCommModule;
151 protected IAvatarFactory m_AvatarFactory; 171 protected IAvatarFactory m_AvatarFactory;