API Documentation

Zend/Cloud/DocumentService/Adapter/WindowsAzure.php

Show: inherited
Table of Contents

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Cloud  
Subpackage
DocumentService  

\Zend_Cloud_DocumentService_Adapter_WindowsAzure

Package: Zend\Cloud\DocumentService

SimpleDB adapter for document service.

Parent(s)
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  ACCOUNT_NAME = 'storage_accountname'
Constant  ACCOUNT_KEY = 'storage_accountkey'
Constant  HOST = "storage_host"
Constant  PROXY_HOST = "storage_proxy_host"
Constant  PROXY_PORT = "storage_proxy_port"
Constant  PROXY_CREDENTIALS = "storage_proxy_credentials"
Constant  DEFAULT_PARTITION_KEY = "default_partition_key"
Constant  PARTITION_KEY = 'PartitionKey'
Constant  ROW_KEY = 'RowKey'
Constant  VERIFY_ETAG = "verify_etag"
Constant  TIMESTAMP_KEY = "Timestamp"
Constant  DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE
Constant  DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'

Properties

Propertyprotectedstring  $_defaultPartitionKey= ''

Partition key to use by default when constructing document identifiers

Details
Type
string
Propertyprotectedstring  $_queryClass= ''Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query''

Class to utilize for new query objects

Default value'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'Details
Type
string
Propertyprotected\Zend_Service_WindowsAzure_Storage_Table  $_storageClient= ''

Azure service instance.

Methods

methodpublic__construct( array $options = array() ) : void

Constructor

Parameters
Name Type Description
$options array
methodprotected_getDocumentFromArray( array $document, null|string $collectionName = null ) : \Zend_Cloud_DocumentService_Document

Create suitable document from array of fields

Parameters
Name Type Description
$document array
$collectionName null|string

Collection to which this document belongs

Returns
Type Description
\Zend_Cloud_DocumentService_Document
methodprotected_resolveAttributes( \Zend_Service_WindowsAzure_Storage_TableEntity $entity ) : array

Resolve table values to attributes

Parameters
Name Type Description
$entity \Zend_Service_WindowsAzure_Storage_TableEntity
Returns
Type Description
array
methodprotected_validateCompositeKey( array $key ) : \throws

Validate a composite key

Parameters
Name Type Description
$key array
Returns
Type Description
\throws Zend_Cloud_DocumentService_Exception
methodprotected_validateDocumentId( array|string $documentId, null|string $collectionName = false ) : array

Validate a document identifier

If the identifier is an array containing a valid partition and row key, returns it. If the identifier is a string: - if a default partition key is present, it creates an identifier using that and the provided document ID - if a collection name is provided, it will use that for the partition key - otherwise, it's invalid

Parameters
Name Type Description
$documentId array|string
$collectionName null|string
Returns
Type Description
array
Throws
Exception Description
\Zend_Cloud_DocumentService_Exception
methodpublic_validateFieldKey( string $key ) : void

Validate an individual field name for well-formedness

Since Azure uses Atom, and fieldnames are included as part of XML element tag names, the field names must be valid XML names.

While we could potentially normalize names, this could also lead to conflict with other field names -- which we should avoid. As such, invalid field names will raise an exception.

Parameters
Name Type Description
$key string
Throws
Exception Description
\Zend_Cloud_DocumentService_Exception
methodpublic_validateFields( \Zend_Cloud_DocumentService_Document|array $document ) : void

Validate a document's fields for well-formedness

Since Azure uses Atom, and fieldnames are included as part of XML element tag names, the field names must be valid XML names.

Parameters
Name Type Description
$document \Zend_Cloud_DocumentService_Document|array
Throws
Exception Description
\Zend_Cloud_DocumentService_Exception
methodprotected_validateKey( string $key ) : void

Validate a partition or row key

Parameters
Name Type Description
$key string
Throws
Exception Description
\Zend_Cloud_DocumentService_Exception
methodpubliccreateCollection( string $name, array $options = null ) : boolean

Create collection.

Parameters
Name Type Description
$name string
$options array
Returns
Type Description
boolean
methodpublicdeleteCollection( string $name, array $options = null ) : boolean

Delete collection.

Parameters
Name Type Description
$name string
$options array
Returns
Type Description
boolean
methodpublicdeleteDocument(  $collectionName,  $documentId, array $options = null ) : void

Delete document.

Parameters
Name Type Description
$collectionName
$documentId
$options array
methodpublicfetchDocument( string $collectionName, mixed $documentId, array $options = null ) : \Zend_Cloud_DocumentService_Document

Fetch single document by ID

Parameters
Name Type Description
$collectionName string

Collection name

$documentId mixed

Document ID, adapter-dependent

$options array
Returns
Type Description
\Zend_Cloud_DocumentService_Document
methodpublicgetClient( ) : \Zend_Service_WindowsAzure_Storage_Table

Get the concrete service client

Returns
Type Description
\Zend_Service_WindowsAzure_Storage_Table
methodpublicgetDefaultPartitionKey( ) : null|string

Retrieve default partition key

Returns
Type Description
null|string
methodpublicinsertDocument(  $collectionName, array|\Zend_Cloud_DocumentService_Document $document, array $options = null ) : boolean

Insert document

Parameters
Name Type Description
$collectionName
$document array|\Zend_Cloud_DocumentService_Document
$options array
Returns
Type Description
boolean
methodpubliclistCollections( array $options = null ) : array

List collections.

Parameters
Name Type Description
$options array
Returns
Type Description
array
methodpubliclistDocuments( string $collectionName, null|array $options = null ) : \Zend_Cloud_DocumentService_DocumentSet

List all documents in a collection

Parameters
Name Type Description
$collectionName string
$options null|array
Returns
Type Description
\Zend_Cloud_DocumentService_DocumentSet
methodpublicquery( string $collectionName, string|\Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query $query, array $options = null ) : array

Query for documents stored in the document service. If a string is passed in $query, the query string will be passed directly to the service.

Parameters
Name Type Description
$collectionName string

Collection name

$query string|\Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
$options array
Returns
Type Description
array Zend_Cloud_DocumentService_DocumentSet
methodpublicreplaceDocument(  $collectionName, \Zend_Cloud_DocumentService_Document $document, array $options = null ) : boolean

Replace document.

The new document replaces the existing document.

Parameters
Name Type Description
$collectionName
$document \Zend_Cloud_DocumentService_Document
$options array
Returns
Type Description
boolean
methodpublicselect(  $fields = null ) : \Zend_Cloud_DocumentService_Query

Create query statement

Parameters
Name Type Description
$fields
Returns
Type Description
\Zend_Cloud_DocumentService_Query
methodpublicsetDefaultPartitionKey( string $key ) : \Zend_Cloud_DocumentService_Adapter_WindowsAzure

Set the default partition key

Parameters
Name Type Description
$key string
Returns
Type Description
\Zend_Cloud_DocumentService_Adapter_WindowsAzure
methodpublicupdateDocument( string $collectionName, mixed|\Zend_Cloud_DocumentService_Document $documentId, null|array|\Zend_Cloud_DocumentService_Document $fieldset = null, array $options = null ) : boolean

Update document.

The new document is merged the existing document.

Parameters
Name Type Description
$collectionName string
$documentId mixed|\Zend_Cloud_DocumentService_Document

Document identifier or document contaiing updates

$fieldset null|array|\Zend_Cloud_DocumentService_Document

Fields to update (or new fields))

$options array
Returns
Type Description
boolean
Documentation was generated by DocBlox 0.15.1.