コード例 #1
0
 /// <summary>
 /// Recursively Publish metadata documents associated to a container
 /// </summary>
 /// <param name="item">The GxObject object</param>
 /// <param name="pr">The publication request object</param>
 private void publishMetadata(IGxObject item, PublicationRequest pr)
 {
     if (item is IGxObjectContainer && !item.Category.Trim().ToLower().StartsWith("arcgis server"))
     {
         IGxObjectContainer container = (IGxObjectContainer)item;
         IEnumGxObject      children  = container.Children;
         if (children == null)
         {
             writeResults(pr.publish(item));
             return;
         }
         IGxObject child = children.Next();
         while (child != null)
         {
             publishMetadata(child, pr);
             child = children.Next();
         }
     }
     else
     {
         if (item is IMetadata)
         {
             writeResults(pr.publish(item));
         }
         else
         {
             writeResults(pr.publish(item, pr.makeAgsUrl(item)));
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Method to initiate publication request
        /// </summary>
        private void publish()
        {
            displayLogsTxtBox.Text = "";
            PublicationParams parameters = new PublicationParams();

            parameters.Password       = txtPassword.Text.Trim();
            parameters.UserName       = txtUsername.Text.Trim();
            parameters.ServerUrl      = txtServer.Text.Trim();
            parameters.Service        = txtService.Text.Trim();
            parameters.LogFilePath    = logFilePath;
            parameters.CurrentWorkDir = workDirectory;
            us.Params = parameters;
            System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
            pr = new PublicationRequest(parameters);
            pr.determineEndPoint();
            try
            {
                IGxApplication catalog = null;

                if (ArcCatalog.Application != null)
                {
                    catalog = (IGxApplication)ArcCatalog.Application;
                }

                if (ArcMap.Application != null)
                {
                    catalog = (IGxApplication)ArcMap.Application;
                }
                IGxObject pGxObject      = catalog.Catalog.SelectedObject;
                String    category       = pGxObject.Category;
                String    parentCategory = pGxObject.Parent.Category;

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("************ Metadata Publishing started at   " + System.DateTime.Now + " ************");
                sb.AppendLine("Publication Parameters ");
                sb.AppendLine("============================================================");
                sb.AppendLine("Metadata Server Url           : " + parameters.ServerUrl);
                sb.AppendLine("Publish Metadata Service Name : " + parameters.Service);
                sb.AppendLine("Selected Workspace Name       : " + pGxObject.FullName);
                sb.AppendLine("Selected container category   : " + category);
                sb.AppendLine("============================================================");
                writeLogs(sb.ToString());

                publishMetadata(pGxObject, pr);

                //sb.AppendLine(displayLogsTxtBox.Text);
                writeLogs("************ Metadata Publishing completed at " + System.DateTime.Now + " ************");
                saveSettings();
                System.Windows.Forms.Cursor.Current = Cursors.Default;
                ShowSuccessMessageBox(StringMessages.PublishSuccessMsg + " " + logFilePath + StringMessages.LogFilePath);
            }
            catch (Exception ex)
            {
                PublishForm.ShowErrorMessageBox(StringMessages.PublishFailureMsg + " " + logFilePath + StringMessages.LogFilePath);
            }
        }
コード例 #3
0
ファイル: PublishForm.cs プロジェクト: k4th/geoportal-server
 /// <summary>
 /// Recursively Publish metadata documents associated to a container
 /// </summary>
 /// <param name="item">The GxObject object</param>
 /// <param name="pr">The publication request object</param>
 private void publishMetadata(IGxObject item, PublicationRequest pr)
 {
     if (item is IGxObjectContainer && !item.Category.Trim().ToLower().StartsWith("arcgis server"))
     {
         IGxObjectContainer container = (IGxObjectContainer)item;
         IEnumGxObject children = container.Children;
         if (children == null)
         {
             writeResults(pr.publish(item));
             return;
         }
         IGxObject child = children.Next();
         while (child != null)
         {
             publishMetadata(child, pr);
             child = children.Next();
         }
     }
     else
     {
         if (item is IMetadata)
         {                    
             writeResults(pr.publish(item));
         }
         else
         {
             writeResults(pr.publish(item, pr.makeAgsUrl(item)));
         }
     }
 }
コード例 #4
0
ファイル: PublishForm.cs プロジェクト: k4th/geoportal-server
        /// <summary>
        /// Method to initiate publication request
        /// </summary>
        private void publish()
        {
            displayLogsTxtBox.Text = "";              
            PublicationParams parameters = new PublicationParams();
            parameters.Password = txtPassword.Text.Trim();
            parameters.UserName = txtUsername.Text.Trim();
            parameters.ServerUrl = txtServer.Text.Trim();
            parameters.Service = txtService.Text.Trim();
            parameters.LogFilePath = logFilePath;
            parameters.CurrentWorkDir = workDirectory;
            us.Params = parameters;
            System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
            pr = new PublicationRequest(parameters);
            pr.determineEndPoint();
            try
            {
                IGxApplication catalog = null;
                IGxViewContainer viewContainer = null;
                if (ArcCatalog.Application != null)
                {
                    catalog = (IGxApplication)ArcCatalog.Application;
                    /*viewContainer = (IGxViewContainer)ArcCatalog.Application;
                    IEnumGxView views = viewContainer.Views;
                    IGxView gxView = views.Next();
                    while (gxView != null)
                    {
                        gxView = views.Next();
                    }*/

                }

                if (ArcMap.Application != null)
                {
                    catalog = (IGxApplication)ArcMap.Application;
                } 
                                                           
                IGxObject pGxObject = catalog.Catalog.SelectedObject;
                String category = pGxObject.Category;
                String parentCategory = pGxObject.Parent.Category;

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("************ Metadata Publishing started at   " + System.DateTime.Now + " ************");
                sb.AppendLine("Publication Parameters ");
                sb.AppendLine("============================================================");
                sb.AppendLine("Metadata Server Url           : " + parameters.ServerUrl);
                sb.AppendLine("Publish Metadata Service Name : " + parameters.Service);
                sb.AppendLine("Selected Workspace Name       : " + pGxObject.FullName);
                sb.AppendLine("Selected container category   : " + category);
                sb.AppendLine("============================================================");
                writeLogs(sb.ToString());
           
                publishMetadata(pGxObject, pr);

                //sb.AppendLine(displayLogsTxtBox.Text);
                writeLogs("************ Metadata Publishing completed at " + System.DateTime.Now + " ************");                
                saveSettings();
                System.Windows.Forms.Cursor.Current = Cursors.Default;
                ShowSuccessMessageBox(StringMessages.PublishSuccessMsg + " " + logFilePath + StringMessages.LogFilePath);

            }
            catch (Exception ex)
            {
                PublishForm.ShowErrorMessageBox(StringMessages.PublishFailureMsg + " " + logFilePath + StringMessages.LogFilePath);
            }
        }