12 #include <zypp/base/LogTools.h> 13 #include <zypp/base/NonCopyable.h> 16 #include <zypp/PathInfo.h> 21 #undef ZYPP_BASE_LOGGER_LOGGROUP 22 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::plugin" 53 DBG <<
"+++++++++++++++ load " << pi << endl;
56 std::list<Pathname> entries;
59 WAR <<
"Plugin dir is not readable: " << pi << endl;
62 for_( it, entries.begin(), entries.end() )
74 WAR <<
"Plugin file is not executable: " << pi << endl;
78 WAR <<
"Plugin path is neither dir nor file: " << pi << endl;
80 DBG <<
"--------------- load " << pi << endl;
85 DBG <<
"+++++++++++++++ send " << frame_r << endl;
94 DBG <<
"--------------- send " << frame_r << endl;
97 const std::list<PluginScript>
scripts()
const 104 MIL <<
"Load plugin: " << pi_r << endl;
114 if ( plugin.isOpen() )
119 WAR <<
"Failed to load plugin " << pi_r << endl;
128 script_r.
send( frame_r );
140 WAR <<
"Bad plugin response from " << script_r <<
": " << ret << endl;
158 : _pimpl( new
Impl() )
PluginExecutor()
Default ctor: Empty plugin list.
const Pathname & path() const
Return current Pathname.
size_t size() const
Number of open plugins.
static ZConfig & instance()
Singleton ctor.
Command frame for communication with PluginScript.
std::ostream & operator<<(std::ostream &str, const InputStream &obj)
const std::string & command() const
Return the frame command.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Parallel execution of stateful PluginScripts.
String related utilities and Regular expression matching.
const Pathname & script() const
Return the script path if set.
PluginFrame receive() const
Receive a PluginFrame.
bool empty() const
Whether no plugins are waiting.
PluginFrame doSend(PluginScript &script_r, const PluginFrame &frame_r)
~PluginExecutor()
Dtor: Send PLUGINEND and close all plugins.
bool isEnomethodCommand() const
Convenience to identify an _ENOMETHOD command.
std::list< PluginScript > _scripts
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
static const std::string & enomethodCommand()
"_ENOMETHOD" command.
void send(const PluginFrame &frame_r)
Send PluginFrame to all open plugins.
void send(const PluginFrame &frame_r) const
Send a PluginFrame.
std::string asUserHistory() const
A single (multiline) string composed of asUserString and historyAsString.
void load(const Pathname &path_r)
void send(const PluginFrame &frame_r)
static const std::string & ackCommand()
"ACK" command.
void open()
Setup connection and execute script.
bool isAckCommand() const
Convenience to identify an ACK command.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
RW_pointer< Impl > _pimpl
Implementation class.
int close()
Close any open connection.
Base class for Exception.
void load(const Pathname &path_r)
Find and launch plugins sending PLUGINBEGIN.
PluginExecutor implementation.
void doLoad(const PathInfo &pi_r)
Launch a plugin sending PLUGINSTART message.
Wrapper class for ::stat/::lstat.
void setHeader(const std::string &key_r, const std::string &value_r=std::string())
Set header for key_r removing all other occurrences of key_r.
Interface to plugin scripts using a Stomp inspired communication protocol.
Easy-to use interface to the ZYPP dependency resolver.
const std::list< PluginScript > scripts() const