/// <summary> /// Initializes a new instance of the <see cref="SolrOperationRunner" /> class. /// </summary> /// <param name="directoryInfoWrapper">The directory information wrapper.</param> /// <param name="restClient">The rest client.</param> /// <param name="log">The log.</param> public SolrOperationRunner(IDirectoryInfoWrapper directoryInfoWrapper = null, IRestClient restClient = null, ISolrLog log = null) { _directoryInfoWrapper = directoryInfoWrapper ?? new DirectoryInfoWrapper(); _restClient = restClient; _log = log; LoadDeserializedOperationObjects(_restClient, _log); }
/// <summary> /// Initializes a new instance of the <see cref="SolrOperationManager" /> class. /// </summary> /// <param name="operationLogger">The operation logger.</param> /// <param name="operationRunner">The operation runner.</param> public SolrOperationManager(ISolrLog operationLogger = null, ISolrOperationRunner operationRunner = null) { SolrLog = operationLogger ?? new SolrLog(); if (OperationRunner == null) { OperationRunner = operationRunner ?? new SolrOperationRunner(null, null, SolrLog); } Reload(); }
/// <summary> /// Loads the deserialized operationModel objects from the flat files. /// </summary> private void LoadDeserializedOperationObjects(IRestClient restClient = null, ISolrLog log = null) { IEnumerable <string> jobFiles = _directoryInfoWrapper.GetFileContentsFromDirectory(); foreach (string jobFileText in jobFiles) { ISolrOperationModel operationModel = JsonConvert.DeserializeObject <SolrOperationModel>(jobFileText); IRestClient operationRestClient = restClient ?? GetSolrRestClient(operationModel); SolrOperations.Add(new SolrOperation(operationModel, operationRestClient, log)); } }
/// <summary> /// Initializes a new instance of the <see cref="SolrOperation"/> class. /// </summary> /// <param name="operationModel">The operation model.</param> /// <param name="restClient">The rest client.</param> /// <param name="solrLog">The solr log.</param> public SolrOperation(ISolrOperationModel operationModel, IRestClient restClient, ISolrLog solrLog) { OperationModel = operationModel; RestClient = restClient; _solrLog = solrLog; }