Cloud/DocumentService/Adapter/WindowsAzure.php
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 [email protected] 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
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-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants

DOCUMENT_CLASS
= 'document_class'

DOCUMENTSET_CLASS
= 'documentset_class'

QUERY_CLASS
= 'query_class'

HTTP_ADAPTER
= 'http_adapter'
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter::HTTP_ADAPTER
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::HTTP_ADAPTER
Properties


string $_defaultPartitionKey =
Partition key to use by default when constructing document identifiers
- Type
- string


string $_documentClass = 'Zend_Cloud_DocumentService_Document'
Class to utilize for new document objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentClass'Zend_Cloud_DocumentService_Document'
Details- Type
- string
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentClass


string $_documentSetClass = 'Zend_Cloud_DocumentService_DocumentSet'
Class to utilize for new document set objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentSetClass'Zend_Cloud_DocumentService_DocumentSet'
Details- Type
- string
- Inherited_from
- \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::$$_documentSetClass


string $_queryClass = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'
Class to utilize for new query objects
'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'
Details- Type
- string
Methods


__construct(array $options = array()) : void
Constructor
Name | Type | Description |
---|---|---|
$options | array |


_getDocumentFromArray(array $document, null | string $collectionName = null) : \Zend_Cloud_DocumentService_Document
Create suitable document from array of fields
Name | Type | Description |
---|---|---|
$document | array | |
$collectionName | null | string | Collection to which this document belongs |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Document |


_resolveAttributes(\Zend_Service_WindowsAzure_Storage_TableEntity $entity) : array
Resolve table values to attributes
Name | Type | Description |
---|---|---|
$entity | \Zend_Service_WindowsAzure_Storage_TableEntity |
Type | Description |
---|---|
array |


_validateCompositeKey(array $key) : \throws
Validate a composite key
Name | Type | Description |
---|---|---|
$key | array |
Type | Description |
---|---|
\throws | Zend_Cloud_DocumentService_Exception |


_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
Name | Type | Description |
---|---|---|
$documentId | array | string | |
$collectionName | null | string |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Cloud_DocumentService_Exception |


_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.
Name | Type | Description |
---|---|---|
$key | string |
Exception | Description |
---|---|
\Zend_Cloud_DocumentService_Exception |


_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.
Name | Type | Description |
---|---|---|
$document | \Zend_Cloud_DocumentService_Document | array |
Exception | Description |
---|---|
\Zend_Cloud_DocumentService_Exception |


_validateKey(string $key) : void
Validate a partition or row key
Name | Type | Description |
---|---|---|
$key | string |
Exception | Description |
---|---|
\Zend_Cloud_DocumentService_Exception |


createCollection(string $name, array $options = null) : boolean
Create collection.
Name | Type | Description |
---|---|---|
$name | string | |
$options | array |
Type | Description |
---|---|
boolean |


deleteCollection(string $name, array $options = null) : boolean
Delete collection.
Name | Type | Description |
---|---|---|
$name | string | |
$options | array |
Type | Description |
---|---|
boolean |


deleteDocument( $collectionName, $documentId, array $options = null) : void
Delete document.
Name | Type | Description |
---|---|---|
$collectionName | ||
$documentId | ||
$options | array |


fetchDocument(string $collectionName, mixed $documentId, array $options = null) : \Zend_Cloud_DocumentService_Document
Fetch single document by ID
Will return false if the document does not exist
Name | Type | Description |
---|---|---|
$collectionName | string | Collection name |
$documentId | mixed | Document ID, adapter-dependent |
$options | array |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Document |


getClient() : \Zend_Service_WindowsAzure_Storage_Table
Get the concrete service client
Type | Description |
---|---|
\Zend_Service_WindowsAzure_Storage_Table |


getDefaultPartitionKey() : null | string
Retrieve default partition key
Type | Description |
---|---|
null | string |


getDocumentClass() : string
Get the class for document objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getDocumentClass()Type | Description |
---|---|
string |


getDocumentSetClass() : string
Get the class for document set objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getDocumentSetClass()Type | Description |
---|---|
string |


getQueryClass() : string
Get the class for query objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::getQueryClass()Type | Description |
---|---|
string |


insertDocument( $collectionName, array | \Zend_Cloud_DocumentService_Document $document, array $options = null) : boolean
Insert document
Name | Type | Description |
---|---|---|
$collectionName | ||
$document | array | \Zend_Cloud_DocumentService_Document | |
$options | array |
Type | Description |
---|---|
boolean |


listCollections(array $options = null) : array
List collections.
Name | Type | Description |
---|---|---|
$options | array |
Type | Description |
---|---|
array |


listDocuments(string $collectionName, null | array $options = null) : \Zend_Cloud_DocumentService_DocumentSet
List all documents in a collection
Name | Type | Description |
---|---|---|
$collectionName | string | |
$options | null | array |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_DocumentSet |


query(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.
Name | Type | Description |
---|---|---|
$collectionName | string | Collection name |
$query | string | \Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query | |
$options | array |
Type | Description |
---|---|
array | Zend_Cloud_DocumentService_DocumentSet |


replaceDocument( $collectionName, \Zend_Cloud_DocumentService_Document $document, array $options = null) : boolean
Replace document.
The new document replaces the existing document.
Name | Type | Description |
---|---|---|
$collectionName | ||
$document | \Zend_Cloud_DocumentService_Document | |
$options | array |
Type | Description |
---|---|
boolean |


select(string $fields = null) : \Zend_Cloud_DocumentService_Query
Create query statement
Name | Type | Description |
---|---|---|
$fields | string |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Query |


setDefaultPartitionKey(string $key) : \Zend_Cloud_DocumentService_Adapter_WindowsAzure
Set the default partition key
Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Adapter_WindowsAzure |


setDocumentClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Set the class for document objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setDocumentClass()Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter |


setDocumentSetClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Set the class for document set objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setDocumentSetClass()Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter |


setQueryClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapter
Set the query class for query objects
Inherited from: \Zend_Cloud_DocumentService_Adapter_AbstractAdapter::setQueryClass()Name | Type | Description |
---|---|---|
$class | string |
Type | Description |
---|---|
\Zend_Cloud_DocumentService_Adapter_AbstractAdapter |


updateDocument(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.
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 |
Type | Description |
---|---|
boolean |