Package gnue :: Package appserver :: Module geasGsdGen :: Class geasGsdGen
[show private | hide private]

Class geasGsdGen

GBaseApp --+    
           |    
  GClientApp --+
               |
              geasGsdGen


Method Summary
  __init__(self, connections)
  run(self)
This is the main function of the gsd generator.
  __addClass(self, className)
This function adds a class to the list of classes respecting all dependencies given by class-references.
  __addRow(self, record, classDef, fields, rows)
This function adds a new row to the given row collection using the values from the given record.
  __createClassList(self, args)
This function creates a sequence of classnames to be dumped.
  __createConditionDicts(self)
This function creates a dictionary with sequences of condition-tuples for all classes where every tuple represents an 'equal'-condition.
  __exportClass(self, className)
Create a TableData object tree with all data of the given class.
  __fishDataDump(self, classDef, fieldlist, rows)
This function exports all records (according to an existing filter) of a class which has a fishhook.
  __getFilterParams(self)
This function iterates over the command line arguments, picks out all elements with an equal sign and removes them from the arguments sequence Such elements are of the form 'classname[.property]=value' where the property part is optional.
  __nativeToString(self, native, datatype)
This function creates a unicode string to be used in a <value>-tag of a GSD file.
  __normalDataDump(self, classDef, fieldlist, rows)
This function creates a resultset for the given class and iterates over all records.
  __openSource(self, classdef, fieldList)
This function creates a new datasource for a table using a list of fields.
  __shrinkList(self, dataDict, circularError, *args)
This function returns a sequence of all keys without any dependencies.
  __verifyFilters(self)
This function iterates over all available filters and creates a dictionary with all filter-ids and their values.
    Inherited from GClientApp
  getConnectionManager(self)
  getLoginHandler(self)
  setLoginHandler(self, loginHandler)
    Inherited from GBaseApp
  addCommandOption(self, *args, **parms)
Create a new command option and add it to the options sequence.
  analyzeCycle(self, cycle)
Return a generator for iterating a given reference cycle.
  buildHelpOptions(self, category)
Build 'help text' for all options of the given category.
  debugGarbageCollection(self, signal, frame)
Debug Python's garbage collection.
  doHelpConfig(self)
Display all configuration settings and their default values and quit the program.
  doSelfDoc(self)
Run the self documentation.
  doVersion(self)
Display the version information and quit the program.
  excepthook(self, etype, value, traceback)
This function catches an exception and evaluates it using getException().
  findCycle(self, search, current, last, path, seen)
Find a reference cycle starting from a given object(current) and ending with a given object(search).
  getCommandLineParameters(self, paramList)
