Service Activator Toolkit
Version 1.1.0 (20081206)

org.eclipse.soda.sat.core.framework.interfaces
Interface IFileLog


public interface IFileLog

The IFileLog interface defines the API for a file-based log. An instance of IFileLog can be created using the FactoryUtility singleton.

 File file = ...
 FactoryUtility utility = FactoryUtility.getInstance();
 IFileLog fileLog = utility.createFileLog(file);
 
An IFileLog must be opened before it can be written to, and closed after use. For example:
 try {
   try {
     fileLog.open();
     fileLog.log(this, "Hello World");
   } finally {
     fileLog.close();
   }
 } catch (IOException exception) {
   ...
 }
 
For convenience, the LogUtility singleton has a built-in IFileLog that may be written to using its logToFile(Object, String) and traceToFile(Object, String) methods.

See Also:
FactoryUtility, LogUtility

Method Summary
 void close()
          Close the file.
 boolean delete()
          Delete the file.
 String getAbsolutePath()
          Get the absolute path of the file.
 String getFilename()
          Get the name of the file.
 void log(Object id, String message)
          Write the specified message to the file.
 void open()
          Open the file.
 

Method Detail

close

void close()
           throws IOException
Close the file.

Throws:
IOException

delete

boolean delete()
               throws IOException
Delete the file.

Returns:
True if the file was deleted, otherwise false.
Throws:
IOException

getAbsolutePath

String getAbsolutePath()
Get the absolute path of the file.

Returns:
The absolute path of the file.

getFilename

String getFilename()
Get the name of the file.

Returns:
String

log

void log(Object id,
         String message)
         throws IOException
Write the specified message to the file. This method is provided for debugging purposes only. Since this method makes use of local file I/O, this should typically not be called in production code.

Parameters:
id - An object that identifies who is logging the message.
message - The message to log.
Throws:
IOException

open

void open()
          throws FileNotFoundException
Open the file.

Throws:
FileNotFoundException

Service Activator Toolkit
Version 1.1.0 (20081206)