/// <summary> /// Set the relevant settings from the DatamoverJSLSettingsParser object. /// </summary> /// <param name="key">Key of the DatamoverJSLSettingsParser map.</param> /// <param name="datamoverJSLSettingsParser">DatamoverJSLSettingsParser object.</param> private void Fill(string key, DatamoverJSLSettingsParser datamoverJSLSettingsParser) { this.AppName = datamoverJSLSettingsParser.Get(key, "service", "appname"); this.ServiceName = datamoverJSLSettingsParser.Get(key, "service", "servicename"); this.DisplayName = datamoverJSLSettingsParser.Get(key, "service", "displayname"); this.ServiceDescription = datamoverJSLSettingsParser.Get(key, "service", "servicedescription"); //this.DataStoreServerLocalPrivateKeyPath = string.Empty; this.LocalUserAccount = datamoverJSLSettingsParser.Get(key, "service", "account"); }
/// <summary> /// Private constructor. /// </summary> private SettingsManager() { // Initialize application state this.ApplicationState = State.OBIT_NOT_INSTALLED; // Initialize all lists this.mInstances = new List <Instance>(); this.mClients = new List <Client>(); this.mDatamovers = new List <Datamover>(); this.mServers = new List <Server>(); // Load (if possible, otherwise instantiate with default values) // the oBIT Manager Application Settings this.mManagerParser = new ManagerSettingsParser(); // Load (if possible, otherwise instantiate with default values) // the AnnotationTool Settings this.mAnnotationToolParser = new AnnotationToolSettingsParser(); // Load (if possible, otherwise instantiate with default values) // the Datamover JSL Settings this.mDatamoverJSLParser = new DatamoverJSLSettingsParser( this.mManagerParser.InstallationDir, this.mManagerParser.DatamoverRelativeDirList ); // Load (if possible, otherwise instantiate with default values) // the Datamover Settings this.mDatamoverParser = new DatamoverSettingsParser( this.mManagerParser.InstallationDir, this.mManagerParser.DatamoverRelativeDirList ); // If needed, update the relative DatamoverJSL directories this.mManagerParser.DatamoverRelativeDirList = this.mDatamoverJSLParser.GetRelativeDatamoverJSLDirs(); // Populate the instances and update the state this.ApplicationState = this.PopulateInstances(); // Set the first instance to be the selected one this.mSelectedInstanceIndex = 0; }
/// <summary> /// Alternative constructor. /// </summary> /// <param name="datamoverInstallationSubDir">Datamover installation subdirectory (relative to the oBIT installation directory.</param> /// <param name="DatamoverIncomingDir">Datamover incoming directory.</param> /// <param name="datamoverJslSettingsParser">A DatamoverJSLSettingsParser object.</param> /// <param name="datamoverSettingsParser">A DatamoverSettingsParser object.</param> public Datamover( string datamoverIncomingDir, DatamoverJSLSettingsParser datamoverJslSettingsParser, DatamoverSettingsParser datamoverSettingsParser) { // First, find the Datamover configuration that fits the client string datamoverJSLPath = ""; foreach (string key in datamoverSettingsParser.Configurations) { string path1 = datamoverSettingsParser.Get(key, "incoming-target"); if (path1 != null) { string path2 = datamoverIncomingDir; if (FileSystem.ComparePaths(path1, path2)) { // Found the correct setting; fill the values Fill(key, datamoverSettingsParser); // Store the path datamoverJSLPath = key; // Inform sLogger.Info("Processed Datamover configuration file from Datamover JSL parent folder '" + datamoverJSLPath + "'."); break; } } } // If we could not find the expected DatamoverJSL configuration that fits the client, // something is wrong in the configuration files. if (datamoverJSLPath.Equals("")) { string msg = "No known Datamover JSL configuration uses the incoming folder '" + datamoverIncomingDir + "'."; sLogger.Error(msg); throw new ConfigurationException(msg); } // Keep track of whether we find the DatamoverJSL configuration bool found = false; // Find the DatamoverJSL configuration that fits the client foreach (string key in datamoverJslSettingsParser.GetRelativeDatamoverJSLDirs()) { if (FileSystem.ComparePaths(key, datamoverJSLPath)) { // Found the correct setting; fill the values Fill(key, datamoverJslSettingsParser); // Inform sLogger.Info("Processed Datamover JSL configuration file from folder '" + key + "'."); // Set found to true found = true; break; } } if (!found) { string msg = "No known Datamover JSL configuration uses the incoming folder '" + datamoverIncomingDir + "'."; sLogger.Error(msg); throw new ConfigurationException(msg); } }