aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2010-01-31 11:10:57 -0800
committerDiva Canto2010-01-31 11:10:57 -0800
commit40d8e91008b7d76ce6b9398484c591eb51c85bdb (patch)
tree7851807bee519bcae508f77e11107c7ed1e99ae9
parentAdded missing file. (diff)
downloadopensim-SC_OLD-40d8e91008b7d76ce6b9398484c591eb51c85bdb.zip
opensim-SC_OLD-40d8e91008b7d76ce6b9398484c591eb51c85bdb.tar.gz
opensim-SC_OLD-40d8e91008b7d76ce6b9398484c591eb51c85bdb.tar.bz2
opensim-SC_OLD-40d8e91008b7d76ce6b9398484c591eb51c85bdb.tar.xz
* Added a few files that were missing in the repo.
* New HGInventoryService which allows restricted access to inventory while outside
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs4
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs104
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs181
-rw-r--r--OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs46
-rw-r--r--OpenSim/Services/InventoryService/HGInventoryService.cs302
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs50
-rw-r--r--bin/config-include/StandaloneHypergrid.ini8
7 files changed, 624 insertions, 71 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
index 54c6d89..1bd00f5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs
@@ -98,9 +98,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory
98 98
99 m_log.Info("[RegionInventoryService]: Starting..."); 99 m_log.Info("[RegionInventoryService]: Starting...");
100 100
101 Object[] args = new Object[] { m_Config, MainServer.Instance, String.Empty }; 101 Object[] args = new Object[] { m_Config, MainServer.Instance, "HGInventoryService" };
102 102
103 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:InventoryServiceInConnector", args); 103 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:HGInventoryServiceInConnector", args);
104 } 104 }
105 } 105 }
106 106
diff --git a/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
new file mode 100644
index 0000000..cf5d521
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HGInventoryServerInConnector.cs
@@ -0,0 +1,104 @@
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.Net;
32using System.Reflection;
33using log4net;
34using Nini.Config;
35using Nwc.XmlRpc;
36using OpenSim.Server.Base;
37using OpenSim.Server.Handlers.Inventory;
38using OpenSim.Services.Interfaces;
39using OpenSim.Framework;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Server.Handlers.Base;
42using OpenMetaverse;
43
44namespace OpenSim.Server.Handlers.Hypergrid
45{
46 public class HGInventoryServiceInConnector : InventoryServiceInConnector
47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 //private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
51 //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
52
53 private IUserAgentService m_UserAgentService;
54
55 public HGInventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
56 base(config, server, configName)
57 {
58 IConfig serverConfig = config.Configs[m_ConfigName];
59 if (serverConfig == null)
60 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
61
62 string userAgentService = serverConfig.GetString("UserAgentService", string.Empty);
63 string m_userserver_url = serverConfig.GetString("UserAgentURI", String.Empty);
64 if (m_userserver_url != string.Empty)
65 {
66 Object[] args = new Object[] { m_userserver_url };
67 m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(userAgentService, args);
68 }
69
70 AddHttpHandlers(server);
71 m_log.Debug("[HG HG INVENTORY HANDLER]: handlers initialized");
72 }
73
74 /// <summary>
75 /// Check that the source of an inventory request for a particular agent is a current session belonging to
76 /// that agent.
77 /// </summary>
78 /// <param name="session_id"></param>
79 /// <param name="avatar_id"></param>
80 /// <returns></returns>
81 public override bool CheckAuthSession(string session_id, string avatar_id)
82 {
83 m_log.InfoFormat("[HG INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id);
84 // This doesn't work
85
86 // if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
87 // {
88 // //cache miss, ask userserver
89 // m_UserAgentService.VerifyAgent(session_id, ???);
90 // }
91 // else
92 // {
93 // // cache hits
94 // m_log.Info("[HG INVENTORY IN CONNECTOR]: got authed session from cache");
95 // return true;
96 // }
97
98 // m_log.Warn("[HG INVENTORY IN CONNECTOR]: unknown session_id, request rejected");
99 // return false;
100
101 return true;
102 }
103 }
104}
diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
new file mode 100644
index 0000000..17d7850
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs
@@ -0,0 +1,181 @@
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.IO;
31using System.Reflection;
32using System.Net;
33using System.Text;
34
35using OpenSim.Server.Base;
36using OpenSim.Server.Handlers.Base;
37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39using OpenSim.Framework;
40using OpenSim.Framework.Servers.HttpServer;
41using OpenSim.Server.Handlers.Simulation;
42using Utils = OpenSim.Server.Handlers.Simulation.Utils;
43
44using OpenMetaverse;
45using OpenMetaverse.StructuredData;
46using Nini.Config;
47using log4net;
48
49
50namespace OpenSim.Server.Handlers.Hypergrid
51{
52 public class HomeAgentHandler
53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private IUserAgentService m_UserAgentService;
56
57 public HomeAgentHandler(IUserAgentService userAgentService)
58 {
59 m_UserAgentService = userAgentService;
60 }
61
62 public Hashtable Handler(Hashtable request)
63 {
64 m_log.Debug("[CONNECTION DEBUGGING]: HomeAgentHandler Called");
65
66 m_log.Debug("---------------------------");
67 m_log.Debug(" >> uri=" + request["uri"]);
68 m_log.Debug(" >> content-type=" + request["content-type"]);
69 m_log.Debug(" >> http-method=" + request["http-method"]);
70 m_log.Debug("---------------------------\n");
71
72 Hashtable responsedata = new Hashtable();
73 responsedata["content_type"] = "text/html";
74 responsedata["keepalive"] = false;
75
76
77 UUID agentID;
78 UUID regionID;
79 string action;
80 if (!Utils.GetParams((string)request["uri"], out agentID, out regionID, out action))
81 {
82 m_log.InfoFormat("[HOME AGENT HANDLER]: Invalid parameters for agent message {0}", request["uri"]);
83 responsedata["int_response_code"] = 404;
84 responsedata["str_response_string"] = "false";
85
86 return responsedata;
87 }
88
89 // Next, let's parse the verb
90 string method = (string)request["http-method"];
91 if (method.Equals("POST"))
92 {
93 DoAgentPost(request, responsedata, agentID);
94 return responsedata;
95 }
96 else
97 {
98 m_log.InfoFormat("[HOME AGENT HANDLER]: method {0} not supported in agent message", method);
99 responsedata["int_response_code"] = HttpStatusCode.MethodNotAllowed;
100 responsedata["str_response_string"] = "Method not allowed";
101
102 return responsedata;
103 }
104
105 }
106
107 protected void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id)
108 {
109 OSDMap args = Utils.GetOSDMap((string)request["body"]);
110 if (args == null)
111 {
112 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
113 responsedata["str_response_string"] = "Bad request";
114 return;
115 }
116
117 // retrieve the input arguments
118 int x = 0, y = 0;
119 UUID uuid = UUID.Zero;
120 string regionname = string.Empty;
121 string gatekeeper_host = string.Empty;
122 int gatekeeper_port = 0;
123
124 if (args.ContainsKey("gatekeeper_host") && args["gatekeeper_host"] != null)
125 gatekeeper_host = args["gatekeeper_host"].AsString();
126 if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null)
127 Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port);
128
129 GridRegion gatekeeper = new GridRegion();
130 gatekeeper.ExternalHostName = gatekeeper_host;
131 gatekeeper.HttpPort = (uint)gatekeeper_port;
132 gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
133
134 if (args.ContainsKey("destination_x") && args["destination_x"] != null)
135 Int32.TryParse(args["destination_x"].AsString(), out x);
136 else
137 m_log.WarnFormat(" -- request didn't have destination_x");
138 if (args.ContainsKey("destination_y") && args["destination_y"] != null)
139 Int32.TryParse(args["destination_y"].AsString(), out y);
140 else
141 m_log.WarnFormat(" -- request didn't have destination_y");
142 if (args.ContainsKey("destination_uuid") && args["destination_uuid"] != null)
143 UUID.TryParse(args["destination_uuid"].AsString(), out uuid);
144 if (args.ContainsKey("destination_name") && args["destination_name"] != null)
145 regionname = args["destination_name"].ToString();
146
147 GridRegion destination = new GridRegion();
148 destination.RegionID = uuid;
149 destination.RegionLocX = x;
150 destination.RegionLocY = y;
151 destination.RegionName = regionname;
152
153 AgentCircuitData aCircuit = new AgentCircuitData();
154 try
155 {
156 aCircuit.UnpackAgentCircuitData(args);
157 }
158 catch (Exception ex)
159 {
160 m_log.InfoFormat("[HOME AGENT HANDLER]: exception on unpacking ChildCreate message {0}", ex.Message);
161 responsedata["int_response_code"] = HttpStatusCode.BadRequest;
162 responsedata["str_response_string"] = "Bad request";
163 return;
164 }
165
166 OSDMap resp = new OSDMap(2);
167 string reason = String.Empty;
168
169 bool result = m_UserAgentService.LoginAgentToGrid(aCircuit, gatekeeper, destination, out reason);
170
171 resp["reason"] = OSD.FromString(reason);
172 resp["success"] = OSD.FromBoolean(result);
173
174 // TODO: add reason if not String.Empty?
175 responsedata["int_response_code"] = HttpStatusCode.OK;
176 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
177 }
178
179 }
180
181}
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
index 3c92209..53db739 100644
--- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Inventory
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private IInventoryService m_InventoryService; 49 protected IInventoryService m_InventoryService;
50 50
51 private bool m_doLookup = false; 51 private bool m_doLookup = false;
52 52
@@ -54,11 +54,12 @@ namespace OpenSim.Server.Handlers.Inventory
54 //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); 54 //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
55 55
56 private string m_userserver_url; 56 private string m_userserver_url;
57 private string m_ConfigName = "InventoryService"; 57 protected string m_ConfigName = "InventoryService";
58 58
59 public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : 59 public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
60 base(config, server, configName) 60 base(config, server, configName)
61 { 61 {
62 m_ConfigName = configName;
62 IConfig serverConfig = config.Configs[m_ConfigName]; 63 IConfig serverConfig = config.Configs[m_ConfigName];
63 if (serverConfig == null) 64 if (serverConfig == null)
64 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); 65 throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
@@ -328,46 +329,9 @@ namespace OpenSim.Server.Handlers.Inventory
328 /// <param name="session_id"></param> 329 /// <param name="session_id"></param>
329 /// <param name="avatar_id"></param> 330 /// <param name="avatar_id"></param>
330 /// <returns></returns> 331 /// <returns></returns>
331 public bool CheckAuthSession(string session_id, string avatar_id) 332 public virtual bool CheckAuthSession(string session_id, string avatar_id)
332 { 333 {
333 if (m_doLookup) 334 return true;
334 {
335 m_log.InfoFormat("[INVENTORY IN CONNECTOR]: checking authed session {0} {1}", session_id, avatar_id);
336
337 //if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
338 //{
339 // cache miss, ask userserver
340 Hashtable requestData = new Hashtable();
341 requestData["avatar_uuid"] = avatar_id;
342 requestData["session_id"] = session_id;
343 ArrayList SendParams = new ArrayList();
344 SendParams.Add(requestData);
345 XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams);
346 XmlRpcResponse UserResp = UserReq.Send(m_userserver_url, 3000);
347
348 Hashtable responseData = (Hashtable)UserResp.Value;
349 if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE")
350 {
351 m_log.Info("[INVENTORY IN CONNECTOR]: got authed session from userserver");
352 //// add to cache; the session time will be automatically renewed
353 //m_session_cache.Add(session_id, avatar_id);
354 return true;
355 }
356 //}
357 //else
358 //{
359 // // cache hits
360 // m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache");
361 // return true;
362 //}
363
364 m_log.Warn("[INVENTORY IN CONNECTOR]: unknown session_id, request rejected");
365 return false;
366 }
367 else
368 {
369 return true;
370 }
371 } 335 }
372 336
373 } 337 }
diff --git a/OpenSim/Services/InventoryService/HGInventoryService.cs b/OpenSim/Services/InventoryService/HGInventoryService.cs
new file mode 100644
index 0000000..85f3bfc
--- /dev/null
+++ b/OpenSim/Services/InventoryService/HGInventoryService.cs
@@ -0,0 +1,302 @@
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.Generic;
30using OpenMetaverse;
31using log4net;
32using Nini.Config;
33using System.Reflection;
34using OpenSim.Services.Base;
35using OpenSim.Services.Interfaces;
36using OpenSim.Data;
37using OpenSim.Framework;
38
39namespace OpenSim.Services.InventoryService
40{
41 public class HGInventoryService : XInventoryService, IInventoryService
42 {
43 private static readonly ILog m_log =
44 LogManager.GetLogger(
45 MethodBase.GetCurrentMethod().DeclaringType);
46
47 protected IXInventoryData m_Database;
48
49 public HGInventoryService(IConfigSource config)
50 : base(config)
51 {
52 string dllName = String.Empty;
53 string connString = String.Empty;
54 //string realm = "Inventory"; // OSG version doesn't use this
55
56 //
57 // Try reading the [DatabaseService] section, if it exists
58 //
59 IConfig dbConfig = config.Configs["DatabaseService"];
60 if (dbConfig != null)
61 {
62 if (dllName == String.Empty)
63 dllName = dbConfig.GetString("StorageProvider", String.Empty);
64 if (connString == String.Empty)
65 connString = dbConfig.GetString("ConnectionString", String.Empty);
66 }
67
68 //
69 // Try reading the [InventoryService] section, if it exists
70 //
71 IConfig authConfig = config.Configs["InventoryService"];
72 if (authConfig != null)
73 {
74 dllName = authConfig.GetString("StorageProvider", dllName);
75 connString = authConfig.GetString("ConnectionString", connString);
76 // realm = authConfig.GetString("Realm", realm);
77 }
78
79 //
80 // We tried, but this doesn't exist. We can't proceed.
81 //
82 if (dllName == String.Empty)
83 throw new Exception("No StorageProvider configured");
84
85 m_Database = LoadPlugin<IXInventoryData>(dllName,
86 new Object[] {connString, String.Empty});
87 if (m_Database == null)
88 throw new Exception("Could not find a storage interface in the given module");
89
90 m_log.Debug("[HG INVENTORY SERVVICE]: Starting...");
91 }
92
93 public override bool CreateUserInventory(UUID principalID)
94 {
95 // NOGO
96 return false;
97 }
98
99
100 public override List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
101 {
102 // NOGO for this inventory service
103 return new List<InventoryFolderBase>();
104 }
105
106 public override InventoryFolderBase GetRootFolder(UUID principalID)
107 {
108 // Warp! Root folder for travelers
109 XInventoryFolder[] folders = m_Database.GetFolders(
110 new string[] { "agentID", "folderName"},
111 new string[] { principalID.ToString(), "Suitcase" });
112
113 if (folders.Length > 0)
114 return ConvertToOpenSim(folders[0]);
115
116 // make one
117 XInventoryFolder suitcase = CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "Suitcase");
118 return ConvertToOpenSim(suitcase);
119 }
120
121 //private bool CreateSystemFolders(UUID principalID, XInventoryFolder suitcase)
122 //{
123
124 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Animation, "Animations");
125 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Bodypart, "Body Parts");
126 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.CallingCard, "Calling Cards");
127 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Clothing, "Clothing");
128 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Gesture, "Gestures");
129 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Landmark, "Landmarks");
130 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.LostAndFoundFolder, "Lost And Found");
131 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Notecard, "Notecards");
132 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Object, "Objects");
133 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.SnapshotFolder, "Photo Album");
134 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.LSLText, "Scripts");
135 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Sound, "Sounds");
136 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.Texture, "Textures");
137 // CreateFolder(principalID, suitcase.folderID, (int)AssetType.TrashFolder, "Trash");
138
139 // return true;
140 //}
141
142
143 public override InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
144 {
145 return GetRootFolder(principalID);
146 }
147
148 //
149 // Use the inherited methods
150 //
151 //public InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
152 //{
153 //}
154
155 //public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
156 //{
157 //}
158
159 //public override bool AddFolder(InventoryFolderBase folder)
160 //{
161 // // Check if it's under the Suitcase folder
162 // List<InventoryFolderBase> skel = base.GetInventorySkeleton(folder.Owner);
163 // InventoryFolderBase suitcase = GetRootFolder(folder.Owner);
164 // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID);
165
166 // foreach (InventoryFolderBase f in suitDescendents)
167 // if (folder.ParentID == f.ID)
168 // {
169 // XInventoryFolder xFolder = ConvertFromOpenSim(folder);
170 // return m_Database.StoreFolder(xFolder);
171 // }
172 // return false;
173 //}
174
175 private List<InventoryFolderBase> GetDescendents(List<InventoryFolderBase> lst, UUID root)
176 {
177 List<InventoryFolderBase> direct = lst.FindAll(delegate(InventoryFolderBase f) { return f.ParentID == root; });
178 if (direct == null)
179 return new List<InventoryFolderBase>();
180
181 List<InventoryFolderBase> indirect = new List<InventoryFolderBase>();
182 foreach (InventoryFolderBase f in direct)
183 indirect.AddRange(GetDescendents(lst, f.ID));
184
185 direct.AddRange(indirect);
186 return direct;
187 }
188
189 // Use inherited method
190 //public bool UpdateFolder(InventoryFolderBase folder)
191 //{
192 //}
193
194 //public override bool MoveFolder(InventoryFolderBase folder)
195 //{
196 // XInventoryFolder[] x = m_Database.GetFolders(
197 // new string[] { "folderID" },
198 // new string[] { folder.ID.ToString() });
199
200 // if (x.Length == 0)
201 // return false;
202
203 // // Check if it's under the Suitcase folder
204 // List<InventoryFolderBase> skel = base.GetInventorySkeleton(folder.Owner);
205 // InventoryFolderBase suitcase = GetRootFolder(folder.Owner);
206 // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID);
207
208 // foreach (InventoryFolderBase f in suitDescendents)
209 // if (folder.ParentID == f.ID)
210 // {
211 // x[0].parentFolderID = folder.ParentID;
212 // return m_Database.StoreFolder(x[0]);
213 // }
214
215 // return false;
216 //}
217
218 public override bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
219 {
220 // NOGO
221 return false;
222 }
223
224 public override bool PurgeFolder(InventoryFolderBase folder)
225 {
226 // NOGO
227 return false;
228 }
229
230 // Unfortunately we need to use the inherited method because of how DeRez works.
231 // The viewer sends the folderID hard-wired in the derez message
232 //public override bool AddItem(InventoryItemBase item)
233 //{
234 // // Check if it's under the Suitcase folder
235 // List<InventoryFolderBase> skel = base.GetInventorySkeleton(item.Owner);
236 // InventoryFolderBase suitcase = GetRootFolder(item.Owner);
237 // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID);
238
239 // foreach (InventoryFolderBase f in suitDescendents)
240 // if (item.Folder == f.ID)
241 // return m_Database.StoreItem(ConvertFromOpenSim(item));
242
243 // return false;
244 //}
245
246 //public override bool UpdateItem(InventoryItemBase item)
247 //{
248 // // Check if it's under the Suitcase folder
249 // List<InventoryFolderBase> skel = base.GetInventorySkeleton(item.Owner);
250 // InventoryFolderBase suitcase = GetRootFolder(item.Owner);
251 // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID);
252
253 // foreach (InventoryFolderBase f in suitDescendents)
254 // if (item.Folder == f.ID)
255 // return m_Database.StoreItem(ConvertFromOpenSim(item));
256
257 // return false;
258 //}
259
260 //public override bool MoveItems(UUID principalID, List<InventoryItemBase> items)
261 //{
262 // // Principal is b0rked. *sigh*
263 // //
264 // // Let's assume they all have the same principal
265 // // Check if it's under the Suitcase folder
266 // List<InventoryFolderBase> skel = base.GetInventorySkeleton(items[0].Owner);
267 // InventoryFolderBase suitcase = GetRootFolder(items[0].Owner);
268 // List<InventoryFolderBase> suitDescendents = GetDescendents(skel, suitcase.ID);
269
270 // foreach (InventoryItemBase i in items)
271 // {
272 // foreach (InventoryFolderBase f in suitDescendents)
273 // if (i.Folder == f.ID)
274 // m_Database.MoveItem(i.ID.ToString(), i.Folder.ToString());
275 // }
276
277 // return true;
278 //}
279
280 // Let these pass. Use inherited methods.
281 //public bool DeleteItems(UUID principalID, List<UUID> itemIDs)
282 //{
283 //}
284
285 //public InventoryItemBase GetItem(InventoryItemBase item)
286 //{
287 //}
288
289 //public InventoryFolderBase GetFolder(InventoryFolderBase folder)
290 //{
291 //}
292
293 //public List<InventoryItemBase> GetActiveGestures(UUID principalID)
294 //{
295 //}
296
297 //public int GetAssetPermissions(UUID principalID, UUID assetID)
298 //{
299 //}
300
301 }
302}
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 2c79c77..2fb6a56 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Services.InventoryService
87 throw new Exception("Could not find a storage interface in the given module"); 87 throw new Exception("Could not find a storage interface in the given module");
88 } 88 }
89 89
90 public bool CreateUserInventory(UUID principalID) 90 public virtual bool CreateUserInventory(UUID principalID)
91 { 91 {
92 // This is braindeaad. We can't ever communicate that we fixed 92 // This is braindeaad. We can't ever communicate that we fixed
93 // an existing inventory. Well, just return root folder status, 93 // an existing inventory. Well, just return root folder status,
@@ -137,7 +137,7 @@ namespace OpenSim.Services.InventoryService
137 return result; 137 return result;
138 } 138 }
139 139
140 private XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) 140 protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name)
141 { 141 {
142 XInventoryFolder newFolder = new XInventoryFolder(); 142 XInventoryFolder newFolder = new XInventoryFolder();
143 143
@@ -153,7 +153,7 @@ namespace OpenSim.Services.InventoryService
153 return newFolder; 153 return newFolder;
154 } 154 }
155 155
156 private XInventoryFolder[] GetSystemFolders(UUID principalID) 156 protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID)
157 { 157 {
158 XInventoryFolder[] allFolders = m_Database.GetFolders( 158 XInventoryFolder[] allFolders = m_Database.GetFolders(
159 new string[] { "agentID" }, 159 new string[] { "agentID" },
@@ -171,7 +171,7 @@ namespace OpenSim.Services.InventoryService
171 return sysFolders; 171 return sysFolders;
172 } 172 }
173 173
174 public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) 174 public virtual List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
175 { 175 {
176 XInventoryFolder[] allFolders = m_Database.GetFolders( 176 XInventoryFolder[] allFolders = m_Database.GetFolders(
177 new string[] { "agentID" }, 177 new string[] { "agentID" },
@@ -191,7 +191,7 @@ namespace OpenSim.Services.InventoryService
191 return folders; 191 return folders;
192 } 192 }
193 193
194 public InventoryFolderBase GetRootFolder(UUID principalID) 194 public virtual InventoryFolderBase GetRootFolder(UUID principalID)
195 { 195 {
196 XInventoryFolder[] folders = m_Database.GetFolders( 196 XInventoryFolder[] folders = m_Database.GetFolders(
197 new string[] { "agentID", "parentFolderID"}, 197 new string[] { "agentID", "parentFolderID"},
@@ -203,7 +203,7 @@ namespace OpenSim.Services.InventoryService
203 return ConvertToOpenSim(folders[0]); 203 return ConvertToOpenSim(folders[0]);
204 } 204 }
205 205
206 public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 206 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
207 { 207 {
208 XInventoryFolder[] folders = m_Database.GetFolders( 208 XInventoryFolder[] folders = m_Database.GetFolders(
209 new string[] { "agentID", "type"}, 209 new string[] { "agentID", "type"},
@@ -215,7 +215,7 @@ namespace OpenSim.Services.InventoryService
215 return ConvertToOpenSim(folders[0]); 215 return ConvertToOpenSim(folders[0]);
216 } 216 }
217 217
218 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) 218 public virtual InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
219 { 219 {
220 // This method doesn't receive a valud principal id from the 220 // This method doesn't receive a valud principal id from the
221 // connector. So we disregard the principal and look 221 // connector. So we disregard the principal and look
@@ -250,7 +250,7 @@ namespace OpenSim.Services.InventoryService
250 return inventory; 250 return inventory;
251 } 251 }
252 252
253 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) 253 public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
254 { 254 {
255 // Since we probably don't get a valid principal here, either ... 255 // Since we probably don't get a valid principal here, either ...
256 // 256 //
@@ -266,18 +266,18 @@ namespace OpenSim.Services.InventoryService
266 return invItems; 266 return invItems;
267 } 267 }
268 268
269 public bool AddFolder(InventoryFolderBase folder) 269 public virtual bool AddFolder(InventoryFolderBase folder)
270 { 270 {
271 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 271 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
272 return m_Database.StoreFolder(xFolder); 272 return m_Database.StoreFolder(xFolder);
273 } 273 }
274 274
275 public bool UpdateFolder(InventoryFolderBase folder) 275 public virtual bool UpdateFolder(InventoryFolderBase folder)
276 { 276 {
277 return AddFolder(folder); 277 return AddFolder(folder);
278 } 278 }
279 279
280 public bool MoveFolder(InventoryFolderBase folder) 280 public virtual bool MoveFolder(InventoryFolderBase folder)
281 { 281 {
282 XInventoryFolder[] x = m_Database.GetFolders( 282 XInventoryFolder[] x = m_Database.GetFolders(
283 new string[] { "folderID" }, 283 new string[] { "folderID" },
@@ -293,7 +293,7 @@ namespace OpenSim.Services.InventoryService
293 293
294 // We don't check the principal's ID here 294 // We don't check the principal's ID here
295 // 295 //
296 public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) 296 public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
297 { 297 {
298 // Ignore principal ID, it's bogus at connector level 298 // Ignore principal ID, it's bogus at connector level
299 // 299 //
@@ -308,7 +308,7 @@ namespace OpenSim.Services.InventoryService
308 return true; 308 return true;
309 } 309 }
310 310
311 public bool PurgeFolder(InventoryFolderBase folder) 311 public virtual bool PurgeFolder(InventoryFolderBase folder)
312 { 312 {
313 XInventoryFolder[] subFolders = m_Database.GetFolders( 313 XInventoryFolder[] subFolders = m_Database.GetFolders(
314 new string[] { "parentFolderID" }, 314 new string[] { "parentFolderID" },
@@ -325,17 +325,17 @@ namespace OpenSim.Services.InventoryService
325 return true; 325 return true;
326 } 326 }
327 327
328 public bool AddItem(InventoryItemBase item) 328 public virtual bool AddItem(InventoryItemBase item)
329 { 329 {
330 return m_Database.StoreItem(ConvertFromOpenSim(item)); 330 return m_Database.StoreItem(ConvertFromOpenSim(item));
331 } 331 }
332 332
333 public bool UpdateItem(InventoryItemBase item) 333 public virtual bool UpdateItem(InventoryItemBase item)
334 { 334 {
335 return m_Database.StoreItem(ConvertFromOpenSim(item)); 335 return m_Database.StoreItem(ConvertFromOpenSim(item));
336 } 336 }
337 337
338 public bool MoveItems(UUID principalID, List<InventoryItemBase> items) 338 public virtual bool MoveItems(UUID principalID, List<InventoryItemBase> items)
339 { 339 {
340 // Principal is b0rked. *sigh* 340 // Principal is b0rked. *sigh*
341 // 341 //
@@ -347,7 +347,7 @@ namespace OpenSim.Services.InventoryService
347 return true; 347 return true;
348 } 348 }
349 349
350 public bool DeleteItems(UUID principalID, List<UUID> itemIDs) 350 public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
351 { 351 {
352 // Just use the ID... *facepalms* 352 // Just use the ID... *facepalms*
353 // 353 //
@@ -357,7 +357,7 @@ namespace OpenSim.Services.InventoryService
357 return true; 357 return true;
358 } 358 }
359 359
360 public InventoryItemBase GetItem(InventoryItemBase item) 360 public virtual InventoryItemBase GetItem(InventoryItemBase item)
361 { 361 {
362 XInventoryItem[] items = m_Database.GetItems( 362 XInventoryItem[] items = m_Database.GetItems(
363 new string[] { "inventoryID" }, 363 new string[] { "inventoryID" },
@@ -369,7 +369,7 @@ namespace OpenSim.Services.InventoryService
369 return ConvertToOpenSim(items[0]); 369 return ConvertToOpenSim(items[0]);
370 } 370 }
371 371
372 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 372 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
373 { 373 {
374 XInventoryFolder[] folders = m_Database.GetFolders( 374 XInventoryFolder[] folders = m_Database.GetFolders(
375 new string[] { "folderID"}, 375 new string[] { "folderID"},
@@ -381,7 +381,7 @@ namespace OpenSim.Services.InventoryService
381 return ConvertToOpenSim(folders[0]); 381 return ConvertToOpenSim(folders[0]);
382 } 382 }
383 383
384 public List<InventoryItemBase> GetActiveGestures(UUID principalID) 384 public virtual List<InventoryItemBase> GetActiveGestures(UUID principalID)
385 { 385 {
386 XInventoryItem[] items = m_Database.GetActiveGestures(principalID); 386 XInventoryItem[] items = m_Database.GetActiveGestures(principalID);
387 387
@@ -396,7 +396,7 @@ namespace OpenSim.Services.InventoryService
396 return ret; 396 return ret;
397 } 397 }
398 398
399 public int GetAssetPermissions(UUID principalID, UUID assetID) 399 public virtual int GetAssetPermissions(UUID principalID, UUID assetID)
400 { 400 {
401 return m_Database.GetAssetPermissions(principalID, assetID); 401 return m_Database.GetAssetPermissions(principalID, assetID);
402 } 402 }
@@ -421,7 +421,7 @@ namespace OpenSim.Services.InventoryService
421 421
422 // CM Helpers 422 // CM Helpers
423 // 423 //
424 private InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) 424 protected InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder)
425 { 425 {
426 InventoryFolderBase newFolder = new InventoryFolderBase(); 426 InventoryFolderBase newFolder = new InventoryFolderBase();
427 427
@@ -435,7 +435,7 @@ namespace OpenSim.Services.InventoryService
435 return newFolder; 435 return newFolder;
436 } 436 }
437 437
438 private XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) 438 protected XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder)
439 { 439 {
440 XInventoryFolder newFolder = new XInventoryFolder(); 440 XInventoryFolder newFolder = new XInventoryFolder();
441 441
@@ -449,7 +449,7 @@ namespace OpenSim.Services.InventoryService
449 return newFolder; 449 return newFolder;
450 } 450 }
451 451
452 private InventoryItemBase ConvertToOpenSim(XInventoryItem item) 452 protected InventoryItemBase ConvertToOpenSim(XInventoryItem item)
453 { 453 {
454 InventoryItemBase newItem = new InventoryItemBase(); 454 InventoryItemBase newItem = new InventoryItemBase();
455 455
@@ -477,7 +477,7 @@ namespace OpenSim.Services.InventoryService
477 return newItem; 477 return newItem;
478 } 478 }
479 479
480 private XInventoryItem ConvertFromOpenSim(InventoryItemBase item) 480 protected XInventoryItem ConvertFromOpenSim(InventoryItemBase item)
481 { 481 {
482 XInventoryItem newItem = new XInventoryItem(); 482 XInventoryItem newItem = new XInventoryItem();
483 483
diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini
index 686d2a4..f36b0c4 100644
--- a/bin/config-include/StandaloneHypergrid.ini
+++ b/bin/config-include/StandaloneHypergrid.ini
@@ -33,7 +33,6 @@
33 SimulationServiceInConnector = true 33 SimulationServiceInConnector = true
34 34
35[AssetService] 35[AssetService]
36 ; For the AssetServiceInConnector
37 LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" 36 LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService"
38 37
39 ; For HGAssetBroker 38 ; For HGAssetBroker
@@ -41,7 +40,6 @@
41 HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector" 40 HypergridAssetService = "OpenSim.Services.Connectors.dll:HGAssetServiceConnector"
42 41
43[InventoryService] 42[InventoryService]
44 ; For the InventoryServiceInConnector
45 LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService" 43 LocalServiceModule = "OpenSim.Services.InventoryService.dll:InventoryService"
46 44
47 ; For HGInventoryBroker 45 ; For HGInventoryBroker
@@ -49,7 +47,6 @@
49 HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector" 47 HypergridInventoryService = "OpenSim.Services.Connectors.dll:HGInventoryServiceConnector"
50 48
51[AvatarService] 49[AvatarService]
52 ; For the InventoryServiceInConnector
53 LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" 50 LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService"
54 51
55[LibraryService] 52[LibraryService]
@@ -117,3 +114,8 @@
117 PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" 114 PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService"
118 GridService = "OpenSim.Services.GridService.dll:GridService" 115 GridService = "OpenSim.Services.GridService.dll:GridService"
119 116
117;; The interface that local users get when they are in other grids
118;; This greatly restricts the inventory operations while in other grids
119[HGInventoryService]
120 ; For the InventoryServiceInConnector
121 LocalServiceModule = "OpenSim.Services.InventoryService.dll:HGInventoryService"