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

A CMIS client is used to communicate with the document manangement server by connecting to an exposed web service. It provides the initial access function to the repositories.

A client may use one of the user agents to authenticate against the CMIS backend, as specified by the =useragent= parameter during object construction. By default a user agent will be used performing HTTP basic auth as a fallback implemented by most CMIS servers.

Available user agents are:

  use Cache::FileCache ();

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

Parent class: REST::Client

METHODS

new(%params)

Create a new WebService::Cmis::Client. This requires a url of the webservice api, as well as a valid useragent handler.

See REST::Client for more options.

Parameters:

  • useragent - handler to be used for authentication

      "WebService::Cmis::Agent::BasicAuth" (default)
  • 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

setUseragent($userAgent)

setter to assert the user agent to be used in the REST::Client

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) -> $ticket

Logs in to the web service. returns an identifier for the internal state of the user agent that may be used to login again later on.

  my $ticket = $client->login(
    user=> $user, 
    password => $password
  );

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

Logs out of the web service invalidating a stored state within the auth handler.

COPYRIGHT AND LICENSE

Copyright 2012-2013 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.