/wp-content/plugins/backwpup/sdk/WindowsAzure/ServiceBus/Models/QueueInfo.php

https://bitbucket.org/cesarmedrano/cesarmedrano · PHP · 444 lines · 172 code · 39 blank · 233 comment · 4 complexity · a622dc5e086c7ed82c4be8712d3945fd MD5 · raw file

  1. <?php
  2. /**
  3. * LICENSE: Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. * http://www.apache.org/licenses/LICENSE-2.0
  7. *
  8. * Unless required by applicable law or agreed to in writing, software
  9. * distributed under the License is distributed on an "AS IS" BASIS,
  10. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. * See the License for the specific language governing permissions and
  12. * limitations under the License.
  13. *
  14. * PHP version 5
  15. *
  16. * @category Microsoft
  17. * @package WindowsAzure\ServiceBus\Models
  18. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  19. * @copyright 2012 Microsoft Corporation
  20. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  21. * @link https://github.com/WindowsAzure/azure-sdk-for-php
  22. */
  23. namespace WindowsAzure\ServiceBus\Models;
  24. use WindowsAzure\Common\Internal\Atom\Content;
  25. use WindowsAzure\Common\Internal\Atom\Entry;
  26. use WindowsAzure\Common\Internal\Resources;
  27. use WindowsAzure\Common\Internal\Serialization\XmlSerializer;
  28. use WindowsAzure\Common\Internal\Utilities;
  29. use WindowsAzure\Common\Internal\Validate;
  30. use WindowsAzure\ServiceBus\Models\QueueDescription;
  31. /**
  32. * The information of a queue.
  33. *
  34. * @category Microsoft
  35. * @package WindowsAzure\ServiceBus\Models
  36. * @author Azure PHP SDK <azurephpsdk@microsoft.com>
  37. * @copyright 2012 Microsoft Corporation
  38. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
  39. * @version Release: @package_version@
  40. * @link https://github.com/WindowsAzure/azure-sdk-for-php
  41. */
  42. class QueueInfo
  43. {
  44. /**
  45. * The entry of the queue info.
  46. *
  47. * @var Entry
  48. */
  49. private $_entry;
  50. /**
  51. * The description of the queue.
  52. *
  53. * @var QueueDescription
  54. */
  55. private $_queueDescription;
  56. /**
  57. * Creates a QueueInfo instance with specified parameters.
  58. *
  59. * @param string $title The name of the queue.
  60. * @param QueueDescription $queueDescription The description of the queue.
  61. */
  62. public function __construct(
  63. $title = Resources::EMPTY_STRING,
  64. $queueDescription = null
  65. ) {
  66. Validate::isString($title, 'title');
  67. if (is_null($queueDescription)) {
  68. $queueDescription = new QueueDescription();
  69. }
  70. $this->_queueDescription = $queueDescription;
  71. $this->_entry = new Entry();
  72. $this->_entry->setTitle($title);
  73. $this->_entry->setAttribute(
  74. Resources::XMLNS,
  75. Resources::SERVICE_BUS_NAMESPACE
  76. );
  77. }
  78. /**
  79. * Populates the properties of the queue info instance with a
  80. * ATOM ENTRY XML string.
  81. *
  82. * @param string $entryXml An ATOM entry based XML string.
  83. *
  84. * @return none
  85. */
  86. public function parseXml($entryXml)
  87. {
  88. $this->_entry->parseXml($entryXml);
  89. $content = $this->_entry->getContent();
  90. if (is_null($content)) {
  91. $this->_queueDescription = null;
  92. } else {
  93. $this->_queueDescription = QueueDescription::create($content->getText());
  94. }
  95. }
  96. /**
  97. * Returns a XML string based on ATOM ENTRY schema.
  98. *
  99. * @param \XMLWriter $xmlWriter The XML writer.
  100. *
  101. * @return none
  102. */
  103. public function writeXml($xmlWriter)
  104. {
  105. $content = null;
  106. if (!is_null($this->_queueDescription)) {
  107. $content = new Content();
  108. $content->setText(
  109. XmlSerializer::objectSerialize(
  110. $this->_queueDescription,
  111. 'QueueDescription'
  112. )
  113. );
  114. $content->setType(Resources::XML_CONTENT_TYPE);
  115. }
  116. $this->_entry->setContent($content);
  117. $this->_entry->writeXml($xmlWriter);
  118. }
  119. /**
  120. * Gets the description of the queue.
  121. *
  122. * @return none
  123. */
  124. public function getQueueDescription()
  125. {
  126. return $this->_queueDescription;
  127. }
  128. /**
  129. * Sets the description of the queue.
  130. *
  131. * @param QueueDescription $queueDescription The description of the queue.
  132. *
  133. * @return none
  134. */
  135. public function setQueueDescription($queueDescription)
  136. {
  137. $this->_queueDescription = $queueDescription;
  138. }
  139. /**
  140. * Gets the title.
  141. *
  142. * @return string
  143. */
  144. public function getTitle()
  145. {
  146. return $this->_entry->getTitle();
  147. }
  148. /**
  149. * Sets the title.
  150. *
  151. * @param string $title The title of the queue info.
  152. *
  153. * @return none
  154. */
  155. public function setTitle($title)
  156. {
  157. $this->_entry->setTitle($title);
  158. }
  159. /**
  160. * Gets the entry.
  161. *
  162. * @return Entry
  163. */
  164. public function getEntry()
  165. {
  166. return $this->_entry;
  167. }
  168. /**
  169. * Sets the entry.
  170. *
  171. * @param Entry $entry The entry of the queue info.
  172. *
  173. * @return none
  174. */
  175. public function setEntry($entry)
  176. {
  177. $this->_entry = $entry;
  178. }
  179. /**
  180. * Gets the lock duration.
  181. *
  182. * @return string
  183. */
  184. public function getLockDuration()
  185. {
  186. return $this->_queueDescription->getLockDuration();
  187. }
  188. /**
  189. * Sets the lock duration.
  190. *
  191. * @param string $lockDuration The lock duration.
  192. *
  193. * @return none
  194. */
  195. public function setLockDuration($lockDuration)
  196. {
  197. $this->_queueDescription->setLockDuration($lockDuration);
  198. }
  199. /**
  200. * gets the maximum size in mega bytes.
  201. *
  202. * @return integer
  203. */
  204. public function getMaxSizeInMegabytes()
  205. {
  206. return $this->_queueDescription->getMaxSizeInMegabytes();
  207. }
  208. /**
  209. * Sets the max size in mega bytes.
  210. *
  211. * @param integer $maxSizeInMegabytes The max size in mega bytes.
  212. *
  213. * @return none
  214. */
  215. public function setMaxSizeInMegabytes($maxSizeInMegabytes)
  216. {
  217. $this->_queueDescription->setMaxSizeInMegabytes($maxSizeInMegabytes);
  218. }
  219. /**
  220. * Gets requires duplicate detection.
  221. *
  222. * @return boolean
  223. */
  224. public function getRequiresDuplicateDetection()
  225. {
  226. return $this->_queueDescription->getRequiresDuplicateDetection();
  227. }
  228. /**
  229. * Sets requires duplicate detection.
  230. *
  231. * @param boolean $requiresDuplicateDetection If duplicate detection is required.
  232. *
  233. * @return none
  234. */
  235. public function setRequiresDuplicateDetection($requiresDuplicateDetection)
  236. {
  237. $this->_queueDescription->setRequiresDuplicateDetection($requiresDuplicateDetection);
  238. }
  239. /**
  240. * Gets the requires session.
  241. *
  242. * @return boolean
  243. */
  244. public function getRequiresSession()
  245. {
  246. return $this->_queueDescription->getRequiresSession();
  247. }
  248. /**
  249. * Sets the requires session.
  250. *
  251. * @param boolean $requiresSession If session is required.
  252. *
  253. * @return none
  254. */
  255. public function setRequiresSession($requiresSession)
  256. {
  257. $this->_queueDescription->setRequiresSession($requiresSession);
  258. }
  259. /**
  260. * gets the default message time to live.
  261. *
  262. * @return string
  263. */
  264. public function getDefaultMessageTimeToLive()
  265. {
  266. return $this->_queueDescription->getDefaultMessageTimeToLive();
  267. }
  268. /**
  269. * Sets the default message time to live.
  270. *
  271. * @param string $defaultMessageTimeToLive The default message time to live.
  272. *
  273. * @return none
  274. */
  275. public function setDefaultMessageTimeToLive($defaultMessageTimeToLive)
  276. {
  277. $this->_queueDescription->setDefaultMessageTimeToLive($defaultMessageTimeToLive);
  278. }
  279. /**
  280. * Gets dead lettering on message expiration.
  281. *
  282. * @return string
  283. */
  284. public function getDeadLetteringOnMessageExpiration()
  285. {
  286. return $this->_queueDescription->getDeadLetteringOnMessageExpiration();
  287. }
  288. /**
  289. * Sets dead lettering on message expiration.
  290. *
  291. * @param string $deadLetteringOnMessageExpiration The dead lettering on
  292. * message expiration.
  293. *
  294. * @return none
  295. */
  296. public function setDeadLetteringOnMessageExpiration(
  297. $deadLetteringOnMessageExpiration
  298. ) {
  299. $this->_queueDescription->setDeadLetteringOnMessageExpiration($deadLetteringOnMessageExpiration);
  300. }
  301. /**
  302. * Gets duplicate detection history time window.
  303. *
  304. * @return string
  305. */
  306. public function getDuplicateDetectionHistoryTimeWindow()
  307. {
  308. return $this->_queueDescription->getDuplicateDetectionHistoryTimeWindow();
  309. }
  310. /**
  311. * Sets the duplicate detection history time window.
  312. *
  313. * @param string $duplicateDetectionHistoryTimeWindow The duplicate
  314. * detection history time window.
  315. *
  316. * @return none
  317. */
  318. public function setDuplicateDetectionHistoryTimeWindow(
  319. $duplicateDetectionHistoryTimeWindow
  320. ) {
  321. $this->_queueDescription->setDuplicateDetectionHistoryTimeWindow(
  322. $duplicateDetectionHistoryTimeWindow
  323. );
  324. }
  325. /**
  326. * Gets maximum delivery count.
  327. *
  328. * @return string
  329. */
  330. public function getMaxDeliveryCount()
  331. {
  332. return $this->_queueDescription->getMaxDeliveryCount();
  333. }
  334. /**
  335. * Sets the maximum delivery count.
  336. *
  337. * @param string $maxDeliveryCount The maximum delivery count.
  338. *
  339. * @return none
  340. */
  341. public function setMaxDeliveryCount($maxDeliveryCount)
  342. {
  343. $this->_queueDescription->setMaxDeliveryCount($maxDeliveryCount);
  344. }
  345. /**
  346. * Gets enable batched operation.
  347. *
  348. * @return boolean
  349. */
  350. public function getEnableBatchedOperations()
  351. {
  352. return $this->_queueDescription->getEnableBatchedOperations();
  353. }
  354. /**
  355. * Sets enable batched operations.
  356. *
  357. * @param boolean $enableBatchedOperations Enable batched operations.
  358. *
  359. * @return none
  360. */
  361. public function setEnableBatchedOperations($enableBatchedOperations)
  362. {
  363. $this->_queueDescription->setEnableBatchedOperations($enableBatchedOperations);
  364. }
  365. /**
  366. * Gets the size in bytes.
  367. *
  368. * @return integer
  369. */
  370. public function getSizeInBytes()
  371. {
  372. return $this->_queueDescription->getSizeInBytes();
  373. }
  374. /**
  375. * Sets the size in bytes.
  376. *
  377. * @param integer $sizeInBytes The size in bytes.
  378. *
  379. * @return none
  380. */
  381. public function setSizeInBytes($sizeInBytes)
  382. {
  383. $this->_queueDescription->setSizeInBytes($sizeInBytes);
  384. }
  385. /**
  386. * Gets the message count.
  387. *
  388. * @return integer
  389. */
  390. public function getMessageCount()
  391. {
  392. return $this->_queueDescription->getMessageCount();
  393. }
  394. /**
  395. * Sets the message count.
  396. *
  397. * @param string $messageCount The count of the message.
  398. *
  399. * @return none
  400. */
  401. public function setMessageCount($messageCount)
  402. {
  403. $this->_queueDescription->setMessageCount($messageCount);
  404. }
  405. }