Beispiel #1
0
 public function testGetMetadataObject()
 {
     $data= $this->rackspace->getMetadataObject(TESTS_ZEND_SERVICE_RACKSPACE_CONTAINER_NAME,
                                                TESTS_ZEND_SERVICE_RACKSPACE_OBJECT_NAME);
     $this->assertTrue($data!==false);
     $this->assertEquals($data['metadata'],$this->metadata2);
 }
Beispiel #2
0
 /**
  * Get the metadata of the object
  * If you don't pass the $key it returns the entire array of metadata value
  *
  * @param string $key
  * @return string|array|boolean
  */
 public function getMetadata($key = null)
 {
     $result = $this->service->getMetadataObject($this->container, $this->name);
     if (!empty($result)) {
         if (empty($key)) {
             return $result['metadata'];
         }
         if (isset($result['metadata'][$key])) {
             return $result['metadata'][$key];
         }
     }
     return false;
 }
Beispiel #3
0
 /**
  * Get a key/value array of metadata for the given path.
  *
  * @param  string $path
  * @param  array $options
  * @return array An associative array of key/value pairs specifying the metadata for this object.
  *                  If no metadata exists, an empty array is returned.
  */
 public function fetchMetadata($path, $options = null)
 {
     $result = $this->rackspace->getMetadataObject($this->container, $path);
     if (!$this->rackspace->isSuccessful()) {
         throw new Exception\RuntimeException('Error on fetch metadata: ' . $this->rackspace->getErrorMsg());
     }
     $metadata = array();
     if (isset($result['metadata'])) {
         $metadata = $result['metadata'];
     }
     // delete the self::DELETE_METADATA_KEY - this is a trick to remove all
     // the metadata information of an object (see deleteMetadata).
     // Rackspace doesn't have an API to remove the metadata of an object
     unset($metadata[self::DELETE_METADATA_KEY]);
     return $metadata;
 }
Beispiel #4
0
 /**
  * Get the metadata of the object
  * If you don't pass the $key it returns the entire array of metadata value
  *
  * @param string $key
  * @return string|array
  */
 public function getMetadata($key = null)
 {
     if (empty($this->metadata) && !$this->getMetadata) {
         $result = $this->service->getMetadataObject($this->container, $this->name);
         if (!empty($result)) {
             $this->hash = $data['hash'];
             $this->size = $data['bytes'];
             $this->contentType = $data['content_type'];
             $this->lastModified = $data['last_modified'];
             if (!empty($result['metadata'])) {
                 $this->metadata = $result['metadata'];
             }
         }
         $this->getMetadata = true;
     }
     if (!empty($this->metadata[$key])) {
         return $this->metadata[$key];
     }
     return $this->metadata;
 }
Beispiel #5
0
 /**
  * Get the metadata of an object in the container
  *
  * @param string $object
  * @return array
  */
 public function getMetadataObject($object)
 {
     return $this->service->getMetadataObject($this->getName(), $object);
 }