diff --git a/FileStorage b/FileStorage deleted file mode 100644 index c6c12d006..000000000 --- a/FileStorage +++ /dev/null @@ -1,54 +0,0 @@ -function newFileStorage() { - - const MODULE_NAME = 'File Cloud' - const INFO_LOG = false - const ERROR_LOG = true - const logger = newWebDebugLog() - logger.fileName = MODULE_NAME - - thisObject = { - getBlobToText: getBlobToText - }; - - return thisObject; - - function getBlobToText(pContainerName, pPath, callBackFunction) { - - let xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function () { - if (this.readyState === 4 && this.status === 200) { - - try { - let response = JSON.parse(xhttp.responseText); - callBackFunction(response.err, response.text, ""); - } catch (err) { - if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] AppPreLoader -> getBlobToText -> Invalid JSON received. "); } - if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] AppPreLoader -> getBlobToText -> response.text = " & response.text); } - callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE, "", ""); - } - } - }; - - try { - - let request = { - conatinerName: pContainerName, - path: pPath - }; - - request = JSON.stringify(request); - - let path = "FileService"; - - let blob = new Blob([request], { type: 'text/plain' }); - - xhttp.open("GET", path, true); - xhttp.send(blob); - - } catch (err) { - - if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] getBlobToText -> err.message = " & err.message); } - - } - } -} \ No newline at end of file diff --git a/src/FileCloud.js b/src/FileCloud.js index b7569918b..79caf7511 100644 --- a/src/FileCloud.js +++ b/src/FileCloud.js @@ -119,11 +119,7 @@ function newFileCloud () { if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> filePath = ' + filePath) } if (INFO_LOG === true) { logger.write('[INFO] getFile -> getFileRecursively -> fileName = ' + fileName) } - let containerName - - containerName = pDataMine.code.codeName.toLowerCase() - - blobService.getBlobToText(containerName, filePath + '/' + fileName, undefined, onFileReceived) + blobService.getBlobToText(filePath + '/' + fileName, undefined, onFileReceived) function onFileReceived (err, text, response) { try { @@ -146,7 +142,6 @@ function newFileCloud () { return } - if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> containerName = ' + containerName) } if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> filePath = ' + filePath) } if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> fileName = ' + fileName) } if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> Unexpected Error Ocurred.') } @@ -181,7 +176,6 @@ function newFileCloud () { return } catch (err) { if (ERROR_LOG === true) { logger.write('[WARN] getFile -> getFileRecursively -> onFileReceived -> err = ' + err.stack) } - if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> containerName = ' + containerName) } if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> filePath = ' + filePath) } if (ERROR_LOG === true) { logger.write('[ERROR] getFile -> getFileRecursively -> onFileReceived -> fileName = ' + fileName) } diff --git a/src/FileStorage.js b/src/FileStorage.js index 8eb476629..9a9abd787 100644 --- a/src/FileStorage.js +++ b/src/FileStorage.js @@ -29,11 +29,11 @@ function newFileStorage () { return thisObject - async function getBlobToText (container, filePath, host, callBackFunction) { + async function getBlobToText (filePath, host, callBackFunction) { try { if (INFO_LOG === true) { logger.write('[INFO] getBlobToText -> Entering function.') } - callServer(undefined, 'Storage/' + container + '/' + filePath, (response, fileContent) => { + callServer(undefined, 'Storage/' + filePath, (response, fileContent) => { if (response.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, fileContent) } else { @@ -44,7 +44,7 @@ function newFileStorage () { if (verifyRetry(err.code) && currentRetry < MAX_RETRY) { currentRetry++ if (INFO_LOG === true) { console.log('[INFO] getTextFile -> Retrying connection to the server because received error: ' + err.code + '. Retry #: ' + currentRetry) } - getBlobToText(container, filePath, host, callBackFunction) + getBlobToText(filePath, host, callBackFunction) } else if (err.message === 'Request aborted') { let err = { code: 'The specified key does not exist.' } callBackFunction(err)