Source for file Manager.php
Documentation is available at Manager.php
* Copyright (c) 2009 - 2011, RealDolmen
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of RealDolmen nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY RealDolmen ''AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL RealDolmen BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @package Microsoft_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
* @license http://phpazure.codeplex.com/license
* @version $Id: Storage.php 45989 2010-05-03 12:19:10Z unknown $
* @see Microsoft_AutoLoader
require_once dirname(__FILE__ ) . '/../../AutoLoader.php';
* @package Microsoft_WindowsAzure
* @subpackage Diagnostics
* @copyright Copyright (c) 2009 - 2011, RealDolmen (http://www.realdolmen.com)
* @license http://phpazure.codeplex.com/license
* @var Microsoft_WindowsAzure_Storage_Blob
* Create a new instance of Microsoft_WindowsAzure_Diagnostics_Manager
* @param Microsoft_WindowsAzure_Storage_Blob $blobStorageClient Blob storage client
* @param string $controlContainer Control container name
public function __construct(Microsoft_WindowsAzure_Storage_Blob $blobStorageClient = null, $controlContainer = 'wad-control-container')
* Ensure storage has been initialized
* Get default configuration values
* @return Microsoft_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.
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
throw new Microsoft_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.');
* Checks if a configuration for current role instance exists. Only works on Development Fabric or Windows Azure Fabric.
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
if (!isset ($_SERVER['RdRoleId'])) {
* Get configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
* @return Microsoft_WindowsAzure_Diagnostics_ConfigurationInstance
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
if (!isset ($_SERVER['RdRoleId'])) {
* Get the current role instance ID. Only works on Development Fabric or Windows Azure Fabric.
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
if (!isset ($_SERVER['RdRoleId'])) {
if (strpos($_SERVER['RdRoleId'], 'deployment(') === false) {
return $_SERVER['RdRoleId'];
$roleIdParts = explode('.', $_SERVER['RdRoleId']);
return $roleIdParts[0] . '/' . $roleIdParts[2] . '/' . $_SERVER['RdRoleId'];
if (!isset ($_SERVER['RoleDeploymentID']) && !isset ($_SERVER['RoleInstanceID']) && !isset ($_SERVER['RoleName'])) {
throw new Exception('Server variables \'RoleDeploymentID\', \'RoleInstanceID\' and \'RoleName\' are unknown. Please verify the application is running in Development Fabric or Windows Azure Fabric.');
if (strpos($_SERVER['RdRoleId'], 'deployment(') === false) {
return $_SERVER['RdRoleId'];
return $_SERVER['RoleDeploymentID'] . '/' . $_SERVER['RoleInstanceID'] . '/' . $_SERVER['RoleName'];
* Set configuration for current role instance. Only works on Development Fabric or Windows Azure Fabric.
* @param Microsoft_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
if (!isset ($_SERVER['RdRoleId'])) {
* 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 Microsoft_WindowsAzure_Diagnostics_ConfigurationInstance
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
throw new Microsoft_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 $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 Microsoft_WindowsAzure_Diagnostics_ConfigurationInstance $configuration Configuration to apply
* @throws Microsoft_WindowsAzure_Diagnostics_Exception
throw new Microsoft_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.');
|