diff --git a/src/capisuite-py/delivery.py b/src/capisuite-py/delivery.py new file mode 100644 index 0000000..3513575 --- /dev/null +++ b/src/capisuite-py/delivery.py @@ -0,0 +1,56 @@ +"""capisuite.delivery + +This module implements routines for delivering received files and status +information to the user. +""" + +__author__ = "Gernot Hillier " +__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 diff --git a/src/capisuite-py/storage.py b/src/capisuite-py/storage.py new file mode 100644 index 0000000..d842bc6 --- /dev/null +++ b/src/capisuite-py/storage.py @@ -0,0 +1,83 @@ +"""capisuite.storage + +This module implements routines for file storage and queue management. +""" + +__author__ = "Gernot Hillier " +__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