Use the new async handling class to actually make the new asset service's
async request perform asynchronously0.6.5-rc1
parent
a983f2a3ac
commit
65c0996a9c
|
@ -141,8 +141,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
asset = SynchronousRestObjectPoster.
|
asset = SynchronousRestObjectRequester.
|
||||||
BeginPostObject<int, AssetBase>("GET", uri, 0);
|
MakeRequest<int, AssetBase>("GET", uri, 0);
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Cache(asset);
|
m_Cache.Cache(asset);
|
||||||
|
@ -162,8 +162,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
|
|
||||||
string uri = m_ServerURI + "/assets/" + id + "/metadata";
|
string uri = m_ServerURI + "/assets/" + id + "/metadata";
|
||||||
|
|
||||||
AssetMetadata asset = SynchronousRestObjectPoster.
|
AssetMetadata asset = SynchronousRestObjectRequester.
|
||||||
BeginPostObject<int, AssetMetadata>("GET", uri, 0);
|
MakeRequest<int, AssetMetadata>("GET", uri, 0);
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,16 +202,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
|
|
||||||
public bool Get(string id, Object sender, AssetRetrieved handler)
|
public bool Get(string id, Object sender, AssetRetrieved handler)
|
||||||
{
|
{
|
||||||
AssetBase asset = Get(id);
|
string uri = m_ServerURI + "/assets/" + id;
|
||||||
handler(id, sender, asset);
|
|
||||||
|
AssetBase asset = null;
|
||||||
|
if (m_Cache != null)
|
||||||
|
asset = m_Cache.Get(id);
|
||||||
|
|
||||||
|
if (asset == null)
|
||||||
|
{
|
||||||
|
AsynchronousRestObjectRequester.
|
||||||
|
MakeRequest<int, AssetBase>("GET", uri, 0,
|
||||||
|
delegate(AssetBase a)
|
||||||
|
{
|
||||||
|
if (m_Cache != null)
|
||||||
|
m_Cache.Cache(a);
|
||||||
|
handler(id, sender, a);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handler(id, sender, asset);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Store(AssetBase asset)
|
public string Store(AssetBase asset)
|
||||||
{
|
{
|
||||||
string uri = m_ServerURI + "/assets/";
|
string uri = m_ServerURI + "/assets/";
|
||||||
|
|
||||||
string newID = SynchronousRestObjectPoster.
|
string newID = SynchronousRestObjectRequester.
|
||||||
BeginPostObject<AssetBase, string>("POST", uri, asset);
|
MakeRequest<AssetBase, string>("POST", uri, asset);
|
||||||
|
|
||||||
if (newID != String.Empty)
|
if (newID != String.Empty)
|
||||||
{
|
{
|
||||||
|
@ -241,8 +263,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
|
|
||||||
string uri = m_ServerURI + "/assets/" + id;
|
string uri = m_ServerURI + "/assets/" + id;
|
||||||
|
|
||||||
if (SynchronousRestObjectPoster.
|
if (SynchronousRestObjectRequester.
|
||||||
BeginPostObject<AssetBase, bool>("POST", uri, asset))
|
MakeRequest<AssetBase, bool>("POST", uri, asset))
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Cache(asset);
|
m_Cache.Cache(asset);
|
||||||
|
@ -256,8 +278,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
{
|
{
|
||||||
string uri = m_ServerURI + "/assets/" + id;
|
string uri = m_ServerURI + "/assets/" + id;
|
||||||
|
|
||||||
if (SynchronousRestObjectPoster.
|
if (SynchronousRestObjectRequester.
|
||||||
BeginPostObject<int, bool>("DELETE", uri, 0))
|
MakeRequest<int, bool>("DELETE", uri, 0))
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Expire(id);
|
m_Cache.Expire(id);
|
||||||
|
|
Loading…
Reference in New Issue