_data = array( 'datasources' => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources() ); } /** * Load configuration XML * * @param string $configurationXml Configuration XML */ public function loadXml($configurationXml) { // Convert to SimpleXMLElement $configurationXml = simplexml_load_string($configurationXml); // Assign general settings $this->DataSources->OverallQuotaInMB = (int)$configurationXml->DataSources->OverallQuotaInMB; // Assign Logs settings $this->DataSources->Logs->BufferQuotaInMB = (int)$configurationXml->DataSources->Logs->BufferQuotaInMB; $this->DataSources->Logs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Logs->ScheduledTransferPeriodInMinutes; $this->DataSources->Logs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->Logs->ScheduledTransferLogLevelFilter; // Assign DiagnosticInfrastructureLogs settings $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB; $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes; $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter; // Assign PerformanceCounters settings $this->DataSources->PerformanceCounters->BufferQuotaInMB = (int)$configurationXml->DataSources->PerformanceCounters->BufferQuotaInMB; $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes; if ($configurationXml->DataSources->PerformanceCounters->Subscriptions && $configurationXml->DataSources->PerformanceCounters->Subscriptions->PerformanceCounterConfiguration) { $subscriptions = $configurationXml->DataSources->PerformanceCounters->Subscriptions; if (count($subscriptions->PerformanceCounterConfiguration) > 1) { $subscriptions = $subscriptions->PerformanceCounterConfiguration; } else { $subscriptions = array($subscriptions->PerformanceCounterConfiguration); } foreach ($subscriptions as $subscription) { $this->DataSources->PerformanceCounters->addSubscription((string)$subscription->CounterSpecifier, (int)$subscription->SampleRateInSeconds); } } // Assign WindowsEventLog settings $this->DataSources->WindowsEventLog->BufferQuotaInMB = (int)$configurationXml->DataSources->WindowsEventLog->BufferQuotaInMB; $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes; $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter = (string)$configurationXml->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter; if ($configurationXml->DataSources->WindowsEventLog->Subscriptions && $configurationXml->DataSources->WindowsEventLog->Subscriptions->string) { $subscriptions = $configurationXml->DataSources->WindowsEventLog->Subscriptions; if (count($subscriptions->string) > 1) { $subscriptions = $subscriptions->string; } else { $subscriptions = array($subscriptions->string); } foreach ($subscriptions as $subscription) { $this->DataSources->WindowsEventLog->addSubscription((string)$subscription); } } // Assign Directories settings $this->DataSources->Directories->BufferQuotaInMB = (int)$configurationXml->DataSources->Directories->BufferQuotaInMB; $this->DataSources->Directories->ScheduledTransferPeriodInMinutes = (int)$configurationXml->DataSources->Directories->ScheduledTransferPeriodInMinutes; if ($configurationXml->DataSources->Directories->Subscriptions && $configurationXml->DataSources->Directories->Subscriptions->DirectoryConfiguration) { $subscriptions = $configurationXml->DataSources->Directories->Subscriptions; if (count($subscriptions->DirectoryConfiguration) > 1) { $subscriptions = $subscriptions->DirectoryConfiguration; } else { $subscriptions = array($subscriptions->DirectoryConfiguration); } foreach ($subscriptions as $subscription) { $this->DataSources->Directories->addSubscription((string)$subscription->Path, (string)$subscription->Container, (int)$subscription->DirectoryQuotaInMB); } } } /** * Create configuration XML * * @return string */ public function toXml() { // Return value $returnValue = array(); // Build XML $returnValue[] = ''; $returnValue[] = ''; // Add data sources $returnValue[] = ' '; $returnValue[] = ' ' . $this->DataSources->OverallQuotaInMB . ''; $returnValue[] = ' '; $returnValue[] = ' ' . $this->DataSources->Logs->BufferQuotaInMB . ''; $returnValue[] = ' ' . $this->DataSources->Logs->ScheduledTransferPeriodInMinutes . ''; $returnValue[] = ' ' . $this->DataSources->Logs->ScheduledTransferLogLevelFilter . ''; $returnValue[] = ' '; $returnValue[] = ' '; $returnValue[] = ' ' . $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB . ''; $returnValue[] = ' ' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes . ''; $returnValue[] = ' ' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter . ''; $returnValue[] = ' '; $returnValue[] = ' '; $returnValue[] = ' ' . $this->DataSources->PerformanceCounters->BufferQuotaInMB . ''; $returnValue[] = ' ' . $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes . ''; if (count($this->DataSources->PerformanceCounters->Subscriptions) == 0) { $returnValue[] = ' '; } else { $returnValue[] = ' '; foreach ($this->DataSources->PerformanceCounters->Subscriptions as $subscription) { $returnValue[] = ' '; $returnValue[] = ' ' . $subscription->CounterSpecifier . ''; $returnValue[] = ' ' . $subscription->SampleRateInSeconds . ''; $returnValue[] = ' '; } $returnValue[] = ' '; } $returnValue[] = ' '; $returnValue[] = ' '; $returnValue[] = ' ' . $this->DataSources->WindowsEventLog->BufferQuotaInMB . ''; $returnValue[] = ' ' . $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes . ''; if (count($this->DataSources->WindowsEventLog->Subscriptions) == 0) { $returnValue[] = ' '; } else { $returnValue[] = ' '; foreach ($this->DataSources->WindowsEventLog->Subscriptions as $subscription) { $returnValue[] = ' ' . $subscription . ''; } $returnValue[] = ' '; } $returnValue[] = ' ' . $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter . ''; $returnValue[] = ' '; $returnValue[] = ' '; $returnValue[] = ' ' . $this->DataSources->Directories->BufferQuotaInMB . ''; $returnValue[] = ' ' . $this->DataSources->Directories->ScheduledTransferPeriodInMinutes . ''; if (count($this->DataSources->Directories->Subscriptions) == 0) { $returnValue[] = ' '; } else { $returnValue[] = ' '; foreach ($this->DataSources->Directories->Subscriptions as $subscription) { $returnValue[] = ' '; $returnValue[] = ' ' . $subscription->Path . ''; $returnValue[] = ' ' . $subscription->Container . ''; $returnValue[] = ' ' . $subscription->DirectoryQuotaInMB . ''; $returnValue[] = ' '; } $returnValue[] = ' '; } $returnValue[] = ' '; $returnValue[] = ' '; $returnValue[] = ' false'; $returnValue[] = ''; // Return return implode("\r\n", $returnValue); } }