First rough ideas of new classes for mail delivery and item storage.

Comments welcome.


git-svn-id: https://svn.ibp.de/svn/capisuite/trunk/capisuite@405 4ebea2bb-67d4-0310-8558-a5799e421b66
This commit is contained in:
gernot 2005-01-08 08:41:32 +00:00
parent dad44cf35d
commit d1608780ab
2 changed files with 139 additions and 0 deletions

View File

@ -0,0 +1,56 @@
"""capisuite.delivery
This module implements routines for delivering received files and status
information to the user.
"""
__author__ = "Gernot Hillier <gernot@hillier.de>"
__copyright__ = "Copyright (c) 2005 by Gernot Hillier"
__version__ = "$Revision: 0.0 $"
__credits__ = "This file is part of www.capisuite.de"
__license__ = """
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
class UserDelivery:
"""
General base class for realizing the delivery of received messages
(e.g. voice or fax files) and status information (e.g. fax job status
reports) to the user. This class only defines the API. The actual
implementation using e.g. mail delivery can be found in derived classes.
"""
def __init__(self,config):
"""
Constructor. Create an instance of the UserDelivery class. 'config'
contains the configuration file object where the necessary
settings for setting up the delivery can be found.
"""
self.config=config
pass
def sendNotice(self,recipient,information):
"""
Send the 'information' text (multi-line string) to the given
'recipient'.
"""
pass
def sendFile(self,recipient,information,file,format):
"""
Send the 'file' together with the given 'information' (multi-line
string) to 'recipient'. If necessary, the file is converted to the
given 'format' (e.g. PDF or WAV) before.
"""
pass
class MailDelivery(UserDelivery):
"""
Default implementation of a UserDelivery which delivers all messages via
mail.
"""
pass

View File

@ -0,0 +1,83 @@
"""capisuite.storage
This module implements routines for file storage and queue management.
"""
__author__ = "Gernot Hillier <gernot@hillier.de>"
__copyright__ = "Copyright (c) 2005 by Gernot Hillier"
__version__ = "$Revision: 0.0 $"
__credits__ = "This file is part of www.capisuite.de"
__license__ = """
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
class ItemStorage:
"""
General base class for realizing the item storage. This class defines the
API for the storage of received messages, given jobs and static files (like
user announcements). One non-static item is always in one of the four
places/states: sendq (job to send), done (successfully sent job), failed
(finally failed job), received (received message). This class only defines
the API, the actual implementation is done in derived classes which could
e.g. store the files on disk or in a database (latter not implemented yet).
"""
def __init__(self,config):
"""
Constructor. Create an instance of the ItemStorage class and do
inital checks like correctness of permissions. 'config' contains the
configuration file object where the necessary settings for
setting up the storage can be found.
"""
self.config=config
pass
def itemDone(self,name):
"""
Move an item from the sendq to the done state/dir.
"""
pass
def itemFailed(self,name):
"""
Move an item from the sendq to the finally failed state/dir.
"""
pass
def getItem(self,queue,name):
"""
Get entry 'name' from the queue 'queue'. Must return a file name in
the local filesystem because the core can only handle files. It should
also check file permissions if necessary.
"""
pass
def addItem(self,queue,name,description):
"""
Add an item to a certain queue with the given description.
"""
pass
def getNewItemName(self,queue):
"""
Return a new uniqe name for an item to be stored in the 'queue'.
"""
pass
def getStaticItem(self,name):
"""
Return the full path of a static item like a user announcement.
"""
pass
class FileStorage(ItemStorage):
"""
Default implementation of an ItemStorage which stores all
messages as files on the local filesystem.
"""
pass