first commit

This commit is contained in:
renjianbo
2026-01-07 11:40:41 +08:00
parent 2b5d784e31
commit 8f2ed2c108
6466 changed files with 1431506 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationLogs.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDiagnosticInfrastructureLogs.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationPerformanceCounters.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationWindowsEventLog.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDirectories.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property int OverallQuotaInMB Overall quota in MB
* @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs Logs Logs
* @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs DiagnosticInfrastructureLogs Diagnostic infrastructure logs
* @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters PerformanceCounters Performance counters
* @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog WindowsEventLog Windows Event Log
* @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories Directories Directories
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param int $overallQuotaInMB Overall quota in MB
*/
public function __construct($overallQuotaInMB = 0)
{
$this->_data = array(
'overallquotainmb' => $overallQuotaInMB,
'logs' => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs(),
'diagnosticinfrastructurelogs' => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs(),
'performancecounters' => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters(),
'windowseventlog' => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog(),
'directories' => new Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories(),
);
}
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_LogLevel
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property int BufferQuotaInMB Buffer quota in MB
* @property int ScheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @property string ScheduledTransferLogLevelFilter Scheduled transfer log level filter
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDiagnosticInfrastructureLogs
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param int $bufferQuotaInMB Buffer quota in MB
* @param int $scheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @param string $scheduledTransferLogLevelFilter Scheduled transfer log level filter
*/
public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED)
{
$this->_data = array(
'bufferquotainmb' => $bufferQuotaInMB,
'scheduledtransferperiodinminutes' => $scheduledTransferPeriodInMinutes,
'scheduledtransferloglevelfilter' => $scheduledTransferLogLevelFilter,
);
}
}

View File

@@ -0,0 +1,90 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/DirectoryConfigurationSubscription.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property int BufferQuotaInMB Buffer quota in MB
* @property int ScheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @property array Subscriptions Subscriptions
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationDirectories
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param int $bufferQuotaInMB Buffer quota in MB
* @param int $scheduledTransferPeriodInMinutes Scheduled transfer period in minutes
*/
public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0)
{
$this->_data = array(
'bufferquotainmb' => $bufferQuotaInMB,
'scheduledtransferperiodinminutes' => $scheduledTransferPeriodInMinutes,
'subscriptions' => array()
);
}
/**
* Add subscription
*
* @param string $path Path
* @param string $container Container
* @param int $directoryQuotaInMB Directory quota in MB
*/
public function addSubscription($path, $container, $directoryQuotaInMB = 1024)
{
$this->_data['subscriptions'][$path] = new Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription($path, $container, $directoryQuotaInMB);
}
/**
* Remove subscription
*
* @param string $path Path
*/
public function removeSubscription($path)
{
if (isset($this->_data['subscriptions'][$path])) {
unset($this->_data['subscriptions'][$path]);
}
}
}

View File

