AbstractAdapter.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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-2015 Zend Technologies USA Inc. (http://www.zend.com)
  17. * @license http://framework.zend.com/license/new-bsd New BSD License
  18. */
  19. require_once 'Zend/Cloud/QueueService/Adapter.php';
  20. require_once 'Zend/Cloud/QueueService/Message.php';
  21. require_once 'Zend/Cloud/QueueService/MessageSet.php';
  22. /**
  23. * Abstract queue adapter
  24. *
  25. * Provides functionality around setting message and message set classes.
  26. *
  27. * @category Zend
  28. * @package Zend_Cloud
  29. * @subpackage QueueService
  30. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. */
  33. abstract class Zend_Cloud_QueueService_Adapter_AbstractAdapter
  34. implements Zend_Cloud_QueueService_Adapter
  35. {
  36. /**@+ option keys */
  37. const MESSAGE_CLASS = 'message_class';
  38. const MESSAGESET_CLASS = 'messageset_class';
  39. /**@-*/
  40. /** @var string Class to use for queue messages */
  41. protected $_messageClass = 'Zend_Cloud_QueueService_Message';
  42. /** @var string Class to use for collections of queue messages */
  43. protected $_messageSetClass = 'Zend_Cloud_QueueService_MessageSet';
  44. /**
  45. * Set class to use for message objects
  46. *
  47. * @param string $class
  48. * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
  49. */
  50. public function setMessageClass($class)
  51. {
  52. $this->_messageClass = (string) $class;
  53. return $this;
  54. }
  55. /**
  56. * Get class to use for message objects
  57. *
  58. * @return string
  59. */
  60. public function getMessageClass()
  61. {
  62. return $this->_messageClass;
  63. }
  64. /**
  65. * Set class to use for message collection objects
  66. *
  67. * @param string $class
  68. * @return Zend_Cloud_QueueService_Adapter_AbstractAdapter
  69. */
  70. public function setMessageSetClass($class)
  71. {
  72. $this->_messageSetClass = (string) $class;
  73. return $this;
  74. }
  75. /**
  76. * Get class to use for message collection objects
  77. *
  78. * @return string
  79. */
  80. public function getMessageSetClass()
  81. {
  82. return $this->_messageSetClass;
  83. }
  84. }