Source for file Mock.php

Documentation is available at Mock.php

  1. <?php
  2. /** 
  3.  *  PHP Version 5
  4.  *
  5.  *  @category    Amazon
  6.  *  @package     Amazon_SimpleDB
  7.  *  @copyright   Copyright 2008 Amazon Technologies, Inc.
  8.  *  @link        http://aws.amazon.com
  9.  *  @license     http://aws.amazon.com/apache2.0  Apache License, Version 2.0
  10.  *  @version     2007-11-07
  11.  */
  12. /******************************************************************************* 
  13.  *    __  _    _  ___ 
  14.  *   (  )( \/\/ )/ __)
  15.  *   /__\ \    / \__ \
  16.  *  (_)(_) \/\/  (___/
  17.  * 
  18.  *  Amazon Simple DB PHP5 Library
  19.  *  Generated: Thu Aug 28 06:20:51 PDT 2008
  20.  * 
  21.  */
  22.  
  23. /**
  24.  *  @see Amazon_SimpleDB_Interface
  25.  */
  26. require_once ('Amazon/SimpleDB/Interface.php')
  27.  
  28. /**
  29.  * Amazon SimpleDB is a web service for running queries on structured
  30.  * data in real time. This service works in close conjunction with Amazon
  31.  * Simple Storage Service (Amazon S3) and Amazon Elastic Compute Cloud
  32.  * (Amazon EC2), collectively providing the ability to store, process
  33.  * and query data sets in the cloud. These services are designed to make
  34.  * web-scale computing easier and more cost-effective for developers.
  35.  * Traditionally, this type of functionality has been accomplished with
  36.  * a clustered relational database that requires a sizable upfront
  37.  * investment, brings more complexity than is typically needed, and often
  38.  * requires a DBA to maintain and administer. In contrast, Amazon SimpleDB
  39.  * is easy to use and provides the core functionality of a database -
  40.  * real-time lookup and simple querying of structured data without the
  41.  * operational complexity.  Amazon SimpleDB requires no schema, automatically
  42.  * indexes your data and provides a simple API for storage and access.
  43.  * This eliminates the administrative burden of data modeling, index
  44.  * maintenance, and performance tuning. Developers gain access to this
  45.  * functionality within Amazon's proven computing environment, are able
  46.  * to scale instantly, and pay only for what they use.
  47.  * 
  48.  */
  49. class  Amazon_SimpleDB_Mock implements Amazon_SimpleDB_Interface
  50. {
  51.     // Public API ------------------------------------------------------------//
  52.  
  53.             
  54.     /**
  55.      * Create Domain
  56.      * The CreateDomain operation creates a new domain. The domain name must be unique
  57.      * among the domains associated with the Access Key ID provided in the request. The CreateDomain
  58.      * operation may take 10 or more seconds to complete.
  59.      *   
  60.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_CreateDomain.html
  61.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_CreateDomain request or Amazon_SimpleDB_Model_CreateDomain object itself
  62.      * @see Amazon_SimpleDB_Model_CreateDomain
  63.      * @return Amazon_SimpleDB_Model_CreateDomainResponse Amazon_SimpleDB_Model_CreateDomainResponse
  64.      *
  65.      * @throws Amazon_SimpleDB_Exception
  66.      */
  67.     public function createDomain($request
  68.     {
  69.         require_once ('Amazon/SimpleDB/Model/CreateDomainResponse.php');
  70.         return Amazon_SimpleDB_Model_CreateDomainResponse::fromXML($this->_invoke('CreateDomain'));
  71.     }
  72.  
  73.  
  74.             
  75.     /**
  76.      * List Domains
  77.      * The ListDomains operaton lists all domains associated with the Access Key ID. It returns
  78.      * domain names up to the limit set by MaxNumberOfDomains. A NextToken is returned if there are more
  79.      * than MaxNumberOfDomains domains. Calling ListDomains successive times with the
  80.      * NextToken returns up to MaxNumberOfDomains more domain names each time.
  81.      *   
  82.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_ListDomains.html
  83.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_ListDomains request or Amazon_SimpleDB_Model_ListDomains object itself
  84.      * @see Amazon_SimpleDB_Model_ListDomains
  85.      * @return Amazon_SimpleDB_Model_ListDomainsResponse Amazon_SimpleDB_Model_ListDomainsResponse
  86.      *
  87.      * @throws Amazon_SimpleDB_Exception
  88.      */
  89.     public function listDomains($request
  90.     {
  91.         require_once ('Amazon/SimpleDB/Model/ListDomainsResponse.php');
  92.         return Amazon_SimpleDB_Model_ListDomainsResponse::fromXML($this->_invoke('ListDomains'));
  93.     }
  94.  
  95.  
  96.             
  97.     /**
  98.      * Delete Domain
  99.      * The DeleteDomain operation deletes a domain. Any items (and their attributes) in the domain
  100.      * are deleted as well. The DeleteDomain operation may take 10 or more seconds to complete.
  101.      *   
  102.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_DeleteDomain.html
  103.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_DeleteDomain request or Amazon_SimpleDB_Model_DeleteDomain object itself
  104.      * @see Amazon_SimpleDB_Model_DeleteDomain
  105.      * @return Amazon_SimpleDB_Model_DeleteDomainResponse Amazon_SimpleDB_Model_DeleteDomainResponse
  106.      *
  107.      * @throws Amazon_SimpleDB_Exception
  108.      */
  109.     public function deleteDomain($request
  110.     {
  111.         require_once ('Amazon/SimpleDB/Model/DeleteDomainResponse.php');
  112.         return Amazon_SimpleDB_Model_DeleteDomainResponse::fromXML($this->_invoke('DeleteDomain'));
  113.     }
  114.  
  115.  
  116.             
  117.     /**
  118.      * Put Attributes
  119.      * The PutAttributes operation creates or replaces attributes within an item. You specify new attributes
  120.      * using a combination of the Attribute.X.Name and Attribute.X.Value parameters. You specify
  121.      * the first attribute by the parameters Attribute.0.Name and Attribute.0.Value, the second
  122.      * attribute by the parameters Attribute.1.Name and Attribute.1.Value, and so on.
  123.      * Attributes are uniquely identified within an item by their name/value combination. For example, a single
  124.      * item can have the attributes { "first_name", "first_value" } and { "first_name",
  125.      * second_value" }. However, it cannot have two attribute instances where both the Attribute.X.Name and
  126.      * Attribute.X.Value are the same.
  127.      * Optionally, the requestor can supply the Replace parameter for each individual value. Setting this value
  128.      * to true will cause the new attribute value to replace the existing attribute value(s). For example, if an
  129.      * item has the attributes { 'a', '1' }, { 'b', '2'} and { 'b', '3' } and the requestor does a
  130.      * PutAttributes of { 'b', '4' } with the Replace parameter set to true, the final attributes of the
  131.      * item will be { 'a', '1' } and { 'b', '4' }, replacing the previous values of the 'b' attribute
  132.      * with the new value.
  133.      *   
  134.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_PutAttributes.html
  135.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_PutAttributes request or Amazon_SimpleDB_Model_PutAttributes object itself
  136.      * @see Amazon_SimpleDB_Model_PutAttributes
  137.      * @return Amazon_SimpleDB_Model_PutAttributesResponse Amazon_SimpleDB_Model_PutAttributesResponse
  138.      *
  139.      * @throws Amazon_SimpleDB_Exception
  140.      */
  141.     public function putAttributes($request
  142.     {
  143.         require_once ('Amazon/SimpleDB/Model/PutAttributesResponse.php');
  144.         return Amazon_SimpleDB_Model_PutAttributesResponse::fromXML($this->_invoke('PutAttributes'));
  145.     }
  146.  
  147.  
  148.             
  149.     /**
  150.      * Get Attributes
  151.      * Returns all of the attributes associated with the item. Optionally, the attributes returned can be limited to
  152.      * the specified AttributeName parameter.
  153.      * If the item does not exist on the replica that was accessed for this operation, an empty attribute is
  154.      * returned. The system does not return an error as it cannot guarantee the item does not exist on other
  155.      * replicas.
  156.      *   
  157.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_GetAttributes.html
  158.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_GetAttributes request or Amazon_SimpleDB_Model_GetAttributes object itself
  159.      * @see Amazon_SimpleDB_Model_GetAttributes
  160.      * @return Amazon_SimpleDB_Model_GetAttributesResponse Amazon_SimpleDB_Model_GetAttributesResponse
  161.      *
  162.      * @throws Amazon_SimpleDB_Exception
  163.      */
  164.     public function getAttributes($request
  165.     {
  166.         require_once ('Amazon/SimpleDB/Model/GetAttributesResponse.php');
  167.         return Amazon_SimpleDB_Model_GetAttributesResponse::fromXML($this->_invoke('GetAttributes'));
  168.     }
  169.  
  170.  
  171.             
  172.     /**
  173.      * Delete Attributes
  174.      * Deletes one or more attributes associated with the item. If all attributes of an item are deleted, the item is
  175.      * deleted.
  176.      *   
  177.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_DeleteAttributes.html
  178.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_DeleteAttributes request or Amazon_SimpleDB_Model_DeleteAttributes object itself
  179.      * @see Amazon_SimpleDB_Model_DeleteAttributes
  180.      * @return Amazon_SimpleDB_Model_DeleteAttributesResponse Amazon_SimpleDB_Model_DeleteAttributesResponse
  181.      *
  182.      * @throws Amazon_SimpleDB_Exception
  183.      */
  184.     public function deleteAttributes($request
  185.     {
  186.         require_once ('Amazon/SimpleDB/Model/DeleteAttributesResponse.php');
  187.         return Amazon_SimpleDB_Model_DeleteAttributesResponse::fromXML($this->_invoke('DeleteAttributes'));
  188.     }
  189.  
  190.  
  191.             
  192.     /**
  193.      * Query
  194.      * The Query operation returns a set of ItemNames that match the query expression. Query operations that
  195.      * run longer than 5 seconds will likely time-out and return a time-out error response.
  196.      * A Query with no QueryExpression matches all items in the domain.
  197.      *   
  198.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_Query.html
  199.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_Query request or Amazon_SimpleDB_Model_Query object itself
  200.      * @see Amazon_SimpleDB_Model_Query
  201.      * @return Amazon_SimpleDB_Model_QueryResponse Amazon_SimpleDB_Model_QueryResponse
  202.      *
  203.      * @throws Amazon_SimpleDB_Exception
  204.      */
  205.     public function query($request
  206.     {
  207.         require_once ('Amazon/SimpleDB/Model/QueryResponse.php');
  208.         return Amazon_SimpleDB_Model_QueryResponse::fromXML($this->_invoke('Query'));
  209.     }
  210.  
  211.  
  212.             
  213.     /**
  214.      * Query With Attributes
  215.      * The QueryWithAttributes operation returns a set of item names and associated attributes.
  216.      * The query semantics of this operation are identical to the Query operation.
  217.      *   
  218.      * @see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/SDB_API_QueryWithAttributes.html
  219.      * @param mixed $request array of parameters for Amazon_SimpleDB_Model_QueryWithAttributes request or Amazon_SimpleDB_Model_QueryWithAttributes object itself
  220.      * @see Amazon_SimpleDB_Model_QueryWithAttributes
  221.      * @return Amazon_SimpleDB_Model_QueryWithAttributesResponse Amazon_SimpleDB_Model_QueryWithAttributesResponse
  222.      *
  223.      * @throws Amazon_SimpleDB_Exception
  224.      */
  225.     public function queryWithAttributes($request
  226.     {
  227.         require_once ('Amazon/SimpleDB/Model/QueryWithAttributesResponse.php');
  228.         return Amazon_SimpleDB_Model_QueryWithAttributesResponse::fromXML($this->_invoke('QueryWithAttributes'));
  229.     }
  230.  
  231.     // Private API ------------------------------------------------------------//
  232.  
  233.     private function _invoke($actionName)
  234.     {
  235.         return $xml file_get_contents('Amazon/SimpleDB/Mock/' $actionName 'Response.xml'/** search include path */ TRUE);
  236.     }
  237. }

Documentation generated on Thu, 28 Aug 2008 06:35:51 -0700 by phpDocumentor 1.4.2