Execute() public method

Execute the request
public Execute ( ) : HashSet
return HashSet
Esempio n. 1
0
        public bool DearchiveInventory(
            string firstName, string lastName, string invPath, string pass, string loadPath,
            Dictionary <string, object> options)
        {
            UserAccount userInfo = GetUserInfo(firstName, lastName, pass);

            if (userInfo != null)
            {
                InventoryArchiveReadRequest request;
                bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);

                try
                {
                    request = new InventoryArchiveReadRequest(m_registry, userInfo, invPath, loadPath, merge);
                }
                catch (EntryPointNotFoundException e)
                {
                    m_log.ErrorFormat(
                        "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                        + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                    m_log.Error(e);

                    return(false);
                }

                request.Execute(false);

                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        public void DearchiveInventory(string firstName, string lastName, string invPath, string loadPath)
        {
            if (m_scenes.Count > 0)
            {
                CachedUserInfo userInfo = GetUserInfo(firstName, lastName);

                if (userInfo != null)
                {
                    InventoryArchiveReadRequest request =
                        new InventoryArchiveReadRequest(userInfo, invPath, loadPath, CommsManager);
                    UpdateClientWithLoadedNodes(userInfo, request.Execute());
                }
            }
        }
Esempio n. 3
0
        public bool DearchiveInventory(
            string firstName, string lastName, string invPath, string pass, Stream loadStream,
            Dictionary <string, object> options)
        {
            if (m_scenes.Count > 0)
            {
                UserAccount userInfo = GetUserInfo(firstName, lastName, pass);

                if (userInfo != null)
                {
//                    if (CheckPresence(userInfo.PrincipalID))
//                    {
                    InventoryArchiveReadRequest request;
                    bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);

                    try
                    {
                        request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadStream, merge);
                    }
                    catch (EntryPointNotFoundException e)
                    {
                        m_log.ErrorFormat(
                            "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                            + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                        m_log.Error(e);

                        return(false);
                    }

                    UpdateClientWithLoadedNodes(userInfo, request.Execute());

                    return(true);
//                    }
//                    else
//                    {
//                        m_log.ErrorFormat(
//                            "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
//                            userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
//                    }
                }
                else
                {
                    m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found",
                                      firstName, lastName);
                }
            }

            return(false);
        }
Esempio n. 4
0
        public bool DearchiveInventory(
             string firstName, string lastName, string invPath, string pass, string loadPath,
             Dictionary<string, object> options)
        {
            if (m_scenes.Count > 0)
            {
                UserAccount userInfo = GetUserInfo(firstName, lastName, pass);

                if (userInfo != null)
                {
//                    if (CheckPresence(userInfo.PrincipalID))
//                    {
                        InventoryArchiveReadRequest request;
                        bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);

                        try
                        {
                            request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
                        }
                        catch (EntryPointNotFoundException e)
                        {
                            m_log.ErrorFormat(
                                "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                                    + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                            m_log.Error(e);

                            return false;
                        }

                        UpdateClientWithLoadedNodes(userInfo, request.Execute());

                        return true;
//                    }
//                    else
//                    {
//                        m_log.ErrorFormat(
//                            "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
//                            userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
//                    }
                }
            }

            return false;
        }
        /// <summary>
        ///   Use the asset set information at path to load assets
        /// </summary>
        /// <param name = "path"></param>
        /// <param name = "assets"></param>
        protected void LoadLibraries(string iarFileName)
        {
            RegionInfo regInfo = new RegionInfo();
            IScene m_MockScene = null;
            //Make the scene for the IAR loader
            if (m_registry is IScene)
                m_MockScene = (IScene) m_registry;
            else
            {
                m_MockScene = new Scene();
                m_MockScene.Initialize(regInfo);
                m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces());
            }

            UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner);
            //Make the user account for the default IAR
            if (uinfo == null)
            {
                MainConsole.Instance.Warn("Creating user " + m_service.LibraryOwnerName);
                m_MockScene.UserAccountService.CreateUser(m_service.LibraryOwner, m_service.LibraryOwnerName, "", "");
                uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner);
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);
            }
            if (m_MockScene.InventoryService.GetRootFolder(m_service.LibraryOwner) == null)
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);

            List<InventoryFolderBase> rootFolders = m_MockScene.InventoryService.GetFolderFolders(uinfo.PrincipalID,
                                                                                                  UUID.Zero);
#if (!ISWIN)
            bool alreadyExists = false;
            foreach (InventoryFolderBase folder in rootFolders)
            {
                if (folder.Name == iarFileName)
                {
                    alreadyExists = true;
                    break;
                }
            }
#else
            bool alreadyExists = rootFolders.Any(folder => folder.Name == iarFileName);