@@ -0,0 +1,220 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationDataSources.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources DataSources Data sources
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*/
public function __construct()
{
$this->_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->WindowsEventLog->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[] = '<?xml version="1.0"?>';
$returnValue[] = '<ConfigRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">';
// Add data sources
$returnValue[] = ' <DataSources>';
$returnValue[] = ' <OverallQuotaInMB>' . $this->DataSources->OverallQuotaInMB . '</OverallQuotaInMB>';
$returnValue[] = ' <Logs>';
$returnValue[] = ' <BufferQuotaInMB>' . $this->DataSources->Logs->BufferQuotaInMB . '</BufferQuotaInMB>';
$returnValue[] = ' <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Logs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
$returnValue[] = ' <ScheduledTransferLogLevelFilter>' . $this->DataSources->Logs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
$returnValue[] = ' </Logs>';
$returnValue[] = ' <DiagnosticInfrastructureLogs>';
$returnValue[] = ' <BufferQuotaInMB>' . $this->DataSources->DiagnosticInfrastructureLogs->BufferQuotaInMB . '</BufferQuotaInMB>';
$returnValue[] = ' <ScheduledTransferPeriodInMinutes>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
$returnValue[] = ' <ScheduledTransferLogLevelFilter>' . $this->DataSources->DiagnosticInfrastructureLogs->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
$returnValue[] = ' </DiagnosticInfrastructureLogs>';
$returnValue[] = ' <PerformanceCounters>';
$returnValue[] = ' <BufferQuotaInMB>' . $this->DataSources->PerformanceCounters->BufferQuotaInMB . '</BufferQuotaInMB>';
$returnValue[] = ' <ScheduledTransferPeriodInMinutes>' . $this->DataSources->PerformanceCounters->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
if (count($this->DataSources->PerformanceCounters->Subscriptions) == 0) {
$returnValue[] = ' <Subscriptions />';
} else {
$returnValue[] = ' <Subscriptions>';
foreach ($this->DataSources->PerformanceCounters->Subscriptions as $subscription) {
$returnValue[] = ' <PerformanceCounterConfiguration>';
$returnValue[] = ' <CounterSpecifier>' . $subscription->CounterSpecifier . '</CounterSpecifier>';
$returnValue[] = ' <SampleRateInSeconds>' . $subscription->SampleRateInSeconds . '</SampleRateInSeconds>';
$returnValue[] = ' </PerformanceCounterConfiguration>';
}
$returnValue[] = ' </Subscriptions>';
}
$returnValue[] = ' </PerformanceCounters>';
$returnValue[] = ' <WindowsEventLog>';
$returnValue[] = ' <BufferQuotaInMB>' . $this->DataSources->WindowsEventLog->BufferQuotaInMB . '</BufferQuotaInMB>';
$returnValue[] = ' <ScheduledTransferPeriodInMinutes>' . $this->DataSources->WindowsEventLog->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
if (count($this->DataSources->WindowsEventLog->Subscriptions) == 0) {
$returnValue[] = ' <Subscriptions />';
} else {
$returnValue[] = ' <Subscriptions>';
foreach ($this->DataSources->WindowsEventLog->Subscriptions as $subscription) {
$returnValue[] = ' <string>' . $subscription . '</string>';
}
$returnValue[] = ' </Subscriptions>';
}
$returnValue[] = ' <ScheduledTransferLogLevelFilter>' . $this->DataSources->WindowsEventLog->ScheduledTransferLogLevelFilter . '</ScheduledTransferLogLevelFilter>';
$returnValue[] = ' </WindowsEventLog>';
$returnValue[] = ' <Directories>';
$returnValue[] = ' <BufferQuotaInMB>' . $this->DataSources->Directories->BufferQuotaInMB . '</BufferQuotaInMB>';
$returnValue[] = ' <ScheduledTransferPeriodInMinutes>' . $this->DataSources->Directories->ScheduledTransferPeriodInMinutes . '</ScheduledTransferPeriodInMinutes>';
if (count($this->DataSources->Directories->Subscriptions) == 0) {
$returnValue[] = ' <Subscriptions />';
} else {
$returnValue[] = ' <Subscriptions>';
foreach ($this->DataSources->Directories->Subscriptions as $subscription) {
$returnValue[] = ' <DirectoryConfiguration>';
$returnValue[] = ' <Path>' . $subscription->Path . '</Path>';
$returnValue[] = ' <Container>' . $subscription->Container . '</Container>';
$returnValue[] = ' <DirectoryQuotaInMB>' . $subscription->DirectoryQuotaInMB . '</DirectoryQuotaInMB>';
$returnValue[] = ' </DirectoryConfiguration>';
}
$returnValue[] = ' </Subscriptions>';
}
$returnValue[] = ' </Directories>';
$returnValue[] = ' </DataSources>';
$returnValue[] = '</ConfigRequest>';
// Return
return implode("\r\n", $returnValue);
}
}

View File

@@ -0,0 +1,67 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_LogLevel
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property int BufferQuotaInMB Buffer quota in MB
* @property int ScheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @property string ScheduledTransferLogLevelFilter Scheduled transfer log level filter
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationLogs
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param int $bufferQuotaInMB Buffer quota in MB
* @param int $scheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @param string $scheduledTransferLogLevelFilter Scheduled transfer log level filter
*/
public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED)
{
$this->_data = array(
'bufferquotainmb' => $bufferQuotaInMB,
'scheduledtransferperiodinminutes' => $scheduledTransferPeriodInMinutes,
'scheduledtransferloglevelfilter' => $scheduledTransferLogLevelFilter,
);
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Data
*
* @var array
*/
protected $_data = null;
/**
* Magic overload for setting properties
*
* @param string $name Name of the property
* @param string $value Value to set
*/
public function __set($name, $value) {
if (array_key_exists(strtolower($name), $this->_data)) {
$this->_data[strtolower($name)] = $value;
return;
}
throw new Zend_Service_WindowsAzure_Diagnostics_Exception("Unknown property: " . $name);
}
/**
* Magic overload for getting properties
*
* @param string $name Name of the property
*/
public function __get($name) {
if (array_key_exists(strtolower($name), $this->_data)) {
return $this->_data[strtolower($name)];
}
throw new Zend_Service_WindowsAzure_Diagnostics_Exception("Unknown property: " . $name);
}
}

