Test on the grid asset problem, don't update to this version unless you just want to test to see if this fixes anything (but it could just as well break grid assets even more).

afrisby
MW 2007-11-01 15:54:59 +00:00
parent 2aa9440437
commit 88f04731ca
2 changed files with 45 additions and 64 deletions

View File

@ -74,7 +74,7 @@ namespace OpenSim.Framework.Communications.Cache
_assetRequests.Enqueue(req);
}
public void UpdateAsset(AssetBase asset)
public virtual void UpdateAsset(AssetBase asset)
{
lock (syncLock)
{

View File

@ -35,10 +35,9 @@ using OpenSim.Framework.Console;
namespace OpenSim.Framework.Communications.Cache
{
public class GridAssetClient : IAssetServer
public class GridAssetClient : AssetServerBase
{
private string _assetServerUrl;
private IAssetReceiver _receiver;
public GridAssetClient(string serverUrl)
{
@ -47,22 +46,24 @@ namespace OpenSim.Framework.Communications.Cache
#region IAssetServer Members
public void SetReceiver(IAssetReceiver receiver)
protected override void RunRequests()
{
_receiver = receiver;
}
while (true)
{
ARequest req = _assetRequests.Dequeue();
//MainLog.Instance.Verbose("AssetStorage","Requesting asset: " + req.AssetID);
public void FetchAsset(LLUUID assetID, bool isTexture)
{
Stream s = null;
try
{
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", assetID.ToString());
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", req.AssetID.ToString());
RestClient rc = new RestClient(_assetServerUrl);
rc.AddResourcePath("assets");
rc.AddResourcePath(assetID.ToString());
if (isTexture)
rc.AddResourcePath(req.AssetID.ToString());
if (req.IsTexture)
rc.AddQueryParameter("texture");
rc.RequestMethod = "GET";
@ -70,31 +71,35 @@ namespace OpenSim.Framework.Communications.Cache
if (s.Length > 0)
{
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
AssetBase asset = (AssetBase) xs.Deserialize(s);
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
AssetBase newAsset = (AssetBase)xs.Deserialize(s);
_receiver.AssetReceived(asset, isTexture);
_receiver.AssetReceived(newAsset, req.IsTexture);
}
else
{
MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", assetID.ToString());
_receiver.AssetNotFound(assetID);
MainLog.Instance.Debug("ASSETCACHE", "Asset not found {0}", req.AssetID.ToString());
_receiver.AssetNotFound(req.AssetID);
}
}
catch (Exception e)
{
MainLog.Instance.Error("ASSETCACHE", e.Message);
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", assetID.ToString());
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString());
MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
}
}
}
public void UpdateAsset(AssetBase asset)
public override void UpdateAsset(AssetBase asset)
{
throw new Exception("The method or operation is not implemented.");
}
public void StoreAndCommitAsset(AssetBase asset)
protected override void StoreAsset(AssetBase asset)
{
try
{
@ -113,40 +118,16 @@ namespace OpenSim.Framework.Communications.Cache
}
}
public void Close()
protected override void CommitAssets()
{
}
public override void Close()
{
throw new Exception("The method or operation is not implemented.");
}
public void LoadAsset(AssetBase info, bool image, string filename)
{
throw new Exception("The method or operation is not implemented.");
}
public List<AssetBase> GetDefaultAssets()
{
throw new Exception("The method or operation is not implemented.");
}
public AssetBase CreateImageAsset(string assetIdStr, string name, string filename)
{
throw new Exception("The method or operation is not implemented.");
}
public void ForEachDefaultAsset(Action<AssetBase> action)
{
throw new Exception("The method or operation is not implemented.");
}
public AssetBase CreateAsset(string assetIdStr, string name, string filename, bool isImage)
{
throw new Exception("The method or operation is not implemented.");
}
public void ForEachXmlAsset(Action<AssetBase> action)
{
throw new Exception("The method or operation is not implemented.");
}
#endregion
}