예제 #1
0
        // TODO: unused
        // private void Dump(Dictionary<UUID, bool> lst)
        // {
        //     m_log.Debug("XXX -------- UUID DUMP ------- XXX");
        //     foreach (KeyValuePair<UUID, bool> kvp in lst)
        //         m_log.Debug(" >> " + kvp.Key + " (texture? " + kvp.Value + ")");
        //     m_log.Debug("XXX -------- UUID DUMP ------- XXX");
        // }

        #endregion


        #region Public interface

        public void Get(UUID assetID, UUID ownerID)
        {
            if (!IsLocalUser(ownerID))
            {
                // Get the item from the remote asset server onto the local AssetCache
                // and place an entry in m_assetMap

                string userAssetURL = UserAssetURL(ownerID);
                if (userAssetURL != null)
                {
                    m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL);
                    AssetBase asset = FetchAsset(userAssetURL, assetID);

                    if (asset != null)
                    {
                        m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL);

                        // OK, now fetch the inside.
                        Dictionary <UUID, int> ids          = new Dictionary <UUID, int>();
                        HGUuidGatherer         uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
                        uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
                        foreach (UUID uuid in ids.Keys)
                        {
                            FetchAsset(userAssetURL, uuid);
                        }
                    }
                    else
                    {
                        m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
                    }
                }
                else
                {
                    m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
                }
            }
        }
예제 #2
0
        //public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
        //{
        //    InventoryClient invCli = null;
        //    string inventoryURL = UserInventoryURL(item.Owner);
        //    if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
        //    {
        //        m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
        //        invCli = new InventoryClient(inventoryURL);
        //        m_inventoryServers.Add(inventoryURL, invCli);
        //    }

        //    item = invCli.GetInventoryItem(item);
        //    if (item != null)
        //    {
        //        // Change the folder, stick it in root folder, all items flattened out here in this region cache
        //        item.Folder = rootFolder;
        //        //userInfo.AddItem(item); don't use this, it calls back to the inventory server
        //        lock (userInfo.RootFolder.Items)
        //        {
        //            userInfo.RootFolder.Items[item.ID] = item;
        //        }

        //    }
        //    return item;
        //}

        public void Post(UUID assetID, UUID ownerID)
        {
                // Post the item from the local AssetCache onto the remote asset server
                // and place an entry in m_assetMap

            string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
            if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
            {
                m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
                AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
                if (asset != null)
                {
                    Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
                    HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
                    uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
                    foreach (UUID uuid in ids.Keys)
                    {
                        asset = m_scene.AssetService.Get(uuid.ToString());
                        if (asset == null)
                            m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
                        else
                            PostAsset(userAssetURL, asset);
                    }

                     // maybe all pieces got there...
                    m_log.DebugFormat("[HGScene]: Successfully posted item {0} to asset server {1}", assetID, userAssetURL);

                }
                else
                    m_log.DebugFormat("[HGScene]: Something wrong with asset {0}, it could not be found", assetID);
            }
            else
                m_log.Debug("[HGScene]: user's asset server is local region's asset server");

        }
예제 #3
0
        // TODO: unused
        // private void Dump(Dictionary<UUID, bool> lst)
        // {
        //     m_log.Debug("XXX -------- UUID DUMP ------- XXX");
        //     foreach (KeyValuePair<UUID, bool> kvp in lst)
        //         m_log.Debug(" >> " + kvp.Key + " (texture? " + kvp.Value + ")");
        //     m_log.Debug("XXX -------- UUID DUMP ------- XXX");
        // }

        #endregion


        #region Public interface

        public void Get(UUID assetID, UUID ownerID)
        {
            // Get the item from the remote asset server onto the local AssetCache
            // and place an entry in m_assetMap

            string userAssetURL = HyperlinkAssets.GetUserAssetServer(ownerID);
            if ((userAssetURL != string.Empty) && (userAssetURL != HyperlinkAssets.GetSimAssetServer()))
            {
                m_log.Debug("[HGScene]: Fetching object " + assetID + " from asset server " + userAssetURL);
                AssetBase asset = FetchAsset(userAssetURL, assetID); 

                if (asset != null)
                {
                    // OK, now fetch the inside.
                    Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
                    HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
                    uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
                    foreach (UUID uuid in ids.Keys)
                        FetchAsset(userAssetURL, uuid);

                    m_log.DebugFormat("[HGScene]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL);

                }
                else
                    m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
            }
            else
                m_log.Debug("[HGScene]: user's asset server is the local region's asset server");
        }
예제 #4
0
        public void Post(UUID assetID, UUID ownerID)
        {
            if (!IsLocalUser(ownerID))
            {
                // Post the item from the local AssetCache onto the remote asset server
                // and place an entry in m_assetMap

                string userAssetURL = UserAssetURL(ownerID);
                if (userAssetURL != null)
                {
                    m_log.Debug("[HGScene]: Posting object " + assetID + " to asset server " + userAssetURL);
                    AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
                    if (asset != null)
                    {
                        Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
                        HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
                        uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
                        foreach (UUID uuid in ids.Keys)
                        {
                            asset = m_scene.AssetService.Get(uuid.ToString());
                            if (asset != null)
                                m_log.DebugFormat("[HGScene]: Posting {0} {1}", asset.Type.ToString(), asset.Name);
                            else
                                m_log.DebugFormat("[HGScene]: Could not find asset {0}", uuid);
                            PostAsset(userAssetURL, asset);
                        }

                        if (ids.Count > 0) // maybe it succeeded...
                            m_log.DebugFormat("[HGScene]: Successfully posted item {0} to remote asset server {1}", assetID, userAssetURL);
                        else
                            m_log.WarnFormat("[HGScene]: Could not post asset {0} to remote asset server {1}", assetID, userAssetURL);

                    }
                    else
                        m_log.Debug("[HGScene]: Something wrong with asset, it could not be found");
                }
                else
                    m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");

            }
        }
예제 #5
0
        // TODO: unused
        // private void Dump(Dictionary<UUID, bool> lst)
        // {
        //     m_log.Debug("XXX -------- UUID DUMP ------- XXX");
        //     foreach (KeyValuePair<UUID, bool> kvp in lst)
        //         m_log.Debug(" >> " + kvp.Key + " (texture? " + kvp.Value + ")");
        //     m_log.Debug("XXX -------- UUID DUMP ------- XXX");
        // }

        #endregion


        #region Public interface

        public void Get(UUID assetID, UUID ownerID)
        {
            if (!IsLocalUser(ownerID))
            {
                // Get the item from the remote asset server onto the local AssetCache
                // and place an entry in m_assetMap

                string userAssetURL = UserAssetURL(ownerID);
                if (userAssetURL != null)
                {
                    m_log.Debug("[HGScene]: Fetching object " + assetID + " to asset server " + userAssetURL);
                    AssetBase asset = FetchAsset(userAssetURL, assetID); 

                    if (asset != null)
                    {
                        m_log.Debug("[HGScene]: Successfully fetched item from remote asset server " + userAssetURL);

                        // OK, now fetch the inside.
                        Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
                        HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
                        uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
                        foreach (UUID uuid in ids.Keys)
                            FetchAsset(userAssetURL, uuid);
                    }
                    else
                        m_log.Warn("[HGScene]: Could not fetch asset from remote asset server " + userAssetURL);
                }
                else
                    m_log.Warn("[HGScene]: Unable to locate foreign user's asset server");
            }
        }