Package handlers :: Module procBuildDict :: Class Handler
[show private | hide private]
[frames | no frames]

Type Handler

object --+    
         |    
   Handler --+
             |
            Handler


Builds a persistent structure containing the tree.

The structure models one tree (all the top directories are branches in this single tree) as nested dictionaries. The top of the structure is a dictionary with an element for each one of the top directories. All the values associated with directories are dictionaries themselves, containing the sub-directories and the files. The values associated with files contain information relevant to the file (in the present implementation, only modification time). The result is a nesting of dictionaries. For example, a file like '/usr/include/sys/wait.h' would be represented in the persistent structure by self.filesStructDict['/']['usr']['include']['sys']['wait.h'].

Reasons for not using the 'shelve' module. First, shelve would have to be used with writeback=True because of the nested directories. That means that it is not really more efficient than this structure. Second, using this structure does not affect the persistence file until the handler is destroyed. This allows other handlers in the stack to use the unchanged file while this handler only prepares the changes to the file. Using shelve would not allow this.
Method Summary
  __init__(self, configDict)
Initializer that uses a dictionary to configure the handler.
  beginParentDirHook(self, dirName, subdirNames, fileNames)
Handles the parent directory that the 'walk' has reached.
  finalizeHook(self)
Save all the results if needed and release resources.
  handleChildDirHook(self, dirName)
Handles a child directory contained in the parent directory.
  handleFileHook(self, fileName)
Handles a file contained in the parent directory.
  setConfig(self, configDict)
Updates itself with configDict.
  treeTopHook(self, topDir)
Takes care of initialization that is needed for every tree.
    Inherited from Handler
  __add__(self, otherHandler)
Operator for layering the handlers in a stack.
  __repr__(self)
  beginParentDirWrapper(self, dirName, subdirNames, fileNames)
Invokes beginParentDirHook for this handler and, recursively, for each handler below this one in the stack.
  calcModifValue(fileNamePath)
Helper method that calculates the value used to determine if a file has been changed or is different from another file. (Static method)
  endParentDirHook(self)
Handles the parent directory that the 'walk' has reached.
  endParentDirWrapper(self)
Invokes endParentDirHook for this handler and, recursively, for each handler below this one in the stack.
  finalizeWrapper(self)
Invokes finalizeHook for this handler and, recursively, for each handler below this one in the stack.
  getMetaCfg(cls)
(Static method)
  handleChildDirWrapper(self, dirName)
Invokes handleChildDirHook for this handler and, recursively, for each handler below this one in the stack.
  handleFileWrapper(self, fileName)
Invokes handleFileHook for this handler and, recursively, for each handler below this one in the stack.
  modifValue(self, fileName)
Helper method to get the value used to determine if a file has been changed or is different from another file.
  setTopDir(self, topDir)
Sets the top directory in the handler.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Instance Method Details

__init__(self, configDict=None)
(Constructor)

Initializer that uses a dictionary to configure the handler.
Overrides:
handlers.baseClass.Handler.__init__ (inherited documentation)

beginParentDirHook(self, dirName, subdirNames=None, fileNames=None)

Handles the parent directory that the 'walk' has reached. It is invoked BEFORE handling the directories and files that the parent directory contains.

It can modify the subdirNames and fileNames lists, thus affecting the traversal of the tree. It is a feature useful for comparing the traversed tree to other trees.
Overrides:
handlers.baseClass.Handler.beginParentDirHook (inherited documentation)

finalizeHook(self)

Save all the results if needed and release resources.
Overrides:
handlers.baseClass.Handler.finalizeHook (inherited documentation)

handleChildDirHook(self, dirName)

Handles a child directory contained in the parent directory.
Overrides:
handlers.baseClass.Handler.handleChildDirHook (inherited documentation)

handleFileHook(self, fileName)

Handles a file contained in the parent directory.
Overrides:
handlers.baseClass.Handler.handleFileHook (inherited documentation)

setConfig(self, configDict)

Updates itself with configDict.
Overrides:
handlers.baseClass.Handler.setConfig (inherited documentation)

treeTopHook(self, topDir)

Takes care of initialization that is needed for every tree.
Overrides:
handlers.baseClass.Handler.treeTopHook (inherited documentation)

Generated by Epydoc 2.1 on Wed Dec 22 15:47:44 2004 http://epydoc.sf.net