Exemple #1
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);
            }
        }
Exemple #2
0
 /// <summary>
 /// Saves publications parameters
 /// </summary>
 private void saveSettings()
 {
     if (us != null)
     {
         PublicationParams parameters = new PublicationParams();
         parameters.Password  = txtPassword.Text.Trim();
         parameters.UserName  = txtUsername.Text.Trim();
         parameters.ServerUrl = txtServer.Text.Trim();
         parameters.Service   = txtService.Text.Trim();
         us.Params            = parameters;
         us.updateUserSettingsFile();
     }
 }
Exemple #3
0
        /// <summary>
        /// Returns an instantiated MDPublisher geoprocessing tool with input
        /// and output parameters set to the specified values.
        /// param name="inFile" the input file
        /// param name="mdFileID" a file identifier (like source uri)
        /// param name="param" the publication parameters
        /// </summary>
        static public MDPublisher xmlPublisher(string inFile, string mdFileID, PublicationParams param)
        {
            // Instantiate the geoprocessing tool and define its parameters
            // Usage: MDPublisher_conversion <source> <publisher> <url> <service> <user> <password>
            MDPublisher mdPublisher = new MDPublisher();

            mdPublisher.source    = inFile;
            mdPublisher.publisher = param.CurrentWorkDir;
            mdPublisher.url       = param.ServerUrl;
            mdPublisher.service   = param.Service + ":EB:" + mdFileID;
            mdPublisher.user      = param.UserName;
            mdPublisher.password  = param.Password;
            return(mdPublisher);
        }
Exemple #4
0
 /// <summary>
 /// Publication request constructor
 /// </summary>
 /// <param name="param"></param>
 public PublicationRequest(PublicationParams param)
 {
     parameters = param;
 }
Exemple #5
0
 /// <summary>
 /// Returns an instantiated MDPublisher geoprocessing tool with input
 /// and output parameters set to the specified values.
 /// param name="inFile" the input file
 /// param name="mdFileID" a file identifier (like source uri)
 /// param name="param" the publication parameters
 /// </summary>
 static public MDPublisher xmlPublisher(string inFile, string mdFileID, PublicationParams param)
 {
   
     // Instantiate the geoprocessing tool and define its parameters
     // Usage: MDPublisher_conversion <source> <publisher> <url> <service> <user> <password>
     MDPublisher mdPublisher = new MDPublisher();
     mdPublisher.source = inFile;
     mdPublisher.publisher = param.CurrentWorkDir;
     mdPublisher.url = param.ServerUrl;
     mdPublisher.service = param.Service + ":EB:" + mdFileID;
     mdPublisher.user = param.UserName;
     mdPublisher.password = param.Password;
     return mdPublisher;
 }
Exemple #6
0
 /// <summary>
 /// Saves publications parameters
 /// </summary>
 private void saveSettings()
 {
     if (us != null)
     {
         PublicationParams parameters = new PublicationParams();
         parameters.Password = txtPassword.Text.Trim();
         parameters.UserName = txtUsername.Text.Trim();
         parameters.ServerUrl = txtServer.Text.Trim();
         parameters.Service = txtService.Text.Trim();
         us.Params = parameters;
         us.updateUserSettingsFile();
     }
 }
Exemple #7
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;
                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);
            }
        }
 /// <summary>
 /// Publication request constructor
 /// </summary>
 /// <param name="param"></param>
 public PublicationRequest(PublicationParams param)
 {
     parameters = param;
 }