diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 4 | ||||
-rwxr-xr-x | cpp/config/PropertyNames.xml | 1 | ||||
-rw-r--r-- | cpp/slice/Ice/Plugin.ice | 14 | ||||
-rw-r--r-- | cpp/src/Ice/PluginManagerI.cpp | 56 | ||||
-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 |
7 files changed, 43 insertions, 39 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 63f78e59463..82b4d263c07 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,10 @@ Changes since version 3.2.X (binary incompatible) ------------------------------------------------- +- The property Ice.Plugin.Logger is now reserved to allow setting + of the communicator's logger from properties. This plugin must + implement a LoggerPlugin. See manual for more details. + - It is no longer possible to provide input files on the command line for icestormadmin nor icegridadmin. diff --git a/cpp/config/PropertyNames.xml b/cpp/config/PropertyNames.xml index 461c75dfb41..cafd3f7d9c0 100755 --- a/cpp/config/PropertyNames.xml +++ b/cpp/config/PropertyNames.xml @@ -296,7 +296,6 @@ generated from the section label. <property name="GC.Interval" /> <property name="ImplicitContext" /> <property name="InitPlugins" /> - <property name="LoggerPlugin" /> <property name="MessageSizeMax" /> <property name="MonitorConnections" /> <property name="Nohup" /> diff --git a/cpp/slice/Ice/Plugin.ice b/cpp/slice/Ice/Plugin.ice index bb3a31ded21..6836f93ed1c 100644 --- a/cpp/slice/Ice/Plugin.ice +++ b/cpp/slice/Ice/Plugin.ice @@ -10,6 +10,8 @@ #ifndef ICE_PLUGIN_ICE #define ICE_PLUGIN_ICE +#include <Ice/LoggerF.ice> + module Ice { @@ -42,6 +44,18 @@ local interface Plugin /** * + * Special communicator plugin used to set the logger. + * Can only be used in conjunction with Ice.Plugin.Logger + * property. + * + **/ +local interface LoggerPlugin extends Plugin +{ + Logger getLogger(); +}; + +/** + * * Each communicator has a plugin manager to administer the set of * plugins. * diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index cda7176581a..c89433e2e67 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -22,7 +22,6 @@ 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&); void Ice::PluginManagerI::initializePlugins() @@ -203,7 +202,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) if(q != plugins.end()) { - loadPlugin(name, q->second, cmdArgs, false); + loadPlugin(name, q->second, cmdArgs); plugins.erase(q); } else @@ -239,7 +238,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) else if(suffix == "cpp") { name = name.substr(0, dotPos); - loadPlugin(name, p->second, cmdArgs, false); + loadPlugin(name, p->second, cmdArgs); plugins.erase(p); } else @@ -263,21 +262,11 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) p = q; } - loadPlugin(name, p->second, cmdArgs, false); + loadPlugin(name, p->second, cmdArgs); plugins.erase(p); } } - string loggerStr = properties->getProperty("Ice.LoggerPlugin.cpp"); - if(loggerStr.empty()) - { - loggerStr = properties->getProperty("Ice.LoggerPlugin"); - } - if(!loggerStr.empty()) - { - loadPlugin("Logger", loggerStr, cmdArgs, true); - } - stringSeqToArgs(cmdArgs, argc, argv); // @@ -292,7 +281,7 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) } void -Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs, bool isLogger) +Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, StringSeq& cmdArgs) { assert(_communicator); @@ -360,35 +349,34 @@ 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". // - if(isLogger) + PLUGIN_FACTORY factory = (PLUGIN_FACTORY)sym; + plugin = factory(_communicator, name, args); + if(!plugin) { - 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; - } + PluginInitializationException e(__FILE__, __LINE__); + ostringstream out; + out << "failure in entry point `" << entryPoint << "'"; + e.reason = out.str(); + throw e; } - else + + if(name == "Logger") { - PLUGIN_FACTORY factory = (PLUGIN_FACTORY)sym; - plugin = factory(_communicator, name, args); - if(!plugin) + LoggerPluginPtr loggerPlugin = dynamic_cast<LoggerPlugin*>(plugin.get()); + if(!loggerPlugin) { PluginInitializationException e(__FILE__, __LINE__); ostringstream out; - out << "failure in entry point `" << entryPoint << "'"; + out << "Ice.Plugin.Logger does not implement an Ice::LoggerPlugin"; e.reason = out.str(); throw e; } - - _plugins[name] = plugin; - _initOrder.push_back(plugin); + _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 a826670152a..fff75e4c01e 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&, bool); + void loadPlugin(const std::string&, const std::string&, StringSeq&); LoggerPtr getLogger() const; CommunicatorPtr _communicator; diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index ab98aceb620..92d94b02ec2 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -7,7 +7,7 @@ // // ********************************************************************** // -// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Aug 20 15:53:16 2007 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Aug 30 13:57:41 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -52,7 +52,6 @@ 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", false, 0), IceInternal::Property("Ice.MessageSizeMax", false, 0), IceInternal::Property("Ice.MonitorConnections", false, 0), IceInternal::Property("Ice.Nohup", false, 0), diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index a6c99f032d2..c4fae4b8cbd 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -7,7 +7,7 @@ // // ********************************************************************** // -// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Aug 20 15:53:16 2007 +// Generated by makeprops.py from file ./config/PropertyNames.xml, Thu Aug 30 13:57:41 2007 // IMPORTANT: Do not edit this file -- any edits made here will be lost! |