|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Queue |
|
17 * @subpackage Adapter |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: Null.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Queue_Adapter_AdapterAbstract |
|
25 */ |
|
26 require_once 'Zend/Queue/Adapter/AdapterAbstract.php'; |
|
27 |
|
28 /** |
|
29 * Class testing. No supported functions. Also used to disable a Zend_Queue. |
|
30 * |
|
31 * @category Zend |
|
32 * @package Zend_Queue |
|
33 * @subpackage Adapter |
|
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
36 */ |
|
37 class Zend_Queue_Adapter_Null extends Zend_Queue_Adapter_AdapterAbstract |
|
38 { |
|
39 /** |
|
40 * Constructor |
|
41 * |
|
42 * @param array|Zend_Config $options |
|
43 * @param null|Zend_Queue $queue |
|
44 * @return void |
|
45 */ |
|
46 public function __construct($options, Zend_Queue $queue = null) |
|
47 { |
|
48 parent::__construct($options, $queue); |
|
49 } |
|
50 |
|
51 /******************************************************************** |
|
52 * Queue management functions |
|
53 *********************************************************************/ |
|
54 |
|
55 /** |
|
56 * Does a queue already exist? |
|
57 * |
|
58 * @throws Zend_Queue_Exception - not supported. |
|
59 */ |
|
60 public function isExists($name) |
|
61 { |
|
62 require_once 'Zend/Queue/Exception.php'; |
|
63 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
64 } |
|
65 |
|
66 |
|
67 /** |
|
68 * Create a new queue |
|
69 * |
|
70 * @throws Zend_Queue_Exception - not supported. |
|
71 */ |
|
72 public function create($name, $timeout=null) |
|
73 { |
|
74 require_once 'Zend/Queue/Exception.php'; |
|
75 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
76 } |
|
77 |
|
78 /** |
|
79 * Delete a queue and all of it's messages |
|
80 * |
|
81 * @throws Zend_Queue_Exception - not supported. |
|
82 */ |
|
83 public function delete($name) |
|
84 { |
|
85 require_once 'Zend/Queue/Exception.php'; |
|
86 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
87 } |
|
88 |
|
89 /** |
|
90 * Get an array of all available queues |
|
91 * |
|
92 * @throws Zend_Queue_Exception - not supported. |
|
93 */ |
|
94 public function getQueues() |
|
95 { |
|
96 require_once 'Zend/Queue/Exception.php'; |
|
97 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
98 } |
|
99 |
|
100 /** |
|
101 * Return the approximate number of messages in the queue |
|
102 * |
|
103 * @throws Zend_Queue_Exception - not supported. |
|
104 */ |
|
105 public function count(Zend_Queue $queue=null) |
|
106 { |
|
107 require_once 'Zend/Queue/Exception.php'; |
|
108 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
109 } |
|
110 |
|
111 /******************************************************************** |
|
112 * Messsage management functions |
|
113 *********************************************************************/ |
|
114 |
|
115 /** |
|
116 * Send a message to the queue |
|
117 * |
|
118 * @throws Zend_Queue_Exception - not supported. |
|
119 */ |
|
120 public function send($message, Zend_Queue $queue=null) |
|
121 { |
|
122 require_once 'Zend/Queue/Exception.php'; |
|
123 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
124 } |
|
125 |
|
126 /** |
|
127 * Get messages in the queue |
|
128 * |
|
129 * @throws Zend_Queue_Exception - not supported. |
|
130 */ |
|
131 public function receive($maxMessages=null, $timeout=null, Zend_Queue $queue=null) |
|
132 { |
|
133 require_once 'Zend/Queue/Exception.php'; |
|
134 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
135 } |
|
136 |
|
137 /** |
|
138 * Delete a message from the queue |
|
139 * |
|
140 * @throws Zend_Queue_Exception - not supported. |
|
141 */ |
|
142 public function deleteMessage(Zend_Queue_Message $message) |
|
143 { |
|
144 require_once 'Zend/Queue/Exception.php'; |
|
145 throw new Zend_Queue_Exception(__FUNCTION__ . '() is not supported by ' . get_class($this)); |
|
146 } |
|
147 |
|
148 /******************************************************************** |
|
149 * Supporting functions |
|
150 *********************************************************************/ |
|
151 |
|
152 /** |
|
153 * Return a list of queue capabilities functions |
|
154 * |
|
155 * $array['function name'] = true or false |
|
156 * true is supported, false is not supported. |
|
157 * |
|
158 * @param string $name |
|
159 * @return array |
|
160 */ |
|
161 public function getCapabilities() |
|
162 { |
|
163 return array( |
|
164 'create' => false, |
|
165 'delete' => false, |
|
166 'send' => false, |
|
167 'receive' => false, |
|
168 'deleteMessage' => false, |
|
169 'getQueues' => false, |
|
170 'count' => false, |
|
171 'isExists' => false, |
|
172 ); |
|
173 } |
|
174 } |