From 93837807ffb24e5811368063b9231a9d8b018d9d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 16 Feb 2009 19:15:16 +0000 Subject: * refactor: remove AssetCache field hanging off Scene * This is always available at Scene.CommsManager.AssetCache --- OpenSim/Region/Application/HGOpenSimNode.cs | 2 +- OpenSim/Region/Application/OpenSimBase.cs | 2 +- .../Agent/Capabilities/CapabilitiesModule.cs | 2 +- .../TextureDownload/UserTextureDownloadService.cs | 2 +- .../Hypergrid/HGStandaloneAssetService.cs | 3 ++- .../Scripting/DynamicTexture/DynamicTextureModule.cs | 6 +++--- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 2 +- .../World/Archiver/ArchiveWriteRequestPreparation.cs | 4 ++-- .../World/WorldMap/TexturedMapTileRenderer.cs | 2 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- .../Framework/Scenes/Hypergrid/HGAssetMapper.cs | 2 +- .../Framework/Scenes/Hypergrid/HGScene.Inventory.cs | 4 ++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 20 ++++++++++---------- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++--- OpenSim/Region/Framework/Scenes/SceneBase.cs | 8 -------- OpenSim/Region/Framework/Scenes/SceneManager.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 +++++--- .../Framework/Scenes/SceneObjectPartInventory.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 4 ++-- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 21 files changed, 41 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index 8778acd..cf0f917 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs @@ -130,7 +130,7 @@ namespace OpenSim return new HGScene( - regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, storageManager, + regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 8198138..add7cb9 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -663,7 +663,7 @@ namespace OpenSim SceneCommunicationService sceneGridService = new SceneCommunicationService(m_commsManager); return new Scene( - regionInfo, circuitManager, m_commsManager, sceneGridService, m_assetCache, + regionInfo, circuitManager, m_commsManager, sceneGridService, storageManager, m_moduleLoader, m_configSettings.DumpAssetsToFile, m_configSettings.PhysicalPrim, m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); } diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index 6327466..2c6b51d 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities Caps caps = new Caps( - m_scene.AssetCache, m_scene.CommsManager.HttpServer, m_scene.RegionInfo.ExternalHostName, + m_scene.CommsManager.AssetCache, m_scene.CommsManager.HttpServer, m_scene.RegionInfo.ExternalHostName, m_scene.CommsManager.HttpServer.Port, capsObjectPath, agentId, m_scene.DumpAssetsToFile, m_scene.RegionInfo.RegionName); diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs index 2f98bab..ae71fda 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs @@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber); m_textureSenders.Add(e.RequestedAssetID, requestHandler); - m_scene.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); + m_scene.CommsManager.AssetCache.GetAsset(e.RequestedAssetID, TextureCallback, true); } } } diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs index c70f65c..7caa786 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneAssetService.cs @@ -114,7 +114,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid protected void AddHttpHandlers(Scene m_scene) { - IAssetDataPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin; + IAssetDataPlugin m_assetProvider + = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; BaseHttpServer httpServer = m_scene.CommsManager.HttpServer; httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 121dc3c..d6f0713 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture if (BlendWithOldTexture) { UUID lastTextureID = part.Shape.Textures.DefaultTexture.TextureID; - oldAsset = scene.AssetCache.GetAsset(lastTextureID, true); + oldAsset = scene.CommsManager.AssetCache.GetAsset(lastTextureID, true); if (oldAsset != null) { assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); @@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture asset.Metadata.Description = "dynamic image"; asset.Metadata.Local = false; asset.Metadata.Temporary = true; - scene.AssetCache.AddAsset(asset); + scene.CommsManager.AssetCache.AddAsset(asset); LastAssetID = asset.Metadata.FullID; @@ -254,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture // remove the old asset from the cache UUID oldID = tmptex.DefaultTexture.TextureID; - scene.AssetCache.ExpireAsset(oldID); + scene.CommsManager.AssetCache.ExpireAsset(oldID); tmptex.DefaultTexture.TextureID = asset.Metadata.FullID; // I'm pretty sure we always want to force this to true diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 9497869..66fc43b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -297,7 +297,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver asset.Metadata.Type = assetType; asset.Data = data; - m_scene.AssetCache.AddAsset(asset); + m_scene.CommsManager.AssetCache.AddAsset(asset); /** * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index bd36779..139dff0 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected AssetBase GetAsset(UUID uuid) { m_waitingForObjectAsset = true; - m_scene.AssetCache.GetAsset(uuid, AssetRequestCallback, true); + m_scene.CommsManager.AssetCache.GetAsset(uuid, AssetRequestCallback, true); // The asset cache callback can either // @@ -324,7 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene, m_saveStream); - new AssetsRequest(assetUuids.Keys, m_scene.AssetCache, awre.ReceivedAllAssets).Execute(); + new AssetsRequest(assetUuids.Keys, m_scene.CommsManager.AssetCache, awre.ReceivedAllAssets).Execute(); } } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs index 2e018d3..69d3dac 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs @@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // will wait anyway) private Bitmap fetchTexture(UUID id) { - AssetBase asset = m_scene.AssetCache.GetAsset(id, true); + AssetBase asset = m_scene.CommsManager.AssetCache.GetAsset(id, true); m_log.DebugFormat("Fetched texture {0}, found: {1}", id, asset != null); if (asset == null) return null; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 9355374..e1c3d85 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -738,7 +738,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap imgstream = new MemoryStream(); // non-async because we know we have the asset immediately. - AssetBase mapasset = m_scene.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true); + AssetBase mapasset = m_scene.CommsManager.AssetCache.GetAsset(m_scene.RegionInfo.lastMapUUID, true); // Decode image to System.Drawing.Image if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image)) diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 4039288..1f01fa2 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs @@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid { AssetBase asset1 = new AssetBase(); Copy(asset, asset1); - m_scene.AssetCache.AssetServer.StoreAsset(asset1); + m_scene.CommsManager.AssetCache.AssetServer.StoreAsset(asset1); } return true; } diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index ea03cf9..423acc1 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs @@ -49,10 +49,10 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid public HGScene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, - IAssetCache assetCach, StorageManager storeManager, + StorageManager storeManager, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) - : base(regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, moduleLoader, + : base(regInfo, authen, commsMan, sceneGridService, storeManager, moduleLoader, dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) { m_log.Info("[HGScene]: Starting HGScene."); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 0c6ad0d..c98629b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -191,7 +191,7 @@ namespace OpenSim.Region.Framework.Scenes AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); item.AssetID = asset.Metadata.FullID; userInfo.UpdateItem(item); @@ -277,7 +277,7 @@ namespace OpenSim.Region.Framework.Scenes } AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); if (isScriptRunning) { @@ -681,7 +681,7 @@ namespace OpenSim.Region.Framework.Scenes } AssetBase asset - = AssetCache.GetAsset( + = CommsManager.AssetCache.GetAsset( item.AssetID, (item.AssetType == (int)AssetType.Texture ? true : false)); if (asset != null) @@ -903,7 +903,7 @@ namespace OpenSim.Region.Framework.Scenes } AssetBase asset = CreateAsset(name, description, assetType, data); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); CreateNewInventoryItem(remoteClient, folderID, asset.Metadata.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); } @@ -1530,7 +1530,7 @@ namespace OpenSim.Region.Framework.Scenes return; AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); TaskInventoryItem taskItem = new TaskInventoryItem(); @@ -1952,7 +1952,7 @@ namespace OpenSim.Region.Framework.Scenes objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); assetID = asset.Metadata.FullID; if (DeRezAction.SaveToExistingUserInventoryItem == action) @@ -2078,7 +2078,7 @@ namespace OpenSim.Region.Framework.Scenes objectGroup.GetPartDescription(objectGroup.LocalId), (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); item.AssetID = asset.Metadata.FullID; item.Description = asset.Metadata.Description; @@ -2115,7 +2115,7 @@ namespace OpenSim.Region.Framework.Scenes grp.GetPartDescription(grp.LocalId), (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); InventoryItemBase item = new InventoryItemBase(); item.Creator = grp.RootPart.CreatorID; @@ -2239,7 +2239,7 @@ namespace OpenSim.Region.Framework.Scenes if (item != null) { - AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); + AssetBase rezAsset = CommsManager.AssetCache.GetAsset(item.AssetID, false); if (rezAsset != null) { @@ -2407,7 +2407,7 @@ namespace OpenSim.Region.Framework.Scenes { UUID ownerID = item.OwnerID; - AssetBase rezAsset = AssetCache.GetAsset(item.AssetID, false); + AssetBase rezAsset = CommsManager.AssetCache.GetAsset(item.AssetID, false); if (rezAsset != null) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0f57b7c..c3ab5e9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -268,7 +268,7 @@ namespace OpenSim.Region.Framework.Scenes public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, SceneCommunicationService sceneGridService, - IAssetCache assetCach, StorageManager storeManager, + StorageManager storeManager, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) { @@ -281,7 +281,6 @@ namespace OpenSim.Region.Framework.Scenes CommsManager = commsMan; m_sceneGridService = sceneGridService; m_storageManager = storeManager; - AssetCache = assetCach; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -3543,7 +3542,7 @@ namespace OpenSim.Region.Framework.Scenes group.GetPartDescription(localID), (sbyte)AssetType.Object, Utils.StringToBytes(sceneObjectXml)); - AssetCache.AddAsset(asset); + CommsManager.AssetCache.AddAsset(asset); InventoryItemBase item = new InventoryItemBase(); item.Creator = part.CreatorID; diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index 3f5c781..3695b21 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -126,14 +126,6 @@ namespace OpenSim.Region.Framework.Scenes protected string m_datastore; - private IAssetCache m_assetCache; - - public IAssetCache AssetCache - { - get { return m_assetCache; } - set { m_assetCache = value; } - } - protected RegionStatus m_regStatus; public RegionStatus Region_Status diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index fe37dae..00b49a1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -642,7 +642,7 @@ namespace OpenSim.Region.Framework.Scenes { for (int i=0;i