[yast-commit] r49042 - in /branches/tmp/lslezak/workshop/core: libscr/src/SCR.cc scr/src/DBusServer.cc scr/src/ScriptingAgent.h
Author: lslezak Date: Mon Jul 14 13:51:27 2008 New Revision: 49042 URL: http://svn.opensuse.org/viewcvs/yast?rev=49042&view=rev Log: - added SCR calls is DBus layer: UnregisterAgent(), UnregisterAllAgents(), UnmountAgent() and RegisterNewAgents() Modified: branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc branches/tmp/lslezak/workshop/core/scr/src/ScriptingAgent.h Modified: branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc?rev=49042&r1=49041&r2=49042&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc (original) +++ branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc Mon Jul 14 13:51:27 2008 @@ -52,14 +52,17 @@ return false; } -static YCPValue CallDBus(const char *method, const YCPPath &path, const YCPValue &args = YCPNull (), +static YCPValue CallDBus(const char *method, const YCPPath &path = YCPNull(), const YCPValue &args = YCPNull (), const YCPValue &opt = YCPNull ()) { DBusMsg msg; // TODO create constants for these strings msg.createCall("org.opensuse.yast.SCR", "/SCR", "org.opensuse.yast.SCR.Methods", method); - msg.addYCPValue(path); + if (!path.isNull()) + { + msg.addYCPValue(path); + } if (!args.isNull()) { @@ -296,11 +299,9 @@ static YCPValue SCRUnregisterAgent (const YCPPath &path) { - // TODO FIXME if (connection != NULL) { - y2error("SCR::UnregisterAgent() call is not implemented yet in DBus layer!"); - return YCPVoid(); + return CallDBus("UnregisterAgent", path); } if (! SCRAgent::instance()) @@ -315,11 +316,9 @@ static YCPValue SCRUnregisterAllAgents () { - // TODO FIXME if (connection != NULL) { - y2error("SCR::UnregisterAllAgents() call is not implemented yet in DBus layer!"); - return YCPVoid(); + return CallDBus("UnregisterAllAgents"); } if (! SCRAgent::instance()) @@ -333,11 +332,9 @@ static YCPValue SCRUnmountAgent (const YCPPath &path) { - // TODO FIXME if (connection != NULL) { - y2error("SCR::UnmountAgent() call is not implemented yet in DBus layer!"); - return YCPVoid(); + return CallDBus("UnmountAgent", path); } if (! SCRAgent::instance()) @@ -352,11 +349,9 @@ static YCPValue SCRRegisterNewAgents () { - // TODO FIXME if (connection != NULL) { - y2error("SCR::RegisterNewAgents() call is not implemented yet in DBus layer!"); - return YCPVoid(); + return CallDBus("RegisterNewAgents"); } if (! SCRAgent::instance()) Modified: branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc?rev=49042&r1=49041&r2=49042&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc (original) +++ branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc Mon Jul 14 13:51:27 2008 @@ -92,7 +92,9 @@ std::string method(request.method()); if (method == "Read" || method == "Write" || method == "Execute" || - method == "Dir" || method == "Error") + method == "Dir" || method == "Error" || method == "UnregisterAgent" || + method == "UnregisterAllAgents" || method == "UnmountAgent" || + method == "RegisterNewAgents") { YCPValue arg = request.getYCPValue(1); YCPValue opt = request.getYCPValue(2); @@ -131,6 +133,14 @@ ret = sa->Dir(pth); else if (method == "Error") ret = sa->Error(pth); + else if (method == "UnregisterAgent") + ret = sa->UnregisterAgent(pth); + else if (method == "UnregisterAllAgents") + ret = sa->UnregisterAllAgents(); + else if (method == "UnmountAgent") + ret = sa->UnmountAgent(pth); + else if (method == "RegisterNewAgents") + ret = sa->RegisterNewAgents(); reply.createReply(request); @@ -201,6 +211,20 @@ " <arg name='path' type='s' direction='in'/>" " <arg name='ret' type='av' direction='out'/>" " </method>" +" <method name='UnregisterAgent'>" +" <arg name='path' type='s' direction='in'/>" +" <arg name='ret' type='b' direction='out'/>" +" </method>" +" <method name='UnregisterAllAgents'>" +" <arg name='ret' type='b' direction='out'/>" +" </method>" +" <method name='RegisterNewAgents'>" +" <arg name='ret' type='b' direction='out'/>" +" </method>" +" <method name='UnmountAgent'>" +" <arg name='path' type='s' direction='in'/>" +" <arg name='ret' type='b' direction='out'/>" +" </method>" " <interface name='org.freedesktop.DBus.Introspectable'>" " <method name='Introspect'>" " <arg name='xml_data' type='s' direction='out'/>" Modified: branches/tmp/lslezak/workshop/core/scr/src/ScriptingAgent.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/ScriptingAgent.h?rev=49042&r1=49041&r2=49042&view=diff ============================================================================== --- branches/tmp/lslezak/workshop/core/scr/src/ScriptingAgent.h (original) +++ branches/tmp/lslezak/workshop/core/scr/src/ScriptingAgent.h Mon Jul 14 13:51:27 2008 @@ -104,6 +104,18 @@ */ virtual YCPBoolean UnmountAgent (const YCPPath &path); + /** + * Register new agents. (bnc#245508#c16) + * Rescan the scrconf registration directories and register any + * agents at new(!) paths. Agents, even new ones, on paths that + * are registered already, will not be replaced. This means that + * .oes.specific.agent will start to work but something like + * adding + * /usr/local/etc/sysconfig to .sysconfig.network would not. + */ + virtual YCPBoolean RegisterNewAgents (); + + private: // once we have to do a sweep (read all scr files because of @@ -157,17 +169,6 @@ void Sweep (); /** - * Register new agents. (bnc#245508#c16) - * Rescan the scrconf registration directories and register any - * agents at new(!) paths. Agents, even new ones, on paths that - * are registered already, will not be replaced. This means that - * .oes.specific.agent will start to work but something like - * adding - * /usr/local/etc/sysconfig to .sysconfig.network would not. - */ - YCPBoolean RegisterNewAgents (); - - /** * For .foo.bar.baz, register foo.bar.baz.scr, or foo.bar.scr, or foo.scr. * BTW we can register an unrelated path because this is just a heuristic. */ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn.opensuse.org