Beispiel #1
0
        private void SendPackage(Guid?pMassiveLoadIdentifier = null)
        {
            try
            {
                CloseStreams();

                if (onlyPrepareMassiveLoad)
                {
                    return;
                }

                Guid massiveLoadFilesIdentifier = MassiveLoadIdentifier;
                if (pMassiveLoadIdentifier.HasValue)
                {
                    massiveLoadFilesIdentifier = pMassiveLoadIdentifier.Value;
                }

                string uriOntology = $"{Uri}/{OntologyNameWithoutExtension}_{massiveLoadFilesIdentifier}_{counter[OntologyNameWithoutExtension].FileCount}.nq";
                string uriSearch   = $"{Uri}/{OntologyNameWithoutExtension}_search_{massiveLoadFilesIdentifier}_{counter[OntologyNameWithoutExtension].FileCount}.nq";
                string uriAcid     = $"{Uri}/{OntologyNameWithoutExtension}_acid_{massiveLoadFilesIdentifier}_{counter[OntologyNameWithoutExtension].FileCount}.txt";

                MassiveDataLoadPackageResource model = new MassiveDataLoadPackageResource();
                model.package_id = Guid.NewGuid();
                model.load_id    = MassiveLoadIdentifier;

                //Si es modo debug queremos los bytes de los ficheros directamente
                if (IsDebugMode)
                {
                    model.ontology_bytes = File.ReadAllBytes($"{FilesDirectory}\\{OntologyNameWithoutExtension}_{MassiveLoadIdentifier}_{counter[OntologyNameWithoutExtension].FileCount}.nq");
                    model.search_bytes   = File.ReadAllBytes($"{FilesDirectory}\\{OntologyNameWithoutExtension}_search_{MassiveLoadIdentifier}_{counter[OntologyNameWithoutExtension].FileCount}.nq");
                    model.sql_bytes      = File.ReadAllBytes($"{FilesDirectory}\\{OntologyNameWithoutExtension}_acid_{MassiveLoadIdentifier}_{counter[OntologyNameWithoutExtension].FileCount}.txt");
                }

                model.ontology_rute = uriOntology;
                model.search_rute   = uriSearch;
                model.sql_rute      = uriAcid;
                model.ontology      = OntologyUrl;
                model.isLast        = false;

                CreatePackageMassiveDataLoad(model);

                Log.Debug($"Package massive data load create with the identifier {MassiveLoadIdentifier}");
            }
            catch (Exception ex)
            {
                Log.Error($"Error creating the package of massive data load {ex.Message}");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new package in a massive data load
        /// </summary>
        /// <param name="model">Data model of the package massive data load</param>
        /// <returns>True if the new massive data load package was created succesfully</returns>
        private bool CreatePackageMassiveDataLoad(MassiveDataLoadPackageResource model)
        {
            bool created = false;

            try
            {
                string url = $"{ApiUrl}/resource/create-massive-load-package";
                WebRequestPostWithJsonObject(url, model);
                created = true;
                Log.Debug("Massive data load package created");
            }
            catch (Exception ex)
            {
                Log.Error($"Error creating massive data load package {model.package_id}. \r\n Json: {JsonConvert.SerializeObject(model)}", ex.Message);
                throw;
            }

            return(created);
        }