summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/PluginManagerI.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-02-18 10:47:12 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-02-18 10:47:12 -0330
commit4a79d581483dd883d8dae7d411c18b68df734e25 (patch)
treeeabb552f84cccab951f2c6edb3cd60022733b30f /cpp/src/Ice/PluginManagerI.cpp
parentMerge branch 'master' of ssh://git/home/git/ice (diff)
downloadice-4a79d581483dd883d8dae7d411c18b68df734e25.tar.bz2
ice-4a79d581483dd883d8dae7d411c18b68df734e25.tar.xz
ice-4a79d581483dd883d8dae7d411c18b68df734e25.zip
Bug 2433 - deprecate Ice.LoggerPlugin
Diffstat (limited to 'cpp/src/Ice/PluginManagerI.cpp')
-rw-r--r--cpp/src/Ice/PluginManagerI.cpp61
1 files changed, 43 insertions, 18 deletions
diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp
index 51c254b6e77..0b594787db7 100644
--- a/cpp/src/Ice/PluginManagerI.cpp
+++ b/cpp/src/Ice/PluginManagerI.cpp
@@ -22,6 +22,7 @@ using namespace IceInternal;
const char * const Ice::PluginManagerI::_kindOfObject = "plugin";
typedef Ice::Plugin* (*PLUGIN_FACTORY)(const CommunicatorPtr&, const string&, const StringSeq&);
+typedef Ice::Logger* (*LOGGER_FACTORY)(const CommunicatorPtr&, const StringSeq&); // DEPRECATED
void
Ice::PluginManagerI::initializePlugins()
@@ -250,6 +251,13 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
}
}
+ // DEPRECATED
+ string loggerStr = properties->getProperty("Ice.LoggerPlugin");
+ if(loggerStr.length() != 0)
+ {
+ loadPlugin("Logger", loggerStr, cmdArgs, true);
+ }
+
stringSeqToArgs(cmdArgs, argc, argv);
//
@@ -264,7 +272,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[])
}
void
-Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs)
+Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs, bool isLogger)
{
assert(_communicator);
@@ -332,33 +340,50 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St
// Invoke the factory function. No exceptions can be raised
// by the factory function because it's declared extern "C".
//
- PLUGIN_FACTORY factory = (PLUGIN_FACTORY)sym;
- plugin = factory(_communicator, name, args);
- if(!plugin)
+ if(isLogger)
{
- PluginInitializationException e(__FILE__, __LINE__);
- ostringstream out;
- out << "failure in entry point `" << entryPoint << "'";
- e.reason = out.str();
- throw e;
+ // DEPRECATED
+ LOGGER_FACTORY factory = (LOGGER_FACTORY)sym;
+ _logger = factory(_communicator, args);
+ if(!_logger)
+ {
+ PluginInitializationException e(__FILE__, __LINE__);
+ ostringstream out;
+ out << "failure in entry point `" << entryPoint << "'";
+ e.reason = out.str();
+ throw e;
+ }
}
-
- if(name == "Logger")
+ else
{
- LoggerPluginPtr loggerPlugin = dynamic_cast<LoggerPlugin*>(plugin.get());
- if(!loggerPlugin)
+ PLUGIN_FACTORY factory = (PLUGIN_FACTORY)sym;
+ plugin = factory(_communicator, name, args);
+ if(!plugin)
{
PluginInitializationException e(__FILE__, __LINE__);
ostringstream out;
- out << "Ice.Plugin.Logger does not implement an Ice::LoggerPlugin";
+ out << "failure in entry point `" << entryPoint << "'";
e.reason = out.str();
throw e;
}
- _logger = loggerPlugin->getLogger();
- }
- _plugins[name] = plugin;
- _initOrder.push_back(plugin);
+ if(name == "Logger")
+ {
+ LoggerPluginPtr loggerPlugin = dynamic_cast<LoggerPlugin*>(plugin.get());
+ if(!loggerPlugin)
+ {
+ PluginInitializationException e(__FILE__, __LINE__);
+ ostringstream out;
+ out << "Ice.Plugin.Logger does not implement an Ice::LoggerPlugin";
+ e.reason = out.str();
+ throw e;
+ }
+ _logger = loggerPlugin->getLogger();
+ }
+
+ _plugins[name] = plugin;
+ _initOrder.push_back(plugin);
+ }
_libraries->add(library);
}