* refactor: remove AssetCache field hanging off Scene

* This is always available at Scene.CommsManager.AssetCache
0.6.3-post-fixes
Justin Clarke Casey 2009-02-16 19:15:16 +00:00
parent ec07e1aad6
commit 93837807ff
23 changed files with 44 additions and 50 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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();
}
}
}

View File

@ -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;

View File

@ -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))

View File

@ -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;
}

View File

@ -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.");

View File

@ -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)
{

View File

@ -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;

View File

@ -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

View File

@ -642,7 +642,7 @@ namespace OpenSim.Region.Framework.Scenes
{
for (int i=0;i<arrassets.Length;i++)
{
AssetBase ab = sn.AssetCache.GetAsset(arrassets[i], true);
AssetBase ab = sn.CommsManager.AssetCache.GetAsset(arrassets[i], true);
if (ab != null && ab.Data != null)
{
j2kdecode.syncdecode(arrassets[i], ab.Data);

View File

@ -2983,7 +2983,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero)
{
m_scene.AssetCache.GetAsset(part.Shape.SculptTexture, part.SculptTextureCallback, true);
m_scene.CommsManager.AssetCache.GetAsset(
part.Shape.SculptTexture, part.SculptTextureCallback, true);
}
}
}

View File

@ -1422,8 +1422,10 @@ if (m_shape != null) {
{
if (dupe.m_shape.SculptEntry && dupe.m_shape.SculptTexture != UUID.Zero)
{
m_parentGroup.Scene.AssetCache.GetAsset(dupe.m_shape.SculptTexture, dupe.SculptTextureCallback, true);
m_parentGroup.Scene.CommsManager.AssetCache.GetAsset(
dupe.m_shape.SculptTexture, dupe.SculptTextureCallback, true);
}
bool UsePhysics = ((dupe.ObjectFlags & (uint)PrimFlags.Physics) != 0);
dupe.DoPhysicsPropertyUpdate(UsePhysics, true);
}
@ -3232,8 +3234,8 @@ if (m_shape != null) {
{
if (m_shape.SculptEntry && m_shape.SculptTexture != UUID.Zero)
{
//AssetBase tx = m_parentGroup.Scene.getase
m_parentGroup.Scene.AssetCache.GetAsset(m_shape.SculptTexture, SculptTextureCallback, true);
m_parentGroup.Scene.CommsManager.AssetCache.GetAsset(
m_shape.SculptTexture, SculptTextureCallback, true);
}
}

View File

@ -251,7 +251,7 @@ namespace OpenSim.Region.Framework.Scenes
m_part.ScheduleFullUpdate();
return;
}
IAssetCache cache = m_part.ParentGroup.Scene.AssetCache;
IAssetCache cache = m_part.ParentGroup.Scene.CommsManager.AssetCache;
cache.GetAsset(item.AssetID, delegate(UUID assetID, AssetBase asset)
{

View File

@ -3549,7 +3549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.RegionInfo.RegionLocY * Constants.RegionSize,
0);
World.AssetCache.GetAsset(item.AssetID,
World.CommsManager.AssetCache.GetAsset(item.AssetID,
delegate(UUID i, AssetBase a)
{
AssetLandmark lm = new AssetLandmark(a);
@ -8851,7 +8851,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public delegate void AssetRequestCallback(UUID assetID, AssetBase asset);
private void WithNotecard(UUID assetID, AssetRequestCallback cb)
{
World.AssetCache.GetAsset(assetID, delegate(UUID i, AssetBase a) { cb(i, a); }, false);
World.CommsManager.AssetCache.GetAsset(assetID, delegate(UUID i, AssetBase a) { cb(i, a); }, false);
}
public LSL_String llGetNumberOfNotecardLines(string name)

View File

@ -1040,7 +1040,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
+ textLength.ToString() + "\n" + notecardData + "}\n";
asset.Data = Encoding.ASCII.GetBytes(notecardData);
World.AssetCache.AddAsset(asset);
World.CommsManager.AssetCache.AddAsset(asset);
// Create Task Entry
TaskInventoryItem taskItem=new TaskInventoryItem();

View File

@ -39,11 +39,10 @@ namespace OpenSim.Tests.Common.Mock
{
public TestScene(
RegionInfo regInfo, AgentCircuitManager authen,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService,
IAssetCache assetCach, StorageManager storeManager,
CommunicationsManager commsMan, SceneCommunicationService sceneGridService, 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)
{
}

View File

@ -77,7 +77,7 @@ namespace OpenSim.Tests.Common.Setup
IConfigSource configSource = new IniConfigSource();
TestScene testScene = new TestScene(
regInfo, acm, cm, scs, cm.AssetCache, sm, null, false, false, false, configSource, null);
regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null);
IRegionModule capsModule = new CapabilitiesModule();
capsModule.Initialise(testScene, new IniConfigSource());