libzypp  10.5.0
zypp::media::MediaAria2c Class Reference

Implementation class for FTP, HTTP and HTTPS MediaHandler using an external program (aria2c) to retrive files. More...

#include <MediaAria2c.h>

Inheritance diagram for zypp::media::MediaAria2c:

List of all members.

Classes

class  Callbacks

Public Member Functions

 MediaAria2c (const Url &url_r, const Pathname &attach_point_hint_r)
virtual ~MediaAria2c ()

Static Public Member Functions

static bool existsAria2cmd ()
 check if aria2c command line is present in the system

Protected Member Functions

virtual void attachTo (bool next=false)
 Call concrete handler to attach the media.
virtual void releaseFrom (const std::string &ejectDev)
 Call concrete handler to release the media.
virtual void getFile (const Pathname &filename) const
 Call concrete handler to provide file below attach point.
virtual void getDir (const Pathname &dirname, bool recurse_r) const
 Call concrete handler to provide directory content (not recursive!) below attach point.
virtual void getDirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const
 Call concrete handler to provide a content list of directory on media via retlist.
virtual void getDirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const
 Basically the same as getDirInfo above.
virtual bool getDoesFileExist (const Pathname &filename) const
 Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly, or user cancels the operation.
virtual bool doGetDoesFileExist (const Pathname &filename) const
virtual void disconnectFrom ()
virtual void getFileCopy (const Pathname &srcFilename, const Pathname &targetFilename) const
virtual bool checkAttachPoint (const Pathname &apoint) const
 Verify if the specified directory as attach point (root) as requires by the particular media handler implementation.

Static Protected Member Functions

static const char *const agentString ()

Private Member Functions

bool authenticate (const std::string &availAuthTypes, bool firstTry) const
std::string getAria2cVersion ()
 External process to get aria2c version.

Private Attributes

std::string _currentCookieFile
std::string _ca_path

Static Private Attributes

static Pathname _cookieFile = "/var/lib/YaST2/cookies"
static std::string _aria2cVersion = "WE DON'T KNOW ARIA2C VERSION"

Detailed Description

Implementation class for FTP, HTTP and HTTPS MediaHandler using an external program (aria2c) to retrive files.

Author:
gfarrasb (gfarrasb@gmail.com)
Duncan Mac-Vicar <dmacvicar@suse.de>
See also:
MediaHandler

Definition at line 31 of file MediaAria2c.h.


Constructor & Destructor Documentation

zypp::media::MediaAria2c::MediaAria2c ( const Url url_r,
const Pathname &  attach_point_hint_r 
)

Definition at line 233 of file MediaAria2c.cc.

virtual zypp::media::MediaAria2c::~MediaAria2c ( ) [inline, virtual]

Definition at line 80 of file MediaAria2c.h.


Member Function Documentation

bool zypp::media::MediaAria2c::existsAria2cmd ( ) [static]

check if aria2c command line is present in the system

Definition at line 71 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::attachTo ( bool  next = false) [protected, virtual]

Call concrete handler to attach the media.

Asserted that not already attached, and attachPoint is a directory.

Parameters:
nexttry next available device in turn until end of device list is reached (for media which are accessible through multiple devices like cdroms).
Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 242 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::releaseFrom ( const std::string &  ejectDev) [protected, virtual]

Call concrete handler to release the media.

If eject is true, and the media is used in one handler instance only, physically eject the media (i.e. CD-ROM).

Asserted that media is attached.

Parameters:
ejectDevDevice to eject. None if empty.
Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 259 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::getFile ( const Pathname &  filename) const [protected, virtual]

Call concrete handler to provide file below attach point.

Default implementation provided, that returns whether a file is located at 'localRoot + filename'.

Asserted that media is attached.

Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 264 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::getDir ( const Pathname &  dirname,
bool  recurse_r 
) const [protected, virtual]

Call concrete handler to provide directory content (not recursive!) below attach point.

Return E_not_supported_by_media if media does not support retrieval of directory content.

Default implementation provided, that returns whether a directory is located at 'localRoot + dirname'.

Asserted that media is attached.

Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 555 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::getDirInfo ( std::list< std::string > &  retlist,
const Pathname &  dirname,
bool  dots = true 
) const [protected, virtual]

Call concrete handler to provide a content list of directory on media via retlist.

If dots is false entries starting with '.' are not reported.

Return E_not_supported_by_media if media does not support retrieval of directory content.

Default implementation provided, that returns the content of a directory at 'localRoot + dirnname' retrieved via 'readdir'.

Asserted that media is attached and retlist is empty.

Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 565 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::getDirInfo ( filesystem::DirContent retlist,
const Pathname &  dirname,
bool  dots = true 
) const [protected, virtual]

Basically the same as getDirInfo above.

The content list is returned as filesystem::DirContent, which includes name and filetype of each directory entry. Retrieving the filetype usg. requires an additional ::stat call for each entry, thus it's more expensive than a simple readdir.

Asserted that media is attached and retlist is empty.

Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 571 of file MediaAria2c.cc.

bool zypp::media::MediaAria2c::getDoesFileExist ( const Pathname &  filename) const [protected, virtual]

Repeatedly calls doGetDoesFileExist() until it successfully returns, fails unexpectedly, or user cancels the operation.

This is used to handle authentication or similar retry scenarios on media level.

Reimplemented from zypp::media::MediaCurl.

Definition at line 545 of file MediaAria2c.cc.

bool zypp::media::MediaAria2c::doGetDoesFileExist ( const Pathname &  filename) const [protected, virtual]
See also:
MediaHandler::getDoesFileExist

Reimplemented from zypp::media::MediaCurl.

Definition at line 550 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::disconnectFrom ( ) [protected, virtual]
Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 254 of file MediaAria2c.cc.

void zypp::media::MediaAria2c::getFileCopy ( const Pathname &  srcFilename,
const Pathname &  targetFilename 
) const [protected, virtual]
Exceptions:
MediaException

Reimplemented from zypp::media::MediaCurl.

Definition at line 271 of file MediaAria2c.cc.

bool zypp::media::MediaAria2c::checkAttachPoint ( const Pathname &  apoint) const [protected, virtual]

Verify if the specified directory as attach point (root) as requires by the particular media handler implementation.

Parameters:
apointThe directory to check.
Returns:
True, if the directory checks succeeded.

Reimplemented from zypp::media::MediaCurl.

Definition at line 249 of file MediaAria2c.cc.

const char *const zypp::media::MediaAria2c::agentString ( ) [static, protected]

Definition at line 212 of file MediaAria2c.cc.

bool zypp::media::MediaAria2c::authenticate ( const std::string &  availAuthTypes,
bool  firstTry 
) const [private]

Reimplemented from zypp::media::MediaCurl.

Definition at line 560 of file MediaAria2c.cc.

std::string zypp::media::MediaAria2c::getAria2cVersion ( ) [private]

External process to get aria2c version.

Definition at line 577 of file MediaAria2c.cc.


Member Data Documentation

Reimplemented from zypp::media::MediaCurl.

Definition at line 99 of file MediaAria2c.h.

std::string zypp::media::MediaAria2c::_ca_path [private]

Definition at line 100 of file MediaAria2c.h.

Pathname zypp::media::MediaAria2c::_cookieFile = "/var/lib/YaST2/cookies" [static, private]

Reimplemented from zypp::media::MediaCurl.

Definition at line 101 of file MediaAria2c.h.

std::string zypp::media::MediaAria2c::_aria2cVersion = "WE DON'T KNOW ARIA2C VERSION" [static, private]

Definition at line 105 of file MediaAria2c.h.


The documentation for this class was generated from the following files: