You are here

abstract class WsConnector in Web Service Data 7

Class definition for Web Service Connector

Hierarchy

Expanded class hierarchy of WsConnector

File

./wsdata.module, line 303
Main module for wsconfig

View source
abstract class WsConnector {
  protected $expires;
  protected $cacheDefaultTime;
  protected $cacheDefaultOverride;
  protected $staleCache;
  protected $endpoint;
  protected $error;

  // All connectors support the default plugin by default.
  // The plugin essentially means all the language data is
  // in the single request.
  protected $languagePlugins = array(
    'default',
  );
  public function getEndpoint() {
    return $this->endpoint;
  }
  public function __construct($endpoint) {
    $this->endpoint = trim($endpoint);
    $this->expires = 0;
    $this->cacheDefaultTime = 0;
    $this->cacheDefaultOverride = FALSE;
    $this->staleCache = FALSE;
  }
  public function supportsCaching() {
    return FALSE;
  }
  public function getError() {
    return $this->error;
  }

  /**
   * Return the list of supported language handling plugins
   */
  public function getSupportedLanguagePlugins() {
    return $this->languagePlugins;
  }
  public function defaultCache($mintime = 0, $override = FALSE, $stale = FALSE) {
    $this->cacheDefaultTime = $mintime;
    $this->cacheDefaultOverride = $override;
    $this->staleCache = $stale;
  }
  abstract function getMethods();
  public abstract function wscall($type, $method, $argument, $options);
  public function create($method, $object, $options = array()) {
    $this->expires = 0;
    return $this
      ->wscall('create', $method, $object, $options);
  }
  public function read($method, $id, $options = array()) {
    $this->expires = 0;
    return $this
      ->wscall('read', $method, $id, $options);
  }
  public function update($id, $method, $object, $options = array()) {
    $this->expires = 0;
    return $this
      ->wscall('update', $method, array(
      $id,
      $object,
    ), $options);
  }
  public function delete($id, $method, $options = array()) {
    $this->expires = 0;
    return $this
      ->wscall('delete', $method, $id, $options);
  }
  public function index($method, $options = array()) {
    $this->expires = 0;
    return $this
      ->wscall('index', $method, array(), $options);
  }
  public function expires() {
    if ($this->expires > 0) {
      return $this->expires;
    }
    else {
      return FALSE;
    }
  }
  public function isDegraded() {
    return FALSE;
  }
  protected function setError($code, $message) {
    $this->error = array(
      'code' => $code,
      'message' => $message,
    );
  }
  protected function clearError() {
    $this->error = NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WsConnector::$cacheDefaultOverride protected property
WsConnector::$cacheDefaultTime protected property
WsConnector::$endpoint protected property
WsConnector::$error protected property
WsConnector::$expires protected property
WsConnector::$languagePlugins protected property
WsConnector::$staleCache protected property
WsConnector::clearError protected function
WsConnector::create public function
WsConnector::defaultCache public function
WsConnector::delete public function
WsConnector::expires public function
WsConnector::getEndpoint public function
WsConnector::getError public function
WsConnector::getMethods abstract function
WsConnector::getSupportedLanguagePlugins public function Return the list of supported language handling plugins
WsConnector::index public function
WsConnector::isDegraded public function
WsConnector::read public function
WsConnector::setError protected function
WsConnector::supportsCaching public function
WsConnector::update public function
WsConnector::wscall abstract public function
WsConnector::__construct public function