6 3 3 Miscellaneous Helper Class

LANSA Integrator

6.3.3 Miscellaneous Helper Class

 

The static method JSMManager.getTemporaryDirectory returns the temporary directory of the current service as a java.io.File object.

The temporary directory is not created by this method.

The name of this temporary directory is the job number and hash code of the service thread.

Example

 

File directory = JSMManager.getTemporaryDirectory () ;

 

 

The static method JSMManager.createTemporaryDirectory returns the temporary directory of the current service as a java.io.File object.

The temporary directory is created by this method.

The name of this temporary directory is the job number and hash code of the service thread.

Example

 

File directory = JSMManager.createTemporaryDirectory () ;

 

 

The static method JSMManager.createTemporaryFile returns the temporary file as a java.io.File object.

If the temporary directory does not exist then it is created, but the temporary file is not created.

The filename only needs to be unique within the service program, so a simple name like "upload" can be used.

To read and write to the file use the FileInputStream and FileOutputStream classes.

Example

 

File file = JSMManager.createTemporaryFile ( filename ) ;

 

 

The temporary directory only exists between a JSM OPEN and JSM CLOSE.

The temporary directory is cleared on the JSM OPEN.

The temporary directory is also cleared on the JSMCLOSE.

There is no need for the programmer to clear the temporary directory.

The static method JSMManager.clearTemporaryDirectory deletes all files in the temporary directory and then deletes the temporary directory.

Example

 

boolean ok = JSMManager.clearTemporaryDirectory () ;

 

 

When a service thread starts a call to the JSMManager.clearTemporaryDirectory method is performed to make sure no previous temporary files from a previous thread with the same hash code exist.

The CLRJSM command can optionally remove all files and directories beneath the temp and trace directory.