/**
  * Validate the SFTP configurations and set the response body to a JSON
  * response including the success of the test connection and any messages to
  * be displayed to the user.
  * @return self
  */
 public function validatesftpAction()
 {
     $request = $this->getRequest();
     $configMap = Mage::getModel('eb2ccore/config');
     $host = $this->_validatorHelper->getParamOrFallbackValue($request, self::SFTP_HOSTNAME_PARAM, self::SFTP_HOSTNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('sftp_location'));
     $username = $this->_validatorHelper->getParamOrFallbackValue($request, self::SFTP_USERNAME_PARAM, self::SFTP_USERNAME_USE_DEFAULT_PARAM, $configMap->getPathForKey('sftp_username'));
     $port = $this->_validatorHelper->getParamOrFallbackValue($request, self::SFTP_PORT_PARAM, self::SFTP_PORT_USE_DEFAULT_PARAM, $configMap->getPathForKey('sftp_port'));
     $key = $this->_validatorHelper->getSftpPrivateKey($request, self::SFTP_PRIV_KEY_PARAM, self::SFTP_PRIV_KEY_USE_DEFAULT_PARAM, Mage::getSingleton('eb2ccore/config')->getPathForKey('sftp_private_key'));
     $this->getResponse()->setHeader('Content-Type', 'text/json')->setBody(json_encode(Mage::helper('eb2ccore/validator')->testSftpConnection($host, $username, $key, $port)));
     return $this;
 }
 /**
  * Get a store context to use as the source of configuration.
  * @return Mage_Core_Model_Store
  */
 protected function _getSourceStore()
 {
     // this may return a Mage_Core_Model_Store or a Mage_Core_Model_Website
     $configSource = $this->_validatorHelper->getConfigSource($this->getRequest());
     // When given a website, get the default store for that website.
     // AMQP config is only at global and website level, so no *current*
     // possibility for the default store to have a different value than the website.
     if ($configSource instanceof Mage_Core_Model_Website) {
         return $configSource->getDefaultStore();
     }
     return $configSource;
 }