You are here

function cmis_invoke in CMIS API 7

Same name and namespace in other branches
  1. 6.4 cmis.module \cmis_invoke()
  2. 7.2 cmis.module \cmis_invoke()

CMIS invoke service. This method should return a stdClass with the following form: $return = new stdClass(); $return->code = 200; // HTTP return code $return->body = 'data'; // result body $return->content_type = 'text/html'; //result content type $return->content_lenght = 200;

Return value

stdClass

1 call to cmis_invoke()
CommonCMISService::doRequest in cmis_common/cmis_common.utils.inc

File

./cmis.module, line 120

Code

function cmis_invoke($repositry_id, $url = '', $properties = array()) {

  // merge in defaults
  $properties += array(
    'headers' => array(),
    'method' => 'GET',
    'data' => NULL,
    'retry' => 3,
  );
  $cmis_repository = cmis_get_repository((string) $repositry_id);

  // If the conf array has specified a transport, then we should use that and not look for modules implementing cmis_invoke
  $cmis_transport = $cmis_repository->settings['transport'];

  // If the default is in use, check that another module isn't implementing cmis_invoke
  if ($cmis_transport == 'cmis_common') {
    foreach (module_implements('cmis_invoke') as $module) {

      //Determine which module to use and change the cmis_transport mechanism from the default set in cmis_get_repository
      if ($module != $cmis_transport) {
        $cmis_transport = $module;
        break;
      }
    }
  }

  // invoke hook_cmis()
  if (module_exists($cmis_transport)) {
    return module_invoke($cmis_transport, 'cmis_invoke', $url, $properties, $cmis_repository->settings);
  }
  else {
    throw new CMISException(t('Unable to lookup CMIS transport [@cmis_transport] for [@cmis_id_or_alias]', array(
      '@cmis_id_or_alias' => $repositry_id,
      '@cmis_transport' => $cmis_transport,
    )));
  }
}