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"
57 DBG <<
"+++++++++++++++ load " <<
pi << endl;
60 std::list<Pathname> entries;
63 WAR <<
"Plugin dir is not readable: " <<
pi << endl;
66 for_(
it, entries.begin(), entries.end() )
69 if (
pii.isFile() &&
pii.userMayRX() )
73 else if (
pi.isFile() )
78 WAR <<
"Plugin file is not executable: " <<
pi << endl;
82 WAR <<
"Plugin path is neither dir nor file: " <<
pi << endl;
84 DBG <<
"--------------- load " <<
pi << endl;
89 DBG <<
"+++++++++++++++ send " <<
frame_r << endl;
98 DBG <<
"--------------- send " <<
frame_r << endl;
108 MIL <<
"Load plugin: " <<
pi_r << endl;
123 WAR <<
"Failed to load plugin " <<
pi_r << endl;
138 WAR <<
e.asUserHistory() << endl;
142 if ( ! (
ret.isAckCommand() ||
ret.isEnomethodCommand() || (
script_r.script() ==
"/bin/cat" &&
frame_r.command() !=
"ERROR" ) ) )
144 WAR <<
"Bad plugin response from " <<
script_r <<
": " <<
ret << endl;
169 {
return _pimpl->empty(); }
172 {
return _pimpl->size(); }
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
shared_ptr< Impl > _pimpl
Base class for Exception.
PluginExecutor implementation.
Impl & operator=(Impl &&)=delete
PluginFrame doSend(PluginScript &script_r, const PluginFrame &frame_r)
void doLoad(const PathInfo &pi_r)
Launch a plugin sending PLUGINSTART message.
std::list< PluginScript > _scripts
Impl & operator=(const Impl &)=delete
Impl(const Impl &)=delete
const std::list< PluginScript > scripts() const
void send(const PluginFrame &frame_r)
void load(const Pathname &path_r)
Parallel execution of stateful PluginScripts.
RW_pointer< Impl > _pimpl
Implementation class.
void load(const Pathname &path_r)
Find and launch plugins sending PLUGINBEGIN.
size_t size() const
Number of open plugins.
PluginExecutor()
Default ctor: Empty plugin list.
void send(const PluginFrame &frame_r)
Send PluginFrame to all open plugins.
~PluginExecutor()
Dtor: Send PLUGINEND and close all plugins.
bool empty() const
Whether no plugins are waiting.
Command frame for communication with PluginScript.
static const std::string & ackCommand()
"ACK" command.
static const std::string & enomethodCommand()
"_ENOMETHOD" command.
Interface to plugin scripts using a Stomp inspired communication protocol.
static ZConfig & instance()
Singleton ctor.
Wrapper class for stat/lstat.
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
int readdir(std::list< std::string > &retlist_r, const Pathname &path_r, bool dots_r)
Return content of directory via retlist.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).