The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Cmis::Client - Transport layer

DESCRIPTION

This is the workhorse communicating with the document manangement server by connecting to the REST service. It provides the initial access function to the repositories.

  use Cache::FileCache ();

  my $client = WebService::Cmis::getClient(
      url => "http://cmis.alfresco.com/service/cmis",
      cache => new Cache::FileCache({
        cache_root => "/tmp/cmis_client"
      }
    )
  )
  
  my $repo = $client->getRepository;

Parent class: REST::Client

METHODS

new(%params)

Create a new WebService::Cmis::Client object. This requires a url of the webservice api, as well as a user and password for authentication.

Parameters:

  • user

  • password

  • url - repository url; example:

      "http://localhost:8080/alfresco/service/cmis"
  • cache - a Cache::Cache object to be used for caching

  • overrideCacheContrib - boolean flag to ignore any http cache control for more aggressive caching

  • loginUrl - url used for ticket-based authentication; example:

      "http://localhost:8080/alfresco/service/api/login?u={username}&pw={password}"
  • logoutUrl - url used for ticket-based authentication; example:

      "http://localhost:8080/alfresco/service/api/login/ticket/{ticket}"

See REST::Client for more options.

toString

return a string representation of this client

clearCache

nukes all of the cache. calling this method is sometimes required to work around caching effects.

purgeCache

purges outdated cache entries. call this method in case the cache backend is able to do a kind of house keeping.

removeFromCache($path, %params)

removes an item from the cache associated with the given path and url parameters

get($path, %params)

does a get against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects to it for you.

request ( $method, $url, [$body_content, %$headers] )

add a cache layer on top of all network connections of the rest client

responseContent

returns the full content of a response

responseCode

returns the HTTP status code of the repsonse

responseStatusLine

returns the "code message" of the response. (See HTTP::Status)

responseBase -> $uri

returns the base uri for this response

post($path, $payload, $contentType, %params)

does a post against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects to it for you.

put($path, $payload, $contentType, %params)

does a put against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects to it for you.

delete($url, %params)

does a delete against the CMIS service. More than likely, you will not need to call this method. Instead, let the other objects to it for you.

processErrors

throws a client or a server exception based on the http error code of the last transaction.

getRepositories() -> %repositories;

returns a hash of WebService::Cmis::Repository objects available at this service.

getRepository($id) -> $repository

returns a WebService::Cmis::Repository of the given ID. if ID is undefined the default repository will be returned.

getCacheHits() -> $num

returns the number of times a result has been fetched from the cache instead of accessing the CMIS backend. returns undefined when no cache is configured

login(%params)

logs in to the web service

Parameters:

  • user

  • password

  • ticket

Login using basic auth. If a loginUrl is configured, a ticket will be aquired to be used for later logins by the same user.

  $client->login({
    user => "user", 
    password => "pasword"
  });

  $ticket = $client->{ticket};

  $client->login({
    user => "user", 
    ticket => "ticket"
  });
logout()

logs out of the web service deleting a ticket previously aquired

COPYRIGHT AND LICENSE

Copyright 2012 Michael Daum

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/artistic.html.