Local filesystem
The local filesystem on Guidewire Cloud Platform (GWCP) refers to the physical filesystem of the node that is running the InsuranceSuite application. Use of the local filesystem on GWCP is prohibited, with exceptions only for local development, testing, and specific temporary file operations. This section details the proper use of the local filesystem on GWCP, adhering to GWCP standards.
For more information about the GWCP standard for local filesystem use, IS-TLS-1299, see https://docs.guidewire.com/cloud/standards/latest/Tools/Standard-IS-TLS-1299-ReadingAndWritingFiles.html.
Creating deletable temporary files
Using the local filesystem within the Guidewire Cloud Platform (GWCP) can cause a number of functional correctness and security risks. One way to properly use the local filesystem within GWCP and avoid such risks is to create temporary files. The platform automatically manages and deletes these temporary files after 24 hours.
This method is discussed in the Guidewire Cloud standard for local filesystem use, IS-TLS-1299. For more information about IS-TLS-1299 and the risks of improper local filesystem use within GWCP, see https://docs.guidewire.com/cloud/standards/latest/Tools/Standard-IS-TLS-1299-ReadingAndWritingFiles.html.
Deletable temporary file creation method
The only way you are allowed to create temporary files in the local filesystem within
GWCP is to use the gw.pl.util.FileUtil\#createDeletableTempFile method.
This method generates temporary files that are confined within the server instance,
thereby blocking access from any other users or external systems. The platform then
automatically manages and deletes these files after 24 hours, eliminating the need for
the application to handle the removal of the temporary files.
Deletable temporary file creation example
This example shows how you can implement the
gw.pl.util.FileUtil\#createDeletableTempFile method:
override public function process(record : InboundRecord, bundle : Bundle, logger : IntentionalLogger, marker : Marker) : void {
try {
var tempFile = FileUtil.createDeletableTempFile("raw", "dat")
Files.write(tempFile.toPath(), {record.Content})
var result = processFile(tempFile)
logger.logResult(marker, "${record.Config} @${record.InboundFile.InputLocation}#${record.LineNumber}: ${result}")
} catch (e : Exception) {
logger.logError(marker, "\"${record.Config} @${record.InboundFile.InputLocation}#${record.LineNumber} Exception: ", e)
}
}
This method is set up to create a temporary file that will write the record's content to the file, as well as log the result and handle any errors. The platform will automatically manage the file and delete it after 24 hours.