diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Service/Nirvanix.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Service/Nirvanix.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,107 @@ + array(), + 'httpClient' => new Zend_Http_Client(), + 'host' => 'http://services.nirvanix.com'); + $this->_options = array_merge($defaultOptions, $options); + + // login and save sessionToken to default POST params + $resp = $this->getService('Authentication')->login($authParams); + $this->_options['defaults']['sessionToken'] = (string)$resp->SessionToken; + } + + /** + * Nirvanix divides its service into namespaces, with each namespace + * providing different functionality. This is a factory method that + * returns a preconfigured Zend_Service_Nirvanix_Namespace_Base proxy. + * + * @param string $namespace Name of the namespace + * @return Zend_Service_Nirvanix_Namespace_Base + */ + public function getService($namespace, $options = array()) + { + switch ($namespace) { + case 'IMFS': + $class = 'Zend_Service_Nirvanix_Namespace_Imfs'; + break; + default: + $class = 'Zend_Service_Nirvanix_Namespace_Base'; + } + + $options['namespace'] = ucfirst($namespace); + $options = array_merge($this->_options, $options); + + if (!class_exists($class)) { + require_once 'Zend/Loader.php'; + Zend_Loader::loadClass($class); + } + return new $class($options); + } + + /** + * Get the configured options. + * + * @return array + */ + public function getOptions() + { + return $this->_options; + } + +}