Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Cloud_DocumentService_Adapter_WindowsAzure Class Reference

Public Member Functions

 __construct ($options=array())
 Constructor.
 
 setDefaultPartitionKey ($key)
 Set the default partition key.
 
 getDefaultPartitionKey ()
 Retrieve default partition key.
 
 createCollection ($name, $options=null)
 Create collection.
 
 deleteCollection ($name, $options=null)
 Delete collection.
 
 listCollections ($options=null)
 List collections.
 
 listDocuments ($collectionName, array $options=null)
 List all documents in a collection.
 
 insertDocument ($collectionName, $document, $options=null)
 Insert document.
 
 replaceDocument ($collectionName, $document, $options=null)
 Replace document.
 
 updateDocument ($collectionName, $documentId, $fieldset=null, $options=null)
 Update document.
 
 deleteDocument ($collectionName, $documentId, $options=null)
 Delete document.
 
 fetchDocument ($collectionName, $documentId, $options=null)
 Fetch single document by ID.
 
 query ($collectionName, $query, $options=null)
 Query for documents stored in the document service.
 
 select ($fields=null)
 Create query statement.
 
 getClient ()
 Get the concrete service client.
 
 _validateFields ($document)
 Validate a document's fields for well-formedness.
 
 _validateFieldKey ($key)
 Validate an individual field name for well-formedness.
 
- Public Member Functions inherited from Zend_Cloud_DocumentService_Adapter_AbstractAdapter
 setDocumentClass ($class)
 Set the class for document objects.
 
 getDocumentClass ()
 Get the class for document objects.
 
 setDocumentSetClass ($class)
 Set the class for document set objects.
 
 getDocumentSetClass ()
 Get the class for document set objects.
 
 setQueryClass ($class)
 Set the query class for query objects.
 
 getQueryClass ()
 Get the class for query objects.
 

Public Attributes

const ACCOUNT_NAME = 'storage_accountname'
 
const ACCOUNT_KEY = 'storage_accountkey'
 
const HOST = "storage_host"
 
const PROXY_HOST = "storage_proxy_host"
 
const PROXY_PORT = "storage_proxy_port"
 
const PROXY_CREDENTIALS = "storage_proxy_credentials"
 
const DEFAULT_PARTITION_KEY = "default_partition_key"
 
const PARTITION_KEY = 'PartitionKey'
 
const ROW_KEY = 'RowKey'
 
const VERIFY_ETAG = "verify_etag"
 
const TIMESTAMP_KEY = "Timestamp"
 
const DEFAULT_HOST = Zend_Service_WindowsAzure_Storage::URL_CLOUD_TABLE
 
const DEFAULT_QUERY_CLASS = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'
 
- Public Attributes inherited from Zend_Cloud_DocumentService_Adapter_AbstractAdapter
const DOCUMENT_CLASS = 'document_class'
 
const DOCUMENTSET_CLASS = 'documentset_class'
 
const QUERY_CLASS = 'query_class'
 
- Public Attributes inherited from Zend_Cloud_DocumentService_Adapter
const HTTP_ADAPTER = 'http_adapter'
 

Protected Member Functions

 _getDocumentFromArray ($document, $collectionName=null)
 Create suitable document from array of fields.
 
 _resolveAttributes (Zend_Service_WindowsAzure_Storage_TableEntity $entity)
 Resolve table values to attributes.
 
 _validateKey ($key)
 Validate a partition or row key.
 
 _validateCompositeKey (array $key)
 Validate a composite key.
 
 _validateDocumentId ($documentId, $collectionName=false)
 Validate a document identifier.
 

Protected Attributes

 $_storageClient
 
 $_queryClass = 'Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query'
 
 $_defaultPartitionKey
 
- Protected Attributes inherited from Zend_Cloud_DocumentService_Adapter_AbstractAdapter
 $_documentClass = 'Zend_Cloud_DocumentService_Document'
 
 $_documentSetClass = 'Zend_Cloud_DocumentService_DocumentSet'
 
 $_queryClass = 'Zend_Cloud_DocumentService_Query'
 

Constructor & Destructor Documentation

__construct (   $options = array())

Constructor.

Parameters
array$options
Returns
void

Member Function Documentation

_getDocumentFromArray (   $document,
  $collectionName = null 
)
protected

Create suitable document from array of fields.

Parameters
array$document
null | string$collectionNameCollection to which this document belongs
Returns
Zend_Cloud_DocumentService_Document
_resolveAttributes ( Zend_Service_WindowsAzure_Storage_TableEntity  $entity)
protected

Resolve table values to attributes.

Parameters
Zend_Service_WindowsAzure_Storage_TableEntity$entity
Returns
array
_validateCompositeKey ( array  $key)
protected

