media/MediaMultiCurl.cc
media/MediaAria2c.cc
media/MediaISO.cc
+ media/MediaPLUGIN.cc
media/MediaSource.cc
media/MediaManager.cc
media/MediaUserAuth.cc
media/MediaException.h
media/MediaHandler.h
media/MediaISO.h
+ media/MediaPLUGIN.h
media/MediaManager.h
media/MediaNFS.h
media/MediaSource.h
#include "zypp/media/MediaAria2c.h"
#include "zypp/media/MediaMultiCurl.h"
#include "zypp/media/MediaISO.h"
+#include "zypp/media/MediaPLUGIN.h"
using namespace std;
else
_handler = new MediaCurl (url,preferred_attach_point);
}
+ else if (scheme == "plugin" )
+ _handler = new MediaPLUGIN (url,preferred_attach_point);
else
{
ZYPP_THROW(MediaUnsupportedUrlSchemeException(url));
* proxy settings to curl, but curl fallbacks to use the content of
* the <tt>http_proxy</tt>, <tt>ftp_proxy</tt>, etc environment
* variables.
+ *
+ * \subsection MediaPlugin_Url MediaPlugin - custom media handler
+ * Media access is delegated to a script located in the libzypp
+ * media plugin directory. The URLs query options are translated
+ * into commandline arguments passed to the script.
+ * - Scheme:
+ * - <b>plugin</b>
+ * - Examples:
+ * \code
+ * "plugin:script?loptv=lvalue&v=optv&lopt=&o&=foo"
+ * \__________/ \____/ \___/ | \_/
+ * __________/__ ____/_ _|_ \ \___
+ * / \ / \ / \ /\ / \
+ * script --loptv "lvalue" -v "optv" --lopt -o -- foo
+ * \endcode
+ * - Query parameters:
+ * - The URLs query options are translated into commandline
+ * arguments passed to the script.
+ * - \b Note: No option may appear twice, as the <tt>(option,value)</tt>
+ * pairs are stored in a hash.
+ * - \b Note: The order in which the query options are passes to the
+ * script is arbitrary, except for an option with an empty key, which
+ * is translated into <tt>'-- value'</tt> and passed as final option.
+ * - <tt>'c[=[value]]'</tt> ist passed as <tt>'-c [value]'</tt>
+ * - <tt>'word[=[value]]'</tt> ist passed as <tt>'--word [value]'</tt>
+ * - <tt>'[=value]'</tt> ist passed as last args as <tt>'-- [value]'</tt>
+ * - \c script<->libzypp communication:
+ * - \TODO to be documented.
*/
class MediaManager: private zypp::base::NonCopyable
{
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/media/MediaPLUGIN.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/base/LogTools.h"
+#include "zypp/base/String.h"
+
+#include "zypp/ExternalProgram.h"
+
+#include "zypp/media/MediaPLUGIN.h"
+#include "zypp/media/MediaManager.h"
+
+using std::endl;
+
+//////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+ namespace media
+ { //////////////////////////////////////////////////////////////////
+
+ MediaPLUGIN::MediaPLUGIN( const Url & url_r, const Pathname & attach_point_hint_r )
+ : MediaHandler( url_r, attach_point_hint_r, /*path below attachpoint*/"/", /*does_download*/false )
+ {
+ MIL << "MediaPLUGIN::MediaPLUGIN(" << url_r << ", " << attach_point_hint_r << ")" << endl;
+ }
+ void MediaPLUGIN::attachTo( bool next_r )
+ {}
+
+ void MediaPLUGIN::releaseFrom( const std::string & ejectDev_r )
+ {}
+
+ void MediaPLUGIN::getFile( const Pathname & filename_r ) const
+ {}
+
+ void MediaPLUGIN::getDir( const Pathname & dirname_r, bool recurse_r ) const
+ {}
+
+ void MediaPLUGIN::getDirInfo( std::list<std::string> & retlist_r, const Pathname & dirname_r, bool dots_r ) const
+ {}
+
+ void MediaPLUGIN::getDirInfo( filesystem::DirContent & retlist_r, const Pathname & dirname_r, bool dots_r ) const
+ {}
+
+ bool MediaPLUGIN::getDoesFileExist( const Pathname & filename_r ) const
+ { return false; }
+
+ //////////////////////////////////////////////////////////////////
+ } // namespace media
+ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+} // namespace zypp
+//////////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/media/MediaPLUGIN.h
+ *
+*/
+#ifndef ZYPP_MEDIA_MEDIAPLUGIN_H
+#define ZYPP_MEDIA_MEDIAPLUGIN_H
+
+#include "zypp/media/MediaHandler.h"
+
+//////////////////////////////////////////////////////////////////////
+namespace zypp
+{ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+ namespace media
+ { //////////////////////////////////////////////////////////////////
+
+ /**
+ * \brief Implementation class for PLUGIN MediaHandler
+ *
+ * @see MediaHandler
+ */
+ class MediaPLUGIN : public MediaHandler
+ {
+ public:
+ MediaPLUGIN( const Url & url_r, const Pathname & attach_point_hint_r );
+
+ virtual ~MediaPLUGIN() { try { release(); } catch(...) {} }
+
+ protected:
+ virtual void attachTo( bool next_r = false );
+ virtual void releaseFrom( const std::string & ejectDev_r );
+ virtual void getFile( const Pathname & filename_r ) const;
+ virtual void getDir( const Pathname & dirname_r, bool recurse_r ) const;
+ virtual void getDirInfo( std::list<std::string> & retlist_r, const Pathname & dirname_r, bool dots_r = true ) const;
+ virtual void getDirInfo( filesystem::DirContent & retlist_r, const Pathname & dirname_r, bool dots_r = true ) const;
+ virtual bool getDoesFileExist( const Pathname & filename_r ) const;
+ };
+
+ //////////////////////////////////////////////////////////////////
+ } // namespace media
+ ////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////
+} // namespace zypp
+//////////////////////////////////////////////////////////////////////
+#endif // ZYPP_MEDIA_MEDIAPLUGIN_H