public AssetBase Get(string id) { AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(null); } } if (asset == null || asset.Data == null || asset.Data.Length == 0) { string uri = MapServer(id) + "/assets/" + id; asset = SynchronousRestObjectRequester.MakeRequest <int, AssetBase>("GET", uri, 0, m_Auth); if (m_Cache != null) { if (asset != null) { m_Cache.Cache(asset); } else { m_Cache.CacheNegative(id); } } } return(asset); }
public AssetBase GetCached(string id) { AssetBase asset = null; if (m_Cache != null) { m_Cache.Get(id, out asset); } return(asset); }
public static OSD ToOSD(WearableCacheItem[] pcacheItems, IAssetCache dataCache) { OSDArray arr = new OSDArray(); foreach (WearableCacheItem item in pcacheItems) { OSDMap itemmap = new OSDMap(); itemmap.Add("textureindex", OSD.FromUInteger(item.TextureIndex)); itemmap.Add("cacheid", OSD.FromUUID(item.CacheId)); itemmap.Add("textureid", OSD.FromUUID(item.TextureID)); if (dataCache != null) { if (dataCache.Check(item.TextureID.ToString())) { AssetBase assetItem; dataCache.Get(item.TextureID.ToString(), out assetItem); if (assetItem != null) { itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); itemmap.Add("assetcreator", OSD.FromString(assetItem.CreatorID)); itemmap.Add("assetname", OSD.FromString(assetItem.Name)); } } } arr.Add(itemmap); } return(arr); }
public virtual bool UpdateContent(string id, byte[] data) { if (m_ServerURI == null) { return(false); } AssetBase asset = null; m_Cache?.Get(id, out asset); if (asset == null) { AssetMetadata metadata = GetMetadata(id); if (metadata == null) { return(false); } asset = new AssetBase(metadata.FullID, metadata.Name, metadata.Type, UUID.Zero.ToString()); asset.Metadata = metadata; } asset.Data = data; string uri = m_ServerURI + "/assets/" + id; if (SynchronousRestObjectRequester.MakeRequest <AssetBase, bool>("POST", uri, asset, m_Auth)) { m_Cache?.Cache(asset, true); return(true); } return(false); }
public AssetBase Get(string id) { AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(null); } } if (asset == null) { asset = m_AssetService.Get(id); if (m_Cache != null) { if (asset != null) { m_Cache.Cache(asset); } else { m_Cache.CacheNegative(id); } } //if (null == asset) // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id); } return(asset); }
public AssetBase Get(string id) { // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Synchronously requesting asset {0}", id); AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(null); } } if (asset == null) { asset = m_AssetService.Get(id); if ((m_Cache != null) && (asset != null)) { m_Cache.Cache(asset); } // if (null == asset) // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id); } return(asset); }
public AssetBase Get(string id) { 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; if (!m_cache.Get(id, out asset)) { return(null); } if (asset != null) { return(asset); } } return(SimianGetOperation(id)); }
public AssetBase Get(string id) { //m_log.DebugFormat("[HG ASSET CONNECTOR]: Get {0}", id); AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(null); } if (asset != null) { return(asset); } } if (IsHG(id)) { asset = m_HGService.Get(id); if (asset != null) { // Now store it locally, if allowed if (m_AssetPerms.AllowedImport(asset.Type)) { m_GridService.Store(asset); } else { return(null); } } } else { asset = m_GridService.Get(id); } if (m_Cache != null) { m_Cache.Cache(asset); } return(asset); }
public AssetBase Get(string id) { string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) { if (!m_Cache.Get(id, out asset)) { return(null); } } if (asset == null || asset.Data == null || asset.Data.Length == 0) { // XXX: Commented out for now since this has either never been properly operational or not for some time // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. // Wasn't noticed before because timeout wasn't actually used. // Not attempting concurrency setting for now as this omission was discovered in release candidate // phase for OpenSimulator 0.8. Need to revisit afterwards. // asset // = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>( // "GET", uri, 0, m_maxAssetRequestConcurrency); asset = SynchronousRestObjectRequester.MakeRequest <int, AssetBase>("GET", uri, 0, m_Auth); if (m_Cache != null) { if (asset != null) { m_Cache.Cache(asset); } else { m_Cache.CacheNegative(id); } } } return(asset); }