private void buttonAccept_Click(object sender, EventArgs e)
        {
            // Accept the changes
            this.mReturnDatamover = this.mEditableDatamover;
            this.DialogResult     = DialogResult.OK;

            // Close the dialog
            this.Close();
        }
        private void buttonCancel_Click(object sender, EventArgs e)
        {
            // Reject the changes
            this.mReturnDatamover = null;
            this.DialogResult     = DialogResult.Cancel;

            // Close the dialog
            this.Close();
        }
        public DatamoverConfigurationDialog(Datamover datamover)
        {
            // Create a copy of the original Datamover object to be edited in this form
            this.mEditableDatamover = new Datamover(datamover);

            InitializeComponent();

            this.UpdateUI();

            // Assign the buttons
            this.AcceptButton = this.buttonAccept;
            this.CancelButton = this.buttonCancel;
        }
Example #4
0
        public bool ConsolidateInstances()
        {
            // Get the reference to the SettingsManager
            SettingsManager settingsManager = SettingsManager.Get();

            // Get references to the relevant objects
            Instance  instance  = settingsManager.SelectedInstance;
            Client    client    = settingsManager.GetClientFromSelectedInstance();
            Datamover datamover = settingsManager.GetDatamoverFromSelectedInstance();
            Server    server    = settingsManager.GetServerFromSelectedInstance();

            // Mirror the Instance name to the Client ConfigurationName property
            client.ConfigurationName = instance.Name;

            // Store the IncomingTarget property from the Datamover object in the
            // DatamoveIncomingDir property of the client.
            client.DatamoverIncomingDir = datamover.IncomingTarget;

            // @TODO Anything else?

            return(true);
        }
Example #5
0
        private void buttonDatamoverIncomingFolderEdit_Click(object sender, EventArgs e)
        {
            Datamover datamover = this.mSettingsManager.GetDatamoverFromInstance(this.mSettingsManager.SelectedInstance);

            using (var form = new DatamoverConfigurationDialog(datamover))
            {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    // Get the updated Client
                    Datamover updatedDatamover = form.Result;

                    // Set it
                    this.mSettingsManager.ReplaceDatamoverObjectForInstance(
                        this.mSettingsManager.SelectedInstance,
                        updatedDatamover
                        );

                    // Update the corresponding field
                    this.comboBoxDatamoverIncomingFolder.Text = updatedDatamover.IncomingTarget;
                }
            }
        }
        /// <summary>
        /// Check if the expected tools subdirectories exist in the Installation Dir,
        // otherwise download and configure them.
        /// </summary>
        /// <returns></returns>
        private bool SearchAndPrepareTools()
        {
            // Set an alias to the SettingsManager
            SettingsManager settingsManager = SettingsManager.Get();

            // Send to operations bar
            this.SendToOperations("Look for oBIT tools.", true);

            // Set some flags
            bool downloadAnnotationTool = false;
            bool downloadDatamover      = false;
            bool downloadJRE            = false;

            // Check for the existence of the Annotation Tool
            string annotationToolPath = Path.Combine(
                settingsManager.InstallationDir,
                "obit_annotation_tool"
                );

            if (Directory.Exists(annotationToolPath))
            {
                this.SendToLogAndOutputPane("Annotation Tool found in '" +
                                            annotationToolPath + "'.");
            }
            else
            {
                this.SendToLogAndOutputPane("Annotation Tool not installed yet.");

                // Does the expected archive exist?
                string annotationToolArchiveFileName;
                if (Environment.Is64BitOperatingSystem)
                {
                    annotationToolArchiveFileName = Constants.AnnotationTool64bitArchiveFileName;
                }
                else
                {
                    annotationToolArchiveFileName = Constants.AnnotationTool32bitArchiveFileName;
                }
                if (!File.Exists(Path.Combine(
                                     settingsManager.InstallationDir,
                                     annotationToolArchiveFileName)))
                {
                    downloadAnnotationTool = true;
                }
            }

            // Get the list of Datamover installations
            for (int i = 0; i < settingsManager.NumInstances; i++)
            {
                // Get current Datamover
                Datamover datamover = settingsManager.GetDatamoverFromInstanceWithIndex(i);

                // Does the folder exist?
                string datamoverJSLPath = Path.Combine(
                    settingsManager.InstallationDir,
                    datamover.InstallationSubDir
                    );
                if (Directory.Exists(datamoverJSLPath))
                {
                    this.SendToLogAndOutputPane("Datamover '" + datamover.ServiceName + "' found in '" +
                                                datamoverJSLPath + "'.");
                }
                else
                {
                    this.SendToLogAndOutputPane("Datamover '" + datamover.ServiceName +
                                                "' not installed yet.");
                }
            }

            // Check for the existance of a Java runtime
            string jrePath = Path.Combine(
                settingsManager.InstallationDir,
                "jre"
                );

            if (Directory.Exists(jrePath))
            {
                this.SendToLogAndOutputPane("Java runtime found in '" +
                                            jrePath + "'.");
            }
            else
            {
                this.SendToLogAndOutputPane("Java runtime not found in '" +
                                            settingsManager.InstallationDir + "'.");
            }

            // Process the instances
            for (int i = 0; i < settingsManager.NumInstances; i++)
            {
                // Get the client
                Client client = settingsManager.GetClientFromInstanceWithIndex(i);

                // Check for existance of the
            }

            return(true);
        }
Example #7
0
 /// <summary>
 /// Replace the Datamover for given Instance with a new one.
 /// </summary>
 /// <param name="instance">Instance object.</param>
 /// <param name="updatedDatamover">Datamover object.</param>
 public void ReplaceDatamoverObjectForInstance(Instance instance, Datamover updatedDatamover)
 {
     this.mDatamovers[instance.DatamoverIndex] = updatedDatamover;
 }
Example #8
0
        private State PopulateInstances()
        {
            // Get the list of instances from the Annotation Tool parser
            var configurations = this.mAnnotationToolParser.Configurations;

            int currentInstance = 0;

            // Inform
            foreach (KeyValuePair <string, Dictionary <string, string> > configuration in configurations)
            {
                // Inform
                sLogger.Info("Processing instance '" + configuration.Key + "'.");

                // Create a new Client from the AnnotationTool settings
                Client client = new Client(configuration.Value);

                // Create a Datamover object from the Datamover and DatamoverJSL configurations
                Datamover datamover;
                try
                {
                    datamover = new Datamover(client.DatamoverIncomingDir, this.mDatamoverJSLParser,
                                              this.mDatamoverParser);
                }
                catch (ConfigurationException)
                {
                    // Inform
                    sLogger.Error("Configuration '" + configuration.Key + "' is invalid and will be skipped.");

                    // Skip this configuration.
                    continue;
                }

                // Create a Server object
                Server server;
                try
                {
                    server = new Server(client, this.mDatamoverParser);
                }
                catch (ConfigurationException e)
                {
                    // Inform
                    sLogger.Error("Configuration '" + configuration.Key + "' is invalid and will be skipped.");

                    // Skip this configuration.
                    continue;
                }

                // Add the objects
                this.mClients.Add(client);
                this.mDatamovers.Add(datamover);
                this.mServers.Add(server);

                // Create new instance
                Instance instance = new Instance(client.ConfigurationName, currentInstance, currentInstance, currentInstance);

                // Add to the instance list
                this.mInstances.Add(instance);

                // Update the counter
                currentInstance++;

                // Inform
                sLogger.Info("Created instance '" + configuration.Key + "'.");
            }

            // @TODO Set the proper State
            return(State.OBIT_NOT_INSTALLED);
        }