Package buildxml :: Package xmlgetter :: Module plugin :: Class BaseSyncPlugin
[hide private]
[frames] | no frames]

Class BaseSyncPlugin

source code


This is the base class for all sync plugins.

Instance Methods [hide private]
 
__init__(self, source_name, url, NO_NET=False)
Initialize the plugin.
source code
bool
_getData(self)
Should be overwritten by the individual plugin's implementation.
source code
 
_consolidate(self)
Should be overwritten by the individual plugin's implementation if a consolidation of the data is necessary.
source code
bool
_writeState(self)
Should be overwritten by the individual plugin's implementation if it makes use of a state variable like e.g.
source code
bool
_loadState(self)
Should be overwritten by the individual plugin's implementation if it makes use of a state variable like e.g.
source code
 
_writeEntries(self)
Write all entries in self._entries to the file specified through self._intermediate_temp_filename.
source code
string
source_name(self)
Get the sources name.
source code
string
url(self)
Get the URL of the plugin.
source code
Stats
stats(self)
Get the statistics of the plugin.
source code
int
entries_written(self)
Get the overall number of written entries.
source code
bool
run(self)
Will be called by the controlling script.
source code

Inherited from request.BaseRequester (private): _requestURL

Inherited from log.BaseLogger: logger

Inherited from log.BaseLogger (private): _getLogger

Class Variables [hide private]

Inherited from log.BaseLogger (private): _loggers

Instance Variables [hide private]
datetime _from_date = LAST_QUERY_DEFAULT
The date to start the query from.
string _url = None
The URL that is the starting point for the data acquisition.
string _intermediate_temp_filename = None
The temporary file to which all data from the queries will be written.
string _temp_filename = None
The temporary file to which all data from the queries will be written.
string _intermediate_xml_filename = None
The filename of the intermediate consolidated XML data.
string _xml_filename = None
The filename of the consolidated XML data.
list of XMLEntry _entries = None
A temporary storage for XMLEntry instances.
int _entries_written = -1
Overall number of elements written.
Stats _stats = None
The statistics for the plugin,
bool _NO_NET = None
Should we actually get the data from the net, or should we use the data from the previous run?
string _base_url = None
Stores the url up to the location part.

Inherited from log.BaseLogger (private): _source_name

Method Details [hide private]

__init__(self, source_name, url, NO_NET=False)
(Constructor)

source code 

Initialize the plugin.

If temporary data exists and NO_NET is False, the temporary data from a previous run is deleted-

Parameters:
  • source_name (string) - The name of the source.
  • url (string) - The starting point for the retrieval of the source's data.
  • NO_NET (bool) - Should we operate on the data of the last run, or retrieve new data?
Overrides: log.BaseLogger.__init__

_getData(self)

source code 

Should be overwritten by the individual plugin's implementation. All data has to be written to _intermediate_temp_filename.

Returns: bool
True or False depending on the success of the retrieval process.

_consolidate(self)

source code 

Should be overwritten by the individual plugin's implementation if a consolidation of the data is necessary.

This function copies the temporary data from _temp_filename to _xml_filename .

_writeState(self)

source code 

Should be overwritten by the individual plugin's implementation if it makes use of a state variable like e.g. the portal plugin.

Returns: bool
True or False depending on the success of the write process.

_loadState(self)

source code 

Should be overwritten by the individual plugin's implementation if it makes use of a state variable like e.g. the portal plugin.

Returns: bool
True or False depending on the success of the read process.

source_name(self)

source code 

Get the sources name.

Returns: string
The value of self._source_name .
Decorators:
  • @property

url(self)

source code 

Get the URL of the plugin.

Returns: string
The value of self._url .
Decorators:
  • @property

stats(self)

source code 

Get the statistics of the plugin.

Returns: Stats
The value of self._stats .
Decorators:
  • @property

entries_written(self)

source code 

Get the overall number of written entries.

Returns: int
The value of self._entries_written .
Decorators:
  • @property

run(self)

source code 

Will be called by the controlling script.

Procedure:

If one of these points fail return False in the end, otherwise return True.

This function should normally not be overridden.

Returns: bool
False if an error or warning occurred, True otherwise.

Instance Variable Details [hide private]

_intermediate_temp_filename

The temporary file to which all data from the queries will be written. This file is necessary, to prevent destruction of useful data from a previous run if an error in _getData() should occurr.
Type:
string
Value:
None

_intermediate_xml_filename

The filename of the intermediate consolidated XML data. Necessary, because errors during consolidation would destruct usable existing data.
Type:
string
Value:
None