View File

@@ -0,0 +1,89 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/PerformanceCounterSubscription.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property int BufferQuotaInMB Buffer quota in MB
* @property int ScheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @property array Subscriptions Subscriptions
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationPerformanceCounters
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param int $bufferQuotaInMB Buffer quota in MB
* @param int $scheduledTransferPeriodInMinutes Scheduled transfer period in minutes
*/
public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0)
{
$this->_data = array(
'bufferquotainmb' => $bufferQuotaInMB,
'scheduledtransferperiodinminutes' => $scheduledTransferPeriodInMinutes,
'subscriptions' => array(),
);
}
/**
* Add subscription
*
* @param string $counterSpecifier Counter specifier
* @param int $sampleRateInSeconds Sample rate in seconds
*/
public function addSubscription($counterSpecifier, $sampleRateInSeconds = 1)
{
$this->_data['subscriptions'][$counterSpecifier] = new Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription($counterSpecifier, $sampleRateInSeconds);
}
/**
* Remove subscription
*
* @param string $counterSpecifier Counter specifier
*/
public function removeSubscription($counterSpecifier)
{
if (isset($this->_data['subscriptions'][$counterSpecifier])) {
unset($this->_data['subscriptions'][$counterSpecifier]);
}
}
}

View File

@@ -0,0 +1,91 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_LogLevel
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/LogLevel.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property int BufferQuotaInMB Buffer quota in MB
* @property int ScheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @property string ScheduledTransferLogLevelFilter Scheduled transfer log level filter
* @property array Subscriptions Subscriptions
*/
class Zend_Service_WindowsAzure_Diagnostics_ConfigurationWindowsEventLog
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param int $bufferQuotaInMB Buffer quota in MB
* @param int $scheduledTransferPeriodInMinutes Scheduled transfer period in minutes
* @param string $scheduledTransferLogLevelFilter Scheduled transfer log level filter
*/
public function __construct($bufferQuotaInMB = 0, $scheduledTransferPeriodInMinutes = 0, $scheduledTransferLogLevelFilter = Zend_Service_WindowsAzure_Diagnostics_LogLevel::UNDEFINED)
{
$this->_data = array(
'bufferquotainmb' => $bufferQuotaInMB,
'scheduledtransferperiodinminutes' => $scheduledTransferPeriodInMinutes,
'scheduledtransferloglevelfilter' => $scheduledTransferLogLevelFilter,
'subscriptions' => array()
);
}
/**
* Add subscription
*
* @param string $filter Event log filter
*/
public function addSubscription($filter)
{
$this->_data['subscriptions'][$filter] = $filter;
}
/**
* Remove subscription
*
* @param string $filter Event log filter
*/
public function removeSubscription($filter)
{
if (isset($this->_data['subscriptions'][$filter])) {
unset($this->_data['subscriptions'][$filter]);
}
}
}

View File

@@ -0,0 +1,62 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property string Path Path
* @property string Container Container
* @property int DirectoryQuotaInMB Directory quota in MB
*/
class Zend_Service_WindowsAzure_Diagnostics_DirectoryConfigurationSubscription
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param string $path Path
* @param string $container Container
* @param int $directoryQuotaInMB Directory quota in MB
*/
public function __construct($path, $container, $directoryQuotaInMB = 1024)
{
$this->_data = array(
'path' => $path,
'container' => $container,
'directoryquotainmb' => $directoryQuotaInMB,
);
}
}

View File

@@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Exception
*/
require_once 'Zend/Service/WindowsAzure/Exception.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_WindowsAzure_Diagnostics_Exception
extends Zend_Service_WindowsAzure_Exception
{
}

View File

@@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_WindowsAzure_Diagnostics_LogLevel
{
const UNDEFINED = 'Undefined';
const CRITICAL = 'Critical';
const ERROR = 'Error';
const WARNING = 'Warning';
const INFORMATION = 'Information';
const VERBOSE = 'Verbose';
}

View File

