pl.edu.agh.cast.importer.base.logging
Class FileImportLogger

java.lang.Object
  extended by pl.edu.agh.cast.importer.base.logging.AbstractImportLogger
      extended by pl.edu.agh.cast.importer.base.logging.FileImportLogger
All Implemented Interfaces:
IImportDataObserver, IImportLogger

public class FileImportLogger
extends AbstractImportLogger

An observer of the import process, which logs events to file. It increments the row and column indices by one, for better user readability.

Author:
AGH CAST Team

Field Summary
static String LOG_DIRECTORY
          The output directory to store the logger files in.
 
Fields inherited from class pl.edu.agh.cast.importer.base.logging.AbstractImportLogger
LEFT_BRACKET, RIGHT_BRACKET, SEPARATOR_COMMA, SEPARATOR_SEMICOMMA
 
Constructor Summary
FileImportLogger(String projectLocation)
          The default constructor.
 
Method Summary
 void finish(String dataSetId)
          Closes the logger file handler and renames the log file, using the specified data set identifier.
 String getLogDirPath()
           
 void initialize(String importedFilePath, String templateName)
          Initializes the layout, appender and logger and logs the start of the import operation into the log file.
 void initialize(String importedFilePath, String templateName, String sheetName)
          Initializes the layout, appender and logger and logs the start of the import operation into the log file.
 void notifyError(AbstractErrorLogData error)
          Notifies when an error occurs.
 void notifyRemoved(DataRow row)
          Notifies when a row is removed.
 void notifyRestored(DataRow row)
          Notifies when a row is restored.
 void notifyValueChanged(DataRow row, int index, Object oldValue, Object newValue)
          Notifies when new value is set in a specified row.
 void setFooterData(int rowsImported, int rowsNotImported, String dataSetName)
          Sets the data necessary for the import logger footer.
 
Methods inherited from class pl.edu.agh.cast.importer.base.logging.AbstractImportLogger
createErrorMsg
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_DIRECTORY

public static final String LOG_DIRECTORY
The output directory to store the logger files in.

See Also:
Constant Field Values
Constructor Detail

FileImportLogger

public FileImportLogger(String projectLocation)
The default constructor.

Parameters:
projectLocation - the location of the project
Method Detail

notifyError

public void notifyError(AbstractErrorLogData error)
Notifies when an error occurs.

Parameters:
error - the error that occurred
See Also:
IImportLogger.notifyError( pl.edu.agh.cast.importer.base.stat.AbstractErrorLogData)

notifyRemoved

public void notifyRemoved(DataRow row)
Notifies when a row is removed.

Parameters:
row - the row which is removed
See Also:
IImportDataObserver.notifyRemoved( pl.edu.agh.cast.importer.base.data.DataRow)

notifyRestored

public void notifyRestored(DataRow row)
Notifies when a row is restored.

Parameters:
row - the row which is restored
See Also:
IImportDataObserver.notifyRestored( pl.edu.agh.cast.importer.base.data.DataRow)

notifyValueChanged

public void notifyValueChanged(DataRow row,
                               int index,
                               Object oldValue,
                               Object newValue)
Notifies when new value is set in a specified row.

Parameters:
row - the row which is edited
index - the position, on which the change had occurred
oldValue - the old value
newValue - the new value
See Also:
IImportDataObserver.notifyValueChanged( pl.edu.agh.cast.importer.base.data.DataRow, int, java.lang.Object, java.lang.Object)

finish

public void finish(String dataSetId)
Closes the logger file handler and renames the log file, using the specified data set identifier.

Parameters:
dataSetId - the id of the data set

initialize

public void initialize(String importedFilePath,
                       String templateName,
                       String sheetName)
Initializes the layout, appender and logger and logs the start of the import operation into the log file. Concerns data with multiple sheets.

Parameters:
importedFilePath - the path to the imported file
templateName - the template name used by the import operation
sheetName - the name of the sheet for data with multiple sheets

initialize

public void initialize(String importedFilePath,
                       String templateName)
Initializes the layout, appender and logger and logs the start of the import operation into the log file. Concerns data with a single sheet.

Parameters:
importedFilePath - the path to the imported file
templateName - the template name used by the import operation

setFooterData

public void setFooterData(int rowsImported,
                          int rowsNotImported,
                          String dataSetName)
Sets the data necessary for the import logger footer.

Parameters:
rowsImported - the number of rows imported
rowsNotImported - the number of rows not imported
dataSetName - the name of the data set

getLogDirPath

public String getLogDirPath()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.