View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{note}
This proposal has been archived, and its various improvements are now addressed with issue [ZF-5791|http://framework.zend.com/issues/browse/ZF-5791].
{note}

{zone-data:component-name}
Zend_Service_Amazon_Abstract
{zone-data}

{zone-data:proposer-list}
[Jon Whitcraft|mailto:jon.zf@mac.com]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 15 Feburary 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Service_Amazon_Abstract is an abstract class for Amazon Web Service that will standardize the key handling across the services..
{zone-data}

{zone-data:references}

{zone-data}

{zone-data:requirements}
* This component *will* be an abstract class.
* This component *will* provide a standard starting base for all amamzon aws classes
* This component *will* extend Zend_Service_Abstract
{zone-data}

{zone-data:dependencies}
* Zend_Service_Abstract
* Zend_Service_Amamzon_Exception
{zone-data}

{zone-data:operation}
This will provide the methods for extending future amamzon web service classes to be based from.
{zone-data}

{zone-data:milestones}
* Milestone 1: Working prototype checked into the incubator supporting use cases
* Milestone 2: Unit tests exist, work, and are checked into SVN.

{zone-data}

{zone-data:class-list}
* Zend_Service_Amazon_Abstract
{zone-data}

{zone-data:use-cases}
||UC-01||

class Zend_Service_Amazon_Sqs extends Zend_Service_Amazon_Abstract {
}

{zone-data}

{zone-data:skeletons}
{code}

require_once 'Zend/Service/Abstract.php';

abstract class Zend_Service_Amazon_Abstract extends Zend_Service_Abstract
{
/**
* @var string Amazon Access Key
*/
protected static $default_accessKey = null;

/**
* @var string Amazon Secret Key
*/
protected static $default_secretKey = null;

/**
* @var string Amazon Secret Key
*/
protected $_secretKey;

/**
* @var string Amazon Access Key
*/
protected $_accessKey;

/**
* Set the keys to use when accessing SQS.
*
* @param string $access_key
* @param string $secret_key
* @return void
*/
public static function setKeys($access_key, $secret_key)
{
self::$default_accessKey = $access_key;
self::$default_secretKey = $secret_key;
}

/**
* Create Amazon Sqs client.
*
* @param string $access_key
* @param string $secret_key
* @return void
*/
public function __construct($access_key=null, $secret_key=null)
{
if(!$access_key) {
$access_key = self::$default_accessKey;
}
if(!$secret_key) {
$secret_key = self::$default_secretKey;
}
if(!$access_key || !$secret_key) {
require_once 'Zend/Service/Amazon/Exception.php';
throw new Zend_Service_Amazon_Exception("AWS keys were not supplied");
}
$this->_accessKey = $access_key;
$this->_secretKey = $secret_key;
}

/**
* Method to fetch the Access Key
*
* @return string
*/
protected function getAccessKey()
{
return $this->_accessKey;
}

/**
* Method to fetch the Secret AWS Key
*
* @return string
*/
protected function getSecretKey()
{
return $this->_secretKey;
}
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>