diff options
Diffstat (limited to 'OpenSim')
15 files changed, 430 insertions, 953 deletions
diff --git a/OpenSim/Data/SQLite/Resources/001_XInventoryStore.sql b/OpenSim/Data/SQLite/Resources/001_XInventoryStore.sql new file mode 100644 index 0000000..7e21996 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/001_XInventoryStore.sql | |||
@@ -0,0 +1,38 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | CREATE TABLE inventoryfolders( | ||
4 | folderName varchar(255), | ||
5 | type integer, | ||
6 | version integer, | ||
7 | folderID varchar(255) primary key, | ||
8 | agentID varchar(255) not null default '00000000-0000-0000-0000-000000000000', | ||
9 | parentFolderID varchar(255) not null default '00000000-0000-0000-0000-000000000000'); | ||
10 | |||
11 | CREATE TABLE inventoryitems( | ||
12 | assetID varchar(255), | ||
13 | assetType integer, | ||
14 | inventoryName varchar(255), | ||
15 | inventoryDescription varchar(255), | ||
16 | inventoryNextPermissions integer, | ||
17 | inventoryCurrentPermissions integer, | ||
18 | invType integer, | ||
19 | creatorID varchar(255), | ||
20 | inventoryBasePermissions integer, | ||
21 | inventoryEveryOnePermissions integer, | ||
22 | salePrice integer default 99, | ||
23 | saleType integer default 0, | ||
24 | creationDate integer default 2000, | ||
25 | groupID varchar(255) default '00000000-0000-0000-0000-000000000000', | ||
26 | groupOwned integer default 0, | ||
27 | flags integer default 0, | ||
28 | inventoryID varchar(255) primary key, | ||
29 | parentFolderID varchar(255) not null default '00000000-0000-0000-0000-000000000000', | ||
30 | avatarID varchar(255) not null default '00000000-0000-0000-0000-000000000000', | ||
31 | inventoryGroupPermissions integer not null default 0); | ||
32 | |||
33 | create index inventoryfolders_agentid on inventoryfolders(agentID); | ||
34 | create index inventoryfolders_parentid on inventoryfolders(parentFolderID); | ||
35 | create index inventoryitems_parentfolderid on inventoryitems(parentFolderID); | ||
36 | create index inventoryitems_avatarid on inventoryitems(avatarID); | ||
37 | |||
38 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/Resources/002_XInventoryStore.sql b/OpenSim/Data/SQLite/Resources/002_XInventoryStore.sql new file mode 100644 index 0000000..545d233 --- /dev/null +++ b/OpenSim/Data/SQLite/Resources/002_XInventoryStore.sql | |||
@@ -0,0 +1,9 @@ | |||
1 | BEGIN TRANSACTION; | ||
2 | |||
3 | ATTACH 'inventoryStore.db' AS old; | ||
4 | |||
5 | INSERT INTO inventoryfolders (folderName, type, version, folderID, agentID, parentFolderID) SELECT `name` AS folderName, `type` AS type, `version` AS version, `UUID` AS folderID, `agentID` AS agentID, `parentID` AS parentFolderID from old.inventoryfolders; | ||
6 | |||
7 | INSERT INTO inventoryitems (assetID, assetType, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions, invType, creatorID, inventoryBasePermissions, inventoryEveryOnePermissions, salePrice, saleType, creationDate, groupID, groupOwned, flags, inventoryID, parentFolderID, avatarID, inventoryGroupPermissions) SELECT `assetID`, `assetType` AS assetType, `inventoryName` AS inventoryName, `inventoryDescription` AS inventoryDescription, `inventoryNextPermissions` AS inventoryNextPermissions, `inventoryCurrentPermissions` AS inventoryCurrentPermissions, `invType` AS invType, `creatorsID` AS creatorID, `inventoryBasePermissions` AS inventoryBasePermissions, `inventoryEveryOnePermissions` AS inventoryEveryOnePermissions, `salePrice` AS salePrice, `saleType` AS saleType, `creationDate` AS creationDate, `groupID` AS groupID, `groupOwned` AS groupOwned, `flags` AS flags, `UUID` AS inventoryID, `parentFolderID` AS parentFolderID, `avatarID` AS avatarID, `inventoryGroupPermissions` AS inventoryGroupPermissions FROM old.inventoryitems; | ||
8 | |||
9 | COMMIT; | ||
diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index 086ac0a..a1412ff 100644 --- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | |||
@@ -29,6 +29,8 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Data; | 31 | using System.Data; |
32 | using System.Reflection; | ||
33 | using log4net; | ||
32 | using OpenMetaverse; | 34 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using Mono.Data.Sqlite; | 36 | using Mono.Data.Sqlite; |
@@ -37,6 +39,8 @@ namespace OpenSim.Data.SQLite | |||
37 | { | 39 | { |
38 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData | 40 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData |
39 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
40 | private string m_Realm; | 44 | private string m_Realm; |
41 | private List<string> m_ColumnNames; | 45 | private List<string> m_ColumnNames; |
42 | private int m_LastExpire; | 46 | private int m_LastExpire; |
@@ -157,7 +161,7 @@ namespace OpenSim.Data.SQLite | |||
157 | } | 161 | } |
158 | catch (Exception e) | 162 | catch (Exception e) |
159 | { | 163 | { |
160 | Console.WriteLine(e.ToString()); | 164 | m_log.Error("[SQLITE]: Exception storing authentication data", e); |
161 | //CloseCommand(cmd); | 165 | //CloseCommand(cmd); |
162 | return false; | 166 | return false; |
163 | } | 167 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs index 3c70aef..9b8e2fa 100644 --- a/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs +++ b/OpenSim/Data/SQLite/SQLiteGenericTableHandler.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Data.SQLite | |||
59 | if (!m_initialized) | 59 | if (!m_initialized) |
60 | { | 60 | { |
61 | m_Connection = new SqliteConnection(connectionString); | 61 | m_Connection = new SqliteConnection(connectionString); |
62 | Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString)); | 62 | //Console.WriteLine(string.Format("OPENING CONNECTION FOR {0} USING {1}", storeName, connectionString)); |
63 | m_Connection.Open(); | 63 | m_Connection.Open(); |
64 | 64 | ||
65 | if (storeName != String.Empty) | 65 | if (storeName != String.Empty) |
diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index be1d041..6064538 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Data.SQLite | |||
49 | public SQLiteXInventoryData(string conn, string realm) | 49 | public SQLiteXInventoryData(string conn, string realm) |
50 | { | 50 | { |
51 | m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>( | 51 | m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>( |
52 | conn, "inventoryfolders", "InventoryStore"); | 52 | conn, "inventoryfolders", "XInventoryStore"); |
53 | m_Items = new SqliteItemHandler( | 53 | m_Items = new SqliteItemHandler( |
54 | conn, "inventoryitems", String.Empty); | 54 | conn, "inventoryitems", String.Empty); |
55 | } | 55 | } |
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs index c64830a..760221d 100644 --- a/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLiteLegacy/SQLiteAuthenticationData.cs | |||
@@ -29,6 +29,8 @@ using System; | |||
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Data; | 31 | using System.Data; |
32 | using System.Reflection; | ||
33 | using log4net; | ||
32 | using OpenMetaverse; | 34 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using Mono.Data.SqliteClient; | 36 | using Mono.Data.SqliteClient; |
@@ -37,6 +39,8 @@ namespace OpenSim.Data.SQLiteLegacy | |||
37 | { | 39 | { |
38 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData | 40 | public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData |
39 | { | 41 | { |
42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
40 | private string m_Realm; | 44 | private string m_Realm; |
41 | private List<string> m_ColumnNames; | 45 | private List<string> m_ColumnNames; |
42 | private int m_LastExpire; | 46 | private int m_LastExpire; |
@@ -162,7 +166,7 @@ namespace OpenSim.Data.SQLiteLegacy | |||
162 | } | 166 | } |
163 | catch (Exception e) | 167 | catch (Exception e) |
164 | { | 168 | { |
165 | Console.WriteLine(e.ToString()); | 169 | m_log.Error("[SQLITE]: Exception storing authentication data", e); |
166 | CloseCommand(cmd); | 170 | CloseCommand(cmd); |
167 | return false; | 171 | return false; |
168 | } | 172 | } |
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index 2b0096b..2cb7895 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs | |||
@@ -122,6 +122,8 @@ namespace OpenSim.Framework | |||
122 | private int _type = 0; | 122 | private int _type = 0; |
123 | private UUID _oldID; | 123 | private UUID _oldID; |
124 | 124 | ||
125 | private bool _ownerChanged = false; | ||
126 | |||
125 | public UUID AssetID { | 127 | public UUID AssetID { |
126 | get { | 128 | get { |
127 | return _assetID; | 129 | return _assetID; |
@@ -320,6 +322,15 @@ namespace OpenSim.Framework | |||
320 | } | 322 | } |
321 | } | 323 | } |
322 | 324 | ||
325 | public bool OwnerChanged { | ||
326 | get { | ||
327 | return _ownerChanged; | ||
328 | } | ||
329 | set { | ||
330 | _ownerChanged = value; | ||
331 | } | ||
332 | } | ||
333 | |||
323 | // See ICloneable | 334 | // See ICloneable |
324 | 335 | ||
325 | #region ICloneable Members | 336 | #region ICloneable Members |
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index c738296..0a5ff3f 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -47,7 +47,6 @@ | |||
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="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> |
49 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> | 49 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> |
50 | <RegionModule id="HGInventoryBroker2" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker2" /> | ||
51 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> | 50 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> |
52 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> | 51 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> |
53 | <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" /> | 52 | <RegionModule id="LocalLandServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Land.LocalLandServicesConnector" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 54508cc..e09db15 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -41,20 +41,21 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
43 | { | 43 | { |
44 | public class HGInventoryBroker : BaseInventoryConnector, INonSharedRegionModule, IInventoryService | 44 | public class HGInventoryBroker : ISharedRegionModule, IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
48 | MethodBase.GetCurrentMethod().DeclaringType); | 48 | MethodBase.GetCurrentMethod().DeclaringType); |
49 | 49 | ||
50 | private static bool m_Initialized = false; | ||
51 | private static bool m_Enabled = false; | 50 | private static bool m_Enabled = false; |
52 | 51 | ||
53 | private static IInventoryService m_GridService; | 52 | private static IInventoryService m_LocalGridInventoryService; |
54 | private static ISessionAuthInventoryService m_HGService; | 53 | private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); |
55 | 54 | ||
56 | private Scene m_Scene; | 55 | // A cache of userIDs --> ServiceURLs, for HGBroker only |
57 | private IUserAccountService m_UserAccountService; | 56 | protected Dictionary<UUID, string> m_InventoryURLs = new Dictionary<UUID,string>(); |
57 | |||
58 | private List<Scene> m_Scenes = new List<Scene>(); | ||
58 | 59 | ||
59 | public Type ReplaceableInterface | 60 | public Type ReplaceableInterface |
60 | { | 61 | { |
@@ -68,67 +69,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
68 | 69 | ||
69 | public void Initialise(IConfigSource source) | 70 | public void Initialise(IConfigSource source) |
70 | { | 71 | { |
71 | if (!m_Initialized) | 72 | IConfig moduleConfig = source.Configs["Modules"]; |
73 | if (moduleConfig != null) | ||
72 | { | 74 | { |
73 | IConfig moduleConfig = source.Configs["Modules"]; | 75 | string name = moduleConfig.GetString("InventoryServices", ""); |
74 | if (moduleConfig != null) | 76 | if (name == Name) |
75 | { | 77 | { |
76 | string name = moduleConfig.GetString("InventoryServices", ""); | 78 | IConfig inventoryConfig = source.Configs["InventoryService"]; |
77 | if (name == Name) | 79 | if (inventoryConfig == null) |
78 | { | 80 | { |
79 | IConfig inventoryConfig = source.Configs["InventoryService"]; | 81 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); |
80 | if (inventoryConfig == null) | 82 | return; |
81 | { | 83 | } |
82 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
87 | String.Empty); | ||
88 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
89 | String.Empty); | ||
90 | |||
91 | if (localDll == String.Empty) | ||
92 | { | ||
93 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
94 | //return; | ||
95 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
96 | } | ||
97 | |||
98 | if (HGDll == String.Empty) | ||
99 | { | ||
100 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | ||
101 | //return; | ||
102 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
103 | } | ||
104 | |||
105 | Object[] args = new Object[] { source }; | ||
106 | m_GridService = | ||
107 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
108 | args); | ||
109 | 84 | ||
110 | m_HGService = | 85 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", |
111 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | 86 | String.Empty); |
112 | args); | 87 | //string HGDll = inventoryConfig.GetString("HypergridInventoryService", |
88 | // String.Empty); | ||
113 | 89 | ||
114 | if (m_GridService == null) | 90 | if (localDll == String.Empty) |
115 | { | 91 | { |
116 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | 92 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); |
117 | return; | 93 | //return; |
118 | } | 94 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); |
119 | if (m_HGService == null) | 95 | } |
120 | { | ||
121 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
122 | return; | ||
123 | } | ||
124 | 96 | ||
125 | Init(source); | 97 | Object[] args = new Object[] { source }; |
98 | m_LocalGridInventoryService = | ||
99 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
100 | args); | ||
126 | 101 | ||
127 | m_Enabled = true; | 102 | if (m_LocalGridInventoryService == null) |
128 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | 103 | { |
104 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
105 | return; | ||
129 | } | 106 | } |
107 | |||
108 | m_Enabled = true; | ||
109 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: HG inventory broker enabled with inner connector of type {0}", m_LocalGridInventoryService.GetType()); | ||
130 | } | 110 | } |
131 | m_Initialized = true; | ||
132 | } | 111 | } |
133 | } | 112 | } |
134 | 113 | ||
@@ -145,19 +124,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
145 | if (!m_Enabled) | 124 | if (!m_Enabled) |
146 | return; | 125 | return; |
147 | 126 | ||
148 | m_Scene = scene; | 127 | m_Scenes.Add(scene); |
149 | m_UserAccountService = m_Scene.UserAccountService; | ||
150 | 128 | ||
151 | scene.RegisterModuleInterface<IInventoryService>(this); | 129 | scene.RegisterModuleInterface<IInventoryService>(this); |
152 | m_cache.AddRegion(scene); | 130 | |
131 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
132 | |||
153 | } | 133 | } |
154 | 134 | ||
155 | public void RemoveRegion(Scene scene) | 135 | public void RemoveRegion(Scene scene) |
156 | { | 136 | { |
157 | if (!m_Enabled) | 137 | if (!m_Enabled) |
158 | return; | 138 | return; |
159 | 139 | ||
160 | m_cache.RemoveRegion(scene); | 140 | m_Scenes.Remove(scene); |
161 | } | 141 | } |
162 | 142 | ||
163 | public void RegionLoaded(Scene scene) | 143 | public void RegionLoaded(Scene scene) |
@@ -169,260 +149,307 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
169 | 149 | ||
170 | } | 150 | } |
171 | 151 | ||
152 | #region URL Cache | ||
153 | |||
154 | void OnClientClosed(UUID clientID, Scene scene) | ||
155 | { | ||
156 | if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache | ||
157 | { | ||
158 | ScenePresence sp = null; | ||
159 | foreach (Scene s in m_Scenes) | ||
160 | { | ||
161 | s.TryGetScenePresence(clientID, out sp); | ||
162 | if ((sp != null) && !sp.IsChildAgent && (s != scene)) | ||
163 | { | ||
164 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache", | ||
165 | scene.RegionInfo.RegionName, clientID); | ||
166 | return; | ||
167 | } | ||
168 | } | ||
169 | DropInventoryServiceURL(clientID); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
175 | /// and sticks it in the cache | ||
176 | /// </summary> | ||
177 | /// <param name="userID"></param> | ||
178 | private void CacheInventoryServiceURL(UUID userID) | ||
179 | { | ||
180 | if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null) | ||
181 | { | ||
182 | // The user does not have a local account; let's cache its service URL | ||
183 | string inventoryURL = string.Empty; | ||
184 | ScenePresence sp = null; | ||
185 | foreach (Scene scene in m_Scenes) | ||
186 | { | ||
187 | scene.TryGetScenePresence(userID, out sp); | ||
188 | if (sp != null) | ||
189 | { | ||
190 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
191 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
192 | { | ||
193 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
194 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
195 | { | ||
196 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
197 | m_InventoryURLs.Add(userID, inventoryURL); | ||
198 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); | ||
199 | return; | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | |||
206 | // else put a null; it means that the methods should forward to local grid's inventory | ||
207 | m_InventoryURLs.Add(userID, null); | ||
208 | } | ||
209 | |||
210 | private void DropInventoryServiceURL(UUID userID) | ||
211 | { | ||
212 | lock (m_InventoryURLs) | ||
213 | if (m_InventoryURLs.ContainsKey(userID)) | ||
214 | { | ||
215 | string url = m_InventoryURLs[userID]; | ||
216 | m_InventoryURLs.Remove(userID); | ||
217 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Removed {0} from the cache of inventory URLs", url); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public string GetInventoryServiceURL(UUID userID) | ||
222 | { | ||
223 | if (m_InventoryURLs.ContainsKey(userID)) | ||
224 | return m_InventoryURLs[userID]; | ||
225 | |||
226 | else | ||
227 | CacheInventoryServiceURL(userID); | ||
228 | |||
229 | return m_InventoryURLs[userID]; | ||
230 | } | ||
231 | #endregion | ||
232 | |||
172 | #region IInventoryService | 233 | #region IInventoryService |
173 | 234 | ||
174 | public override bool CreateUserInventory(UUID userID) | 235 | public bool CreateUserInventory(UUID userID) |
175 | { | 236 | { |
176 | return m_GridService.CreateUserInventory(userID); | 237 | return m_LocalGridInventoryService.CreateUserInventory(userID); |
177 | } | 238 | } |
178 | 239 | ||
179 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 240 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
180 | { | 241 | { |
181 | return m_GridService.GetInventorySkeleton(userId); | 242 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); |
182 | } | 243 | } |
183 | 244 | ||
184 | public override InventoryCollection GetUserInventory(UUID userID) | 245 | public InventoryCollection GetUserInventory(UUID userID) |
185 | { | 246 | { |
186 | return null; | 247 | return null; |
187 | } | 248 | } |
188 | 249 | ||
189 | public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 250 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
190 | { | 251 | { |
191 | } | 252 | } |
192 | 253 | ||
193 | // Inherited. See base | 254 | public InventoryFolderBase GetRootFolder(UUID userID) |
194 | //public override InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
195 | //{ | ||
196 | // if (IsLocalGridUser(userID)) | ||
197 | // return m_GridService.GetFolderForType(userID, type); | ||
198 | // else | ||
199 | // { | ||
200 | // UUID sessionID = GetSessionID(userID); | ||
201 | // string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | ||
202 | // // !!!!!! | ||
203 | // return null; | ||
204 | // //return m_HGService.GetFolderForType(uri, sessionID, type); | ||
205 | // } | ||
206 | //} | ||
207 | |||
208 | public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
209 | { | 255 | { |
210 | string uri = string.Empty; | 256 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); |
211 | if (!IsForeignUser(userID, out uri)) | 257 | |
212 | return m_GridService.GetFolderContent(userID, folderID); | 258 | string invURL = GetInventoryServiceURL(userID); |
213 | else | 259 | |
214 | { | 260 | if (invURL == null) // not there, forward to local inventory connector to resolve |
215 | UUID sessionID = GetSessionID(userID); | 261 | return m_LocalGridInventoryService.GetRootFolder(userID); |
216 | uri = uri + "/" + userID.ToString(); | 262 | |
217 | return m_HGService.GetFolderContent(uri, folderID, sessionID); | 263 | IInventoryService connector = GetConnector(invURL); |
218 | } | 264 | |
265 | return connector.GetRootFolder(userID); | ||
219 | } | 266 | } |
220 | 267 | ||
221 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | 268 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) |
222 | { | 269 | { |
223 | string uri = string.Empty; | 270 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); |
224 | if (!IsForeignUser(userID, out uri)) | 271 | |
225 | { | 272 | string invURL = GetInventoryServiceURL(userID); |
226 | // This is not pretty, but it will have to do for now | 273 | |
227 | if (m_GridService is BaseInventoryConnector) | 274 | if (invURL == null) // not there, forward to local inventory connector to resolve |
228 | { | 275 | return m_LocalGridInventoryService.GetFolderForType(userID, type); |
229 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module"); | 276 | |
230 | return ((BaseInventoryConnector)m_GridService).GetSystemFolders(userID); | 277 | IInventoryService connector = GetConnector(invURL); |
231 | } | 278 | |
232 | else | 279 | return connector.GetFolderForType(userID, type); |
233 | { | ||
234 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal"); | ||
235 | return GetSystemFoldersLocal(userID); | ||
236 | } | ||
237 | } | ||
238 | else | ||
239 | { | ||
240 | UUID sessionID = GetSessionID(userID); | ||
241 | uri = uri + "/" + userID.ToString(); | ||
242 | return m_HGService.GetSystemFolders(uri, sessionID); | ||
243 | } | ||
244 | } | 280 | } |
245 | 281 | ||
246 | private Dictionary<AssetType, InventoryFolderBase> GetSystemFoldersLocal(UUID userID) | 282 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
247 | { | 283 | { |
248 | InventoryFolderBase root = m_GridService.GetRootFolder(userID); | 284 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID); |
249 | if (root != null) | ||
250 | { | ||
251 | InventoryCollection content = m_GridService.GetFolderContent(userID, root.ID); | ||
252 | if (content != null) | ||
253 | { | ||
254 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
255 | foreach (InventoryFolderBase folder in content.Folders) | ||
256 | { | ||
257 | //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scanning folder type {0}", (AssetType)folder.Type); | ||
258 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
259 | folders[(AssetType)folder.Type] = folder; | ||
260 | } | ||
261 | // Put the root folder there, as type Folder | ||
262 | folders[AssetType.Folder] = root; | ||
263 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | ||
264 | return folders; | ||
265 | } | ||
266 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID); | ||
267 | 285 | ||
268 | } | 286 | string invURL = GetInventoryServiceURL(userID); |
287 | |||
288 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
289 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | ||
290 | |||
291 | IInventoryService connector = GetConnector(invURL); | ||
269 | 292 | ||
270 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder not found for {0}", userID); | 293 | return connector.GetFolderContent(userID, folderID); |
271 | 294 | ||
272 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
273 | } | 295 | } |
274 | 296 | ||
275 | public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | 297 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) |
276 | { | 298 | { |
277 | string uri = string.Empty; | 299 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID); |
278 | if (!IsForeignUser(userID, out uri)) | 300 | |
279 | return m_GridService.GetFolderItems(userID, folderID); | 301 | string invURL = GetInventoryServiceURL(userID); |
280 | else | 302 | |
281 | { | 303 | if (invURL == null) // not there, forward to local inventory connector to resolve |
282 | UUID sessionID = GetSessionID(userID); | 304 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); |
283 | uri = uri + "/" + userID.ToString(); | 305 | |
284 | return m_HGService.GetFolderItems(uri, folderID, sessionID); | 306 | IInventoryService connector = GetConnector(invURL); |
285 | } | 307 | |
308 | return connector.GetFolderItems(userID, folderID); | ||
309 | |||
286 | } | 310 | } |
287 | 311 | ||
288 | public override bool AddFolder(InventoryFolderBase folder) | 312 | public bool AddFolder(InventoryFolderBase folder) |
289 | { | 313 | { |
290 | if (folder == null) | 314 | if (folder == null) |
291 | return false; | 315 | return false; |
292 | 316 | ||
293 | string uri = string.Empty; | 317 | m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID); |
294 | if (!IsForeignUser(folder.Owner, out uri)) | 318 | |
295 | return m_GridService.AddFolder(folder); | 319 | string invURL = GetInventoryServiceURL(folder.Owner); |
296 | else | 320 | |
297 | { | 321 | if (invURL == null) // not there, forward to local inventory connector to resolve |
298 | UUID sessionID = GetSessionID(folder.Owner); | 322 | return m_LocalGridInventoryService.AddFolder(folder); |
299 | uri = uri + "/" + folder.Owner.ToString(); | 323 | |
300 | return m_HGService.AddFolder(uri, folder, sessionID); | 324 | IInventoryService connector = GetConnector(invURL); |
301 | } | 325 | |
326 | return connector.AddFolder(folder); | ||
302 | } | 327 | } |
303 | 328 | ||
304 | public override bool UpdateFolder(InventoryFolderBase folder) | 329 | public bool UpdateFolder(InventoryFolderBase folder) |
305 | { | 330 | { |
306 | if (folder == null) | 331 | if (folder == null) |
307 | return false; | 332 | return false; |
308 | 333 | ||
309 | string uri = string.Empty; | 334 | m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID); |
310 | if (!IsForeignUser(folder.Owner, out uri)) | 335 | |
311 | return m_GridService.UpdateFolder(folder); | 336 | string invURL = GetInventoryServiceURL(folder.Owner); |
312 | else | 337 | |
313 | { | 338 | if (invURL == null) // not there, forward to local inventory connector to resolve |
314 | UUID sessionID = GetSessionID(folder.Owner); | 339 | return m_LocalGridInventoryService.UpdateFolder(folder); |
315 | uri = uri + "/" + folder.Owner.ToString(); | 340 | |
316 | return m_HGService.UpdateFolder(uri, folder, sessionID); | 341 | IInventoryService connector = GetConnector(invURL); |
317 | } | 342 | |
343 | return connector.UpdateFolder(folder); | ||
318 | } | 344 | } |
319 | 345 | ||
320 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | 346 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) |
321 | { | 347 | { |
322 | if (folderIDs == null) | 348 | if (folderIDs == null) |
323 | return false; | 349 | return false; |
324 | if (folderIDs.Count == 0) | 350 | if (folderIDs.Count == 0) |
325 | return false; | 351 | return false; |
326 | 352 | ||
327 | string uri = string.Empty; | 353 | m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID); |
328 | if (!IsForeignUser(ownerID, out uri)) | 354 | |
329 | return m_GridService.DeleteFolders(ownerID, folderIDs); | 355 | string invURL = GetInventoryServiceURL(ownerID); |
330 | else | 356 | |
331 | { | 357 | if (invURL == null) // not there, forward to local inventory connector to resolve |
332 | UUID sessionID = GetSessionID(ownerID); | 358 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); |
333 | uri = uri + "/" + ownerID.ToString(); | 359 | |
334 | return m_HGService.DeleteFolders(uri, folderIDs, sessionID); | 360 | IInventoryService connector = GetConnector(invURL); |
335 | } | 361 | |
362 | return connector.DeleteFolders(ownerID, folderIDs); | ||
336 | } | 363 | } |
337 | 364 | ||
338 | public override bool MoveFolder(InventoryFolderBase folder) | 365 | public bool MoveFolder(InventoryFolderBase folder) |
339 | { | 366 | { |
340 | if (folder == null) | 367 | if (folder == null) |
341 | return false; | 368 | return false; |
342 | 369 | ||
343 | string uri = string.Empty; | 370 | m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner); |
344 | if (!IsForeignUser(folder.Owner, out uri)) | 371 | |
345 | return m_GridService.MoveFolder(folder); | 372 | string invURL = GetInventoryServiceURL(folder.Owner); |
346 | else | 373 | |
347 | { | 374 | if (invURL == null) // not there, forward to local inventory connector to resolve |
348 | UUID sessionID = GetSessionID(folder.Owner); | 375 | return m_LocalGridInventoryService.MoveFolder(folder); |
349 | uri = uri + "/" + folder.Owner.ToString(); | 376 | |
350 | return m_HGService.MoveFolder(uri, folder, sessionID); | 377 | IInventoryService connector = GetConnector(invURL); |
351 | } | 378 | |
379 | return connector.MoveFolder(folder); | ||
352 | } | 380 | } |
353 | 381 | ||
354 | public override bool PurgeFolder(InventoryFolderBase folder) | 382 | public bool PurgeFolder(InventoryFolderBase folder) |
355 | { | 383 | { |
356 | if (folder == null) | 384 | if (folder == null) |
357 | return false; | 385 | return false; |
358 | 386 | ||
359 | string uri = string.Empty; | 387 | m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner); |
360 | if (!IsForeignUser(folder.Owner, out uri)) | ||
361 | return m_GridService.PurgeFolder(folder); | ||
362 | else | ||
363 | { | ||
364 | UUID sessionID = GetSessionID(folder.Owner); | ||
365 | uri = uri + "/" + folder.Owner.ToString(); | ||
366 | return m_HGService.PurgeFolder(uri, folder, sessionID); | ||
367 | } | ||
368 | } | ||
369 | 388 | ||
370 | // public bool AddItem(InventoryItemBase item) inherited | 389 | string invURL = GetInventoryServiceURL(folder.Owner); |
371 | // Uses AddItemPlain | ||
372 | 390 | ||
373 | protected override bool AddItemPlain(InventoryItemBase item) | 391 | if (invURL == null) // not there, forward to local inventory connector to resolve |
392 | return m_LocalGridInventoryService.PurgeFolder(folder); | ||
393 | |||
394 | IInventoryService connector = GetConnector(invURL); | ||
395 | |||
396 | return connector.PurgeFolder(folder); | ||
397 | } | ||
398 | |||
399 | public bool AddItem(InventoryItemBase item) | ||
374 | { | 400 | { |
375 | if (item == null) | 401 | if (item == null) |
376 | return false; | 402 | return false; |
377 | 403 | ||
378 | string uri = string.Empty; | 404 | m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID); |
379 | if (!IsForeignUser(item.Owner, out uri)) | 405 | |
380 | { | 406 | string invURL = GetInventoryServiceURL(item.Owner); |
381 | return m_GridService.AddItem(item); | 407 | |
382 | } | 408 | if (invURL == null) // not there, forward to local inventory connector to resolve |
383 | else | 409 | return m_LocalGridInventoryService.AddItem(item); |
384 | { | 410 | |
385 | UUID sessionID = GetSessionID(item.Owner); | 411 | IInventoryService connector = GetConnector(invURL); |
386 | uri = uri + "/" + item.Owner.ToString(); | 412 | |
387 | return m_HGService.AddItem(uri, item, sessionID); | 413 | return connector.AddItem(item); |
388 | } | ||
389 | } | 414 | } |
390 | 415 | ||
391 | public override bool UpdateItem(InventoryItemBase item) | 416 | public bool UpdateItem(InventoryItemBase item) |
392 | { | 417 | { |
393 | if (item == null) | 418 | if (item == null) |
394 | return false; | 419 | return false; |
395 | 420 | ||
396 | string uri = string.Empty; | 421 | m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID); |
397 | if (!IsForeignUser(item.Owner, out uri)) | 422 | |
398 | return m_GridService.UpdateItem(item); | 423 | string invURL = GetInventoryServiceURL(item.Owner); |
399 | else | 424 | |
400 | { | 425 | if (invURL == null) // not there, forward to local inventory connector to resolve |
401 | UUID sessionID = GetSessionID(item.Owner); | 426 | return m_LocalGridInventoryService.UpdateItem(item); |
402 | uri = uri + "/" + item.Owner.ToString(); | 427 | |
403 | return m_HGService.UpdateItem(uri, item, sessionID); | 428 | IInventoryService connector = GetConnector(invURL); |
404 | } | 429 | |
430 | return connector.UpdateItem(item); | ||
405 | } | 431 | } |
406 | 432 | ||
407 | public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | 433 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) |
408 | { | 434 | { |
409 | if (items == null) | 435 | if (items == null) |
410 | return false; | 436 | return false; |
411 | if (items.Count == 0) | 437 | if (items.Count == 0) |
412 | return true; | 438 | return true; |
413 | 439 | ||
414 | string uri = string.Empty; | 440 | m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID); |
415 | if (!IsForeignUser(ownerID, out uri)) | 441 | |
416 | return m_GridService.MoveItems(ownerID, items); | 442 | string invURL = GetInventoryServiceURL(ownerID); |
417 | else | 443 | |
418 | { | 444 | if (invURL == null) // not there, forward to local inventory connector to resolve |
419 | UUID sessionID = GetSessionID(ownerID); | 445 | return m_LocalGridInventoryService.MoveItems(ownerID, items); |
420 | uri = uri + "/" + ownerID.ToString(); | 446 | |
421 | return m_HGService.MoveItems(uri, items, sessionID); | 447 | IInventoryService connector = GetConnector(invURL); |
422 | } | 448 | |
449 | return connector.MoveItems(ownerID, items); | ||
423 | } | 450 | } |
424 | 451 | ||
425 | public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | 452 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) |
426 | { | 453 | { |
427 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); | 454 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); |
428 | 455 | ||
@@ -431,109 +458,98 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
431 | if (itemIDs.Count == 0) | 458 | if (itemIDs.Count == 0) |
432 | return true; | 459 | return true; |
433 | 460 | ||
434 | string uri = string.Empty; | 461 | m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID); |
435 | if (!IsForeignUser(ownerID, out uri)) | 462 | |
436 | return m_GridService.DeleteItems(ownerID, itemIDs); | 463 | string invURL = GetInventoryServiceURL(ownerID); |
437 | else | 464 | |
438 | { | 465 | if (invURL == null) // not there, forward to local inventory connector to resolve |
439 | UUID sessionID = GetSessionID(ownerID); | 466 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); |
440 | uri = uri + "/" + ownerID.ToString(); | 467 | |
441 | return m_HGService.DeleteItems(uri, itemIDs, sessionID); | 468 | IInventoryService connector = GetConnector(invURL); |
442 | } | 469 | |
470 | return connector.DeleteItems(ownerID, itemIDs); | ||
443 | } | 471 | } |
444 | 472 | ||
445 | public override InventoryItemBase GetItem(InventoryItemBase item) | 473 | public InventoryItemBase GetItem(InventoryItemBase item) |
446 | { | 474 | { |
447 | if (item == null) | 475 | if (item == null) |
448 | return null; | 476 | return null; |
449 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner); | 477 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); |
450 | string uri = string.Empty; | 478 | |
451 | if (!IsForeignUser(item.Owner, out uri)) | 479 | string invURL = GetInventoryServiceURL(item.Owner); |
452 | return m_GridService.GetItem(item); | 480 | |
453 | else | 481 | if (invURL == null) // not there, forward to local inventory connector to resolve |
454 | { | 482 | return m_LocalGridInventoryService.GetItem(item); |
455 | UUID sessionID = GetSessionID(item.Owner); | 483 | |
456 | uri = uri + "/" + item.Owner.ToString(); | 484 | IInventoryService connector = GetConnector(invURL); |
457 | return m_HGService.QueryItem(uri, item, sessionID); | 485 | |
458 | } | 486 | return connector.GetItem(item); |
459 | } | 487 | } |
460 | 488 | ||
461 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) | 489 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
462 | { | 490 | { |
463 | if (folder == null) | 491 | if (folder == null) |
464 | return null; | 492 | return null; |
465 | 493 | ||
466 | string uri = string.Empty; | 494 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); |
467 | if (!IsForeignUser(folder.Owner, out uri)) | 495 | |
468 | return m_GridService.GetFolder(folder); | 496 | string invURL = GetInventoryServiceURL(folder.Owner); |
469 | else | 497 | |
470 | { | 498 | if (invURL == null) // not there, forward to local inventory connector to resolve |
471 | UUID sessionID = GetSessionID(folder.Owner); | 499 | return m_LocalGridInventoryService.GetFolder(folder); |
472 | uri = uri + "/" + folder.Owner.ToString(); | 500 | |
473 | return m_HGService.QueryFolder(uri, folder, sessionID); | 501 | IInventoryService connector = GetConnector(invURL); |
474 | } | 502 | |
503 | return connector.GetFolder(folder); | ||
475 | } | 504 | } |
476 | 505 | ||
477 | public override bool HasInventoryForUser(UUID userID) | 506 | public bool HasInventoryForUser(UUID userID) |
478 | { | 507 | { |
479 | return false; | 508 | return false; |
480 | } | 509 | } |
481 | 510 | ||
482 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | 511 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
483 | { | 512 | { |
484 | return new List<InventoryItemBase>(); | 513 | return new List<InventoryItemBase>(); |
485 | } | 514 | } |
486 | 515 | ||
487 | public override int GetAssetPermissions(UUID userID, UUID assetID) | 516 | public int GetAssetPermissions(UUID userID, UUID assetID) |
488 | { | 517 | { |
489 | string uri = string.Empty; | 518 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID); |
490 | if (!IsForeignUser(userID, out uri)) | ||
491 | return m_GridService.GetAssetPermissions(userID, assetID); | ||
492 | else | ||
493 | { | ||
494 | UUID sessionID = GetSessionID(userID); | ||
495 | uri = uri + "/" + userID.ToString(); | ||
496 | return m_HGService.GetAssetPermissions(uri, assetID, sessionID); | ||
497 | } | ||
498 | } | ||
499 | 519 | ||
500 | #endregion | 520 | string invURL = GetInventoryServiceURL(userID); |
501 | 521 | ||
502 | private UUID GetSessionID(UUID userID) | 522 | if (invURL == null) // not there, forward to local inventory connector to resolve |
503 | { | 523 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); |
504 | ScenePresence sp = null; | 524 | |
505 | if (m_Scene.TryGetScenePresence(userID, out sp)) | 525 | IInventoryService connector = GetConnector(invURL); |
506 | { | ||
507 | return sp.ControllingClient.SessionId; | ||
508 | } | ||
509 | 526 | ||
510 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID); | 527 | return connector.GetAssetPermissions(userID, assetID); |
511 | return UUID.Zero; | ||
512 | } | 528 | } |
513 | 529 | ||
514 | private bool IsForeignUser(UUID userID, out string inventoryURL) | 530 | #endregion |
515 | { | ||
516 | inventoryURL = string.Empty; | ||
517 | UserAccount account = null; | ||
518 | if (m_Scene.UserAccountService != null) | ||
519 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
520 | 531 | ||
521 | if (account == null) // foreign user | 532 | private IInventoryService GetConnector(string url) |
533 | { | ||
534 | IInventoryService connector = null; | ||
535 | lock (m_connectors) | ||
522 | { | 536 | { |
523 | ScenePresence sp = null; | 537 | if (m_connectors.ContainsKey(url)) |
524 | m_Scene.TryGetScenePresence(userID, out sp); | ||
525 | if (sp != null) | ||
526 | { | 538 | { |
527 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | 539 | connector = m_connectors[url]; |
528 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | 540 | } |
529 | { | 541 | else |
530 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | 542 | { |
531 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | 543 | // We're instantiating this class explicitly, but this won't |
532 | return true; | 544 | // work in general, because the remote grid may be running |
533 | } | 545 | // an inventory server that has a different protocol. |
546 | // Eventually we will want a piece of protocol asking | ||
547 | // the remote server about its kind. Definitely cool thing to do! | ||
548 | connector = new RemoteXInventoryServicesConnector(url); | ||
549 | m_connectors.Add(url, connector); | ||
534 | } | 550 | } |
535 | } | 551 | } |
536 | return false; | 552 | return connector; |
537 | } | 553 | } |
538 | 554 | ||
539 | } | 555 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs deleted file mode 100644 index fc3393f..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs +++ /dev/null | |||
@@ -1,556 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
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 : ISharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private static bool m_Enabled = false; | ||
51 | |||
52 | private static IInventoryService m_LocalGridInventoryService; | ||
53 | private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); | ||
54 | |||
55 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
56 | protected Dictionary<UUID, string> m_InventoryURLs = new Dictionary<UUID,string>(); | ||
57 | |||
58 | private List<Scene> m_Scenes = new List<Scene>(); | ||
59 | |||
60 | public Type ReplaceableInterface | ||
61 | { | ||
62 | get { return null; } | ||
63 | } | ||
64 | |||
65 | public string Name | ||
66 | { | ||
67 | get { return "HGInventoryBroker2"; } | ||
68 | } | ||
69 | |||
70 | public void Initialise(IConfigSource source) | ||
71 | { | ||
72 | IConfig moduleConfig = source.Configs["Modules"]; | ||
73 | if (moduleConfig != null) | ||
74 | { | ||
75 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
76 | if (name == Name) | ||
77 | { | ||
78 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
79 | if (inventoryConfig == null) | ||
80 | { | ||
81 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
82 | return; | ||
83 | } | ||
84 | |||
85 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
86 | String.Empty); | ||
87 | //string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
88 | // String.Empty); | ||
89 | |||
90 | if (localDll == String.Empty) | ||
91 | { | ||
92 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
93 | //return; | ||
94 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
95 | } | ||
96 | |||
97 | Object[] args = new Object[] { source }; | ||
98 | m_LocalGridInventoryService = | ||
99 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
100 | args); | ||
101 | |||
102 | if (m_LocalGridInventoryService == null) | ||
103 | { | ||
104 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
105 | return; | ||
106 | } | ||
107 | |||
108 | m_Enabled = true; | ||
109 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: HG inventory broker enabled with inner connector of type {0}", m_LocalGridInventoryService.GetType()); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | |||
114 | public void PostInitialise() | ||
115 | { | ||
116 | } | ||
117 | |||
118 | public void Close() | ||
119 | { | ||
120 | } | ||
121 | |||
122 | public void AddRegion(Scene scene) | ||
123 | { | ||
124 | if (!m_Enabled) | ||
125 | return; | ||
126 | |||
127 | m_Scenes.Add(scene); | ||
128 | |||
129 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
130 | |||
131 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
132 | |||
133 | } | ||
134 | |||
135 | public void RemoveRegion(Scene scene) | ||
136 | { | ||
137 | if (!m_Enabled) | ||
138 | return; | ||
139 | |||
140 | m_Scenes.Remove(scene); | ||
141 | } | ||
142 | |||
143 | public void RegionLoaded(Scene scene) | ||
144 | { | ||
145 | if (!m_Enabled) | ||
146 | return; | ||
147 | |||
148 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); | ||
149 | |||
150 | } | ||
151 | |||
152 | #region URL Cache | ||
153 | |||
154 | void OnClientClosed(UUID clientID, Scene scene) | ||
155 | { | ||
156 | if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache | ||
157 | { | ||
158 | ScenePresence sp = null; | ||
159 | foreach (Scene s in m_Scenes) | ||
160 | { | ||
161 | s.TryGetScenePresence(clientID, out sp); | ||
162 | if ((sp != null) && !sp.IsChildAgent && (s != scene)) | ||
163 | { | ||
164 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache", | ||
165 | scene.RegionInfo.RegionName, clientID); | ||
166 | return; | ||
167 | } | ||
168 | } | ||
169 | DropInventoryServiceURL(clientID); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | /// <summary> | ||
174 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
175 | /// and sticks it in the cache | ||
176 | /// </summary> | ||
177 | /// <param name="userID"></param> | ||
178 | private void CacheInventoryServiceURL(UUID userID) | ||
179 | { | ||
180 | if (m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, userID) == null) | ||
181 | { | ||
182 | // The user does not have a local account; let's cache its service URL | ||
183 | string inventoryURL = string.Empty; | ||
184 | ScenePresence sp = null; | ||
185 | foreach (Scene scene in m_Scenes) | ||
186 | { | ||
187 | scene.TryGetScenePresence(userID, out sp); | ||
188 | if (sp != null) | ||
189 | { | ||
190 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
191 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
192 | { | ||
193 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
194 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
195 | { | ||
196 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
197 | m_InventoryURLs.Add(userID, inventoryURL); | ||
198 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Added {0} to the cache of inventory URLs", inventoryURL); | ||
199 | return; | ||
200 | } | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | |||
206 | // else put a null; it means that the methods should forward to local grid's inventory | ||
207 | m_InventoryURLs.Add(userID, null); | ||
208 | } | ||
209 | |||
210 | private void DropInventoryServiceURL(UUID userID) | ||
211 | { | ||
212 | lock (m_InventoryURLs) | ||
213 | if (m_InventoryURLs.ContainsKey(userID)) | ||
214 | { | ||
215 | string url = m_InventoryURLs[userID]; | ||
216 | m_InventoryURLs.Remove(userID); | ||
217 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Removed {0} from the cache of inventory URLs", url); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public string GetInventoryServiceURL(UUID userID) | ||
222 | { | ||
223 | if (m_InventoryURLs.ContainsKey(userID)) | ||
224 | return m_InventoryURLs[userID]; | ||
225 | |||
226 | else | ||
227 | CacheInventoryServiceURL(userID); | ||
228 | |||
229 | return m_InventoryURLs[userID]; | ||
230 | } | ||
231 | #endregion | ||
232 | |||
233 | #region IInventoryService | ||
234 | |||
235 | public bool CreateUserInventory(UUID userID) | ||
236 | { | ||
237 | return m_LocalGridInventoryService.CreateUserInventory(userID); | ||
238 | } | ||
239 | |||
240 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
241 | { | ||
242 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); | ||
243 | } | ||
244 | |||
245 | public InventoryCollection GetUserInventory(UUID userID) | ||
246 | { | ||
247 | return null; | ||
248 | } | ||
249 | |||
250 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
251 | { | ||
252 | } | ||
253 | |||
254 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
255 | { | ||
256 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); | ||
257 | |||
258 | string invURL = GetInventoryServiceURL(userID); | ||
259 | |||
260 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
261 | return m_LocalGridInventoryService.GetRootFolder(userID); | ||
262 | |||
263 | IInventoryService connector = GetConnector(invURL); | ||
264 | |||
265 | return connector.GetRootFolder(userID); | ||
266 | } | ||
267 | |||
268 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
269 | { | ||
270 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); | ||
271 | |||
272 | string invURL = GetInventoryServiceURL(userID); | ||
273 | |||
274 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
275 | return m_LocalGridInventoryService.GetFolderForType(userID, type); | ||
276 | |||
277 | IInventoryService connector = GetConnector(invURL); | ||
278 | |||
279 | return connector.GetFolderForType(userID, type); | ||
280 | } | ||
281 | |||
282 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
283 | { | ||
284 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID); | ||
285 | |||
286 | string invURL = GetInventoryServiceURL(userID); | ||
287 | |||
288 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
289 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | ||
290 | |||
291 | IInventoryService connector = GetConnector(invURL); | ||
292 | |||
293 | return connector.GetFolderContent(userID, folderID); | ||
294 | |||
295 | } | ||
296 | |||
297 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
298 | { | ||
299 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID); | ||
300 | |||
301 | string invURL = GetInventoryServiceURL(userID); | ||
302 | |||
303 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
304 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | ||
305 | |||
306 | IInventoryService connector = GetConnector(invURL); | ||
307 | |||
308 | return connector.GetFolderItems(userID, folderID); | ||
309 | |||
310 | } | ||
311 | |||
312 | public bool AddFolder(InventoryFolderBase folder) | ||
313 | { | ||
314 | if (folder == null) | ||
315 | return false; | ||
316 | |||
317 | m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID); | ||
318 | |||
319 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
320 | |||
321 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
322 | return m_LocalGridInventoryService.AddFolder(folder); | ||
323 | |||
324 | IInventoryService connector = GetConnector(invURL); | ||
325 | |||
326 | return connector.AddFolder(folder); | ||
327 | } | ||
328 | |||
329 | public bool UpdateFolder(InventoryFolderBase folder) | ||
330 | { | ||
331 | if (folder == null) | ||
332 | return false; | ||
333 | |||
334 | m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID); | ||
335 | |||
336 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
337 | |||
338 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
339 | return m_LocalGridInventoryService.UpdateFolder(folder); | ||
340 | |||
341 | IInventoryService connector = GetConnector(invURL); | ||
342 | |||
343 | return connector.UpdateFolder(folder); | ||
344 | } | ||
345 | |||
346 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
347 | { | ||
348 | if (folderIDs == null) | ||
349 | return false; | ||
350 | if (folderIDs.Count == 0) | ||
351 | return false; | ||
352 | |||
353 | m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID); | ||
354 | |||
355 | string invURL = GetInventoryServiceURL(ownerID); | ||
356 | |||
357 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
358 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); | ||
359 | |||
360 | IInventoryService connector = GetConnector(invURL); | ||
361 | |||
362 | return connector.DeleteFolders(ownerID, folderIDs); | ||
363 | } | ||
364 | |||
365 | public bool MoveFolder(InventoryFolderBase folder) | ||
366 | { | ||
367 | if (folder == null) | ||
368 | return false; | ||
369 | |||
370 | m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner); | ||
371 | |||
372 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
373 | |||
374 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
375 | return m_LocalGridInventoryService.MoveFolder(folder); | ||
376 | |||
377 | IInventoryService connector = GetConnector(invURL); | ||
378 | |||
379 | return connector.MoveFolder(folder); | ||
380 | } | ||
381 | |||
382 | public bool PurgeFolder(InventoryFolderBase folder) | ||
383 | { | ||
384 | if (folder == null) | ||
385 | return false; | ||
386 | |||
387 | m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner); | ||
388 | |||
389 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
390 | |||
391 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
392 | return m_LocalGridInventoryService.PurgeFolder(folder); | ||
393 | |||
394 | IInventoryService connector = GetConnector(invURL); | ||
395 | |||
396 | return connector.PurgeFolder(folder); | ||
397 | } | ||
398 | |||
399 | public bool AddItem(InventoryItemBase item) | ||
400 | { | ||
401 | if (item == null) | ||
402 | return false; | ||
403 | |||
404 | m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID); | ||
405 | |||
406 | string invURL = GetInventoryServiceURL(item.Owner); | ||
407 | |||
408 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
409 | return m_LocalGridInventoryService.AddItem(item); | ||
410 | |||
411 | IInventoryService connector = GetConnector(invURL); | ||
412 | |||
413 | return connector.AddItem(item); | ||
414 | } | ||
415 | |||
416 | public bool UpdateItem(InventoryItemBase item) | ||
417 | { | ||
418 | if (item == null) | ||
419 | return false; | ||
420 | |||
421 | m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID); | ||
422 | |||
423 | string invURL = GetInventoryServiceURL(item.Owner); | ||
424 | |||
425 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
426 | return m_LocalGridInventoryService.UpdateItem(item); | ||
427 | |||
428 | IInventoryService connector = GetConnector(invURL); | ||
429 | |||
430 | return connector.UpdateItem(item); | ||
431 | } | ||
432 | |||
433 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
434 | { | ||
435 | if (items == null) | ||
436 | return false; | ||
437 | if (items.Count == 0) | ||
438 | return true; | ||
439 | |||
440 | m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID); | ||
441 | |||
442 | string invURL = GetInventoryServiceURL(ownerID); | ||
443 | |||
444 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
445 | return m_LocalGridInventoryService.MoveItems(ownerID, items); | ||
446 | |||
447 | IInventoryService connector = GetConnector(invURL); | ||
448 | |||
449 | return connector.MoveItems(ownerID, items); | ||
450 | } | ||
451 | |||
452 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
453 | { | ||
454 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); | ||
455 | |||
456 | if (itemIDs == null) | ||
457 | return false; | ||
458 | if (itemIDs.Count == 0) | ||
459 | return true; | ||
460 | |||
461 | m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID); | ||
462 | |||
463 | string invURL = GetInventoryServiceURL(ownerID); | ||
464 | |||
465 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
466 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); | ||
467 | |||
468 | IInventoryService connector = GetConnector(invURL); | ||
469 | |||
470 | return connector.DeleteItems(ownerID, itemIDs); | ||
471 | } | ||
472 | |||
473 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
474 | { | ||
475 | if (item == null) | ||
476 | return null; | ||
477 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); | ||
478 | |||
479 | string invURL = GetInventoryServiceURL(item.Owner); | ||
480 | |||
481 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
482 | return m_LocalGridInventoryService.GetItem(item); | ||
483 | |||
484 | IInventoryService connector = GetConnector(invURL); | ||
485 | |||
486 | return connector.GetItem(item); | ||
487 | } | ||
488 | |||
489 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
490 | { | ||
491 | if (folder == null) | ||
492 | return null; | ||
493 | |||
494 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); | ||
495 | |||
496 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
497 | |||
498 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
499 | return m_LocalGridInventoryService.GetFolder(folder); | ||
500 | |||
501 | IInventoryService connector = GetConnector(invURL); | ||
502 | |||
503 | return connector.GetFolder(folder); | ||
504 | } | ||
505 | |||
506 | public bool HasInventoryForUser(UUID userID) | ||
507 | { | ||
508 | return false; | ||
509 | } | ||
510 | |||
511 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
512 | { | ||
513 | return new List<InventoryItemBase>(); | ||
514 | } | ||
515 | |||
516 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
517 | { | ||
518 | m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID); | ||
519 | |||
520 | string invURL = GetInventoryServiceURL(userID); | ||
521 | |||
522 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
523 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); | ||
524 | |||
525 | IInventoryService connector = GetConnector(invURL); | ||
526 | |||
527 | return connector.GetAssetPermissions(userID, assetID); | ||
528 | } | ||
529 | |||
530 | #endregion | ||
531 | |||
532 | private IInventoryService GetConnector(string url) | ||
533 | { | ||
534 | IInventoryService connector = null; | ||
535 | lock (m_connectors) | ||
536 | { | ||
537 | if (m_connectors.ContainsKey(url)) | ||
538 | { | ||
539 | connector = m_connectors[url]; | ||
540 | } | ||
541 | else | ||
542 | { | ||
543 | // We're instantiating this class explicitly, but this won't | ||
544 | // work in general, because the remote grid may be running | ||
545 | // an inventory server that has a different protocol. | ||
546 | // Eventually we will want a piece of protocol asking | ||
547 | // the remote server about its kind. Definitely cool thing to do! | ||
548 | connector = new RemoteXInventoryServicesConnector(url); | ||
549 | m_connectors.Add(url, connector); | ||
550 | } | ||
551 | } | ||
552 | return connector; | ||
553 | } | ||
554 | |||
555 | } | ||
556 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index a2f26d5..22bd04c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -41,7 +41,7 @@ using OpenMetaverse; | |||
41 | 41 | ||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | 42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory |
43 | { | 43 | { |
44 | public class LocalInventoryServicesConnector : BaseInventoryConnector, ISharedRegionModule, IInventoryService | 44 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService |
45 | { | 45 | { |
46 | private static readonly ILog m_log = | 46 | private static readonly ILog m_log = |
47 | LogManager.GetLogger( | 47 | LogManager.GetLogger( |
@@ -50,7 +50,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
50 | private IInventoryService m_InventoryService; | 50 | private IInventoryService m_InventoryService; |
51 | 51 | ||
52 | private bool m_Enabled = false; | 52 | private bool m_Enabled = false; |
53 | private bool m_Initialized = false; | ||
54 | 53 | ||
55 | public Type ReplaceableInterface | 54 | public Type ReplaceableInterface |
56 | { | 55 | { |
@@ -93,23 +92,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
93 | if (m_InventoryService == null) | 92 | if (m_InventoryService == null) |
94 | { | 93 | { |
95 | m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: Can't load inventory service"); | 94 | m_log.Error("[LOCAL INVENTORY SERVICES CONNECTOR]: Can't load inventory service"); |
96 | //return; | ||
97 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | 95 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); |
98 | } | 96 | } |
99 | 97 | ||
100 | //List<IInventoryDataPlugin> plugins | ||
101 | // = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>( | ||
102 | // configSettings.StandaloneInventoryPlugin, | ||
103 | // configSettings.StandaloneInventorySource); | ||
104 | |||
105 | //foreach (IInventoryDataPlugin plugin in plugins) | ||
106 | //{ | ||
107 | // // Using the OSP wrapper plugin for database plugins should be made configurable at some point | ||
108 | // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this)); | ||
109 | //} | ||
110 | |||
111 | Init(source); | ||
112 | |||
113 | m_Enabled = true; | 98 | m_Enabled = true; |
114 | m_log.Info("[LOCAL INVENTORY SERVICES CONNECTOR]: Local inventory connector enabled"); | 99 | m_log.Info("[LOCAL INVENTORY SERVICES CONNECTOR]: Local inventory connector enabled"); |
115 | } | 100 | } |
@@ -128,99 +113,60 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
128 | { | 113 | { |
129 | if (!m_Enabled) | 114 | if (!m_Enabled) |
130 | return; | 115 | return; |
131 | |||
132 | if (!m_Initialized) | ||
133 | { | ||
134 | m_Initialized = true; | ||
135 | } | ||
136 | |||
137 | // m_log.DebugFormat( | ||
138 | // "[LOCAL INVENTORY SERVICES CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); | ||
139 | 116 | ||
140 | scene.RegisterModuleInterface<IInventoryService>(this); | 117 | scene.RegisterModuleInterface<IInventoryService>(this); |
141 | m_cache.AddRegion(scene); | ||
142 | } | 118 | } |
143 | 119 | ||
144 | public void RemoveRegion(Scene scene) | 120 | public void RemoveRegion(Scene scene) |
145 | { | 121 | { |
146 | if (!m_Enabled) | 122 | if (!m_Enabled) |
147 | return; | 123 | return; |
148 | |||
149 | m_cache.RemoveRegion(scene); | ||
150 | } | 124 | } |
151 | 125 | ||
152 | public void RegionLoaded(Scene scene) | 126 | public void RegionLoaded(Scene scene) |
153 | { | 127 | { |
154 | if (!m_Enabled) | 128 | if (!m_Enabled) |
155 | return; | 129 | return; |
156 | |||
157 | m_log.InfoFormat( | ||
158 | "[LOCAL INVENTORY SERVICES CONNECTOR]: Enabled local inventory for region {0}", scene.RegionInfo.RegionName); | ||
159 | } | 130 | } |
160 | 131 | ||
161 | #region IInventoryService | 132 | #region IInventoryService |
162 | 133 | ||
163 | public override bool CreateUserInventory(UUID user) | 134 | public bool CreateUserInventory(UUID user) |
164 | { | 135 | { |
165 | return m_InventoryService.CreateUserInventory(user); | 136 | return m_InventoryService.CreateUserInventory(user); |
166 | } | 137 | } |
167 | 138 | ||
168 | public override List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | 139 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) |
169 | { | 140 | { |
170 | return m_InventoryService.GetInventorySkeleton(userId); | 141 | return m_InventoryService.GetInventorySkeleton(userId); |
171 | } | 142 | } |
172 | 143 | ||
173 | public override InventoryCollection GetUserInventory(UUID id) | 144 | public InventoryCollection GetUserInventory(UUID id) |
174 | { | 145 | { |
175 | return m_InventoryService.GetUserInventory(id); | 146 | return m_InventoryService.GetUserInventory(id); |
176 | } | 147 | } |
177 | 148 | ||
178 | public override void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | 149 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) |
179 | { | 150 | { |
180 | m_InventoryService.GetUserInventory(userID, callback); | 151 | m_InventoryService.GetUserInventory(userID, callback); |
181 | } | 152 | } |
182 | 153 | ||
183 | // Inherited. See base | 154 | public InventoryFolderBase GetRootFolder(UUID userID) |
184 | //public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
185 | //{ | ||
186 | // return m_InventoryService.GetFolderForType(userID, type); | ||
187 | //} | ||
188 | |||
189 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
190 | { | 155 | { |
191 | InventoryFolderBase root = m_InventoryService.GetRootFolder(userID); | 156 | return m_InventoryService.GetRootFolder(userID); |
192 | if (root != null) | 157 | } |
193 | { | ||
194 | InventoryCollection content = GetFolderContent(userID, root.ID); | ||
195 | if (content != null) | ||
196 | { | ||
197 | Dictionary<AssetType, InventoryFolderBase> folders = new Dictionary<AssetType, InventoryFolderBase>(); | ||
198 | foreach (InventoryFolderBase folder in content.Folders) | ||
199 | { | ||
200 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | ||
201 | { | ||
202 | //m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type); | ||
203 | folders[(AssetType)folder.Type] = folder; | ||
204 | } | ||
205 | } | ||
206 | // Put the root folder there, as type Folder | ||
207 | folders[AssetType.Folder] = root; | ||
208 | //m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type); | ||
209 | 158 | ||
210 | return folders; | 159 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) |
211 | } | 160 | { |
212 | } | 161 | return m_InventoryService.GetFolderForType(userID, type); |
213 | m_log.WarnFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: System folders for {0} not found", userID); | ||
214 | return new Dictionary<AssetType, InventoryFolderBase>(); | ||
215 | } | 162 | } |
216 | 163 | ||
217 | public override InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 164 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |
218 | { | 165 | { |
219 | return m_InventoryService.GetFolderContent(userID, folderID); | 166 | return m_InventoryService.GetFolderContent(userID, folderID); |
220 | } | 167 | } |
221 | 168 | ||
222 | 169 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | |
223 | public override List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
224 | { | 170 | { |
225 | return m_InventoryService.GetFolderItems(userID, folderID); | 171 | return m_InventoryService.GetFolderItems(userID, folderID); |
226 | } | 172 | } |
@@ -230,7 +176,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
230 | /// </summary> | 176 | /// </summary> |
231 | /// <param name="folder"></param> | 177 | /// <param name="folder"></param> |
232 | /// <returns>true if the folder was successfully added</returns> | 178 | /// <returns>true if the folder was successfully added</returns> |
233 | public override bool AddFolder(InventoryFolderBase folder) | 179 | public bool AddFolder(InventoryFolderBase folder) |
234 | { | 180 | { |
235 | return m_InventoryService.AddFolder(folder); | 181 | return m_InventoryService.AddFolder(folder); |
236 | } | 182 | } |
@@ -240,7 +186,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
240 | /// </summary> | 186 | /// </summary> |
241 | /// <param name="folder"></param> | 187 | /// <param name="folder"></param> |
242 | /// <returns>true if the folder was successfully updated</returns> | 188 | /// <returns>true if the folder was successfully updated</returns> |
243 | public override bool UpdateFolder(InventoryFolderBase folder) | 189 | public bool UpdateFolder(InventoryFolderBase folder) |
244 | { | 190 | { |
245 | return m_InventoryService.UpdateFolder(folder); | 191 | return m_InventoryService.UpdateFolder(folder); |
246 | } | 192 | } |
@@ -250,12 +196,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
250 | /// </summary> | 196 | /// </summary> |
251 | /// <param name="folder">A folder containing the details of the new location</param> | 197 | /// <param name="folder">A folder containing the details of the new location</param> |
252 | /// <returns>true if the folder was successfully moved</returns> | 198 | /// <returns>true if the folder was successfully moved</returns> |
253 | public override bool MoveFolder(InventoryFolderBase folder) | 199 | public bool MoveFolder(InventoryFolderBase folder) |
254 | { | 200 | { |
255 | return m_InventoryService.MoveFolder(folder); | 201 | return m_InventoryService.MoveFolder(folder); |
256 | } | 202 | } |
257 | 203 | ||
258 | public override bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | 204 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) |
259 | { | 205 | { |
260 | return m_InventoryService.DeleteFolders(ownerID, folderIDs); | 206 | return m_InventoryService.DeleteFolders(ownerID, folderIDs); |
261 | } | 207 | } |
@@ -265,18 +211,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
265 | /// </summary> | 211 | /// </summary> |
266 | /// <param name="folder"></param> | 212 | /// <param name="folder"></param> |
267 | /// <returns>true if the folder was successfully purged</returns> | 213 | /// <returns>true if the folder was successfully purged</returns> |
268 | public override bool PurgeFolder(InventoryFolderBase folder) | 214 | public bool PurgeFolder(InventoryFolderBase folder) |
269 | { | 215 | { |
270 | return m_InventoryService.PurgeFolder(folder); | 216 | return m_InventoryService.PurgeFolder(folder); |
271 | } | 217 | } |
272 | 218 | ||
273 | /// <summary> | 219 | /// <summary> |
274 | /// Add a new item to the user's inventory, plain | 220 | /// Add a new item to the user's inventory |
275 | /// Called by base class AddItem | ||
276 | /// </summary> | 221 | /// </summary> |
277 | /// <param name="item"></param> | 222 | /// <param name="item"></param> |
278 | /// <returns>true if the item was successfully added</returns> | 223 | /// <returns>true if the item was successfully added</returns> |
279 | protected override bool AddItemPlain(InventoryItemBase item) | 224 | public bool AddItem(InventoryItemBase item) |
280 | { | 225 | { |
281 | return m_InventoryService.AddItem(item); | 226 | return m_InventoryService.AddItem(item); |
282 | } | 227 | } |
@@ -286,13 +231,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
286 | /// </summary> | 231 | /// </summary> |
287 | /// <param name="item"></param> | 232 | /// <param name="item"></param> |
288 | /// <returns>true if the item was successfully updated</returns> | 233 | /// <returns>true if the item was successfully updated</returns> |
289 | public override bool UpdateItem(InventoryItemBase item) | 234 | public bool UpdateItem(InventoryItemBase item) |
290 | { | 235 | { |
291 | return m_InventoryService.UpdateItem(item); | 236 | return m_InventoryService.UpdateItem(item); |
292 | } | 237 | } |
293 | 238 | ||
294 | 239 | ||
295 | public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | 240 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) |
296 | { | 241 | { |
297 | return m_InventoryService.MoveItems(ownerID, items); | 242 | return m_InventoryService.MoveItems(ownerID, items); |
298 | } | 243 | } |
@@ -302,12 +247,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
302 | /// </summary> | 247 | /// </summary> |
303 | /// <param name="item"></param> | 248 | /// <param name="item"></param> |
304 | /// <returns>true if the item was successfully deleted</returns> | 249 | /// <returns>true if the item was successfully deleted</returns> |
305 | public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | 250 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) |
306 | { | 251 | { |
307 | return m_InventoryService.DeleteItems(ownerID, itemIDs); | 252 | return m_InventoryService.DeleteItems(ownerID, itemIDs); |
308 | } | 253 | } |
309 | 254 | ||
310 | public override InventoryItemBase GetItem(InventoryItemBase item) | 255 | public InventoryItemBase GetItem(InventoryItemBase item) |
311 | { | 256 | { |
312 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); | 257 | // m_log.DebugFormat("[LOCAL INVENTORY SERVICES CONNECTOR]: Requesting inventory item {0}", item.ID); |
313 | 258 | ||
@@ -322,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
322 | return item; | 267 | return item; |
323 | } | 268 | } |
324 | 269 | ||
325 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) | 270 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) |
326 | { | 271 | { |
327 | return m_InventoryService.GetFolder(folder); | 272 | return m_InventoryService.GetFolder(folder); |
328 | } | 273 | } |
@@ -332,17 +277,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
332 | /// </summary> | 277 | /// </summary> |
333 | /// <param name="userID"></param> | 278 | /// <param name="userID"></param> |
334 | /// <returns></returns> | 279 | /// <returns></returns> |
335 | public override bool HasInventoryForUser(UUID userID) | 280 | public bool HasInventoryForUser(UUID userID) |
336 | { | 281 | { |
337 | return m_InventoryService.HasInventoryForUser(userID); | 282 | return m_InventoryService.HasInventoryForUser(userID); |
338 | } | 283 | } |
339 | 284 | ||
340 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | 285 | public List<InventoryItemBase> GetActiveGestures(UUID userId) |
341 | { | 286 | { |
342 | return m_InventoryService.GetActiveGestures(userId); | 287 | return m_InventoryService.GetActiveGestures(userId); |
343 | } | 288 | } |
344 | 289 | ||
345 | public override int GetAssetPermissions(UUID userID, UUID assetID) | 290 | public int GetAssetPermissions(UUID userID, UUID assetID) |
346 | { | 291 | { |
347 | return m_InventoryService.GetAssetPermissions(userID, assetID); | 292 | return m_InventoryService.GetAssetPermissions(userID, assetID); |
348 | } | 293 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 56b50dc..a1a4f9e 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -135,7 +135,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
135 | data.Y = 0; | 135 | data.Y = 0; |
136 | blocks.Add(data); | 136 | blocks.Add(data); |
137 | 137 | ||
138 | remoteClient.SendMapBlock(blocks, 0); | 138 | remoteClient.SendMapBlock(blocks, 2); |
139 | } | 139 | } |
140 | 140 | ||
141 | private Scene GetClientScene(IClientAPI client) | 141 | private Scene GetClientScene(IClientAPI client) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8ceb109..3e78a08 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -4556,6 +4556,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4556 | foreach (SceneObjectPart child in partList) | 4556 | foreach (SceneObjectPart child in partList) |
4557 | { | 4557 | { |
4558 | child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); | 4558 | child.Inventory.ChangeInventoryOwner(remoteClient.AgentId); |
4559 | child.TriggerScriptChangedEvent(Changed.OWNER); | ||
4559 | child.ApplyNextOwnerPermissions(); | 4560 | child.ApplyNextOwnerPermissions(); |
4560 | } | 4561 | } |
4561 | } | 4562 | } |
@@ -4565,6 +4566,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4565 | 4566 | ||
4566 | group.HasGroupChanged = true; | 4567 | group.HasGroupChanged = true; |
4567 | part.GetProperties(remoteClient); | 4568 | part.GetProperties(remoteClient); |
4569 | part.TriggerScriptChangedEvent(Changed.OWNER); | ||
4570 | group.ResumeScripts(); | ||
4568 | part.ScheduleFullUpdate(); | 4571 | part.ScheduleFullUpdate(); |
4569 | 4572 | ||
4570 | break; | 4573 | break; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index bc3225a..64282d1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -1082,12 +1082,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1082 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 1082 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; |
1083 | item.CurrentPermissions |= 8; | 1083 | item.CurrentPermissions |= 8; |
1084 | } | 1084 | } |
1085 | item.OwnerChanged = true; | ||
1085 | item.CurrentPermissions &= item.NextPermissions; | 1086 | item.CurrentPermissions &= item.NextPermissions; |
1086 | item.BasePermissions &= item.NextPermissions; | 1087 | item.BasePermissions &= item.NextPermissions; |
1087 | item.EveryonePermissions &= item.NextPermissions; | 1088 | item.EveryonePermissions &= item.NextPermissions; |
1088 | } | 1089 | } |
1089 | |||
1090 | m_part.TriggerScriptChangedEvent(Changed.OWNER); | ||
1091 | } | 1090 | } |
1092 | 1091 | ||
1093 | public void ApplyGodPermissions(uint perms) | 1092 | public void ApplyGodPermissions(uint perms) |
@@ -1180,7 +1179,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1180 | foreach (IScriptModule engine in engines) | 1179 | foreach (IScriptModule engine in engines) |
1181 | { | 1180 | { |
1182 | if (engine != null) | 1181 | if (engine != null) |
1182 | { | ||
1183 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { Changed.OWNER }); | ||
1183 | engine.ResumeScript(item.ItemID); | 1184 | engine.ResumeScript(item.ItemID); |
1185 | } | ||
1184 | } | 1186 | } |
1185 | } | 1187 | } |
1186 | } | 1188 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index b3e4740..96f6486 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -549,5 +549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
549 | public const int STATS_ACTIVE_SCRIPTS = 19; | 549 | public const int STATS_ACTIVE_SCRIPTS = 19; |
550 | public const int STATS_SCRIPT_LPS = 20; | 550 | public const int STATS_SCRIPT_LPS = 20; |
551 | 551 | ||
552 | public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; | ||
553 | public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; | ||
552 | } | 554 | } |
553 | } | 555 | } |