Author: lslezak
Date: Fri Jan 30 16:20:58 2009
New Revision: 55172
URL: http://svn.opensuse.org/viewcvs/yast?rev=55172&view=rev
Log:
- import a Yast name space including nested namespaces, use generic
import (language independent)
Modified:
branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc
branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.h
branches/tmp/lslezak/core/dbus/namespace_service/Makefile.am
Modified: branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc (original)
+++ branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.cc Fri Jan 30 16:20:58 2009
@@ -10,6 +10,7 @@
#include
#include
+#include
#include
#include
#include
@@ -20,49 +21,48 @@
#include <functional>
-DBusModulesServer::DBusModulesServer(const std::string &name_space) : e(this)
-{
- // create the namespace
- YBlockPtr block = Bytecode::readModule(name_space);
+#include
- if (block == NULL)
+void DBusModulesServer::init_wfm()
+{
+ if (Y2WFMComponent::instance() == NULL)
{
- y2milestone("Loading YCP namespace failed, laoding plugin...");
+ wfm = Y2ComponentBroker::createClient("wfm");
- Y2PluginComponent* comp = NULL;
- // try to load the library
- for (int level = 0; level < Y2PathSearch::numberOfComponentLevels ();
- level++)
+ if (wfm == NULL)
{
- std::string filename = Y2PathSearch::findy2plugin(name_space, level);
- if (filename.empty ())
- continue;
+ y2error("Cannot create WFM component");
+ }
+ }
+}
- y2debug ("Trying file '%s'", filename.c_str ());
+DBusModulesServer::DBusModulesServer(const std::string &name_space) : e(this), wfm(NULL)
+{
+ init_wfm();
- comp = new Y2PluginComponent(filename, name_space.c_str(), name_space.c_str(), name_space.c_str());
- if (comp) break;
- }
+ Import import(name_space); // has an iternal static cache
- if (comp)
- {
- // use the internal component, that should provide the namespace
- Y2Component *c = comp->component();
-
- if (c)
- ns = c->import(name_space.c_str());
- }
- else
- ns = NULL;
+ ns = import.nameSpace();
+
+ if (ns == NULL)
+ {
+ y2error("Import name space %s failed", name_space.c_str());
}
else
{
- ns = block->nameSpace();
+ ns->initialize();
+ y2milestone("Imported name space: %s", name_space.c_str());
}
}
DBusModulesServer::~DBusModulesServer()
{
+ if (wfm != NULL)
+ {
+ y2milestone("Deleting WFM component");
+ delete wfm;
+ wfm = NULL;
+ }
}
void DBusModulesServer::registerFunctions(const std::string &interface_prefix)
Modified: branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.h?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.h (original)
+++ branches/tmp/lslezak/core/dbus/namespace_service/DBusModulesServer.h Fri Jan 30 16:20:58 2009
@@ -12,6 +12,7 @@
#include
#include
+#include
#include <functional>
@@ -54,6 +55,10 @@
};
Callback e;
+
+ Y2Component *wfm;
+
+ void init_wfm();
};
Modified: branches/tmp/lslezak/core/dbus/namespace_service/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/core/dbus/namespace_service/Makefile.am?rev=55172&r1=55171&r2=55172&view=diff
==============================================================================
--- branches/tmp/lslezak/core/dbus/namespace_service/Makefile.am (original)
+++ branches/tmp/lslezak/core/dbus/namespace_service/Makefile.am Fri Jan 30 16:20:58 2009
@@ -12,9 +12,9 @@
modules_dbus_server_SOURCES = modules_dbus_server.cc DBusModulesServer.cc DBusModulesServer.h
-modules_dbus_server_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) $(POLKIT_CFLAGS) -I$(top_builddir)/liby2dbus/src -I$(srcdir)/../../scr/src -I$(top_builddir)/libscr/src/include
+modules_dbus_server_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) $(POLKIT_CFLAGS) -I$(top_builddir)/liby2dbus/src -I$(srcdir)/../../scr/src -I$(top_builddir)/libscr/src/include -I$(top_builddir)/wfm/src
-modules_dbus_server_LDADD = ${AGENT_LIBADD} $(top_builddir)/liby2dbus/src/liby2dbus.la $(top_builddir)/scr/src/libpy2scr.la
+modules_dbus_server_LDADD = ${AGENT_LIBADD} $(top_builddir)/liby2dbus/src/liby2dbus.la $(top_builddir)/scr/src/libpy2scr.la $(top_builddir)/wfm/src/libpy2wfm.la
# service activation config
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org