public override void Connect(IReadOnlyCollection <Component> instanceComponents) { Logger.Instance.Log(LogLevel.Info, "\nConfiguring components ({0}, {1}, {2}, {3}) to work with component({4}):\n", ESAgentComponentId, ESIndexComponentId, ESZookeeperComponentId, ESFileProcessorComponentId, DatabaseComponentId); ESAgentComponent esAgent = instanceComponents.Single(c => c.Id == ESAgentComponentId) as ESAgentComponent; ESIndexComponent esIndex = instanceComponents.Single(c => c.Id == ESIndexComponentId) as ESIndexComponent; ESZooKeeperComponent esZooKeeper = instanceComponents.Single(c => c.Id == ESZookeeperComponentId) as ESZooKeeperComponent; ESFileProcessorComponent esFileProcessor = instanceComponents.Single(c => c.Id == ESFileProcessorComponentId) as ESFileProcessorComponent; DatabaseComponent databaseComponent = instanceComponents.Single(c => c.Id == DatabaseComponentId) as DatabaseComponent; DropSolrIndex(esIndex); string serviceNameXPath = "/configuration/ServiceName"; esFileProcessor.ServiceName = FileSystemFactory.GetFileSystem(esFileProcessor.ServerName).XmlHelper.XmlPeek(esFileProcessor.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esFileProcessor.ServerName, esFileProcessor.ServiceName); esAgent.ServiceName = FileSystemFactory.GetFileSystem(esAgent.ServerName).XmlHelper.XmlPeek(esAgent.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esAgent.ServerName, esAgent.ServiceName); esIndex.ServiceName = FileSystemFactory.GetFileSystem(esIndex.ServerName).XmlHelper.XmlPeek(esIndex.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esIndex.ServerName, esIndex.ServiceName); esZooKeeper.ServiceName = FileSystemFactory.GetFileSystem(esZooKeeper.ServerName).XmlHelper.XmlPeek(esZooKeeper.PathToConfig, serviceNameXPath); WindowsServiceHelper.StopService(esZooKeeper.ServerName, esZooKeeper.ServiceName); //Wait Until services are stopped for 30 seconds Thread.Sleep(30000); HttpServerConnection connection = IomFactory.CreateHttpServerConnection(databaseComponent.InnovatorUrl, databaseComponent.DatabaseName, databaseComponent.LoginOfRootInnovatorUser, databaseComponent.PasswordOfRootInnovatorUser.Value); try { connection.Login(); Innovator innovator = new Innovator(connection); EditVariable(innovator, "ES_SolrUrl", esIndex.ESAIClusterUrl); EditVariable(innovator, "ES_AIClusterUrl", esIndex.ESAIClusterUrl); EditCryptoPwd(innovator, esAgent); } finally { connection.Logout(); } UpdateESZooKeeperServiceConfig(esZooKeeper, databaseComponent); WindowsServiceHelper.StartService(esZooKeeper.ServerName, esZooKeeper.ServiceName); UpdateESIndexServiceConfig(esIndex, databaseComponent); WindowsServiceHelper.StartService(esIndex.ServerName, esIndex.ServiceName); UpdateESAgentServiceConfig(esAgent, databaseComponent); WindowsServiceHelper.StartService(esAgent.ServerName, esAgent.ServiceName); UpdateESFileProcessorServiceConfig(esFileProcessor, databaseComponent); WindowsServiceHelper.StartService(esFileProcessor.ServerName, esFileProcessor.ServiceName); ReloadSolrCollection(esIndex); }
private static void UpdateESAgentServiceConfig(ESAgentComponent esAgent, DatabaseComponent databaseComponent) { string innovatorUrlXPath = "/configuration/Aras_Innovator_URL"; string innovatorDBPath = "/configuration/Aras_Innovator_DB"; IFileSystem targetFileSystem = FileSystemFactory.GetFileSystem(esAgent.ServerName); targetFileSystem.XmlHelper.XmlPoke(esAgent.PathToConfig, innovatorUrlXPath, databaseComponent.InnovatorUrl); targetFileSystem.XmlHelper.XmlPoke(esAgent.PathToConfig, innovatorDBPath, databaseComponent.DatabaseName); }
private static void UpdateESFileProcessorServiceConfig(ESFileProcessorComponent esFileProcessor, DatabaseComponent databaseComponent) { string innovatorUrlXPath = "/configuration/FileProcessor/ArasInnovatorURL"; string innovatorDBPath = "/configuration/FileProcessor/ArasInnovatorDB"; IFileSystem targetFileSystem = FileSystemFactory.GetFileSystem(esFileProcessor.ServerName); targetFileSystem.XmlHelper.XmlPoke(esFileProcessor.PathToConfig, innovatorUrlXPath, databaseComponent.InnovatorUrl); targetFileSystem.XmlHelper.XmlPoke(esFileProcessor.PathToConfig, innovatorDBPath, databaseComponent.DatabaseName); }
/// <summary> /// Resets the <see cref="FileSystem"/>. /// </summary> public virtual void ResetFileSystemProvider() { FileSystem = FileSystemFactory.GetFileSystem(); }