Convert a sequence of parameters (i.e.
  handleStartupError(self, msg)
Display a startup error and exit gracefully.
  printHelp(self)
Print help information for this application and quit the program.
  printHelpConn(self)
Print connection/database-related help information and quit the program.
  printHelpDev(self)
Print help information for this application and quit the program.
  printHelpFooter(self)
Print the help footer including the address for bug reports.
  printHelpHeader(self)
Print version information and the usage header
  printVersion(self)
Display version information for this application
  selfdoc(self, command, handle, format, options)
Run the self-documentation for an application.
  _debugger(self)
Run the application in the python debugger.
  _profile(self)
Run the application through the python profiler and print some statistics afterwards.
  _showException(self, group, name, message, detail)
This function shows an exception specified by the given parameters.

Class Variable Summary
str COMMAND = 'gnue-gsdgen'
str NAME = 'geasGsdGen'
str SUMMARY = 'A tool to dump data from a database into a GN...
str USAGE = '[options]  [classname] [classname] [...]'
str VERSION = '0.5.2+svn.9887'
    Inherited from GBaseApp
list ARGUMENTS = []
str AUTHOR = 'GNU Enterprise Project'
list COMMAND_OPTIONS = []
str CONFIGFILE = 'gnue.conf'
NoneType connections = None                                                                  
str EMAIL = 'info@gnue.org'
dict OPTIONS = {}
str REPORT_BUGS_TO = 'Please report any bugs to info@gnue.or...
int USE_CONNECTIONS = 1                                                                     
int USE_DATABASE_OPTIONS = 0                                                                     
int USE_RPC_OPTIONS = 0                                                                     

Method Details

__init__(self, connections=None)
(Constructor)

Overrides:
gnue.common.apps.GBaseApp.GBaseApp.__init__

run(self)

This is the main function of the gsd generator. If parses the options given, creates the GSD object tree and dumps it to the output file.
Overrides:
gnue.common.apps.GBaseApp.GBaseApp.run

__addClass(self, className)

This function adds a class to the list of classes respecting all dependencies given by class-references.

__addRow(self, record, classDef, fields, rows)

This function adds a new row to the given row collection using the values from the given record.
Parameters:
record - record which should be exported
classDef - class definition of the record
fields - sequence of fieldnames to be exported
rows - GSRows instance which is parent of the newly created rows

__createClassList(self, args)

This function creates a sequence of classnames to be dumped. This sequence is in a proper order so no constraint-violations should occur.
Parameters:
args - list of classnames or modulenames to be exported

__createConditionDicts(self)

This function creates a dictionary with sequences of condition-tuples for all classes where every tuple represents an 'equal'-condition. To get the final condition per class all tuples will be AND-connected.

Such a tuple has the following form: (source-relation, souce-item, destination-relation, destination-item)

If destination-relation is None, destination-item is a field-value otherwise it's a field-name.

Examples:
  • (foo, bar, foobar, barbaz) means foo.bar = foobar.barbaz
  • (foo, bar, None, barbaz) means foo.bar = barbaz
Returns:
dictionary with conditions

__exportClass(self, className)

Create a TableData object tree with all data of the given class.
Parameters:
className - fully qualified name of the class to be exported

__fishDataDump(self, classDef, fieldlist, rows)

This function exports all records (according to an existing filter) of a class which has a fishhook. All records are exported in an order which allows reimporting without reference-violation.
Parameters:
classDef - class definition of the class to be dumped
fieldlist - list of fieldnames to be exported
rows - GSRows collection to which new records will be added

__getFilterParams(self)

This function iterates over the command line arguments, picks out all elements with an equal sign and removes them from the arguments sequence Such elements are of the form 'classname[.property]=value' where the property part is optional. From all these elements a dictionary is built where the 'classname'-part acts as key and the value is another dictionary with 'property'-part as key an 'value' as it's value. If no 'property' is given 'gnue_id' will be used.
Returns:
dictionary with filter-parameters and their requested values

__nativeToString(self, native, datatype)

This function creates a unicode string to be used in a <value>-tag of a GSD file. The native python object will be treated and theirfore converted as 'datatype'.

__normalDataDump(self, classDef, fieldlist, rows)

This function creates a resultset for the given class and iterates over all records. All fields with a value other than <None> will be added to the rows collection.
Parameters:
classDef - class definition of the class to be dumped
fieldlist - list of fieldnames to be exported
rows - GSRows collection to which new records will be added

__openSource(self, classdef, fieldList)

This function creates a new datasource for a table using a list of fields.
Parameters:
classdef - classdefinition to prepare a datasource for
fieldList - sequence with fieldnames
Returns:
tuple with the datasource and it's field list

__shrinkList(self, dataDict, circularError, *args)

This function returns a sequence of all keys without any dependencies. If no such items were found but there are still entries in the dictionary a CircularReferenceError will be raised.
Parameters:
dataDict - dictionary to extract items from. The values are sequences with keys which are referencing to an item
circularError - exception class which will be raised if there are circular references
Returns:
sequence of all keys which do not have any dependency

__verifyFilters(self)

This function iterates over all available filters and creates a dictionary with all filter-ids and their values.
Returns:
dictionary with gnue-id of the filter-class as key and the gnue-id of the filter-value as value

Class Variable Details

COMMAND

Type:
str
Value:
'gnue-gsdgen'                                                          

NAME

Type:
str
Value:
'geasGsdGen'                                                           

SUMMARY

Type:
str
Value:
'A tool to dump data from a database into a GNUe Schema Definition (gs\
d) file.'                                                              

USAGE

Type:
str
Value:
'[options]  [classname] [classname] [...]'                             

VERSION

Type:
str
Value:
'0.5.2+svn.9887'                                                       


GNUe Home

Private API

Developer's Corner