#include <MediaAccess.h>
Inheritance diagram for zypp::media::MediaAccess:
Public Types | |
typedef intrusive_ptr< MediaAccess > | Ptr |
typedef intrusive_ptr< const MediaAccess > | constPtr |
Public Member Functions | |
MediaAccess () | |
constructor | |
void | open (const Url &url, const Pathname &preferred_attach_point="") |
open url. | |
bool | isOpen () const |
True if media is open. | |
bool | downloads () const |
Hint if files are downloaded or not. | |
std::string | protocol () const |
Used Protocol if media is opened, otherwise 'unknown'. | |
Url | url () const |
Url if media is opened, otherwise empty. | |
void | close () |
close url | |
void | attach (bool next=false) |
Use concrete handler to attach the media. | |
bool | isAttached () const |
True if media is attached. | |
Pathname | localRoot () const |
Return the local directory that corresponds to medias url, no matter if media isAttached or not. | |
Pathname | localPath (const Pathname &pathname) const |
Short for 'localRoot() + pathname', but returns an empty pathname if media is not open. | |
void | disconnect () |
Use concrete handler to disconnect the media. | |
void | release (bool eject=false) |
Use concrete handler to release the media. | |
void | provideFile (const Pathname &filename, bool cached=false, bool checkonly=false) const |
Use concrete handler to provide file denoted by path below 'attach point'. | |
void | releaseFile (const Pathname &filename) const |
Remove filename below attach point IFF handler downloads files to the local filesystem. | |
void | provideDir (const Pathname &dirname) const |
Use concrete handler to provide directory denoted by path below 'attach point' (not recursive!). | |
void | provideDirTree (const Pathname &dirname) const |
Use concrete handler to provide directory tree denoted by path below 'attach point' (recursive!!). | |
void | releaseDir (const Pathname &dirname) const |
Remove directory tree below attach point IFF handler downloads files to the local filesystem. | |
void | releasePath (const Pathname &pathname) const |
Remove pathname below attach point IFF handler downloads files to the local filesystem. | |
void | dirInfo (std::list< std::string > &retlist, const Pathname &dirname, bool dots=true) const |
Return content of directory on media via retlist. | |
void | dirInfo (filesystem::DirContent &retlist, const Pathname &dirname, bool dots=true) const |
Basically the same as dirInfo above. | |
virtual | ~MediaAccess () |
Destructor. | |
virtual std::ostream & | dumpOn (std::ostream &str) const |
Overload to realize std::ostream & operator<<. | |
void | getFile (const Url &from, const Pathname &to) |
Get file from location at specified by URL and copy it to destination. | |
Static Public Member Functions | |
static bool | downloads (const Url &url) |
Hint if files will be downloaded when using the specified media url . | |
static bool | canBeVolatile (const Url &url) |
Hint whether the media can provide volatile contents. | |
Private Member Functions | |
AttachedMedia | attachedMedia () const |
bool | isSharedMedia () const |
void | resetParentId () |
bool | dependsOnParent () const |
bool | dependsOnParent (MediaAccessId parentId, bool exactIdMatch) const |
Private Attributes | |
MediaHandler * | _handler |
handler for 'physical' media == 0 if not open | |
Static Private Attributes | |
static const Pathname | _noPath |
Friends | |
class | MediaManager |
class | MediaManager_Impl |
Classes | |
class | FileProvider |
Helper class that provides file on construction and cleans up on destruction. More... |
The concrete MediaHandler for a certain url is created on open and deleted on .
The inteface here basically checks whether the handler exists, then forwards the request to MediaHandler.
Definition at line 49 of file MediaAccess.h.
|
Definition at line 52 of file MediaAccess.h. |
|
Definition at line 53 of file MediaAccess.h. |
|
constructor
Definition at line 47 of file MediaAccess.cc. |
|
Destructor.
Definition at line 53 of file MediaAccess.cc. References close(). |
|
Definition at line 63 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::attachedMedia(). |
|
Definition at line 70 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::isSharedMedia(). |
|
Definition at line 77 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::resetParentId(). |
|
Definition at line 83 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::dependsOnParent(). |
|
Definition at line 89 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::dependsOnParent(). |
|
open url. If preferred_attach_point is given, try to use it as attach point. Caution: The medium can choose a different attach point. Only getAttachPoint() knows the real attach point.
Definition at line 98 of file MediaAccess.cc. References zypp::Url::isValid(), MIL, url(), and ZYPP_THROW. Referenced by getFile(). |
|
True if media is open.
Definition at line 99 of file MediaAccess.h. References _handler. |
|
Hint if files are downloaded or not.
Definition at line 172 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::downloads(). Referenced by zypp::media::MediaManager::downloads(). |
|
Hint if files will be downloaded when using the specified media
Definition at line 147 of file MediaAccess.cc. References zypp::Url::getScheme(), and url(). |
|
Hint whether the media can provide volatile contents.
Definition at line 155 of file MediaAccess.cc. References zypp::Url::getScheme(), and url(). Referenced by zypp::SourceFactory::createFrom(), and zypp::source::susetags::SuseTagsImpl::readContentFile(). |
|
Used Protocol if media is opened, otherwise 'unknown'.
Definition at line 163 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::protocol(). |
|
Url if media is opened, otherwise empty.
Definition at line 183 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::url(). Referenced by canBeVolatile(), downloads(), open(), and provideFile(). |
|
close url
Definition at line 193 of file MediaAccess.cc. References _handler, MIL, zypp::media::MediaHandler::release(), WAR, ZYPP_CAUGHT, and ZYPP_RETHROW. Referenced by ~MediaAccess(). |
|
Use concrete handler to attach the media.
Definition at line 217 of file MediaAccess.cc. References _handler, zypp::media::MediaHandler::attach(), and ZYPP_THROW. Referenced by getFile(). |
|
True if media is attached.
Definition at line 227 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::isAttached(). |
|
Return the local directory that corresponds to medias url, no matter if media isAttached or not. Files requested will be available at 'localRoot() + filename' or better 'localPath( filename )'. If media is not open an empty pathname is returned. Definition at line 235 of file MediaAccess.cc. References _handler, _noPath, and zypp::media::MediaHandler::localRoot(). |
|
Short for 'localRoot() + pathname', but returns an empty pathname if media is not open. Files provided will be available at 'localPath(filename)'. Definition at line 246 of file MediaAccess.cc. References _handler, _noPath, and zypp::media::MediaHandler::localPath(). Referenced by provideFile(). |
|
Use concrete handler to disconnect the media. This is useful for media which e.g. holds open a connection to a server like FTP. After calling disconnect() the media object still is valid and files are present. After calling disconnect() it's not possible to call provideFile() or provideDir() anymore.
Definition at line 255 of file MediaAccess.cc. References _handler, zypp::media::MediaHandler::disconnect(), and ZYPP_THROW. |
|
Use concrete handler to release the media.
Definition at line 265 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::release(). Referenced by getFile(). |
|
Use concrete handler to provide file denoted by path below 'attach point'. Filename is interpreted relative to the attached url and a path prefix is preserved.
Definition at line 279 of file MediaAccess.cc. References _handler, zypp::filesystem::Pathname::asString(), zypp::filesystem::PathInfo::isExist(), localPath(), zypp::media::MediaHandler::provideFile(), url(), and ZYPP_THROW. |
|
Remove filename below attach point IFF handler downloads files to the local filesystem. Never remove anything from media.
Definition at line 298 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::releaseFile(). |
|
Use concrete handler to provide directory denoted by path below 'attach point' (not recursive!). 'dirname' is interpreted relative to the attached url and a path prefix is preserved.
Definition at line 311 of file MediaAccess.cc. References _handler, zypp::filesystem::Pathname::asString(), zypp::media::MediaHandler::provideDir(), and ZYPP_THROW. |
|
Use concrete handler to provide directory tree denoted by path below 'attach point' (recursive!!). 'dirname' is interpreted relative to the attached url and a path prefix is preserved.
Definition at line 321 of file MediaAccess.cc. References _handler, zypp::filesystem::Pathname::asString(), zypp::media::MediaHandler::provideDirTree(), and ZYPP_THROW. |
|
Remove directory tree below attach point IFF handler downloads files to the local filesystem. Never remove anything from media.
Definition at line 331 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::releaseDir(). |
|
Remove pathname below attach point IFF handler downloads files to the local filesystem. Never remove anything from media. If pathname denotes a directory it is recursively removed. If pathname is empty or '/' everything below the attachpoint is recursively removed.
Definition at line 340 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::releasePath(). |
|
Return content of directory on media via retlist. If dots is false entries starting with '.' are not reported. The request is forwarded to the concrete handler, which may atempt to retieve the content e.g. via 'readdir' Caution: This is not supported by all media types. Be prepared to handle E_not_supported_by_media.
|
|
Basically the same as dirInfo above. The content 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. Caution: This is not supported by all media types. Be prepared to handle E_not_supported_by_media.
Definition at line 363 of file MediaAccess.cc. References _handler, zypp::filesystem::Pathname::asString(), zypp::media::MediaHandler::dirInfo(), and ZYPP_THROW. |
|
Overload to realize std::ostream & operator<<.
Reimplemented from zypp::base::ReferenceCounted. Definition at line 375 of file MediaAccess.cc. References _handler, and zypp::media::MediaHandler::protocol(). Referenced by zypp::media::operator<<(). |
|
Get file from location at specified by URL and copy it to destination.
Definition at line 384 of file MediaAccess.cc. References _handler, zypp::filesystem::Pathname::asString(), attach(), zypp::filesystem::Pathname::basename(), DBG, zypp::filesystem::Pathname::dirname(), zypp::Url::getPathData(), open(), zypp::media::MediaHandler::provideFileCopy(), release(), zypp::Url::setPathData(), and ZYPP_RETHROW. |
|
Definition at line 65 of file MediaAccess.h. |
|
Definition at line 66 of file MediaAccess.h. |
|
Definition at line 57 of file MediaAccess.h. Referenced by localPath(), and localRoot(). |
|
handler for 'physical' media == 0 if not open
Definition at line 63 of file MediaAccess.h. Referenced by attach(), attachedMedia(), close(), dependsOnParent(), dirInfo(), disconnect(), downloads(), dumpOn(), getFile(), isAttached(), isOpen(), isSharedMedia(), localPath(), localRoot(), protocol(), provideDir(), provideDirTree(), provideFile(), release(), releaseDir(), releaseFile(), releasePath(), resetParentId(), and url(). |