/src/xdb/template.py

http://pyaimt.googlecode.com/ · Python · 74 lines · 39 code · 11 blank · 24 comment · 4 complexity · c46c0f99c68e5684281b7a0a795f707e MD5 · raw file

  1. # Copyright 2005-2006 Daniel Henninger <jadestorm@nc.rr.com>
  2. # Licensed for distribution under the GPL version 2, check COPYING for details
  3. #
  4. # This is a template for any new XDB drivers that might be written.
  5. #
  6. class XDB:
  7. """
  8. Class for storage of data.
  9. """
  10. def __init__(self, name):
  11. """ Creates an XDB object. """
  12. # Do whatever setup type stuff you might need
  13. def getRegistration(self, jabberID):
  14. """ Retrieve registration information from the XDB.
  15. Returns a username and password. """
  16. return None
  17. def getRegistrationList(self):
  18. """ Returns an array of all of the registered jids. """
  19. return []
  20. def setRegistration(self, jabberID, username, password):
  21. """ Sets up or creates a registration in the XDB.
  22. username and password are for the legacy account. """
  23. pass
  24. def removeRegistration(self, jabberID):
  25. """ Removes a registration from the XDB. """
  26. pass
  27. def getSettingList(self, jabberID):
  28. """ Gets a list of all settings for a user from the XDB. """
  29. return {}
  30. def getSetting(self, jabberID, variable):
  31. """ Gets a user setting from the XDB. """
  32. return None
  33. def setSetting(self, jabberID, variable, value):
  34. """ Sets a user setting in the XDB. """
  35. pass
  36. def getListTypes(self, jabberID):
  37. """ Returns an array containing a list of all list types
  38. associated with a user. """
  39. return []
  40. def getListEntry(self, namespace, jabberID, legacyID):
  41. """ Retrieves a legacy ID entry from a list in
  42. the XDB, based off the namespace and jabberID you provide. """
  43. return None
  44. def getList(self, namespace, jabberID):
  45. """ Retrieves an array containing an entire list of a
  46. jabberID's from the XDB, based off the namespace and jabberID
  47. you provide. """
  48. return None
  49. def setListEntry(self, namespace, jabberID, legacyID, payload = {}):
  50. """ Updates or adds a legacy ID entry to a list in
  51. the XDB, based off the namespace and jabberID you provide. """
  52. pass
  53. def removeListEntry(self, namespace, jabberID, legacyID):
  54. """ Removes a legacy ID entry from a list in
  55. the XDB, based off the namespace and jabberID you provide. """
  56. pass
  57. def housekeep():
  58. """ Perform cleanup type tasks upon startup. """
  59. pass