diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2008-02-18 10:47:12 -0330 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2008-02-18 10:47:12 -0330 |
commit | 4a79d581483dd883d8dae7d411c18b68df734e25 (patch) | |
tree | eabb552f84cccab951f2c6edb3cd60022733b30f /cpp/src | |
parent | Merge branch 'master' of ssh://git/home/git/ice (diff) | |
download | ice-4a79d581483dd883d8dae7d411c18b68df734e25.tar.bz2 ice-4a79d581483dd883d8dae7d411c18b68df734e25.tar.xz ice-4a79d581483dd883d8dae7d411c18b68df734e25.zip |
Bug 2433 - deprecate Ice.LoggerPlugin
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/PluginManagerI.cpp | 61 | ||||
-rw-r--r-- | cpp/src/Ice/PluginManagerI.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 |
4 files changed, 49 insertions, 19 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); } diff --git a/cpp/src/Ice/PluginManagerI.h b/cpp/src/Ice/PluginManagerI.h index 2757baa64e1..fb4f6a528e5 100644 --- a/cpp/src/Ice/PluginManagerI.h +++ b/cpp/src/Ice/PluginManagerI.h @@ -37,7 +37,7 @@ private: friend class IceInternal::Instance; void loadPlugins(int&, char*[]); - void loadPlugin(const std::string&, const std::string&, StringSeq&); + void loadPlugin(const std::string&, const std::string&, StringSeq&, bool = false); LoggerPtr getLogger() const; CommunicatorPtr _communicator; diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index d12f58310bc..205452ece8c 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -6,6 +6,8 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +// +// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Feb 18 10:11:33 2008 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -71,6 +73,7 @@ const IceInternal::Property IcePropsData[] = IceInternal::Property("Ice.GC.Interval", false, 0), IceInternal::Property("Ice.ImplicitContext", false, 0), IceInternal::Property("Ice.InitPlugins", false, 0), + IceInternal::Property("Ice.LoggerPlugin", true, 0), IceInternal::Property("Ice.MessageSizeMax", false, 0), IceInternal::Property("Ice.MonitorConnections", true, 0), IceInternal::Property("Ice.Nohup", false, 0), diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 8e247ec6e8a..ba5ac9e5d89 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -6,6 +6,8 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +// +// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Feb 18 10:11:33 2008 // IMPORTANT: Do not edit this file -- any edits made here will be lost! |