コード例 #1
0
ファイル: GpHelper.cs プロジェクト: k4th/geoportal-server
 /// <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;
 }
コード例 #2
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);
            }
        }
コード例 #3
0
ファイル: PublishForm.cs プロジェクト: k4th/geoportal-server
 /// <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();
     }
 }
コード例 #4
0
 /// <summary>
 /// Publication request constructor
 /// </summary>
 /// <param name="param"></param>
 public PublicationRequest(PublicationParams param)
 {
     parameters = param;
 }