diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Hypergrid')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs | 98 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs | 26 |
2 files changed, 72 insertions, 52 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index b6fa41d..244ac3b 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Framework.Communications.Clients; | 36 | using OpenSim.Framework.Communications.Clients; |
37 | using OpenSim.Region.Framework.Scenes.Serialization; | 37 | using OpenSim.Region.Framework.Scenes.Serialization; |
38 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
39 | 40 | ||
40 | //using HyperGrid.Framework; | 41 | //using HyperGrid.Framework; |
@@ -52,13 +53,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
52 | 53 | ||
53 | private Scene m_scene; | 54 | private Scene m_scene; |
54 | 55 | ||
55 | private IHyperlinkService m_hyper; | 56 | private IHyperAssetService m_hyper; |
56 | IHyperlinkService HyperlinkService | 57 | IHyperAssetService HyperlinkAssets |
57 | { | 58 | { |
58 | get | 59 | get |
59 | { | 60 | { |
60 | if (m_hyper == null) | 61 | if (m_hyper == null) |
61 | m_hyper = m_scene.RequestModuleInterface<IHyperlinkService>(); | 62 | m_hyper = m_scene.RequestModuleInterface<IHyperAssetService>(); |
62 | return m_hyper; | 63 | return m_hyper; |
63 | } | 64 | } |
64 | } | 65 | } |
@@ -99,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
99 | 100 | ||
100 | if (asset != null) | 101 | if (asset != null) |
101 | { | 102 | { |
102 | m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); | 103 | m_log.DebugFormat("[HGScene]: Copied asset {0} from {1} to local asset server. ", asset.ID, url); |
103 | return asset; | 104 | return asset; |
104 | } | 105 | } |
105 | return null; | 106 | return null; |
@@ -129,6 +130,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
129 | } | 130 | } |
130 | 131 | ||
131 | m_scene.AssetService.Store(asset1); | 132 | m_scene.AssetService.Store(asset1); |
133 | m_log.DebugFormat("[HGScene]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url); | ||
132 | } | 134 | } |
133 | return true; | 135 | return true; |
134 | } | 136 | } |
@@ -167,34 +169,32 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
167 | 169 | ||
168 | public void Get(UUID assetID, UUID ownerID) | 170 | public void Get(UUID assetID, UUID ownerID) |
169 | { | 171 | { |
170 | if (!HyperlinkService.IsLocalUser(ownerID)) | 172 | // Get the item from the remote asset server onto the local AssetCache |
173 | // and place an entry in m_assetMap | ||
174 | |||
175 | string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID); | ||
176 | if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer())) | ||
171 | { | 177 | { |
172 | // Get the item from the remote asset server onto the local AssetCache | 178 | m_log.Debug("[HGScene]: Fetching object " + assetID + " from asset server " + userAssetURL); |
173 | // and place an entry in m_assetMap | 179 | AssetBase asset = FetchAsset(userAssetURL, assetID); |
174 | 180 | ||
175 | string userAssetURL = UserAssetURL(ownerID); | 181 | if (asset != null) |
176 | if (userAssetURL != null) | ||
177 | { | 182 | { |
178 | m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL); | 183 | // OK, now fetch the inside. |
179 | AssetBase asset = FetchAsset(userAssetURL, assetID); | 184 | Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); |
185 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); | ||
186 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | ||
187 | foreach (UUID uuid in ids.Keys) | ||
188 | FetchAsset(userAssetURL, uuid); | ||
189 | |||
190 | m_log.DebugFormat("[HGScene]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL); | ||
180 | 191 | ||
181 | if (asset != null) | ||
182 | { | ||
183 | m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL); | ||
184 | |||
185 | // OK, now fetch the inside. | ||
186 | Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); | ||
187 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); | ||
188 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | ||
189 | foreach (UUID uuid in ids.Keys) | ||
190 | FetchAsset(userAssetURL, uuid); | ||
191 | } | ||
192 | else | ||
193 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); | ||
194 | } | 192 | } |
195 | else | 193 | else |
196 | m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); | 194 | m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL); |
197 | } | 195 | } |
196 | else | ||
197 | m_log.Debug("[HGScene]: user's asset server is the local region's asset server"); | ||
198 | } | 198 | } |
199 | 199 | ||
200 | //public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) | 200 | //public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) |
@@ -225,44 +225,38 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
225 | 225 | ||
226 | public void Post(UUID assetID, UUID ownerID) | 226 | public void Post(UUID assetID, UUID ownerID) |
227 | { | 227 | { |
228 | if (!HyperlinkService.IsLocalUser(ownerID)) | ||
229 | { | ||
230 | // Post the item from the local AssetCache onto the remote asset server | 228 | // Post the item from the local AssetCache onto the remote asset server |
231 | // and place an entry in m_assetMap | 229 | // and place an entry in m_assetMap |
232 | 230 | ||
233 | string userAssetURL = UserAssetURL(ownerID); | 231 | string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID); |
234 | if (userAssetURL != null) | 232 | if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer())) |
233 | { | ||
234 | m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL); | ||
235 | AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); | ||
236 | if (asset != null) | ||
235 | { | 237 | { |
236 | m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL); | 238 | Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); |
237 | AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); | 239 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); |
238 | if (asset != null) | 240 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); |
241 | foreach (UUID uuid in ids.Keys) | ||
239 | { | 242 | { |
240 | Dictionary<UUID, int> ids = new Dictionary<UUID, int>(); | 243 | asset = m_scene.AssetService.Get(uuid.ToString()); |
241 | HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty); | 244 | if (asset == null) |
242 | uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); | 245 | m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid); |
243 | foreach (UUID uuid in ids.Keys) | 246 | else |
244 | { | ||
245 | asset = m_scene.AssetService.Get(uuid.ToString()); | ||
246 | if (asset != null) | ||
247 | m_log.DebugFormat("[HGScene]: Posting {0} {1}", asset.Type.ToString(), asset.Name); | ||
248 | else | ||
249 | m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid); | ||
250 | PostAsset(userAssetURL, asset); | 247 | PostAsset(userAssetURL, asset); |
251 | } | 248 | } |
252 | 249 | ||
253 | if (ids.Count > 0) // maybe it succeeded... | 250 | // maybe all pieces got there... |
254 | m_log.DebugFormat("[HGScene]: Successfully posted item {0} to remote asset server {1}", assetID, userAssetURL); | 251 | m_log.DebugFormat("[HGScene]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL); |
255 | else | ||
256 | m_log.WarnFormat("[HGScene]: Could not post asset {0} to remote asset server {1}", assetID, userAssetURL); | ||
257 | 252 | ||
258 | } | ||
259 | else | ||
260 | m_log.Debug("[HGScene]: Something wrong with asset, it could not be found"); | ||
261 | } | 253 | } |
262 | else | 254 | else |
263 | m_log.Warn("[HGScene]: Unable to locate foreign user's asset server"); | 255 | m_log.DebugFormat("[HGScene]: Something wrong with asset {0}, it could not be found", assetID); |
264 | |||
265 | } | 256 | } |
257 | else | ||
258 | m_log.Debug("[HGScene]: user's asset server is local region's asset server"); | ||
259 | |||
266 | } | 260 | } |
267 | 261 | ||
268 | #endregion | 262 | #endregion |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index 8fe3565..6f7f34f 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs | |||
@@ -32,6 +32,7 @@ using OpenMetaverse; | |||
32 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications; | 33 | using OpenSim.Framework.Communications; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Region.Framework.Interfaces; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.Framework.Scenes.Hypergrid | 37 | namespace OpenSim.Region.Framework.Scenes.Hypergrid |
37 | { | 38 | { |
@@ -41,6 +42,21 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 43 | ||
43 | private HGAssetMapper m_assMapper; | 44 | private HGAssetMapper m_assMapper; |
45 | public HGAssetMapper AssetMapper | ||
46 | { | ||
47 | get { return m_assMapper; } | ||
48 | } | ||
49 | |||
50 | private IHyperAssetService m_hyper; | ||
51 | private IHyperAssetService HyperAssets | ||
52 | { | ||
53 | get | ||
54 | { | ||
55 | if (m_hyper == null) | ||
56 | m_hyper = RequestModuleInterface<IHyperAssetService>(); | ||
57 | return m_hyper; | ||
58 | } | ||
59 | } | ||
44 | 60 | ||
45 | #endregion | 61 | #endregion |
46 | 62 | ||
@@ -140,6 +156,16 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
140 | 156 | ||
141 | } | 157 | } |
142 | 158 | ||
159 | protected override void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver) | ||
160 | { | ||
161 | string userAssetServer = HyperAssets.GetUserAssetServer(sender); | ||
162 | if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer())) | ||
163 | m_assMapper.Get(item.AssetID, sender); | ||
164 | |||
165 | userAssetServer = HyperAssets.GetUserAssetServer(receiver); | ||
166 | if ((userAssetServer != string.Empty) && (userAssetServer != HyperAssets.GetSimAssetServer())) | ||
167 | m_assMapper.Post(item.AssetID, receiver); | ||
168 | } | ||
143 | 169 | ||
144 | #endregion | 170 | #endregion |
145 | 171 | ||