public virtual bool Get(string id, object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(false); } } if (asset == null && m_ServerURI != null) { string uri = m_ServerURI + "/assets/" + id; lock (m_AssetHandlers) { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); List <AssetRetrievedEx> handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. handlers.Add(handlerEx); return(true); } handlers = new List <AssetRetrievedEx>(); handlers.Add(handlerEx); m_AssetHandlers.Add(id, handlers); QueuedAssetRequest request = new QueuedAssetRequest(); request.id = id; request.uri = uri; Util.FireAndForget(x => { AssetRequestProcessor(request); }); } } else { if (asset != null && (asset.Data == null || asset.Data.Length == 0)) { asset = null; } handler(id, sender, asset); } return(true); }
public bool Get(string id, object sender, AssetRetrieved handler) { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AssetServerURI"); if (m_serverURL != string.Empty) { serverURIs = new List <string>(new string[1] { m_serverURL }); } foreach (string m_ServerURI in serverURIs) { string uri = m_ServerURI + "/" + id; Aurora.Framework.AssetBase asset = null; if (m_Cache != null) { asset = m_Cache.Get(id); } if (asset == null) { bool result = false; AsynchronousRestObjectRequester. MakeRequest("GET", uri, 0, delegate(AssetBase aa) { Aurora.Framework.AssetBase a = TearDown(aa); if (m_Cache != null) { m_Cache.Cache(a.IDString, a); } handler(id, sender, a); result = true; }); if (result) { return(result); } } else { handler(id, sender, asset); return(true); } } return(false); }
public bool Get(string id, Object sender, AssetRetrieved handler) { string url = string.Empty; string assetID = string.Empty; if (StringToUrlAndAssetID(id, out url, out assetID)) { IAssetService connector = GetConnector(url); return(connector.Get(assetID, sender, handler)); } return(false); }
public bool Get(string id, object sender, AssetRetrieved handler) { string url = string.Empty; string assetID = string.Empty; if (Util.ParseForeignAssetID(id, out url, out assetID) > 0) { IAssetService connector = GetConnector(url); return(connector.Get(assetID, sender, handler)); } return(false); }
public virtual bool Get(string id, object sender, AssetRetrieved callBack) { AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.GetFromMemory(id, out asset)) { callBack(id, sender, null); return(false); } } if (asset == null) { if (id.Equals(Util.UUIDZeroString)) { callBack(id, sender, null); return(false); } lock (m_AssetHandlers) { SimpleAssetRetrieved handlerEx = new SimpleAssetRetrieved(delegate(AssetBase _asset) { callBack(id, sender, _asset); _asset = null; }); List <SimpleAssetRetrieved> handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. handlers.Add(handlerEx); return(true); } handlers = new List <SimpleAssetRetrieved>(); handlers.Add(handlerEx); m_AssetHandlers.Add(id, handlers); m_localRequestsQueue.Enqueue(id); } } else { if (asset != null && (asset.Data == null || asset.Data.Length == 0)) { asset = null; } callBack(id, sender, asset); } return(true); }
public void Get(string id, object sender, AssetRetrieved handler) { m_localService.Get(id, sender, delegate(string idd, object senderr, AssetBase asset) { if (asset == null) { handler(id, sender, Get(id)); } else { handler(id, sender, asset); } }); }
public bool Get(string id, Object sender, AssetRetrieved handler) { UUID assetID; if (!UUID.TryParse(id, out assetID)) { return(false); } AssetBase asset = m_Database.FetchAsset(assetID); handler(id, sender, asset); return(true); }
public bool Get(string id, Object sender, AssetRetrieved handler) { string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) { asset = m_Cache.Get(id); } if (asset == null || asset.Data == null || asset.Data.Length == 0) { lock (m_AssetHandlers) { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); // AssetRetrievedEx handlers; List <AssetRetrievedEx> handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. // handlers += handlerEx; handlers.Add(handlerEx); return(true); } // Load the asset ourselves // handlers += handlerEx; handlers = new List <AssetRetrievedEx>(); handlers.Add(handlerEx); m_AssetHandlers.Add(id, handlers); } QueuedAssetRequest request = new QueuedAssetRequest(); request.id = id; request.uri = uri; m_requestQueue.Enqueue(request); } else { handler(id, sender, asset); } return(true); }
public virtual bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); UUID assetID; if (!UUID.TryParse(id, out assetID)) { return(false); } AssetBase asset = m_Database.FetchAsset(assetID); handler(id, sender, asset); return(true); }
public virtual bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id); if (!UUID.TryParse(id, out UUID assetID) || assetID == UUID.Zero) { return(false); } AssetBase asset = Get(id); //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset); handler(id, sender, asset); return(true); }
public virtual bool Get(string id, Object sender, AssetRetrieved handler) { List <string> serverURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AssetServerURI"); foreach (string m_ServerURI in serverURIs) { string uri = m_ServerURI + "/" + id; AssetBase asset = null; if (m_Cache != null) { asset = m_Cache.Get(id); } if (asset == null) { bool result = false; AsynchronousRestObjectRequester. MakeRequest <int, AssetBase>("GET", uri, 0, delegate(AssetBase a) { if (m_Cache != null) { m_Cache.Cache(a); } handler(id, sender, a); result = true; }); if (result) { return(result); } } else { //Util.FireAndForget(delegate { handler(id, sender, asset); }); handler(id, sender, asset); return(true); } } return(false); }
public virtual bool Get(String id, Object sender, AssetRetrieved handler) { //MainConsole.Instance.DebugFormat("[AssetService]: Get asset async {0}", id); AssetBase asset = m_database.GetAsset(UUID.Parse(id)); IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache>(); if (cache != null && asset != null && asset.Data.Length != 0) { cache.Cache(asset); } //MainConsole.Instance.DebugFormat("[AssetService]: Got asset {0}", asset); handler(id, sender, asset); return(true); }
public virtual bool Get(string id, object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(false); } } if (asset == null) { lock (m_AssetHandlers) { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); List <AssetRetrievedEx> handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. handlers.Add(handlerEx); return(true); } handlers = new List <AssetRetrievedEx>(); handlers.Add(handlerEx); m_AssetHandlers.Add(id, handlers); m_requestQueue.Add(id); } } else { if (asset != null && (asset.Data == null || asset.Data.Length == 0)) { asset = null; } handler(id, sender, asset); } return(true); }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(false); } } if (asset != null) { Util.FireAndForget(delegate { handler(id, sender, asset); asset = null; }, null, "HGAssetBroker.GotFromCache"); return(true); } if (IsHG(id)) { return(m_HGService.Get(id, sender, delegate(string assetID, Object s, AssetBase a) { if (m_Cache != null) { m_Cache.Cache(a); } handler(assetID, s, a); a = null; })); } else { return(m_GridService.Get(id, sender, delegate(string assetID, Object s, AssetBase a) { if (m_Cache != null) { m_Cache.Cache(a); } handler(assetID, s, a); a = null; })); } }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = m_Cache.Get(id); if (asset != null) { handler(id, sender, asset); return(true); } return(m_AssetService.Get(id, sender, delegate(string assetID, Object s, AssetBase a) { if (a != null) { m_Cache.Cache(a); } handler(assetID, s, a); })); }
public bool Get(string id, object sender, AssetRetrieved handler) { // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id); if (m_Cache != null) { AssetBase asset; if (!m_Cache.Get(id, out asset)) { return(false); } if (asset != null) { Util.FireAndForget(o => handler(id, sender, asset), null, "LocalAssetServiceConnector.GotFromCacheCallback"); return(true); } } if (id.Equals(Util.UUIDZeroString)) { return(false); } return(m_AssetService.Get(id, sender, delegate(string assetID, object s, AssetBase a) { if (m_Cache != null) { if (a == null) { m_Cache.CacheNegative(assetID); } else { m_Cache.Cache(a); } } // if (null == a) // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); Util.FireAndForget(o => handler(assetID, s, a), null, "LocalAssetServiceConnector.GotFromServiceCallback"); })); }
public bool Get(string id, object sender, AssetRetrieved handler) { if (checkForError()) { return(false); } try { Boolean result = m_assetService.Get(id, sender, handler); if (result == false) { foreach (AssetServerProxy service in m_extraAssetServers) { if (result == false) { result = service.Get(id, sender, handler); if (result == true) { m_log.Info("[AssetServerProxy]: Add asset '" + id + "' to cache from external asset storage at " + service.AssetServiceName); } } } } return(result); } catch { m_errorCount++; m_lastError = Tools.getUnixTime(); m_log.Error("[AssetServerProxy]: Add remote asset server to temporary blacklist: " + m_assetServiceURL); } return(false); }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) { asset = m_Cache.Get(id); } if (asset != null) { handler(id, sender, asset); return(true); } if (IsHG(id)) { return(m_HGService.Get(id, sender, delegate(string assetID, Object s, AssetBase a) { if (m_Cache != null) { m_Cache.Cache(a); } handler(assetID, s, a); })); } else { return(m_GridService.Get(id, sender, delegate(string assetID, Object s, AssetBase a) { if (m_Cache != null) { m_Cache.Cache(a); } handler(assetID, s, a); })); } }
/// <summary> /// Get an asset asynchronously /// </summary> /// <param name="id">The asset id</param> /// <param name="sender">Represents the requester. Passed back via the handler</param> /// <param name="handler">The handler to call back once the asset has been retrieved</param> /// <returns>True if the id was parseable, false otherwise</returns> public bool Get(string id, Object sender, AssetRetrieved handler) { // Cache fetch if (m_cache != null) { AssetBase asset = m_cache.Get(id); if (asset != null) { handler(id, sender, asset); return(true); } } Util.FireAndForget( delegate(object o) { AssetBase asset = GetRemote(id); handler(id, sender, asset); } ); return(true); }
public bool Get(string id, Object sender, AssetRetrieved handler) { string uri = m_ServerURI + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) { asset = m_Cache.Get(id); } if (asset == null) { bool result = false; AsynchronousRestObjectRequester. MakeRequest <int, AssetBase>("GET", uri, 0, delegate(AssetBase a) { if (m_Cache != null) { m_Cache.Cache(a); } handler(id, sender, a); result = true; }); return(result); } else { //Util.FireAndForget(delegate { handler(id, sender, asset); }); handler(id, sender, asset); } return(true); }
// public delegate void AssetRetrieved(string id, Object sender, AssetBase asset); public virtual bool Get(string id, Object sender, AssetRetrieved handler) { return(m_assetConnector.Get(id, sender, (i, s, asset) => { if (asset != null) { if (!m_AssetPerms.AllowedExport(asset.Type)) { asset = null; } else { if (asset.Metadata.Type == (sbyte)AssetType.Object) { asset.Data = AdjustIdentifiers(asset.Data); } AdjustIdentifiers(asset.Metadata); } } handler(i, s, asset); })); }
public bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); AssetBase asset = m_Database.GetAsset (id); IImprovedAssetCache cache = m_registry.RequestModuleInterface<IImprovedAssetCache> (); if (cache != null && asset != null) cache.Cache (asset); //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); handler(id, sender, asset); return true; }
/// <summary> /// Get an asset asynchronously /// </summary> /// <param name="id">The asset id</param> /// <param name="sender">Represents the requester. Passed back via the handler</param> /// <param name="handler">The handler to call back once the asset has been retrieved</param> /// <returns>True if the id was parseable, false otherwise</returns> public bool Get(string id, Object sender, AssetRetrieved handler) { // Cache fetch if (m_cache != null) { AssetBase asset = m_cache.Get(id); if (asset != null) { handler(id, sender, asset); return true; } } Util.FireAndForget( delegate(object o) { AssetBase asset = GetRemote(id); handler(id, sender, asset); } ); return true; }
public bool Get(string id, Object sender, AssetRetrieved handler) { return(false); }
public virtual bool Get (string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); AssetBase asset = null; string url = string.Empty, assetID = string.Empty; if (StringToUrlAndAssetID (id, out url, out assetID)) { IAssetService connector = GetConnector (url); asset = connector.Get (assetID); FixAssetID (ref asset); handler (id, sender, asset); return true; } asset = m_Database.GetAsset (id); IImprovedAssetCache cache = m_registry.RequestModuleInterface<IImprovedAssetCache> (); if (cache != null && asset != null) cache.Cache (asset); //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); FixAssetID (ref asset); handler(id, sender, asset); return true; }
public virtual bool Get(String id, Object sender, AssetRetrieved handler) { //MainConsole.Instance.DebugFormat("[AssetService]: Get asset async {0}", id); AssetBase asset = m_database.GetAsset(UUID.Parse(id)); IImprovedAssetCache cache = m_registry.RequestModuleInterface<IImprovedAssetCache>(); if (cache != null && asset != null && asset.Data.Length != 0) cache.Cache(asset); //MainConsole.Instance.DebugFormat("[AssetService]: Got asset {0}", asset); handler(id, sender, asset); return true; }
public bool Get(string id, object sender, AssetRetrieved handler) { handler(id, sender, Get(id)); return(true); }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) m_Cache.Get(id); if (asset != null) { Util.FireAndForget(delegate { handler(id, sender, asset); }); return true; } return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if ((a != null) && (m_Cache != null)) m_Cache.Cache(a); Util.FireAndForget(delegate { handler(assetID, s, a); }); }); }
public override bool Get(string id, object sender, AssetRetrieved handler) { string url = string.Empty; string assetID = string.Empty; if (StringToUrlAndAssetID (id, out url, out assetID)) { IAssetService connector = GetConnector (url); return connector.Get (assetID, sender, handler); } return base.Get (id, sender, handler); }
public override bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset != null) { Util.FireAndForget(delegate { handler(id, sender, asset); }); return true; } if (IsHG(id)) { string url = string.Empty; string assetID = string.Empty; if (StringToUrlAndAssetID(id, out url, out assetID)) { IAssetService connector = GetConnector(url); return connector.Get(assetID, sender, delegate(string newAssetID, Object s, AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); handler(assetID, s, a); }); } return false; } else { return base.Get(id, sender, delegate(string assetID, Object s, AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); handler(assetID, s, a); }); } }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) m_Cache.Get(id); if (asset != null) { handler.BeginInvoke(id, sender, asset, null, null); return true; } return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if ((a != null) && (m_Cache != null)) m_Cache.Cache(a); handler.BeginInvoke(assetID, s, a, null, null); }); }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset != null) { Util.FireAndForget(delegate { handler(id, sender, asset); }); return true; } if (IsHG(id)) { return m_HGService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); handler(assetID, s, a); }); } else { return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); handler(assetID, s, a); }); } }
public virtual void Get(String id, Object sender, AssetRetrieved handler) { Util.FireAndForget((o) => { handler(id, sender, Get(id)); }); }
public bool Get(string id, object sender, AssetRetrieved handler) { throw new NotImplementedException(); }
public bool Get(string id, Object sender, AssetRetrieved handler) { // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); string uri = m_ServerURI + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset == null) { lock (m_AssetHandlers) { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); AssetRetrievedEx handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. handlers += handlerEx; return true; } // Load the asset ourselves handlers += handlerEx; m_AssetHandlers.Add(id, handlers); } bool success = false; try { AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, delegate(AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); AssetRetrievedEx handlers; lock (m_AssetHandlers) { handlers = m_AssetHandlers[id]; m_AssetHandlers.Remove(id); } handlers.Invoke(a); }, 30); success = true; } finally { if (!success) { lock (m_AssetHandlers) { m_AssetHandlers.Remove(id); } } } } else { handler(id, sender, asset); } return true; }
public override void Get(string id, object sender, AssetRetrieved handler) { base.Get(id, sender, handler); }
public bool Get(string id, Object sender, AssetRetrieved handler) { // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); string uri = m_ServerURI + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) { asset = m_Cache.Get(id); } if (asset == null) { lock (m_AssetHandlers) { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); AssetRetrievedEx handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. handlers += handlerEx; return(true); } // Load the asset ourselves handlers += handlerEx; m_AssetHandlers.Add(id, handlers); } bool success = false; try { AsynchronousRestObjectRequester.MakeRequest <int, AssetBase>("GET", uri, 0, delegate(AssetBase a) { if (a != null && m_Cache != null) { m_Cache.Cache(a); } AssetRetrievedEx handlers; lock (m_AssetHandlers) { handlers = m_AssetHandlers[id]; m_AssetHandlers.Remove(id); } handlers.Invoke(a); }, m_maxAssetRequestConcurrency); success = true; } finally { if (!success) { lock (m_AssetHandlers) { m_AssetHandlers.Remove(id); } } } } else { handler(id, sender, asset); } return(true); }
public bool Get(string id, Object sender, AssetRetrieved handler) { // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id); if (m_Cache != null) { AssetBase asset = m_Cache.Get(id); if (asset != null) { Util.FireAndForget( o => handler(id, sender, asset), null, "LocalAssetServiceConnector.GotFromCacheCallback"); return true; } } return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if ((a != null) && (m_Cache != null)) m_Cache.Cache(a); // if (null == a) // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not asynchronously find asset with id {0}", id); Util.FireAndForget( o => handler(assetID, s, a), null, "LocalAssetServiceConnector.GotFromServiceCallback"); }); }
public virtual void Get (string id, object sender, AssetRetrieved handler) { var asset = Get (id); if (asset != null) { Util.FireAndForget ((o) => {handler (id, sender, asset);}); //asset.Dispose (); } }
/// <summary> /// Get an asset asynchronously /// </summary> /// <param name="id">The asset id</param> /// <param name="sender">Represents the requester. Passed back via the handler</param> /// <param name="handler">The handler to call back once the asset has been retrieved</param> /// <returns>True if the id was parseable, false otherwise</returns> public bool Get(string id, Object sender, AssetRetrieved handler) { Util.FireAndForget( delegate(object o) { AssetBase asset = Get(id); handler(id, sender, asset); } ); return true; }
public virtual bool Get(string id, Object sender, AssetRetrieved handler) { List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AssetServerURI"); if (m_serverURL != string.Empty) serverURIs = new List<string>(new string[1] { m_serverURL }); foreach (string m_ServerURI in serverURIs) { string uri = m_ServerURI + "/" + id; AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset == null) { bool result = false; AsynchronousRestObjectRequester. MakeRequest<int, AssetBase>("GET", uri, 0, delegate(AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); handler(id, sender, a); result = true; }); if (result) return result; } else { handler(id, sender, asset); return true; } } return false; }
public virtual bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); handler(id, sender, Get(id)); return true; }
public virtual void Get(String id, Object sender, AssetRetrieved handler) { Util.FireAndForget((o) => { handler(id, sender, Get(id)); }); }
public virtual bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[XASSET SERVICE]: Get asset async {0}", id); UUID assetID; if (!UUID.TryParse(id, out assetID)) return false; AssetBase asset = Get(id); //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset); handler(id, sender, asset); return true; }
public bool Get(string id, object sender, AssetRetrieved handler) { handler(id, sender, Get(id)); return true; }
public bool Get(string id, Object sender, AssetRetrieved handler) { string url = string.Empty; string assetID = string.Empty; if (Util.ParseForeignAssetID(id, out url, out assetID)) { IAssetService connector = GetConnector(url); return connector.Get(assetID, sender, handler); } return false; }
public bool Get(string id, Object sender, AssetRetrieved handler) { string uri = m_ServerURI + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset == null) { bool result = false; AsynchronousRestObjectRequester. MakeRequest<int, AssetBase>("GET", uri, 0, delegate(AssetBase a) { if (m_Cache != null) m_Cache.Cache(a); handler(id, sender, a); result = true; }); return result; } else { //Util.FireAndForget(delegate { handler(id, sender, asset); }); handler(id, sender, asset); } return true; }
public bool Get(string id, object sender, AssetRetrieved handler) { throw new NotImplementedException(); }
public override void Get(string id, object sender, AssetRetrieved handler) { base.Get(id, sender, handler); }
public bool Get(string id, object sender, AssetRetrieved handler) { bool asset = m_localService.Get(id, sender, handler); if (!asset) asset = m_remoteService.Get(id, sender, handler); return asset; }
public void Get(string id, object sender, AssetRetrieved handler) { m_localService.Get(id, sender, delegate(string idd, object senderr, AssetBase asset) { if (asset == null) handler(id, sender, Get(id)); else handler(id, sender, asset); }); }
void IAssetService.Get(string id, object sender, AssetRetrieved handler) { List<string> serverURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AssetServerURI"); if (m_serverURL != string.Empty) serverURIs = new List<string>(new string[1] { m_serverURL }); foreach (string m_ServerURI in serverURIs) { string uri = m_ServerURI + "/" + id; Aurora.Framework.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) { handler(id, sender, TearDown(a)); }); } else { handler(id, sender, asset); } } }
/// <summary> /// Get an asset asynchronously /// </summary> /// <param name="id">The asset id</param> /// <param name="sender">Represents the requester. Passed back via the handler</param> /// <param name="handler">The handler to call back once the asset has been retrieved</param> /// <returns>True if the id was parseable, false otherwise</returns> public bool Get(string id, Object sender, AssetRetrieved handler) { if (String.IsNullOrEmpty(m_serverUrl)) { m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); throw new InvalidOperationException(); } // Cache fetch if (m_cache != null) { AssetBase asset = m_cache.Get(id); if (asset != null) { handler(id, sender, asset); return true; } } Util.FireAndForget( delegate(object o) { AssetBase asset = GetRemote(id); handler(id, sender, asset); } ); return true; }
public bool Get(string id, Object sender, AssetRetrieved handler) { AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset != null) { handler.BeginInvoke(id, sender, asset, null, null); return true; } if (IsHG(id)) { return m_HGService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if (a != null && m_Cache != null) m_Cache.Cache(a); handler(assetID, s, a); }); } else { return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) { if (a != null && m_Cache != null) m_Cache.Cache(a); handler(assetID, s, a); }); } }
public bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); UUID assetID; if (!UUID.TryParse(id, out assetID)) return false; AssetBase asset = m_Database.GetAsset(assetID); //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); handler(id, sender, asset); return true; }
public bool Get(string id, Object sender, AssetRetrieved handler) { string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) asset = m_Cache.Get(id); if (asset == null || asset.Data == null || asset.Data.Length == 0) { lock (m_AssetHandlers) { AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); // AssetRetrievedEx handlers; List<AssetRetrievedEx> handlers; if (m_AssetHandlers.TryGetValue(id, out handlers)) { // Someone else is already loading this asset. It will notify our handler when done. // handlers += handlerEx; handlers.Add(handlerEx); return true; } // Load the asset ourselves // handlers += handlerEx; handlers = new List<AssetRetrievedEx>(); handlers.Add(handlerEx); m_AssetHandlers.Add(id, handlers); } QueuedAssetRequest request = new QueuedAssetRequest(); request.id = id; request.uri = uri; m_requestQueue.Enqueue(request); } else { handler(id, sender, asset); } return true; }