/** * @see FileBackend::fileExists() */ function doFileExists( array $params ) {die(); // TODO: Merely renamed this functino from fileExists. Check if more is neccessarey // TODO: Off topic here: Prepare function might call some internal function which can be overridden. list( $srcCont, $srcRel ) = $this->resolveStoragePath( $params['src'] ); if ( $srcRel === null ) { return false; // invalid storage path } $exists = $this->storageClient->blobExists( $srcCont, $srcRel ); return $exists; }
/** * 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 */ public function getConfigurationForRoleInstance($roleInstance = null) { if (is_null($roleInstance)) { 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.'); } if ($this->_blobStorageClient->blobExists($this->_controlContainer, $roleInstance)) { $configurationInstance = new Microsoft_WindowsAzure_Diagnostics_ConfigurationInstance(); $configurationInstance->loadXml($this->_blobStorageClient->getBlobData($this->_controlContainer, $roleInstance)); return $configurationInstance; } return new Microsoft_WindowsAzure_Diagnostics_ConfigurationInstance(); }
/** * @see FileBackend::doCreateInternal() */ function doCreateInternal(array $params) { $status = Status::newGood(); list($dstCont, $dstRel) = $this->resolveStoragePath($params['dst']); if ($dstRel === null) { $status->fatal('backend-fail-invalidpath', $params['dst']); return $status; } if (empty($params['overwrite'])) { //Blob should not be overridden // Check if the destination object already exists if ($this->storageClient->blobExists($dstCont, $dstRel)) { $status->fatal('backend-fail-alreadyexists', $params['dst']); return $status; } } // Actually create the object try { $this->storageClient->putBlobData($dstCont, $dstRel, $params['content']); } catch (Exception $e) { $status->fatal('backend-fail-internal'); } return $status; }