/**
  * Populates the properties with a specified XML string based on ATOM 
  * ENTRY schema. 
  * 
  * @param string $xmlString An XML string representing a rule info instance.
  * 
  * @return none
  */
 public function parseXml($xmlString)
 {
     $this->_entry->parseXml($xmlString);
     $content = $this->_entry->getContent();
     if (is_null($content)) {
         $this->_ruleDescription = null;
     } else {
         $this->_ruleDescription = RuleDescription::create($content->getText());
     }
 }
示例#2
0
 /**
  * Populates the properties of the queue info instance with a 
  * ATOM ENTRY XML string. 
  * 
  * @param string $entryXml An ATOM entry based XML string.
  * 
  * @return none
  */
 public function parseXml($entryXml)
 {
     $this->_entry->parseXml($entryXml);
     $content = $this->_entry->getContent();
     if (is_null($content)) {
         $this->_queueDescription = null;
     } else {
         $this->_queueDescription = QueueDescription::create($content->getText());
     }
 }
 /**
  * Create a job.
  *
  * @param WindowsAzure\MediaServices\Models\JobTemplate $jobTemplate   Job
  * template data
  *
  * @param array                                         $taskTemplates Performed
  * tasks template array
  *
  * @return Models\JobTemplate
  */
 public function createJobTemplate($jobTemplate, $taskTemplates)
 {
     Validate::isA($jobTemplate, 'WindowsAzure\\MediaServices\\Models\\JobTemplate', 'jobTemplate');
     Validate::isArray($taskTemplates, 'taskTemplates');
     $batch = new BatchRequest();
     $batch->appendContext($this->_getCreateEmptyJobTemplateContext($jobTemplate));
     if ($taskTemplates != null) {
         foreach ($taskTemplates as $taskTemplate) {
             $batch->appendContext($this->_getCreateTaskTemplateContext($taskTemplate));
         }
     }
     $batch->encode();
     $method = Resources::HTTP_POST;
     $headers = $batch->getHeaders();
     $postParams = array();
     $queryParams = array();
     $path = '$batch';
     $statusCode = Resources::STATUS_ACCEPTED;
     $body = $batch->getBody();
     $response = $this->send($method, $headers, $postParams, $queryParams, $path, $statusCode, $body);
     $batchResponse = new BatchResponse($response->getBody(), $batch);
     $responses = $batchResponse->getContexts();
     $jobTemplateResponse = $responses[0];
     $entry = new Entry();
     $entry->parseXml($jobTemplateResponse->getBody());
     $properties = $this->getPropertiesFromAtomEntry($entry);
     return JobTemplate::createFromOptions($properties);
 }
示例#4
0
 /**     
  * Processes entry node. 
  * 
  * @param array $xmlArray An array of simple xml elements. 
  * 
  * @return array
  */
 protected function processEntryNode($xmlArray)
 {
     $entry = array();
     $entryItem = $xmlArray[Resources::ENTRY];
     if (is_array($entryItem)) {
         foreach ($xmlArray[Resources::ENTRY] as $entryXmlInstance) {
             $entryInstance = new Entry();
             $entryInstance->parseXml($entryXmlInstance->asXML());
             $entry[] = $entryInstance;
         }
     } else {
         $entryInstance = new Entry();
         $entryInstance->parseXml($entryItem->asXML());
         $entry[] = $entryInstance;
     }
     return $entry;
 }