Exemple #1
0
 def getFileAccessPointerForFile(self, fileName):
     """
     
        @Summary : Verifies if the specified file was the last one accessed 
                   by the filetype/client/machine combination specified 
                   in the current instance. 
                   
                   If it is, it will return the position that was last read.
                   Otherwise returns 0(top of the file.)
        
        @param fileName: File for wich you are interested in reading and want to 
                     read as if it was the last file read.             
        
        @return: returns the pointer to where we last read the specified file. 
        
        
         
     """
     
     accessPointer = 0
     accessFile    =  self.buildLogFilesAccessFileName() 
     identifier    = os.path.basename( accessFile)
     accessManager = LogFileAccessManager( accessFile = accessFile )
     
     if accessManager.isTheLastFileThatWasReadByThisIdentifier( fileName, identifier ) ==True:
         accessPointer = accessManager.getLastReadPositionAssociatedWith(identifier)
     
     return accessPointer 
Exemple #2
0
 def saveFileAccessPointer(self):
     """
        @summary: Saves the informations relative to 
                  the last access made to log files
                  by the fileStatscollector's instance. 
         
     """
     
     accessFile    = self.buildLogFilesAccessFileName() 
     identifier    = os.path.basename( accessFile)
     accessManager = LogFileAccessManager( accessFile = accessFile )
     
     accessManager.setFirstLineAndLastReadPositionAssociatedwith(self.firstLineOfLastFileRead, self.lastPositionRead, identifier)       
     accessManager.saveAccessDictionary()