Cloud/DocumentService/Adapter/WindowsAzure.php

Show: PublicProtectedPrivateinherited
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-2014 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.
Provides functionality surrounding setting classes for each of: - document objects - document set objects - query class objects
Parent(s)
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

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

Properties

>VPropertyprotectedstring $_defaultPartitionKey
Partition key to use by default when constructing document identifiers
Details
Type
string
>VPropertyprotectedstring $_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
>VPropertyprotected\Zend_Service_WindowsAzure_Storage_Table $_storageClient
Azure service instance.

Methods

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

Constructor

Parameters
NameTypeDescription
$optionsarray
methodprotected_getDocumentFromArray(array $document, null | string $collectionName = null) : \Zend_Cloud_DocumentService_Document

Create suitable document from array of fields

Parameters
NameTypeDescription
$documentarray
$collectionNamenull | string

Collection to which this document belongs

Returns
TypeDescription
\Zend_Cloud_DocumentService_Document
methodprotected_resolveAttributes(\Zend_Service_WindowsAzure_Storage_TableEntity $entity) : array

Resolve table values to attributes

Parameters
NameTypeDescription
$entity\Zend_Service_WindowsAzure_Storage_TableEntity
Returns
TypeDescription
array
methodprotected_validateCompositeKey(array $key) : \throws

Validate a composite key

Parameters
NameTypeDescription
$keyarray
Returns
TypeDescription
\throwsZend_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
NameTypeDescription
$documentIdarray | string
$collectionNamenull | string
Returns
TypeDescription
array
Throws
ExceptionDescription
\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
NameTypeDescription
$keystring
Throws
ExceptionDescription
\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
NameTypeDescription
$document\Zend_Cloud_DocumentService_Document | array
Throws
ExceptionDescription
\Zend_Cloud_DocumentService_Exception
methodprotected_validateKey(string $key) : void

Validate a partition or row key

Parameters
NameTypeDescription
$keystring
Throws
ExceptionDescription
\Zend_Cloud_DocumentService_Exception
methodpubliccreateCollection(string $name, array $options = null) : boolean

Create collection.

Parameters
NameTypeDescription
$namestring
$optionsarray
Returns
TypeDescription
boolean
methodpublicdeleteCollection(string $name, array $options = null) : boolean

Delete collection.

Parameters
NameTypeDescription
$namestring
$optionsarray
Returns
TypeDescription
boolean
methodpublicdeleteDocument( $collectionName,  $documentId, array $options = null) : void

Delete document.

Parameters
NameTypeDescription
$collectionName
$documentId
$optionsarray
methodpublicfetchDocument(string $collectionName, mixed $documentId, array $options = null) : \Zend_Cloud_DocumentService_Document

Fetch single document by ID

Parameters
NameTypeDescription
$collectionNamestring

Collection name

$documentIdmixed

Document ID, adapter-dependent

$optionsarray
Returns
TypeDescription
\Zend_Cloud_DocumentService_Document
methodpublicgetClient() : \Zend_Service_WindowsAzure_Storage_Table

Get the concrete service client

methodpublicgetDefaultPartitionKey() : null | string

Retrieve default partition key

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

Insert document

Parameters
NameTypeDescription
$collectionName
$documentarray | \Zend_Cloud_DocumentService_Document
$optionsarray
Returns
TypeDescription
boolean
methodpubliclistCollections(array $options = null) : array

List collections.

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
array
methodpubliclistDocuments(string $collectionName, null | array $options = null) : \Zend_Cloud_DocumentService_DocumentSet

List all documents in a collection

Parameters
NameTypeDescription
$collectionNamestring
$optionsnull | array
Returns
TypeDescription
\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
NameTypeDescription
$collectionNamestring

Collection name

$querystring | \Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query
$optionsarray
Returns
TypeDescription
arrayZend_Cloud_DocumentService_DocumentSet
methodpublicreplaceDocument( $collectionName, \Zend_Cloud_DocumentService_Document $document, array $options = null) : boolean

Replace document.

The new document replaces the existing document.
Parameters
NameTypeDescription
$collectionName
$document\Zend_Cloud_DocumentService_Document
$optionsarray
Returns
TypeDescription
boolean
methodpublicselect( $fields = null) : \Zend_Cloud_DocumentService_Query

Create query statement

Parameters
NameTypeDescription
$fields
Returns
TypeDescription
\Zend_Cloud_DocumentService_Query
methodpublicsetDefaultPartitionKey(string $key) : \Zend_Cloud_DocumentService_Adapter_WindowsAzure

Set the default partition key

Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
\Zend_Cloud_DocumentService_Adapter_WindowsAzure
methodpublicupdateDocument(string $collectionName, mixed | \Zend_Cloud_DocumentService_Document $documentId,  $fieldset = null, array $options = null) : boolean

Update document.

The new document is merged the existing document.
Parameters
NameTypeDescription
$collectionNamestring
$documentIdmixed | \Zend_Cloud_DocumentService_Document

Document identifier or document contaiing updates

$fieldset
$optionsarray
Returns
TypeDescription
boolean
Documentation was generated by phpDocumentor 2.2.0 .