diff options
Diffstat (limited to '')
16 files changed, 875 insertions, 150 deletions
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 0fb9e78..06defe4 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs | |||
@@ -53,8 +53,8 @@ namespace OpenSim.Data | |||
53 | /// When a database driver starts up, it specifies a resource that | 53 | /// When a database driver starts up, it specifies a resource that |
54 | /// needs to be brought up to the current revision. For instance: | 54 | /// needs to be brought up to the current revision. For instance: |
55 | /// | 55 | /// |
56 | /// Migration um = new Migration(Assembly, DbConnection, "Users"); | 56 | /// Migration um = new Migration(DbConnection, Assembly, "Users"); |
57 | /// um.Upgrade(); | 57 | /// um.Update(); |
58 | /// | 58 | /// |
59 | /// This works out which version Users is at, and applies all the | 59 | /// This works out which version Users is at, and applies all the |
60 | /// revisions past it to it. If there is no users table, all | 60 | /// revisions past it to it. If there is no users table, all |
@@ -110,10 +110,11 @@ namespace OpenSim.Data | |||
110 | return; | 110 | return; |
111 | 111 | ||
112 | // If not, create the migration tables | 112 | // If not, create the migration tables |
113 | DbCommand cmd = _conn.CreateCommand(); | 113 | using (DbCommand cmd = _conn.CreateCommand()) |
114 | cmd.CommandText = _migrations_create; | 114 | { |
115 | cmd.ExecuteNonQuery(); | 115 | cmd.CommandText = _migrations_create; |
116 | cmd.Dispose(); | 116 | cmd.ExecuteNonQuery(); |
117 | } | ||
117 | 118 | ||
118 | InsertVersion("migrations", 1); | 119 | InsertVersion("migrations", 1); |
119 | } | 120 | } |
@@ -131,37 +132,37 @@ namespace OpenSim.Data | |||
131 | m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); | 132 | m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); |
132 | m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); | 133 | m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); |
133 | 134 | ||
134 | DbCommand cmd = _conn.CreateCommand(); | 135 | using (DbCommand cmd = _conn.CreateCommand()) |
135 | foreach (KeyValuePair<int, string> kvp in migrations) | ||
136 | { | 136 | { |
137 | int newversion = kvp.Key; | 137 | foreach (KeyValuePair<int, string> kvp in migrations) |
138 | cmd.CommandText = kvp.Value; | ||
139 | // we need to up the command timeout to infinite as we might be doing long migrations. | ||
140 | cmd.CommandTimeout = 0; | ||
141 | try | ||
142 | { | ||
143 | cmd.ExecuteNonQuery(); | ||
144 | } | ||
145 | catch (Exception e) | ||
146 | { | 138 | { |
147 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | 139 | int newversion = kvp.Key; |
148 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | 140 | cmd.CommandText = kvp.Value; |
149 | cmd.CommandText = "ROLLBACK;"; | 141 | // we need to up the command timeout to infinite as we might be doing long migrations. |
150 | cmd.ExecuteNonQuery(); | 142 | cmd.CommandTimeout = 0; |
151 | } | 143 | try |
144 | { | ||
145 | cmd.ExecuteNonQuery(); | ||
146 | } | ||
147 | catch (Exception e) | ||
148 | { | ||
149 | m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", cmd.CommandText); | ||
150 | m_log.DebugFormat("[MIGRATIONS]: An error has occurred in the migration {0}.\n This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.", e.Message); | ||
151 | cmd.CommandText = "ROLLBACK;"; | ||
152 | cmd.ExecuteNonQuery(); | ||
153 | } | ||
152 | 154 | ||
153 | if (version == 0) | 155 | if (version == 0) |
154 | { | 156 | { |
155 | InsertVersion(_type, newversion); | 157 | InsertVersion(_type, newversion); |
156 | } | 158 | } |
157 | else | 159 | else |
158 | { | 160 | { |
159 | UpdateVersion(_type, newversion); | 161 | UpdateVersion(_type, newversion); |
162 | } | ||
163 | version = newversion; | ||
160 | } | 164 | } |
161 | version = newversion; | ||
162 | } | 165 | } |
163 | |||
164 | cmd.Dispose(); | ||
165 | } | 166 | } |
166 | 167 | ||
167 | // private int MaxVersion() | 168 | // private int MaxVersion() |
@@ -200,43 +201,46 @@ namespace OpenSim.Data | |||
200 | protected virtual int FindVersion(DbConnection conn, string type) | 201 | protected virtual int FindVersion(DbConnection conn, string type) |
201 | { | 202 | { |
202 | int version = 0; | 203 | int version = 0; |
203 | DbCommand cmd = conn.CreateCommand(); | 204 | using (DbCommand cmd = conn.CreateCommand()) |
204 | try | ||
205 | { | 205 | { |
206 | cmd.CommandText = "select version from migrations where name='" + type +"' order by version desc"; | 206 | try |
207 | using (IDataReader reader = cmd.ExecuteReader()) | ||
208 | { | 207 | { |
209 | if (reader.Read()) | 208 | cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; |
209 | using (IDataReader reader = cmd.ExecuteReader()) | ||
210 | { | 210 | { |
211 | version = Convert.ToInt32(reader["version"]); | 211 | if (reader.Read()) |
212 | { | ||
213 | version = Convert.ToInt32(reader["version"]); | ||
214 | } | ||
215 | reader.Close(); | ||
212 | } | 216 | } |
213 | reader.Close(); | 217 | } |
218 | catch | ||
219 | { | ||
220 | // Something went wrong, so we're version 0 | ||
214 | } | 221 | } |
215 | } | 222 | } |
216 | catch | ||
217 | { | ||
218 | // Something went wrong, so we're version 0 | ||
219 | } | ||
220 | cmd.Dispose(); | ||
221 | return version; | 223 | return version; |
222 | } | 224 | } |
223 | 225 | ||
224 | private void InsertVersion(string type, int version) | 226 | private void InsertVersion(string type, int version) |
225 | { | 227 | { |
226 | DbCommand cmd = _conn.CreateCommand(); | 228 | using (DbCommand cmd = _conn.CreateCommand()) |
227 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; | 229 | { |
228 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); | 230 | cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; |
229 | cmd.ExecuteNonQuery(); | 231 | m_log.InfoFormat("[MIGRATIONS]: Creating {0} at version {1}", type, version); |
230 | cmd.Dispose(); | 232 | cmd.ExecuteNonQuery(); |
233 | } | ||
231 | } | 234 | } |
232 | 235 | ||
233 | private void UpdateVersion(string type, int version) | 236 | private void UpdateVersion(string type, int version) |
234 | { | 237 | { |
235 | DbCommand cmd = _conn.CreateCommand(); | 238 | using (DbCommand cmd = _conn.CreateCommand()) |
236 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; | 239 | { |
237 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); | 240 | cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; |
238 | cmd.ExecuteNonQuery(); | 241 | m_log.InfoFormat("[MIGRATIONS]: Updating {0} to version {1}", type, version); |
239 | cmd.Dispose(); | 242 | cmd.ExecuteNonQuery(); |
243 | } | ||
240 | } | 244 | } |
241 | 245 | ||
242 | // private SortedList<int, string> GetAllMigrations() | 246 | // private SortedList<int, string> GetAllMigrations() |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index 192deb2..e0e9b9c 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -145,7 +145,7 @@ namespace OpenSim.Data.MySQL | |||
145 | /// <summary> | 145 | /// <summary> |
146 | /// Returns a list of the root folders within a users inventory | 146 | /// Returns a list of the root folders within a users inventory |
147 | /// </summary> | 147 | /// </summary> |
148 | /// <param name="user">The user whos inventory is to be searched</param> | 148 | /// <param name="user">The user whose inventory is to be searched</param> |
149 | /// <returns>A list of folder objects</returns> | 149 | /// <returns>A list of folder objects</returns> |
150 | public List<InventoryFolderBase> getUserRootFolders(UUID user) | 150 | public List<InventoryFolderBase> getUserRootFolders(UUID user) |
151 | { | 151 | { |
@@ -284,7 +284,7 @@ namespace OpenSim.Data.MySQL | |||
284 | { | 284 | { |
285 | InventoryItemBase item = new InventoryItemBase(); | 285 | InventoryItemBase item = new InventoryItemBase(); |
286 | 286 | ||
287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is indemic to the system, or legacy. It would be nice to live fix these. | 287 | // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. |
288 | if (reader["creatorID"] == null) | 288 | if (reader["creatorID"] == null) |
289 | { | 289 | { |
290 | item.CreatorId = UUID.Zero.ToString(); | 290 | item.CreatorId = UUID.Zero.ToString(); |
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 1208b97..4d1de22 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -236,7 +236,7 @@ namespace OpenSim.Framework | |||
236 | catch { } | 236 | catch { } |
237 | 237 | ||
238 | m_log.Warn("[SHAPE]: Failed to decode texture, length=" + ((m_textureEntry != null) ? m_textureEntry.Length : 0)); | 238 | m_log.Warn("[SHAPE]: Failed to decode texture, length=" + ((m_textureEntry != null) ? m_textureEntry.Length : 0)); |
239 | return new Primitive.TextureEntry(null); | 239 | return new Primitive.TextureEntry(UUID.Zero); |
240 | } | 240 | } |
241 | 241 | ||
242 | set { m_textureEntry = value.GetBytes(); } | 242 | set { m_textureEntry = value.GetBytes(); } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 312db38..23d5b3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
149 | 149 | ||
150 | if (m_FriendsService == null) | 150 | if (m_FriendsService == null) |
151 | { | 151 | { |
152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); | 152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue"); |
153 | throw new Exception("Connector load error"); | 153 | throw new Exception("Connector load error"); |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index aaa318c..0a5ff3f 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -45,6 +45,7 @@ | |||
45 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> | 45 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> |
46 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> | 46 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> |
47 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> | 47 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> |
48 | <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> | ||
48 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> | 49 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> |
49 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> | 50 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> |
50 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> | 51 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs new file mode 100644 index 0000000..22aac02 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs | |||
@@ -0,0 +1,589 @@ | |||
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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Services.Connectors; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
43 | { | ||
44 | public class HGInventoryBroker2 : BaseInventoryConnector, INonSharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private static bool m_Initialized = false; | ||
51 | private static bool m_Enabled = false; | ||
52 | |||
53 | private static IInventoryService m_LocalGridInventoryService; | ||
54 | private static ISessionAuthInventoryService m_HGService; // obsolete | ||
55 | private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); | ||
56 | |||
57 | |||
58 | private Scene m_Scene; | ||
59 | private IUserAccountService m_UserAccountService; | ||
60 | |||
61 | public Type ReplaceableInterface | ||
62 | { | ||
63 | get { return null; } | ||
64 | } | ||
65 | |||
66 | public string Name | ||
67 | { | ||
68 | get { return "HGInventoryBroker2"; } | ||
69 | } | ||
70 | |||
71 | public void Initialise(IConfigSource source) | ||
72 | { | ||
73 | if (!m_Initialized) | ||
74 | { | ||
75 | IConfig moduleConfig = source.Configs["Modules"]; | ||
76 | if (moduleConfig != null) | ||
77 | { | ||
78 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
79 | if (name == Name) | ||
80 | { | ||
81 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
82 | if (inventoryConfig == null) | ||
83 | { | ||
84 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
85 | return; | ||
86 | } | ||
87 | |||
88 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
89 | String.Empty); | ||
90 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
91 | String.Empty); | ||
92 | |||
93 | if (localDll == String.Empty) | ||
94 | { | ||
95 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
96 | //return; | ||
97 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
98 | } | ||
99 | |||
100 | if (HGDll == String.Empty) | ||
101 | { | ||
102 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | ||
103 | //return; | ||
104 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
105 | } | ||
106 | |||
107 | Object[] args = new Object[] { source }; | ||
108 | m_LocalGridInventoryService = | ||
109 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
110 | args); | ||
111 | |||
112 | m_HGService = | ||
113 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | ||
114 | args); | ||
115 | |||
116 | if (m_LocalGridInventoryService == null) | ||
117 | { | ||
118 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
119 | return; | ||
120 | } | ||
121 | if (m_HGService == null) | ||
122 | { | ||
123 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
124 | return; | ||
125 | } | ||
126 | |||
127 | Init(source); | ||
128 | |||
129 | m_Enabled = true; | ||
130 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | ||
131 | } | ||
132 | } | ||
133 | m_Initialized = true; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | public void PostInitialise() | ||
138 | { | ||
139 | } | ||
140 | |||
141 | public void Close() | ||
142 | { | ||
143 | } | ||
144 | |||
145 | public void AddRegion(Scene scene) | ||
146 | { | ||
147 | if (!m_Enabled) | ||
148 | return; | ||
149 | |||
150 | m_Scene = scene; | ||
151 | m_UserAccountService = m_Scene.UserAccountService; | ||
152 | |||
153 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
154 | m_cache.AddRegion(scene); | ||
155 | } | ||
156 | |||
157 | public void RemoveRegion(Scene scene) | ||
158 | { | ||
159 | if (!m_Enabled) | ||
160 | return; | ||
161 | |||
162 | m_cache.RemoveRegion(scene); | ||
163 | } | ||
164 | |||
165 | public void RegionLoaded(Scene scene) | ||
166 | { | ||
167 | if (!m_Enabled) | ||
168 | return; | ||
169 | |||
170 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); | ||
171 | |||
172 | } | ||
173 | |||
174 | |||
175 | #region IInventoryService | ||
176 | |||
177 | public override bool CreateUserInventory(UUID userID) | ||
178 | { | ||
179 | return m_LocalGridInventoryService.CreateUserInventory(userID); | ||
180 | } | ||
181 | |||
182 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
183 | { | ||
184 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); | ||
185 | } | ||
186 | |||
187 | public override InventoryCollection GetUserInventory(UUID userID) | ||
188 | { | ||
189 | return null; | ||
190 | } | ||
191 | |||
192 | public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
193 | { | ||
194 | } | ||
195 | |||
196 | // Inherited. See base | ||
197 | //public override InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
198 | //{ | ||
199 | // if (IsLocalGridUser(userID)) | ||
200 | // return m_GridService.GetFolderForType(userID, type); | ||
201 | // else | ||
202 | // { | ||
203 | // UUID sessionID = GetSessionID(userID); | ||
204 | // string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | ||
205 | // // !!!!!! | ||
206 | // return null; | ||
207 | // //return m_HGService.GetFolderForType(uri, sessionID, type); | ||
208 | // } | ||
209 | //} | ||
210 | |||
211 | public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
212 | { | ||
213 | m_log.Debug("[HGInventory]: GetFolderContent " + folderID); | ||
214 | string url = string.Empty; | ||
215 | |||
216 | string invURL = m_cache.GetInventoryServiceURL(userID); | ||
217 | |||
218 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
219 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | ||
220 | |||
221 | IInventoryService connector = GetConnector(url); | ||
222 | return connector.GetFolderContent(userID, folderID); | ||
223 | |||
224 | //if (StringToUrlAndUserID(id, out url, out userID)) | ||
225 | //{ | ||
226 | // ISessionAuthInventoryService connector = GetConnector(url); | ||
227 | // return connector.GetFolderContent(userID, folderID, sessionID); | ||
228 | //} | ||
229 | |||
230 | //return null; | ||
231 | |||
232 | ////////// | ||
233 | |||
234 | //string uri = string.Empty; | ||
235 | //if (!IsForeignUser(userID, out uri)) | ||
236 | // return m_GridService.GetFolderContent(userID, folderID); | ||
237 | //else | ||
238 | //{ | ||
239 | // UUID sessionID = GetSessionID(userID); | ||
240 | // uri = uri + "/" + userID.ToString(); | ||
241 | // return m_HGService.GetFolderContent(uri, folderID, sessionID); | ||
242 | //} | ||
243 | } | ||
244 | |||
245 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
246 | { | ||
247 | string uri = string.Empty; | ||
248 | if (!IsForeignUser(userID, out uri)) | ||
249 | { | ||
250 | // This is not pretty, but it will have to do for now | ||
251 | if (m_LocalGridInventoryService is BaseInventoryConnector) | ||
252 | { | ||
253 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module"); | ||
254 | return ((BaseInventoryConnector)m_LocalGridInventoryService).GetSystemFolders(userID); | ||
255 | } | ||
256 | else | ||
257 | { | ||
258 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal"); | ||
259 | return GetSystemFoldersLocal(userID); | ||
260 | } | ||
261 | } | ||
262 | else | ||
263 | { | ||
264 | UUID sessionID = GetSessionID(userID); | ||
265 | uri = uri + "/" + userID.ToString(); | ||
266 | return m_HGService.GetSystemFolders(uri, sessionID); | ||
267 | } | ||
268 | } | ||
269 | |||
270 | private Dictionary<AssetType, InventoryFolderBase> GetSystemFoldersLocal(UUID userID) | ||
271 | { | ||
272 | InventoryFolderBase root = m_LocalGridInventoryService.GetRootFolder(userID); | ||
273 | if (root != null) | ||
274 | { | ||
275 | InventoryCollection content = m_LocalGridInventoryService.GetFolderContent(userID, root.ID); | ||
276 | if (content != null) | ||
277 | { | ||
278 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
279 | foreach (InventoryFolderBase folder in content.Folders) | ||
280 | { | ||
281 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scanning folder type {0}", (AssetType)folder.Type); | ||
282 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
283 | folders[(AssetType)folder.Type] = folder; | ||
284 | } | ||
285 | // Put the root folder there, as type Folder | ||
286 | folders[AssetType.Folder] = root; | ||
287 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | ||
288 | return folders; | ||
289 | } | ||
290 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); | ||
291 | |||
292 | } | ||
293 | |||
294 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder not found for {0}", userID); | ||
295 | |||
296 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
297 | } | ||
298 | |||
299 | public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
300 | { | ||
301 | string uri = string.Empty; | ||
302 | if (!IsForeignUser(userID, out uri)) | ||
303 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | ||
304 | else | ||
305 | { | ||
306 | UUID sessionID = GetSessionID(userID); | ||
307 | uri = uri + "/" + userID.ToString(); | ||
308 | return m_HGService.GetFolderItems(uri, folderID, sessionID); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | public override bool AddFolder(InventoryFolderBase folder) | ||
313 | { | ||
314 | if (folder == null) | ||
315 | return false; | ||
316 | |||
317 | string uri = string.Empty; | ||
318 | if (!IsForeignUser(folder.Owner, out uri)) | ||
319 | return m_LocalGridInventoryService.AddFolder(folder); | ||
320 | else | ||
321 | { | ||
322 | UUID sessionID = GetSessionID(folder.Owner); | ||
323 | uri = uri + "/" + folder.Owner.ToString(); | ||
324 | return m_HGService.AddFolder(uri, folder, sessionID); | ||
325 | } | ||
326 | } | ||
327 | |||
328 | public override bool UpdateFolder(InventoryFolderBase folder) | ||
329 | { | ||
330 | if (folder == null) | ||
331 | return false; | ||
332 | |||
333 | string uri = string.Empty; | ||
334 | if (!IsForeignUser(folder.Owner, out uri)) | ||
335 | return m_LocalGridInventoryService.UpdateFolder(folder); | ||
336 | else | ||
337 | { | ||
338 | UUID sessionID = GetSessionID(folder.Owner); | ||
339 | uri = uri + "/" + folder.Owner.ToString(); | ||
340 | return m_HGService.UpdateFolder(uri, folder, sessionID); | ||
341 | } | ||
342 | } | ||
343 | |||
344 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
345 | { | ||
346 | if (folderIDs == null) | ||
347 | return false; | ||
348 | if (folderIDs.Count == 0) | ||
349 | return false; | ||
350 | |||
351 | string uri = string.Empty; | ||
352 | if (!IsForeignUser(ownerID, out uri)) | ||
353 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); | ||
354 | else | ||
355 | { | ||
356 | UUID sessionID = GetSessionID(ownerID); | ||
357 | uri = uri + "/" + ownerID.ToString(); | ||
358 | return m_HGService.DeleteFolders(uri, folderIDs, sessionID); | ||
359 | } | ||
360 | } | ||
361 | |||
362 | public override bool MoveFolder(InventoryFolderBase folder) | ||
363 | { | ||
364 | if (folder == null) | ||
365 | return false; | ||
366 | |||
367 | string uri = string.Empty; | ||
368 | if (!IsForeignUser(folder.Owner, out uri)) | ||
369 | return m_LocalGridInventoryService.MoveFolder(folder); | ||
370 | else | ||
371 | { | ||
372 | UUID sessionID = GetSessionID(folder.Owner); | ||
373 | uri = uri + "/" + folder.Owner.ToString(); | ||
374 | return m_HGService.MoveFolder(uri, folder, sessionID); | ||
375 | } | ||
376 | } | ||
377 | |||
378 | public override bool PurgeFolder(InventoryFolderBase folder) | ||
379 | { | ||
380 | if (folder == null) | ||
381 | return false; | ||
382 | |||
383 | string uri = string.Empty; | ||
384 | if (!IsForeignUser(folder.Owner, out uri)) | ||
385 | return m_LocalGridInventoryService.PurgeFolder(folder); | ||
386 | else | ||
387 | { | ||
388 | UUID sessionID = GetSessionID(folder.Owner); | ||
389 | uri = uri + "/" + folder.Owner.ToString(); | ||
390 | return m_HGService.PurgeFolder(uri, folder, sessionID); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | // public bool AddItem(InventoryItemBase item) inherited | ||
395 | // Uses AddItemPlain | ||
396 | |||
397 | protected override bool AddItemPlain(InventoryItemBase item) | ||
398 | { | ||
399 | if (item == null) | ||
400 | return false; | ||
401 | |||
402 | string uri = string.Empty; | ||
403 | if (!IsForeignUser(item.Owner, out uri)) | ||
404 | { | ||
405 | return m_LocalGridInventoryService.AddItem(item); | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | UUID sessionID = GetSessionID(item.Owner); | ||
410 | uri = uri + "/" + item.Owner.ToString(); | ||
411 | return m_HGService.AddItem(uri, item, sessionID); | ||
412 | } | ||
413 | } | ||
414 | |||
415 | public override bool UpdateItem(InventoryItemBase item) | ||
416 | { | ||
417 | if (item == null) | ||
418 | return false; | ||
419 | |||
420 | string uri = string.Empty; | ||
421 | if (!IsForeignUser(item.Owner, out uri)) | ||
422 | return m_LocalGridInventoryService.UpdateItem(item); | ||
423 | else | ||
424 | { | ||
425 | UUID sessionID = GetSessionID(item.Owner); | ||
426 | uri = uri + "/" + item.Owner.ToString(); | ||
427 | return m_HGService.UpdateItem(uri, item, sessionID); | ||
428 | } | ||
429 | } | ||
430 | |||
431 | public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
432 | { | ||
433 | if (items == null) | ||
434 | return false; | ||
435 | if (items.Count == 0) | ||
436 | return true; | ||
437 | |||
438 | string uri = string.Empty; | ||
439 | if (!IsForeignUser(ownerID, out uri)) | ||
440 | return m_LocalGridInventoryService.MoveItems(ownerID, items); | ||
441 | else | ||
442 | { | ||
443 | UUID sessionID = GetSessionID(ownerID); | ||
444 | uri = uri + "/" + ownerID.ToString(); | ||
445 | return m_HGService.MoveItems(uri, items, sessionID); | ||
446 | } | ||
447 | } | ||
448 | |||
449 | public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
450 | { | ||
451 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); | ||
452 | |||
453 | if (itemIDs == null) | ||
454 | return false; | ||
455 | if (itemIDs.Count == 0) | ||
456 | return true; | ||
457 | |||
458 | string uri = string.Empty; | ||
459 | if (!IsForeignUser(ownerID, out uri)) | ||
460 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); | ||
461 | else | ||
462 | { | ||
463 | UUID sessionID = GetSessionID(ownerID); | ||
464 | uri = uri + "/" + ownerID.ToString(); | ||
465 | return m_HGService.DeleteItems(uri, itemIDs, sessionID); | ||
466 | } | ||
467 | } | ||
468 | |||
469 | public override InventoryItemBase GetItem(InventoryItemBase item) | ||
470 | { | ||
471 | if (item == null) | ||
472 | return null; | ||
473 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner); | ||
474 | string uri = string.Empty; | ||
475 | if (!IsForeignUser(item.Owner, out uri)) | ||
476 | return m_LocalGridInventoryService.GetItem(item); | ||
477 | else | ||
478 | { | ||
479 | UUID sessionID = GetSessionID(item.Owner); | ||
480 | uri = uri + "/" + item.Owner.ToString(); | ||
481 | return m_HGService.QueryItem(uri, item, sessionID); | ||
482 | } | ||
483 | } | ||
484 | |||
485 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
486 | { | ||
487 | if (folder == null) | ||
488 | return null; | ||
489 | |||
490 | string uri = string.Empty; | ||
491 | if (!IsForeignUser(folder.Owner, out uri)) | ||
492 | return m_LocalGridInventoryService.GetFolder(folder); | ||
493 | else | ||
494 | { | ||
495 | UUID sessionID = GetSessionID(folder.Owner); | ||
496 | uri = uri + "/" + folder.Owner.ToString(); | ||
497 | return m_HGService.QueryFolder(uri, folder, sessionID); | ||
498 | } | ||
499 | } | ||
500 | |||
501 | public override bool HasInventoryForUser(UUID userID) | ||
502 | { | ||
503 | return false; | ||
504 | } | ||
505 | |||
506 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
507 | { | ||
508 | return new List<InventoryItemBase>(); | ||
509 | } | ||
510 | |||
511 | public override int GetAssetPermissions(UUID userID, UUID assetID) | ||
512 | { | ||
513 | string uri = string.Empty; | ||
514 | if (!IsForeignUser(userID, out uri)) | ||
515 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); | ||
516 | else | ||
517 | { | ||
518 | UUID sessionID = GetSessionID(userID); | ||
519 | uri = uri + "/" + userID.ToString(); | ||
520 | return m_HGService.GetAssetPermissions(uri, assetID, sessionID); | ||
521 | } | ||
522 | } | ||
523 | |||
524 | #endregion | ||
525 | |||
526 | private IInventoryService GetConnector(string url) | ||
527 | { | ||
528 | IInventoryService connector = null; | ||
529 | lock (m_connectors) | ||
530 | { | ||
531 | if (m_connectors.ContainsKey(url)) | ||
532 | { | ||
533 | connector = m_connectors[url]; | ||
534 | } | ||
535 | else | ||
536 | { | ||
537 | // We're instantiating this class explicitly, but this won't | ||
538 | // work in general, because the remote grid may be running | ||
539 | // an inventory server that has a different protocol. | ||
540 | // Eventually we will want a piece of protocol asking | ||
541 | // the remote server about its kind. Definitely cool thing to do! | ||
542 | connector = new RemoteXInventoryServicesConnector(url); | ||
543 | m_connectors.Add(url, connector); | ||
544 | } | ||
545 | } | ||
546 | return connector; | ||
547 | } | ||
548 | |||
549 | |||
550 | private UUID GetSessionID(UUID userID) | ||
551 | { | ||
552 | ScenePresence sp = null; | ||
553 | if (m_Scene.TryGetScenePresence(userID, out sp)) | ||
554 | { | ||
555 | return sp.ControllingClient.SessionId; | ||
556 | } | ||
557 | |||
558 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID); | ||
559 | return UUID.Zero; | ||
560 | } | ||
561 | |||
562 | private bool IsForeignUser(UUID userID, out string inventoryURL) | ||
563 | { | ||
564 | inventoryURL = string.Empty; | ||
565 | UserAccount account = null; | ||
566 | if (m_Scene.UserAccountService != null) | ||
567 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
568 | |||
569 | if (account == null) // foreign user | ||
570 | { | ||
571 | ScenePresence sp = null; | ||
572 | m_Scene.TryGetScenePresence(userID, out sp); | ||
573 | if (sp != null) | ||
574 | { | ||
575 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
576 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
577 | { | ||
578 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
579 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
580 | return true; | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | return false; | ||
585 | } | ||
586 | |||
587 | |||
588 | } | ||
589 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 5e06580..9c6e1cd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -51,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
51 | // The cache proper | 51 | // The cache proper |
52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; | 52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; |
53 | 53 | ||
54 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
55 | protected Dictionary<UUID, string> m_InventoryURLs; | ||
56 | |||
54 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) | 57 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) |
55 | { | 58 | { |
56 | m_Scenes = new List<Scene>(); | 59 | m_Scenes = new List<Scene>(); |
@@ -89,8 +92,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
89 | 92 | ||
90 | // If not, go get them and place them in the cache | 93 | // If not, go get them and place them in the cache |
91 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); | 94 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); |
95 | CacheInventoryServiceURL(presence.Scene, presence.UUID); | ||
96 | |||
92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | 97 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", |
93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); | 98 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); |
99 | |||
94 | } | 100 | } |
95 | 101 | ||
96 | void OnClientClosed(UUID clientID, Scene scene) | 102 | void OnClientClosed(UUID clientID, Scene scene) |
@@ -113,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
113 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | 119 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", |
114 | scene.RegionInfo.RegionName, clientID); | 120 | scene.RegionInfo.RegionName, clientID); |
115 | DropCachedSystemFolders(clientID); | 121 | DropCachedSystemFolders(clientID); |
122 | DropInventoryServiceURL(clientID); | ||
116 | } | 123 | } |
117 | } | 124 | } |
118 | 125 | ||
@@ -174,5 +181,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
174 | 181 | ||
175 | return null; | 182 | return null; |
176 | } | 183 | } |
184 | |||
185 | /// <summary> | ||
186 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
187 | /// and sticks it in the cache | ||
188 | /// </summary> | ||
189 | /// <param name="userID"></param> | ||
190 | private void CacheInventoryServiceURL(Scene scene, UUID userID) | ||
191 | { | ||
192 | if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) | ||
193 | { | ||
194 | // The user does not have a local account; let's cache its service URL | ||
195 | string inventoryURL = string.Empty; | ||
196 | ScenePresence sp = null; | ||
197 | scene.TryGetScenePresence(userID, out sp); | ||
198 | if (sp != null) | ||
199 | { | ||
200 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
201 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
202 | { | ||
203 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
204 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
205 | { | ||
206 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
207 | m_InventoryURLs.Add(userID, inventoryURL); | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private void DropInventoryServiceURL(UUID userID) | ||
215 | { | ||
216 | lock (m_InventoryURLs) | ||
217 | if (m_InventoryURLs.ContainsKey(userID)) | ||
218 | m_InventoryURLs.Remove(userID); | ||
219 | } | ||
220 | |||
221 | public string GetInventoryServiceURL(UUID userID) | ||
222 | { | ||
223 | if (m_InventoryURLs.ContainsKey(userID)) | ||
224 | return m_InventoryURLs[userID]; | ||
225 | |||
226 | return null; | ||
227 | } | ||
177 | } | 228 | } |
178 | } | 229 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs index fb353c2..96d0c1c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -65,6 +65,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
65 | { | 65 | { |
66 | } | 66 | } |
67 | 67 | ||
68 | public RemoteXInventoryServicesConnector(string url) | ||
69 | { | ||
70 | m_RemoteConnector = new XInventoryServicesConnector(url); | ||
71 | } | ||
72 | |||
68 | public RemoteXInventoryServicesConnector(IConfigSource source) | 73 | public RemoteXInventoryServicesConnector(IConfigSource source) |
69 | { | 74 | { |
70 | Init(source); | 75 | Init(source); |
@@ -183,6 +188,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
183 | 188 | ||
184 | public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 189 | public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
185 | { | 190 | { |
191 | m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolderContent {0}", folderID); | ||
186 | try | 192 | try |
187 | { | 193 | { |
188 | return m_RemoteConnector.GetFolderContent(userID, folderID); | 194 | return m_RemoteConnector.GetFolderContent(userID, folderID); |
@@ -295,6 +301,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
295 | 301 | ||
296 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) | 302 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) |
297 | { | 303 | { |
304 | m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); | ||
298 | if (folder == null) | 305 | if (folder == null) |
299 | return null; | 306 | return null; |
300 | 307 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs index 5fac189..16cd7e4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs | |||
@@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | { | 39 | { |
40 | int Type { get; } | 40 | int Type { get; } |
41 | UUID AssetID { get; } | 41 | UUID AssetID { get; } |
42 | T RetreiveAsset<T>() where T : Asset, new(); | 42 | T RetrieveAsset<T>() where T : Asset, new(); |
43 | } | 43 | } |
44 | } | 44 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs index 5bf29d7..bf85cbc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs | |||
@@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | public class InventoryItem : IInventoryItem | 39 | public class InventoryItem : IInventoryItem |
40 | { | 40 | { |
41 | TaskInventoryItem m_privateItem; | 41 | TaskInventoryItem m_privateItem; |
42 | Scene m_rootSceene; | 42 | Scene m_rootScene; |
43 | 43 | ||
44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) | 44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) |
45 | { | 45 | { |
46 | m_rootSceene = rootScene; | 46 | m_rootScene = rootScene; |
47 | m_privateItem = internalItem; | 47 | m_privateItem = internalItem; |
48 | } | 48 | } |
49 | 49 | ||
@@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
82 | public UUID AssetID { get { return m_privateItem.AssetID; } } | 82 | public UUID AssetID { get { return m_privateItem.AssetID; } } |
83 | 83 | ||
84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. | 84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. |
85 | public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() | 85 | public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() |
86 | { | 86 | { |
87 | AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); | 87 | AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString()); |
88 | T result = new T(); | 88 | T result = new T(); |
89 | 89 | ||
90 | if ((sbyte)result.AssetType != a.Type) | 90 | if ((sbyte)result.AssetType != a.Type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index d8c0ba5..f719683 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
261 | // } | 261 | // } |
262 | //} | 262 | //} |
263 | 263 | ||
264 | public object GetCompilerOutput(UUID assetID) | 264 | public string GetCompilerOutput(string assetID) |
265 | { | 265 | { |
266 | return Path.Combine(ScriptEnginesPath, Path.Combine( | 266 | return Path.Combine(ScriptEnginesPath, Path.Combine( |
267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | 267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), |
268 | FilePrefix + "_compiled_" + assetID + ".dll")); | 268 | FilePrefix + "_compiled_" + assetID + ".dll")); |
269 | } | 269 | } |
270 | 270 | ||
271 | public string GetCompilerOutput(UUID assetID) | ||
272 | { | ||
273 | return GetCompilerOutput(assetID.ToString()); | ||
274 | } | ||
275 | |||
271 | /// <summary> | 276 | /// <summary> |
272 | /// Converts script from LSL to CS and calls CompileFromCSText | 277 | /// Converts script from LSL to CS and calls CompileFromCSText |
273 | /// </summary> | 278 | /// </summary> |
@@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
279 | linemap = null; | 284 | linemap = null; |
280 | m_warnings.Clear(); | 285 | m_warnings.Clear(); |
281 | 286 | ||
282 | assembly = Path.Combine(ScriptEnginesPath, Path.Combine( | 287 | assembly = GetCompilerOutput(asset); |
283 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | ||
284 | FilePrefix + "_compiled_" + asset + ".dll")); | ||
285 | 288 | ||
286 | if (!Directory.Exists(ScriptEnginesPath)) | 289 | if (!Directory.Exists(ScriptEnginesPath)) |
287 | { | 290 | { |
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 7164520..16b05df 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
91 | sr.Close(); | 91 | sr.Close(); |
92 | body = body.Trim(); | 92 | body = body.Trim(); |
93 | 93 | ||
94 | m_log.DebugFormat("[XXX]: query String: {0}", body); | 94 | //m_log.DebugFormat("[XXX]: query String: {0}", body); |
95 | 95 | ||
96 | try | 96 | try |
97 | { | 97 | { |
@@ -213,7 +213,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
213 | result["RESULT"] = "False"; | 213 | result["RESULT"] = "False"; |
214 | 214 | ||
215 | string xmlString = ServerUtils.BuildXmlResponse(result); | 215 | string xmlString = ServerUtils.BuildXmlResponse(result); |
216 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 216 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
217 | UTF8Encoding encoding = new UTF8Encoding(); | 217 | UTF8Encoding encoding = new UTF8Encoding(); |
218 | return encoding.GetBytes(xmlString); | 218 | return encoding.GetBytes(xmlString); |
219 | } | 219 | } |
@@ -228,12 +228,20 @@ namespace OpenSim.Server.Handlers.Asset | |||
228 | 228 | ||
229 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); | 229 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); |
230 | 230 | ||
231 | Dictionary<string, object> sfolders = new Dictionary<string, object>(); | ||
231 | if (folders != null) | 232 | if (folders != null) |
233 | { | ||
234 | int i = 0; | ||
232 | foreach (InventoryFolderBase f in folders) | 235 | foreach (InventoryFolderBase f in folders) |
233 | result[f.ID.ToString()] = EncodeFolder(f); | 236 | { |
237 | sfolders["folder_" + i.ToString()] = EncodeFolder(f); | ||
238 | i++; | ||
239 | } | ||
240 | } | ||
241 | result["FOLDERS"] = sfolders; | ||
234 | 242 | ||
235 | string xmlString = ServerUtils.BuildXmlResponse(result); | 243 | string xmlString = ServerUtils.BuildXmlResponse(result); |
236 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 244 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
237 | UTF8Encoding encoding = new UTF8Encoding(); | 245 | UTF8Encoding encoding = new UTF8Encoding(); |
238 | return encoding.GetBytes(xmlString); | 246 | return encoding.GetBytes(xmlString); |
239 | } | 247 | } |
@@ -246,10 +254,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
246 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | 254 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); |
247 | InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); | 255 | InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal); |
248 | if (rfolder != null) | 256 | if (rfolder != null) |
249 | result[rfolder.ID.ToString()] = EncodeFolder(rfolder); | 257 | result["folder"] = EncodeFolder(rfolder); |
250 | 258 | ||
251 | string xmlString = ServerUtils.BuildXmlResponse(result); | 259 | string xmlString = ServerUtils.BuildXmlResponse(result); |
252 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 260 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
253 | UTF8Encoding encoding = new UTF8Encoding(); | 261 | UTF8Encoding encoding = new UTF8Encoding(); |
254 | return encoding.GetBytes(xmlString); | 262 | return encoding.GetBytes(xmlString); |
255 | } | 263 | } |
@@ -263,10 +271,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
263 | Int32.TryParse(request["TYPE"].ToString(), out type); | 271 | Int32.TryParse(request["TYPE"].ToString(), out type); |
264 | InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); | 272 | InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type); |
265 | if (folder != null) | 273 | if (folder != null) |
266 | result[folder.ID.ToString()] = EncodeFolder(folder); | 274 | result["folder"] = EncodeFolder(folder); |
267 | 275 | ||
268 | string xmlString = ServerUtils.BuildXmlResponse(result); | 276 | string xmlString = ServerUtils.BuildXmlResponse(result); |
269 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 277 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
270 | UTF8Encoding encoding = new UTF8Encoding(); | 278 | UTF8Encoding encoding = new UTF8Encoding(); |
271 | return encoding.GetBytes(xmlString); | 279 | return encoding.GetBytes(xmlString); |
272 | } | 280 | } |
@@ -283,18 +291,26 @@ namespace OpenSim.Server.Handlers.Asset | |||
283 | if (icoll != null) | 291 | if (icoll != null) |
284 | { | 292 | { |
285 | Dictionary<string, object> folders = new Dictionary<string, object>(); | 293 | Dictionary<string, object> folders = new Dictionary<string, object>(); |
294 | int i = 0; | ||
286 | foreach (InventoryFolderBase f in icoll.Folders) | 295 | foreach (InventoryFolderBase f in icoll.Folders) |
287 | folders[f.ID.ToString()] = EncodeFolder(f); | 296 | { |
297 | folders["folder_" + i.ToString()] = EncodeFolder(f); | ||
298 | i++; | ||
299 | } | ||
288 | result["FOLDERS"] = folders; | 300 | result["FOLDERS"] = folders; |
289 | 301 | ||
302 | i = 0; | ||
290 | Dictionary<string, object> items = new Dictionary<string, object>(); | 303 | Dictionary<string, object> items = new Dictionary<string, object>(); |
291 | foreach (InventoryItemBase i in icoll.Items) | 304 | foreach (InventoryItemBase it in icoll.Items) |
292 | items[i.ID.ToString()] = EncodeItem(i); | 305 | { |
306 | items["item_" + i.ToString()] = EncodeItem(it); | ||
307 | i++; | ||
308 | } | ||
293 | result["ITEMS"] = items; | 309 | result["ITEMS"] = items; |
294 | } | 310 | } |
295 | 311 | ||
296 | string xmlString = ServerUtils.BuildXmlResponse(result); | 312 | string xmlString = ServerUtils.BuildXmlResponse(result); |
297 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 313 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
298 | UTF8Encoding encoding = new UTF8Encoding(); | 314 | UTF8Encoding encoding = new UTF8Encoding(); |
299 | return encoding.GetBytes(xmlString); | 315 | return encoding.GetBytes(xmlString); |
300 | } | 316 | } |
@@ -308,12 +324,21 @@ namespace OpenSim.Server.Handlers.Asset | |||
308 | UUID.TryParse(request["FOLDER"].ToString(), out folderID); | 324 | UUID.TryParse(request["FOLDER"].ToString(), out folderID); |
309 | 325 | ||
310 | List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID); | 326 | List<InventoryItemBase> items = m_InventoryService.GetFolderItems(principal, folderID); |
327 | Dictionary<string, object> sitems = new Dictionary<string, object>(); | ||
328 | |||
311 | if (items != null) | 329 | if (items != null) |
330 | { | ||
331 | int i = 0; | ||
312 | foreach (InventoryItemBase item in items) | 332 | foreach (InventoryItemBase item in items) |
313 | result[item.ID.ToString()] = EncodeItem(item); | 333 | { |
334 | sitems["item_" + i.ToString()] = EncodeItem(item); | ||
335 | i++; | ||
336 | } | ||
337 | } | ||
338 | result["ITEMS"] = sitems; | ||
314 | 339 | ||
315 | string xmlString = ServerUtils.BuildXmlResponse(result); | 340 | string xmlString = ServerUtils.BuildXmlResponse(result); |
316 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 341 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
317 | UTF8Encoding encoding = new UTF8Encoding(); | 342 | UTF8Encoding encoding = new UTF8Encoding(); |
318 | return encoding.GetBytes(xmlString); | 343 | return encoding.GetBytes(xmlString); |
319 | } | 344 | } |
@@ -483,10 +508,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
483 | InventoryItemBase item = new InventoryItemBase(id); | 508 | InventoryItemBase item = new InventoryItemBase(id); |
484 | item = m_InventoryService.GetItem(item); | 509 | item = m_InventoryService.GetItem(item); |
485 | if (item != null) | 510 | if (item != null) |
486 | result[item.ID.ToString()] = EncodeItem(item); | 511 | result["item"] = EncodeItem(item); |
487 | 512 | ||
488 | string xmlString = ServerUtils.BuildXmlResponse(result); | 513 | string xmlString = ServerUtils.BuildXmlResponse(result); |
489 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 514 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
490 | UTF8Encoding encoding = new UTF8Encoding(); | 515 | UTF8Encoding encoding = new UTF8Encoding(); |
491 | return encoding.GetBytes(xmlString); | 516 | return encoding.GetBytes(xmlString); |
492 | } | 517 | } |
@@ -500,10 +525,10 @@ namespace OpenSim.Server.Handlers.Asset | |||
500 | InventoryFolderBase folder = new InventoryFolderBase(id); | 525 | InventoryFolderBase folder = new InventoryFolderBase(id); |
501 | folder = m_InventoryService.GetFolder(folder); | 526 | folder = m_InventoryService.GetFolder(folder); |
502 | if (folder != null) | 527 | if (folder != null) |
503 | result[folder.ID.ToString()] = EncodeFolder(folder); | 528 | result["folder"] = EncodeFolder(folder); |
504 | 529 | ||
505 | string xmlString = ServerUtils.BuildXmlResponse(result); | 530 | string xmlString = ServerUtils.BuildXmlResponse(result); |
506 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 531 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
507 | UTF8Encoding encoding = new UTF8Encoding(); | 532 | UTF8Encoding encoding = new UTF8Encoding(); |
508 | return encoding.GetBytes(xmlString); | 533 | return encoding.GetBytes(xmlString); |
509 | } | 534 | } |
@@ -515,12 +540,20 @@ namespace OpenSim.Server.Handlers.Asset | |||
515 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | 540 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); |
516 | 541 | ||
517 | List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal); | 542 | List<InventoryItemBase> gestures = m_InventoryService.GetActiveGestures(principal); |
543 | Dictionary<string, object> items = new Dictionary<string, object>(); | ||
518 | if (gestures != null) | 544 | if (gestures != null) |
545 | { | ||
546 | int i = 0; | ||
519 | foreach (InventoryItemBase item in gestures) | 547 | foreach (InventoryItemBase item in gestures) |
520 | result[item.ID.ToString()] = EncodeItem(item); | 548 | { |
549 | items["item_" + i.ToString()] = EncodeItem(item); | ||
550 | i++; | ||
551 | } | ||
552 | } | ||
553 | result["ITEMS"] = items; | ||
521 | 554 | ||
522 | string xmlString = ServerUtils.BuildXmlResponse(result); | 555 | string xmlString = ServerUtils.BuildXmlResponse(result); |
523 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 556 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
524 | UTF8Encoding encoding = new UTF8Encoding(); | 557 | UTF8Encoding encoding = new UTF8Encoding(); |
525 | return encoding.GetBytes(xmlString); | 558 | return encoding.GetBytes(xmlString); |
526 | } | 559 | } |
@@ -537,7 +570,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
537 | 570 | ||
538 | result["RESULT"] = perms.ToString(); | 571 | result["RESULT"] = perms.ToString(); |
539 | string xmlString = ServerUtils.BuildXmlResponse(result); | 572 | string xmlString = ServerUtils.BuildXmlResponse(result); |
540 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 573 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
541 | UTF8Encoding encoding = new UTF8Encoding(); | 574 | UTF8Encoding encoding = new UTF8Encoding(); |
542 | return encoding.GetBytes(xmlString); | 575 | return encoding.GetBytes(xmlString); |
543 | } | 576 | } |
@@ -549,13 +582,19 @@ namespace OpenSim.Server.Handlers.Asset | |||
549 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); | 582 | UUID.TryParse(request["PRINCIPAL"].ToString(), out principal); |
550 | 583 | ||
551 | Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal); | 584 | Dictionary<AssetType, InventoryFolderBase> sfolders = GetSystemFolders(principal); |
585 | //m_log.DebugFormat("[XXX]: SystemFolders got {0} folders", sfolders.Count); | ||
552 | 586 | ||
553 | if (sfolders != null) | 587 | Dictionary<string, object> folders = new Dictionary<string, object>(); |
554 | foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders) | 588 | int i = 0; |
555 | result[kvp.Key.ToString()] = EncodeFolder(kvp.Value); | 589 | foreach (KeyValuePair<AssetType, InventoryFolderBase> kvp in sfolders) |
590 | { | ||
591 | folders["folder_" + i.ToString()] = EncodeFolder(kvp.Value); | ||
592 | i++; | ||
593 | } | ||
594 | result["FOLDERS"] = folders; | ||
556 | 595 | ||
557 | string xmlString = ServerUtils.BuildXmlResponse(result); | 596 | string xmlString = ServerUtils.BuildXmlResponse(result); |
558 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 597 | //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
559 | UTF8Encoding encoding = new UTF8Encoding(); | 598 | UTF8Encoding encoding = new UTF8Encoding(); |
560 | return encoding.GetBytes(xmlString); | 599 | return encoding.GetBytes(xmlString); |
561 | } | 600 | } |
@@ -589,7 +628,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
589 | ret["Flags"] = item.Flags.ToString(); | 628 | ret["Flags"] = item.Flags.ToString(); |
590 | ret["Folder"] = item.Folder.ToString(); | 629 | ret["Folder"] = item.Folder.ToString(); |
591 | ret["GroupID"] = item.GroupID.ToString(); | 630 | ret["GroupID"] = item.GroupID.ToString(); |
592 | ret["GroupedOwned"] = item.GroupOwned.ToString(); | 631 | ret["GroupOwned"] = item.GroupOwned.ToString(); |
593 | ret["GroupPermissions"] = item.GroupPermissions.ToString(); | 632 | ret["GroupPermissions"] = item.GroupPermissions.ToString(); |
594 | ret["ID"] = item.ID.ToString(); | 633 | ret["ID"] = item.ID.ToString(); |
595 | ret["InvType"] = item.InvType.ToString(); | 634 | ret["InvType"] = item.InvType.ToString(); |
@@ -664,7 +703,7 @@ namespace OpenSim.Server.Handlers.Asset | |||
664 | return folders; | 703 | return folders; |
665 | } | 704 | } |
666 | } | 705 | } |
667 | m_log.WarnFormat("[INVENTORY SERVICE]: System folders for {0} not found", userID); | 706 | m_log.WarnFormat("[XINVENTORY SERVICE]: System folders for {0} not found", userID); |
668 | return new Dictionary<AssetType, InventoryFolderBase>(); | 707 | return new Dictionary<AssetType, InventoryFolderBase>(); |
669 | } | 708 | } |
670 | #endregion | 709 | #endregion |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index ed87f3f..4e512e7 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -106,7 +106,10 @@ namespace OpenSim.Services.AssetService | |||
106 | return null; | 106 | return null; |
107 | 107 | ||
108 | AssetBase asset = m_Database.GetAsset(assetID); | 108 | AssetBase asset = m_Database.GetAsset(assetID); |
109 | return asset.Metadata; | 109 | if (asset != null) |
110 | return asset.Metadata; | ||
111 | |||
112 | return null; | ||
110 | } | 113 | } |
111 | 114 | ||
112 | public byte[] GetData(string id) | 115 | public byte[] GetData(string id) |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index edf224f..52294da 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | |||
@@ -112,8 +112,15 @@ namespace OpenSim.Services.Connectors | |||
112 | 112 | ||
113 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); | 113 | List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); |
114 | 114 | ||
115 | foreach (Object o in ret.Values) | 115 | try |
116 | folders.Add(BuildFolder((Dictionary<string,object>)o)); | 116 | { |
117 | foreach (Object o in ret.Values) | ||
118 | folders.Add(BuildFolder((Dictionary<string, object>)o)); | ||
119 | } | ||
120 | catch (Exception e) | ||
121 | { | ||
122 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping folder list: {0}", e.Message); | ||
123 | } | ||
117 | 124 | ||
118 | return folders; | 125 | return folders; |
119 | } | 126 | } |
@@ -130,7 +137,7 @@ namespace OpenSim.Services.Connectors | |||
130 | if (ret.Count == 0) | 137 | if (ret.Count == 0) |
131 | return null; | 138 | return null; |
132 | 139 | ||
133 | return BuildFolder(ret); | 140 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
134 | } | 141 | } |
135 | 142 | ||
136 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) | 143 | public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) |
@@ -146,7 +153,7 @@ namespace OpenSim.Services.Connectors | |||
146 | if (ret.Count == 0) | 153 | if (ret.Count == 0) |
147 | return null; | 154 | return null; |
148 | 155 | ||
149 | return BuildFolder(ret); | 156 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
150 | } | 157 | } |
151 | 158 | ||
152 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) | 159 | public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) |
@@ -173,10 +180,17 @@ namespace OpenSim.Services.Connectors | |||
173 | Dictionary<string,object> items = | 180 | Dictionary<string,object> items = |
174 | (Dictionary<string,object>)ret["ITEMS"]; | 181 | (Dictionary<string,object>)ret["ITEMS"]; |
175 | 182 | ||
176 | foreach (Object o in folders.Values) | 183 | try |
177 | inventory.Folders.Add(BuildFolder((Dictionary<string,object>)o)); | 184 | { |
178 | foreach (Object o in items.Values) | 185 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i |
179 | inventory.Items.Add(BuildItem((Dictionary<string,object>)o)); | 186 | inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); |
187 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | ||
188 | inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); | ||
189 | } | ||
190 | catch (Exception e) | ||
191 | { | ||
192 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception unwrapping content list: {0}", e.Message); | ||
193 | } | ||
180 | 194 | ||
181 | return inventory; | 195 | return inventory; |
182 | } | 196 | } |
@@ -194,13 +208,12 @@ namespace OpenSim.Services.Connectors | |||
194 | if (ret.Count == 0) | 208 | if (ret.Count == 0) |
195 | return null; | 209 | return null; |
196 | 210 | ||
197 | 211 | Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; | |
198 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 212 | List<InventoryItemBase> fitems = new List<InventoryItemBase>(); |
199 | 213 | foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i | |
200 | foreach (Object o in ret.Values) | 214 | fitems.Add(BuildItem((Dictionary<string, object>)o)); |
201 | items.Add(BuildItem((Dictionary<string,object>)o)); | ||
202 | 215 | ||
203 | return items; | 216 | return fitems; |
204 | } | 217 | } |
205 | 218 | ||
206 | public bool AddFolder(InventoryFolderBase folder) | 219 | public bool AddFolder(InventoryFolderBase folder) |
@@ -405,7 +418,7 @@ namespace OpenSim.Services.Connectors | |||
405 | if (ret.Count == 0) | 418 | if (ret.Count == 0) |
406 | return null; | 419 | return null; |
407 | 420 | ||
408 | return BuildItem(ret); | 421 | return BuildItem((Dictionary<string, object>)ret["item"]); |
409 | } | 422 | } |
410 | 423 | ||
411 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 424 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
@@ -420,7 +433,7 @@ namespace OpenSim.Services.Connectors | |||
420 | if (ret.Count == 0) | 433 | if (ret.Count == 0) |
421 | return null; | 434 | return null; |
422 | 435 | ||
423 | return BuildFolder(ret); | 436 | return BuildFolder((Dictionary<string, object>)ret["folder"]); |
424 | } | 437 | } |
425 | 438 | ||
426 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) | 439 | public List<InventoryItemBase> GetActiveGestures(UUID principalID) |
@@ -435,8 +448,8 @@ namespace OpenSim.Services.Connectors | |||
435 | 448 | ||
436 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | 449 | List<InventoryItemBase> items = new List<InventoryItemBase>(); |
437 | 450 | ||
438 | foreach (Object o in ret.Values) | 451 | foreach (Object o in ret.Values) // getting the values directly, we don't care about the keys item_i |
439 | items.Add(BuildItem((Dictionary<string,object>)o)); | 452 | items.Add(BuildItem((Dictionary<string, object>)o)); |
440 | 453 | ||
441 | return items; | 454 | return items; |
442 | } | 455 | } |
@@ -469,13 +482,14 @@ namespace OpenSim.Services.Connectors | |||
469 | 482 | ||
470 | try | 483 | try |
471 | { | 484 | { |
472 | foreach (KeyValuePair<string, object> kvp in ret) | 485 | Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; |
486 | |||
487 | foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i | ||
473 | { | 488 | { |
474 | InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)(kvp.Value)); | 489 | InventoryFolderBase folder = BuildFolder((Dictionary<string, object>)o); |
475 | short type = 0; | 490 | sfolders.Add((AssetType)folder.Type, folder); |
476 | if (Int16.TryParse(kvp.Key, out type)) | ||
477 | sfolders.Add((AssetType)type, folder); | ||
478 | } | 491 | } |
492 | |||
479 | } | 493 | } |
480 | catch (Exception e) | 494 | catch (Exception e) |
481 | { | 495 | { |
@@ -522,13 +536,20 @@ namespace OpenSim.Services.Connectors | |||
522 | { | 536 | { |
523 | InventoryFolderBase folder = new InventoryFolderBase(); | 537 | InventoryFolderBase folder = new InventoryFolderBase(); |
524 | 538 | ||
525 | folder.ParentID = new UUID(data["ParentID"].ToString()); | 539 | try |
526 | folder.Type = short.Parse(data["Type"].ToString()); | 540 | { |
527 | folder.Version = ushort.Parse(data["Version"].ToString()); | 541 | folder.ParentID = new UUID(data["ParentID"].ToString()); |
528 | folder.Name = data["Name"].ToString(); | 542 | folder.Type = short.Parse(data["Type"].ToString()); |
529 | folder.Owner = new UUID(data["Owner"].ToString()); | 543 | folder.Version = ushort.Parse(data["Version"].ToString()); |
530 | folder.ID = new UUID(data["ID"].ToString()); | 544 | folder.Name = data["Name"].ToString(); |
531 | 545 | folder.Owner = new UUID(data["Owner"].ToString()); | |
546 | folder.ID = new UUID(data["ID"].ToString()); | ||
547 | } | ||
548 | catch (Exception e) | ||
549 | { | ||
550 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building folder: {0}", e.Message); | ||
551 | } | ||
552 | |||
532 | return folder; | 553 | return folder; |
533 | } | 554 | } |
534 | 555 | ||
@@ -536,26 +557,33 @@ namespace OpenSim.Services.Connectors | |||
536 | { | 557 | { |
537 | InventoryItemBase item = new InventoryItemBase(); | 558 | InventoryItemBase item = new InventoryItemBase(); |
538 | 559 | ||
539 | item.AssetID = new UUID(data["AssetID"].ToString()); | 560 | try |
540 | item.AssetType = int.Parse(data["AssetType"].ToString()); | 561 | { |
541 | item.Name = data["Name"].ToString(); | 562 | item.AssetID = new UUID(data["AssetID"].ToString()); |
542 | item.Owner = new UUID(data["Owner"].ToString()); | 563 | item.AssetType = int.Parse(data["AssetType"].ToString()); |
543 | item.ID = new UUID(data["ID"].ToString()); | 564 | item.Name = data["Name"].ToString(); |
544 | item.InvType = int.Parse(data["InvType"].ToString()); | 565 | item.Owner = new UUID(data["Owner"].ToString()); |
545 | item.Folder = new UUID(data["Folder"].ToString()); | 566 | item.ID = new UUID(data["ID"].ToString()); |
546 | item.CreatorId = data["CreatorId"].ToString(); | 567 | item.InvType = int.Parse(data["InvType"].ToString()); |
547 | item.Description = data["Description"].ToString(); | 568 | item.Folder = new UUID(data["Folder"].ToString()); |
548 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); | 569 | item.CreatorId = data["CreatorId"].ToString(); |
549 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); | 570 | item.Description = data["Description"].ToString(); |
550 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); | 571 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); |
551 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); | 572 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); |
552 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); | 573 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); |
553 | item.GroupID = new UUID(data["GroupID"].ToString()); | 574 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); |
554 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); | 575 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); |
555 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); | 576 | item.GroupID = new UUID(data["GroupID"].ToString()); |
556 | item.SaleType = byte.Parse(data["SaleType"].ToString()); | 577 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); |
557 | item.Flags = uint.Parse(data["Flags"].ToString()); | 578 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); |
558 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | 579 | item.SaleType = byte.Parse(data["SaleType"].ToString()); |
580 | item.Flags = uint.Parse(data["Flags"].ToString()); | ||
581 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | ||
582 | } | ||
583 | catch (Exception e) | ||
584 | { | ||
585 | m_log.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception building item: {0}", e.Message); | ||
586 | } | ||
559 | 587 | ||
560 | return item; | 588 | return item; |
561 | } | 589 | } |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 0d6577e..fbcd663 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -109,7 +109,7 @@ namespace OpenSim.Services.InventoryService | |||
109 | { | 109 | { |
110 | existingRootFolder = GetRootFolder(user); | 110 | existingRootFolder = GetRootFolder(user); |
111 | } | 111 | } |
112 | catch (Exception e) | 112 | catch /*(Exception e)*/ |
113 | { | 113 | { |
114 | // Munch the exception, it has already been reported | 114 | // Munch the exception, it has already been reported |
115 | // | 115 | // |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index bbd37d1..4d7103b 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -184,7 +184,7 @@ namespace OpenSim.Services.InventoryService | |||
184 | 184 | ||
185 | foreach (XInventoryFolder x in allFolders) | 185 | foreach (XInventoryFolder x in allFolders) |
186 | { | 186 | { |
187 | m_log.DebugFormat("[INVENTORY]: Adding folder {0} to skeleton", x.folderName); | 187 | //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); |
188 | folders.Add(ConvertToOpenSim(x)); | 188 | folders.Add(ConvertToOpenSim(x)); |
189 | } | 189 | } |
190 | 190 | ||
@@ -221,7 +221,7 @@ namespace OpenSim.Services.InventoryService | |||
221 | // connector. So we disregard the principal and look | 221 | // connector. So we disregard the principal and look |
222 | // by ID. | 222 | // by ID. |
223 | // | 223 | // |
224 | m_log.DebugFormat("[INVENTORY]: Fetch contents for folder {0}", folderID.ToString()); | 224 | m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString()); |
225 | InventoryCollection inventory = new InventoryCollection(); | 225 | InventoryCollection inventory = new InventoryCollection(); |
226 | inventory.UserID = principalID; | 226 | inventory.UserID = principalID; |
227 | inventory.Folders = new List<InventoryFolderBase>(); | 227 | inventory.Folders = new List<InventoryFolderBase>(); |
@@ -233,7 +233,7 @@ namespace OpenSim.Services.InventoryService | |||
233 | 233 | ||
234 | foreach (XInventoryFolder x in folders) | 234 | foreach (XInventoryFolder x in folders) |
235 | { | 235 | { |
236 | m_log.DebugFormat("[INVENTORY]: Adding folder {0} to response", x.folderName); | 236 | //m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to response", x.folderName); |
237 | inventory.Folders.Add(ConvertToOpenSim(x)); | 237 | inventory.Folders.Add(ConvertToOpenSim(x)); |
238 | } | 238 | } |
239 | 239 | ||
@@ -243,7 +243,7 @@ namespace OpenSim.Services.InventoryService | |||
243 | 243 | ||
244 | foreach (XInventoryItem i in items) | 244 | foreach (XInventoryItem i in items) |
245 | { | 245 | { |
246 | m_log.DebugFormat("[INVENTORY]: Adding item {0} to response", i.inventoryName); | 246 | //m_log.DebugFormat("[XINVENTORY]: Adding item {0} to response", i.inventoryName); |
247 | inventory.Items.Add(ConvertToOpenSim(i)); | 247 | inventory.Items.Add(ConvertToOpenSim(i)); |
248 | } | 248 | } |
249 | 249 | ||