web/lib/Zend/Cloud/QueueService/Adapter/AbstractAdapter.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * LICENSE
       
     4  *
       
     5  * This source file is subject to the new BSD license that is bundled
       
     6  * with this package in the file LICENSE.txt.
       
     7  * It is also available through the world-wide-web at this URL:
       
     8  * http://framework.zend.com/license/new-bsd
       
     9  * If you did not receive a copy of the license and are unable to
       
    10  * obtain it through the world-wide-web, please send an email
       
    11  * to license@zend.com so we can send you a copy immediately.
       
    12  *
       
    13  * @category   Zend
       
    14  * @package    Zend_Cloud
       
    15  * @subpackage QueueService
       
    16  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    17  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    18  */
       
    19 
       
    20 require_once 'Zend/Cloud/QueueService/Adapter.php';
       
    21 require_once 'Zend/Cloud/QueueService/Message.php';
       
    22 require_once 'Zend/Cloud/QueueService/MessageSet.php';
       
    23 
       
    24 /**
       
    25  * Abstract queue adapter
       
    26  *
       
    27  * Provides functionality around setting message and message set classes.
       
    28  *
       
    29  * @category   Zend
       
    30  * @package    Zend_Cloud
       
    31  * @subpackage QueueService
       
    32  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    33  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    34  */
       
    35 abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
       
    36     implements Zend_Cloud_QueueService_Adapter
       
    37 {
       
    38     /**@+ option keys */
       
    39     const MESSAGE_CLASS    = 'message_class';
       
    40     const MESSAGESET_CLASS = 'messageset_class';
       
    41     /**@-*/
       
    42 
       
    43     /** @var string Class to use for queue messages */
       
    44     protected $_messageClass    = 'Zend_Cloud_QueueService_Message';
       
    45 
       
    46     /** @var string Class to use for collections of queue messages */
       
    47     protected $_messageSetClass = 'Zend_Cloud_QueueService_MessageSet';
       
    48 
       
    49     /**
       
    50      * Set class to use for message objects
       
    51      * 
       
    52      * @param  string $class 
       
    53      * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
       
    54      */
       
    55     public function setMessageClass($class)
       
    56     {
       
    57         $this->_messageClass = (string) $class;
       
    58         return $this;
       
    59     }
       
    60 
       
    61     /**
       
    62      * Get class to use for message objects
       
    63      * 
       
    64      * @return string
       
    65      */
       
    66     public function getMessageClass()
       
    67     {
       
    68         return $this->_messageClass;
       
    69     }
       
    70 
       
    71     /**
       
    72      * Set class to use for message collection objects
       
    73      * 
       
    74      * @param  string $class 
       
    75      * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
       
    76      */
       
    77     public function setMessageSetClass($class)
       
    78     {
       
    79         $this->_messageSetClass = (string) $class;
       
    80         return $this;
       
    81     }
       
    82 
       
    83     /**
       
    84      * Get class to use for message collection objects
       
    85      * 
       
    86      * @return string
       
    87      */
       
    88     public function getMessageSetClass()
       
    89     {
       
    90         return $this->_messageSetClass;
       
    91     }
       
    92 }