You are here

function cmis_common_cmisapi_invoke in CMIS API 6.4

Same name and namespace in other branches
  1. 6.3 cmis_common/cmis_common.module \cmis_common_cmisapi_invoke()
  2. 7.2 cmis_common/cmis_common.module \cmis_common_cmisapi_invoke()
  3. 7 cmis_common/cmis_common.module \cmis_common_cmisapi_invoke()

Implementation of hook_cmisapi_invoke().

File

cmis_common/cmis_common.module, line 21

Code

function cmis_common_cmisapi_invoke() {
  $args = func_get_args();
  $cmis_method = $args[0];
  $repository_id = $args[1];
  unset($args[0]);
  unset($args[1]);
  $cmis_repository = cmis_get_repository($repository_id);

  // pass repository info from cache
  if ($cmis_method == 'getRepositoryInfo' && isset($cmis_repository->info)) {
    return $cmis_repository->info;
  }

  // cache service instance
  if (!isset($cmis_repository->service)) {
    module_load_include('utils.inc', 'cmis_common');

    // CommonCMISService allows other modules to control the way CMISService class
    // calls the CMIS repositories via hook_cmis_invoke()
    $cmis_repository->service = new CommonCMISService($cmis_repository->settings['url'], $cmis_repository->settings['user'], $cmis_repository->settings['password']);
  }
  return call_user_func_array(array(
    $cmis_repository->service,
    $cmis_method,
  ), $args);
}