Validate a composite key.

Parameters
array$key
Returns
throws Zend_Cloud_DocumentService_Exception
_validateDocumentId (   $documentId,
  $collectionName = false 
)
protected

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
array | string$documentId
null | string$collectionName
Returns
array
Exceptions
Zend_Cloud_DocumentService_Exception
_validateFieldKey (   $key)

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
string$key
Returns
void
Exceptions
Zend_Cloud_DocumentService_Exception
_validateFields (   $document)

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
Zend_Cloud_DocumentService_Document | array$document
Returns
void
Exceptions
Zend_Cloud_DocumentService_Exception
_validateKey (   $key)
protected

Validate a partition or row key.

Parameters
string$key
Returns
void
Exceptions
Zend_Cloud_DocumentService_Exception
createCollection (   $name,
  $options = null 
)

Create collection.

Parameters
string$name
array$options
Returns
boolean

Implements Zend_Cloud_DocumentService_Adapter.

deleteCollection (   $name,
  $options = null 
)

Delete collection.

Parameters
string$name
array$options
Returns
boolean

Implements Zend_Cloud_DocumentService_Adapter.

deleteDocument (   $collectionName,
  $documentId,
  $options = null 
)

Delete document.

Parameters
mixed$documentDocument ID or Document object.
array$options
Returns
void

Implements Zend_Cloud_DocumentService_Adapter.

fetchDocument (   $collectionName,
  $documentId,
  $options = null 
)

Fetch single document by ID.

Parameters
string$collectionNameCollection name
mixed$documentIdDocument ID, adapter-dependent
array$options
Returns
Zend_Cloud_DocumentService_Document

Implements Zend_Cloud_DocumentService_Adapter.

getClient ( )

Get the concrete service client.

Returns
Zend_Service_WindowsAzure_Storage_Table

Implements Zend_Cloud_DocumentService_Adapter.

getDefaultPartitionKey ( )

Retrieve default partition key.

Returns
null|string
insertDocument (   $collectionName,
  $document,
  $options = null 
)

Insert document.

Parameters
array | Zend_Cloud_DocumentService_Document$document
array$options
Returns
boolean

Implements Zend_Cloud_DocumentService_Adapter.

listCollections (   $options = null)

List collections.

Parameters
array$options
Returns
array

Implements Zend_Cloud_DocumentService_Adapter.

listDocuments (   $collectionName,
array  $options = null 
)

List all documents in a collection.

Parameters
string$collectionName
null | array$options
Returns
Zend_Cloud_DocumentService_DocumentSet

Implements Zend_Cloud_DocumentService_Adapter.

query (   $collectionName,
  $query,
  $options = null 
)

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
string$collectionNameCollection name
string | Zend_Cloud_DocumentService_Adapter_WindowsAzure_Query$query
array$options
Returns
array Zend_Cloud_DocumentService_DocumentSet

Implements Zend_Cloud_DocumentService_Adapter.

replaceDocument (   $collectionName,
  $document,
  $options = null 
)

Replace document.

The new document replaces the existing document.

Parameters
Zend_Cloud_DocumentService_Document$document
array$options
Returns
boolean

Implements Zend_Cloud_DocumentService_Adapter.

select (   $fields = null)

Create query statement.

Returns
Zend_Cloud_DocumentService_Query

Implements Zend_Cloud_DocumentService_Adapter.

setDefaultPartitionKey (   $key)

Set the default partition key.

Parameters
string$key
Returns
Zend_Cloud_DocumentService_Adapter_WindowsAzure
updateDocument (   $collectionName,
  $documentId,
  $fieldset = null,
  $options = null 
)

Update document.

The new document is merged the existing document.

Parameters
string$collectionName
mixed | Zend_Cloud_DocumentService_Document$documentIdDocument identifier or document contaiing updates
null|array|Zend_Cloud_DocumentService_DocumentFields to update (or new fields))
array$options
Returns
boolean

Implements Zend_Cloud_DocumentService_Adapter.

Member Data Documentation

$_defaultPartitionKey
protected
$_storageClient
protected
const ACCOUNT_KEY = 'storage_accountkey'
const ACCOUNT_NAME = 'storage_accountname'
const DEFAULT_PARTITION_KEY = "default_partition_key"
const HOST = "storage_host"
const PARTITION_KEY = 'PartitionKey'
const PROXY_CREDENTIALS = "storage_proxy_credentials"
const PROXY_HOST = "storage_proxy_host"
const PROXY_PORT = "storage_proxy_port"
const ROW_KEY = 'RowKey'
const TIMESTAMP_KEY = "Timestamp"
const VERIFY_ETAG = "verify_etag"