#endif
            if (alreadyExists)
            {
                MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Found previously loaded iar file {0}, ignoring.", iarFileName);
                return;
            }

            MainConsole.Instance.InfoFormat("[LIBRARY INVENTORY]: Loading iar file {0}", iarFileName);
            InventoryFolderBase rootFolder = m_MockScene.InventoryService.GetRootFolder(uinfo.PrincipalID);

            if (null == rootFolder)
            {
                //We need to create the root folder, otherwise the IAR freaks
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID, false);
            }

            InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName,
                                                                                   false);

            try
            {
                List<InventoryNodeBase> nodes = new List<InventoryNodeBase>(archread.Execute(true));
                if (nodes.Count == 0)
                    return;
                InventoryFolderBase f = (InventoryFolderBase) nodes[0];

                TraverseFolders(nodes[0].ID, m_MockScene);
                //This is our loaded folder
                //Fix the name for later
                f.Name = iarFileName;
                f.ParentID = UUID.Zero;
                //f.Type = (int)AssetType.RootFolder;
                m_MockScene.InventoryService.UpdateFolder(f);
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName,
                                  e.StackTrace);
            }
            finally
            {
                archread.Close();
            }
        }
        public bool DearchiveInventory(string firstName, string lastName, string invPath, string loadPath)
        {
            if (m_scenes.Count > 0)
            {   
                CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
                
                if (userInfo != null)
                {
                    if (CheckPresence(userInfo.UserProfile.ID))
                    {
                        InventoryArchiveReadRequest request = 
                            new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);                
                        UpdateClientWithLoadedNodes(userInfo, request.Execute());

                        return true;
                    }
                    else
                    {
                        m_log.ErrorFormat(
                            "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
                            userInfo.UserProfile.Name, userInfo.UserProfile.ID);
                    }
                }                                         
            }

            return false;
        }           
        /// <summary>
        /// Use the asset set information at path to load assets
        /// </summary>
        /// <param name="path"></param>
        /// <param name="assets"></param>
        protected void LoadLibraries(string iarFileName)
        {
            RegionInfo regInfo = new RegionInfo();
            Scene m_MockScene = null;
            //Make the scene for the IAR loader
            if (m_registry is Scene)
                m_MockScene = (Scene)m_registry;
            else
            {
                m_MockScene = new Scene(regInfo);
                m_MockScene.AddModuleInterfaces(m_registry.GetInterfaces());
            }

            UserAccount uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwner);
            //Make the user account for the default IAR
            if (uinfo == null)
            {
                m_log.Warn("Creating user " + m_service.LibraryOwnerName[0] + " " + m_service.LibraryOwnerName[1]);
                m_MockScene.UserAccountService.CreateUser(m_service.LibraryOwnerName[0],
                    m_service.LibraryOwnerName[1], "", "");
                uinfo = m_MockScene.UserAccountService.GetUserAccount(UUID.Zero, m_service.LibraryOwnerName[0],
                    m_service.LibraryOwnerName[1]);
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID);
            }

            InventoryCollection col = m_MockScene.InventoryService.GetFolderContent(uinfo.PrincipalID, UUID.Zero);
            bool alreadyExists = false;
            foreach (InventoryFolderBase folder in col.Folders)
            {
                if (folder.Name == iarFileName)
                {
                    alreadyExists = true;
                    break;
                }
            }
            if (alreadyExists)
            {
                m_log.InfoFormat("[LIBRARY INVENTORY]: Found previously loaded iar file {0}, ignoring.", iarFileName);
                return;
            }

            m_log.InfoFormat("[LIBRARY INVENTORY]: Loading iar file {0}", iarFileName);
            InventoryFolderBase rootFolder = m_MockScene.InventoryService.GetRootFolder(uinfo.PrincipalID);

            if (null == rootFolder)
            {
                //We need to create the root folder, otherwise the IAR freaks
                m_MockScene.InventoryService.CreateUserInventory(uinfo.PrincipalID);
            }

            InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName, false);

            try
            {
                List<InventoryNodeBase> nodes = new List<InventoryNodeBase>(archread.Execute(true));
                if (nodes.Count == 0)
                    return;
                InventoryFolderImpl f = new InventoryFolderImpl((InventoryFolderBase)nodes[0]);

                TraverseFolders(f, nodes[0].ID, m_MockScene);
                //This is our loaded folder
                //Fix the name for later
                f.Name = iarFileName;
                f.ParentID = UUID.Zero;
                bool update = m_MockScene.InventoryService.UpdateFolder(f);
                m_service.AddToDefaultInventory(f);
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.StackTrace);
            }
            finally
            {
                archread.Close();
            }
        }
