Esempio n. 1
0
 /**
  * Parse XML form of a vCloud entity to a VMware vCloud data object.
  *
  * @param string $xml     An XML string, representing a vCloud entity
  * @param string $return  Class name of the output object.
  * @return mixed|null     A VMware vCloud data object
  * @since Version 1.0.0
  */
 public static function getObjByXml($xml, $return = null)
 {
     if (empty($xml)) {
         return null;
     }
     return VMware_VCloud_API_Helper::parseString($xml, $return);
 }
Esempio n. 2
0
 /**
  * Get names of the component files in the OVF package.
  *
  * @param string $ovfDescUrl   OVF descriptor URL
  * @return array File names
  * @access private
  */
 private function getOVFFileNames($ovfDescUrl)
 {
     $ovfFiles = array();
     $envelope = $this->downloadOVFDescriptor($ovfDescUrl);
     $envObj = VMware_VCloud_API_Helper::parseString($envelope);
     $files = $envObj->getReferences()->getFile();
     foreach ($files as $file) {
         $fileName = $file->get_href();
         if ($fileName) {
             array_push($ovfFiles, $fileName);
         }
     }
     return $ovfFiles;
 }
Esempio n. 3
0
 // binds the queue to the routing key on the exchange
 #$ex->bind($queue, $rkey);
 // this sample will keep on running until retrieves expected notification message.
 while (true) {
     echo "Please wait ...\n";
     sleep(10);
     // get message from the queue in every 10 seconds.
     $ret = $q->get();
     if (array_key_exists('msg', $ret)) {
         $msg = $ret['msg'];
         // get the message
     }
     if (isset($msg)) {
         echo $msg . "\n";
         // Get Notification data object from the notification message.
         $not = VMware_VCloud_API_Helper::parseString($msg);
         if ('VMware_VCloud_API_Extension_NotificationType' == get_class($not)) {
             // use the entity URL to create an SDK blocking task object.
             $entityLink = getEntityLink('entity', $not);
             $orgLink = getEntityLink('up', $not);
             $userLink = getEntityLink('down', $not);
             echo "entity = " . $entityLink->get_name() . "\n";
             echo "org = " . $orgLink->get_name() . "\n";
             echo "user = "******"\n";
             // filter the notification message for this sample.
             if (isset($entityLink) && $op == $entityLink->get_name() && (isset($orgLink) && $orgName == $orgLink->get_name()) && (isset($userLink) && $owner == $userLink->get_name())) {
                 echo "message:\n {$msg}\n";
                 // get the blocking task vCloud entity ID
                 $blockingTaskId = $entityLink->get_id();
                 // get the blocking task resource URL from its entity ID
                 $blockingTaskUrl = VMware_VCloud_SDK_Helper::getUrlByEntityId($service, $blockingTaskId);