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()) : voidConstructor
| Name | Type | Description |
|---|---|---|
| $options | array |

_getDocumentFromArray(array $document, null | string $collectionName = null) : \Zend_Cloud_DocumentService_DocumentCreate 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) : arrayResolve table values to attributes
| Name | Type | Description |
|---|---|---|
| $entity | \Zend_Service_WindowsAzure_Storage_TableEntity |
| Type | Description |
|---|---|
| array |

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

_validateDocumentId(array | string $documentId, null | string $collectionName = false) : arrayValidate 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) : voidValidate 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) : voidValidate 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) : voidValidate a partition or row key
| Name | Type | Description |
|---|---|---|
| $key | string |
| Exception | Description |
|---|---|
| \Zend_Cloud_DocumentService_Exception |

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

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

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

fetchDocument(string $collectionName, mixed $documentId, array $options = null) : \Zend_Cloud_DocumentService_DocumentFetch 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_TableGet the concrete service client
| Type | Description |
|---|---|
| \Zend_Service_WindowsAzure_Storage_Table |

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

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

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

getQueryClass() : stringGet 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) : booleanInsert document
| Name | Type | Description |
|---|---|---|
| $collectionName | ||
| $document | array | \Zend_Cloud_DocumentService_Document | |
| $options | array |
| Type | Description |
|---|---|
| boolean |

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

listDocuments(string $collectionName, null | array $options = null) : \Zend_Cloud_DocumentService_DocumentSetList 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) : arrayQuery 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) : booleanReplace 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_QueryCreate query statement
| Name | Type | Description |
|---|---|---|
| $fields | string |
| Type | Description |
|---|---|
| \Zend_Cloud_DocumentService_Query |

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

setDocumentClass(string $class) : \Zend_Cloud_DocumentService_Adapter_AbstractAdapterSet 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_AbstractAdapterSet 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_AbstractAdapterSet 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) : booleanUpdate 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 |