Esempio n. 8
0
        protected void LoadLibrariesFromArchives()
        {
            InventoryFolderImpl lib = m_Library.LibraryRootFolder;
            if (lib == null)
            {
                m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module");
                return;
            }

            RegionInfo regInfo = new RegionInfo();
            Scene m_MockScene = new Scene(regInfo);
            LocalInventoryService invService = new LocalInventoryService(lib);
            m_MockScene.RegisterModuleInterface<IInventoryService>(invService);
            m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService);

            UserAccount uinfo = new UserAccount(lib.Owner);
            uinfo.FirstName = "OpenSim";
            uinfo.LastName = "Library";
            uinfo.ServiceURLs = new Dictionary<string, object>();

            foreach (string iarFileName in Directory.GetFiles(pathToLibraries, "*.iar"))
            {
                string simpleName = Path.GetFileNameWithoutExtension(iarFileName);

                m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
                simpleName = GetInventoryPathFromName(simpleName);

                InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, simpleName, iarFileName, false);
                try
                {
                    HashSet<InventoryNodeBase> nodes = archread.Execute();
                    if (nodes != null && nodes.Count == 0)
                    {
                        // didn't find the subfolder with the given name; place it on the top
                        m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
                        archread.Close();
                        archread = new InventoryArchiveReadRequest(m_MockScene.InventoryService, m_MockScene.AssetService, m_MockScene.UserAccountService, uinfo, "/", iarFileName, false);
                        archread.Execute();
                    }

                    foreach (InventoryNodeBase node in nodes)
                        FixPerms(node);
                }
                catch (Exception e)
                {
                    m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.StackTrace);
                }
                finally
                {
                    archread.Close();
                }
            }
        }
Esempio n. 9
0
        protected void LoadLibrariesFromArchives()
        {
            InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot;
            if (lib == null)
            {
                m_log.Debug("[LIBRARY MODULE]: No library. Ignoring Library Module");
                return;
            }

            lib.Name = m_LibraryName;

            RegionInfo regInfo = new RegionInfo();
            Scene m_MockScene = new Scene(regInfo);
            m_MockScene.CommsManager = m_Scene.CommsManager;
            LocalInventoryService invService = new LocalInventoryService((LibraryRootFolder)lib);
            m_MockScene.RegisterModuleInterface<IInventoryService>(invService);
            m_MockScene.RegisterModuleInterface<IAssetService>(m_Scene.AssetService);

            UserProfileData profile = new UserProfileData();
            profile.FirstName = "OpenSim";
            profile.ID = lib.Owner;
            profile.SurName = "Library";
            CachedUserInfo uinfo = new CachedUserInfo(invService, profile);

            foreach (string iarFileName in Directory.GetFiles(pathToLibraries, "*.iar"))
            {
                string simpleName = Path.GetFileNameWithoutExtension(iarFileName);

                m_log.InfoFormat("[LIBRARY MODULE]: Loading library archive {0} ({1})...", iarFileName, simpleName);
                simpleName = GetInventoryPathFromName(simpleName);

                try
                {
                    InventoryArchiveReadRequest archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, simpleName, iarFileName);
                    List<InventoryNodeBase> nodes = archread.Execute();
                    if (nodes.Count == 0)
                    {
                        // didn't find the subfolder with the given name; place it on the top
                        m_log.InfoFormat("[LIBRARY MODULE]: Didn't find {0} in library. Placing archive on the top level", simpleName);
                        archread.Close();
                        archread = new InventoryArchiveReadRequest(m_MockScene, uinfo, "/", iarFileName);
                        archread.Execute();
                    }
                    archread.Close();
                }
                catch (Exception e)
                {
                    m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message);
                }
            }
        }
 public void DearchiveInventory(string firstName, string lastName, string invPath, string loadPath)
 {
     if (m_scenes.Count > 0)
     {   
         CachedUserInfo userInfo = GetUserInfo(firstName, lastName);
         
         if (userInfo != null)
         {
             InventoryArchiveReadRequest request = 
                 new InventoryArchiveReadRequest(userInfo, invPath, loadPath, CommsManager);                
             UpdateClientWithLoadedNodes(userInfo, request.Execute());
         }
     }                
 }
        public bool DearchiveInventory(
             string firstName, string lastName, string invPath, string pass, string loadPath, 
             Dictionary<string, object> options)
        {
            UserAccount userInfo = GetUserInfo(firstName, lastName, pass);

            if (userInfo != null)
            {
                InventoryArchiveReadRequest request;
                bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);

                try
                {
                    request = new InventoryArchiveReadRequest(m_registry, userInfo, invPath, loadPath, merge);
                }
                catch (EntryPointNotFoundException e)
                {
                    m_log.ErrorFormat(
                        "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                            + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                    m_log.Error(e);

                    return false;
                }

                request.Execute(false);

                return true;
            }

            return false;
        }
        public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath)
        {
            if (m_scenes.Count > 0)
            {
                CachedUserInfo userInfo = GetUserInfo(firstName, lastName, pass);
                
                if (userInfo != null)
                {
                    if (CheckPresence(userInfo.UserProfile.ID))
                    {
                        InventoryArchiveReadRequest request;
                        
                        try
                        {
                            request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath);
                        }
                        catch (EntryPointNotFoundException e)
                        {
                            m_log.ErrorFormat(
                                "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
                                    + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
                            m_log.Error(e);

                            return false;
                        }
                        
                        UpdateClientWithLoadedNodes(userInfo, request.Execute());

                        return true;
                    }
                    else
                    {
                        m_log.ErrorFormat(
                            "[INVENTORY ARCHIVER]: User {0} {1} not logged in to this region simulator",
                            userInfo.UserProfile.Name, userInfo.UserProfile.ID);
                    }
                }
            }

            return false;
        }