#include "zypp/base/ReferenceCounted.h"
#include "zypp/base/NonCopyable.h"
#include "zypp/base/PtrTypes.h"
+#include "zypp/APIConfig.h"
#include "zypp/Pathname.h"
#include "zypp/PathInfo.h"
#include "zypp/media/MediaSource.h"
#include "zypp/Url.h"
-#include "zypp/base/Logger.h"
-
-#include <iostream> // endl
namespace zypp {
namespace media {
MediaHandler * _handler;
friend class MediaManager;
+ friend class MediaManager_Impl;
+
AttachedMedia attachedMedia() const;
bool isSharedMedia() const;
- bool dependsOnParent(MediaAccessId parentId) const;
+ void resetParentId();
+ bool dependsOnParent() const;
+ bool dependsOnParent(MediaAccessId parentId,
+ bool exactIdMatch) const;
public:
/**
bool downloads() const;
/**
- * Hint if files will be downloaded when using the
- * specified media \p url.
- *
- * @note This hint is based on the \p url scheme
- * only and does not imply, that the URL is valid.
- *
- * @param url The media URL to check.
- * @return True, if the files are downloaded.
- */
- static
- bool downloads(const Url &url);
-
- /**
* Used Protocol if media is opened, otherwise 'unknown'.
**/
std::string protocol() const;
**/
bool isAttached() const;
+ bool hasMoreDevices() const;
+
+ /**
+ * Fill in a vector of detected ejectable devices and the index of the
+ * currently attached device within the vector. The contents of the vector
+ * are the device names (/dev/cdrom and such).
+ *
+ * \param devices vector to load with the device names
+ * \param index index of the currently used device in the devices vector
+ */
+ virtual void
+ getDetectedDevices(std::vector<std::string> & devices,
+ unsigned int & index) const;
+
+
/**
* Return the local directory that corresponds to medias url,
* no matter if media isAttached or not. Files requested will
*/
void disconnect();
- /**
- * Use concrete handler to release the media.
- * @param eject if true, physically eject the media * (i.e. CD-ROM)
- *
- * \throws MediaException
- *
- **/
- void release( bool eject = false );
+ /**
+ * Use concrete handler to release the media.
+ * @param ejectDev Device to eject. None if empty.
+ *
+ * \throws MediaException
+ *
+ **/
+ void release( const std::string & ejectDev = "" );
/**
* Use concrete handler to provide file denoted by path below
* \throws MediaException
*
**/
- void provideFile( const Pathname & filename, bool cached = false, bool checkonly = false ) const;
+ void provideFile( const Pathname & filename, const ByteCount &expectedFileSize ) const;
/**
* Remove filename below attach point IFF handler downloads files
**/
void releasePath( const Pathname & pathname ) const;
+ /**
+ * set a deltafile to be used in the next download
+ */
+ void setDeltafile( const Pathname & filename ) const;
+
public:
/**
void dirInfo( filesystem::DirContent & retlist,
const Pathname & dirname, bool dots = true ) const;
+ /**
+ * check if a file exists
+ *
+ * Asserted that url is a file and not a dir.
+ *
+ * \throws MediaException
+ *
+ **/
+ bool doesFileExist( const Pathname & filename ) const;
+
/**
* Destructor
**/
ZYPP_THROW(MediaBadFilenameException(_file.asString()));
} else if ( _media ) {
try {
- _media->provideFile( _file );
+ _media->provideFile( _file, 0 );
_local_file = _media->localPath( _file );
}
catch (const MediaException & excpt_r)
catch (const MediaException &excpt_r)
{
ZYPP_CAUGHT(excpt_r);
- INT << "Exception raised while releasing file" << std::endl;
}
catch(...) {} // No exception from dtor!
}