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 virtual AssetBase Get(string id)
        {
            AssetBase asset = null;

            if (m_Cache != null)
            {
                if (!m_Cache.Get(id, out asset))
                {
                    return(null);
                }
            }

            if (asset == null && m_ServerURI != null)
            {
                string uri = m_ServerURI + "/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 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);
        }
Ejemplo n.º 4
0
        public AssetBase Get(string id)
        {
            //m_log.DebugFormat("[HG ASSET CONNECTOR]: Get {0}", id);
            AssetBase asset = null;

            if (IsHG(id))
            {
                asset = GetForeign(id);
                if (asset != null)
                {
                    // Now store it locally, if allowed
                    if (m_AssetPerms != null && !m_AssetPerms.AllowedImport(asset.Type))
                    {
                        return(null);
                    }
                    Store(asset);
                }
            }
            else
            {
                if (m_Cache != null)
                {
                    if (!m_Cache.Get(id, out asset))
                    {
                        return(null);
                    }
                    if (asset != null)
                    {
                        return(asset);
                    }
                }
                asset = GetFromLocal(id);
                if (m_Cache != null)
                {
                    if (asset == null)
                    {
                        m_Cache.CacheNegative(id);
                    }
                    else
                    {
                        m_Cache.Cache(asset);
                    }
                }
            }
            return(asset);
        }
Ejemplo n.º 5
0
        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);
        }