Ejemplo n.º 1
0
        protected override ModelNode[] Load()
        {
            String strCacheDir = Dapple.MainForm.Settings.CachePath;
            Directory.CreateDirectory(strCacheDir);
            m_oServer = new Server(m_oUri.ToBaseUri(), strCacheDir, DapServerRootModelNode.DAPSecureToken, true);

            if (m_oServer.Status != Server.ServerStatus.OnLine)
            {
                throw new DapException("Server is " + m_oServer.Status.ToString());
            }

            m_oServer.GetDatasetCount(m_oModel.SearchBounds_DAP, m_oModel.SearchKeyword);

            DapBrowserMapModelNode oBrowserMap = new DapBrowserMapModelNode(m_oModel, m_oServer);
            m_blBrowserMapAvailable = oBrowserMap.PassesFilter;

            m_strTitle = m_oServer.Name;
            m_blEntireCatalogMode = m_oServer.MajorVersion < 6 || (m_oServer.MajorVersion == 6 && m_oServer.MinorVersion < 3);

            List<ModelNode> result = new List<ModelNode>();

            if (DisplayBrowserMap)
            {
                result.Add(oBrowserMap);
            }

            String strEdition;
            CatalogFolder folder = null;

            // --- Make three attempts to get the catalog hierarchy root ---
            for (int attempt = 0; attempt < 3; attempt++)
            {
                folder = s_oCCM.GetCatalogHierarchyRoot(m_oServer, m_oModel.SearchBounds_DAP, m_oModel.SearchBoundsSet, m_oModel.SearchKeywordSet, m_oModel.SearchKeyword, out m_blEntireCatalogMode, out strEdition);
                if (folder != null) break;
                Thread.Sleep(5000);
            }
            if (folder == null) throw new Exception("Catalog hierarchy root was inaccessible. Try refreshing the server.");

            foreach (CatalogFolder oSubFolder in folder.Folders)
                result.Add(new DapDirectoryModelNode(m_oModel, oSubFolder));

            while (!DapServerModelNode.s_oCCM.bGetDatasetList(m_oServer, folder.Hierarchy, folder.Timestamp, m_oModel.SearchBounds_DAP, m_oModel.SearchBoundsSet, m_oModel.SearchKeywordSet, m_oModel.SearchKeyword))
            { }

            FolderDatasetList oDatasets = DapServerModelNode.s_oCCM.GetDatasets(m_oServer, folder, m_oModel.SearchBounds_DAP, m_oModel.SearchBoundsSet, m_oModel.SearchKeywordSet, m_oModel.SearchKeyword);
            if (oDatasets == null) throw new Exception("Dataset list was inaccessible. Try refreshing the server.");

            foreach (DataSet oDataset in oDatasets.Datasets)
                result.Add(new DapDatasetModelNode(m_oModel, oDataset));

            return result.ToArray();
        }
Ejemplo n.º 2
0
        protected override ModelNode[] Load()
        {
            String strCacheDir = Dapple.MainForm.Settings.CachePath;

            Directory.CreateDirectory(strCacheDir);
            m_oServer = new Server(m_oUri.ToBaseUri(), strCacheDir, DapServerRootModelNode.DAPSecureToken, true);

            if (m_oServer.Status != Server.ServerStatus.OnLine)
            {
                throw new DapException("Server is " + m_oServer.Status.ToString());
            }

            m_oServer.GetDatasetCount(m_oModel.SearchBounds_DAP, m_oModel.SearchKeyword);

            DapBrowserMapModelNode oBrowserMap = new DapBrowserMapModelNode(m_oModel, m_oServer);

            m_blBrowserMapAvailable = oBrowserMap.PassesFilter;

            m_strTitle            = m_oServer.Name;
            m_blEntireCatalogMode = m_oServer.MajorVersion < 6 || (m_oServer.MajorVersion == 6 && m_oServer.MinorVersion < 3);

            List <ModelNode> result = new List <ModelNode>();

            if (DisplayBrowserMap)
            {
                result.Add(oBrowserMap);
            }

            String        strEdition;
            CatalogFolder folder = null;

            // --- Make three attempts to get the catalog hierarchy root ---
            for (int attempt = 0; attempt < 3; attempt++)
            {
                folder = s_oCCM.GetCatalogHierarchyRoot(m_oServer, m_oModel.SearchBounds_DAP, m_oModel.SearchBoundsSet, m_oModel.SearchKeywordSet, m_oModel.SearchKeyword, out m_blEntireCatalogMode, out strEdition);
                if (folder != null)
                {
                    break;
                }
                Thread.Sleep(5000);
            }
            if (folder == null)
            {
                throw new Exception("Catalog hierarchy root was inaccessible. Try refreshing the server.");
            }

            foreach (CatalogFolder oSubFolder in folder.Folders)
            {
                result.Add(new DapDirectoryModelNode(m_oModel, oSubFolder));
            }

            while (!DapServerModelNode.s_oCCM.bGetDatasetList(m_oServer, folder.Hierarchy, folder.Timestamp, m_oModel.SearchBounds_DAP, m_oModel.SearchBoundsSet, m_oModel.SearchKeywordSet, m_oModel.SearchKeyword))
            {
            }

            FolderDatasetList oDatasets = DapServerModelNode.s_oCCM.GetDatasets(m_oServer, folder, m_oModel.SearchBounds_DAP, m_oModel.SearchBoundsSet, m_oModel.SearchKeywordSet, m_oModel.SearchKeyword);

            if (oDatasets == null)
            {
                throw new Exception("Dataset list was inaccessible. Try refreshing the server.");
            }

            foreach (DataSet oDataset in oDatasets.Datasets)
            {
                result.Add(new DapDatasetModelNode(m_oModel, oDataset));
            }

            return(result.ToArray());
        }