@@ -0,0 +1,190 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Storage_Blob
*/
require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationInstance.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Service_WindowsAzure_Diagnostics_Manager
{
/**
* Blob storage client
*
* @var Zend_Service_WindowsAzure_Storage_Blob
*/
protected $_blobStorageClient = null;
/**
* Control container name
*
* @var string
*/
protected $_controlContainer = '';
/**
* Create a new instance of Zend_Service_WindowsAzure_Diagnostics_Manager
*
* @param Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient Blob storage client
* @param string $controlContainer Control container name
*/
public function __construct(Zend_Service_WindowsAzure_Storage_Blob $blobStorageClient = null, $controlContainer = 'wad-control-container')
{
$this->_blobStorageClient = $blobStorageClient;
$this->_controlContainer = $controlContainer;
$this->_ensureStorageInitialized();
}
/**
* Ensure storage has been initialized
*/
protected function _ensureStorageInitialized()
{
if (!$this->_blobStorageClient->containerExists($this->_controlContainer)) {
$this->_blobStorageClient->createContainer($this->_controlContainer);
}
}
/**
* Get default configuration values
*
* @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
*/
public function getDefaultConfiguration()
{
return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
}
/**
* Checks if a configuration for a specific role instance exists.
*
* @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
* @return boolean
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
public function configurationForRoleInstanceExists($roleInstance = null)
{
if ($roleInstance === null) {
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
}
return $this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance);
}
/**
* Checks if a configuration for current role instance exists. Only works on Development Fabric or Windows Azure Fabric.
*
* @return boolean
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
public function configurationForCurrentRoleInstanceExists()
{
if (!isset($_SERVER['RdRoleId'])) {
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
}
return $this->_blobStorageClient->blobExists($this->_controlContainer, $_SERVER['RdRoleId']);
}
/**
* Get configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
*
* @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
public function getConfigurationForCurrentRoleInstance()
{
if (!isset($_SERVER['RdRoleId'])) {
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
}
return $this->getConfigurationForRoleInstance($_SERVER['RdRoleId']);
}
/**
* Set configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
*
* @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
public function setConfigurationForCurrentRoleInstance(Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
{
if (!isset($_SERVER['RdRoleId'])) {
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Server variable \'RdRoleId\' is unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
}
$this->setConfigurationForRoleInstance($_SERVER['RdRoleId'], $configuration);
}
/**
* Get configuration for a specific role instance
*
* @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
* @return Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
public function getConfigurationForRoleInstance($roleInstance = null)
{
if ($roleInstance === null) {
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
}
if ($this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance)) {
$configurationInstance = new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
$configurationInstance->loadXml( $this->_blobStorageClient->getBlobData($this->_controlContainer, $roleInstance) );
return $configurationInstance;
}
return new Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance();
}
/**
* Set configuration for a specific role instance
*
* @param string $roleInstance Role instance name, can be found in $_SERVER['RdRoleId'] when hosted on Windows Azure.
* @param Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
* @throws Zend_Service_WindowsAzure_Diagnostics_Exception
*/
public function setConfigurationForRoleInstance($roleInstance = null, Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance $configuration)
{
if ($roleInstance === null) {
throw new Zend_Service_WindowsAzure_Diagnostics_Exception('Role instance should be specified. Try reading $_SERVER[\'RdRoleId\'] for this information if the application is hosted on Windows Azure Fabric or Development Fabric.');
}
$this->_blobStorageClient->putBlobData($this->_controlContainer, $roleInstance, $configuration->toXml(), array(), null, array('Content-Type' => 'text/xml'));
}
}

View File

@@ -0,0 +1,59 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @see Zend_Service_WindowsAzure_Diagnostics_Exception
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/Exception.php';
/**
* @see Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
*/
require_once 'Zend/Service/WindowsAzure/Diagnostics/ConfigurationObjectBaseAbstract.php';
/**
* @category Zend
* @package Zend_Service_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property string CounterSpecifier Counter specifier
* @property int SampleRateInSeconds Sample rate in seconds
*/
class Zend_Service_WindowsAzure_Diagnostics_PerformanceCounterSubscription
extends Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract
{
/**
* Constructor
*
* @param string $counterSpecifier Counter specifier
* @param int $sampleRateInSeconds Sample rate in seconds
*/
public function __construct($counterSpecifier, $sampleRateInSeconds = 1)
{
$this->_data = array(
'counterspecifier' => $counterSpecifier,
'samplerateinseconds' => $sampleRateInSeconds
);
}
}