MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / registerPluginFactory

Method registerPluginFactory

src/yvalve/PluginManager.cpp:1063–1115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1061
1062
1063void PluginManager::registerPluginFactory(unsigned int interfaceType, const char* defaultName, IPluginFactory* factory)
1064{
1065 try
1066 {
1067 MutexLockGuard g(plugins->mutex, FB_FUNCTION);
1068
1069 if (!current)
1070 {
1071 // not good time to call this function - ignore request
1072 gds__log("Unexpected call to register plugin %s, type %d - ignored\n", defaultName, interfaceType);
1073 return;
1074 }
1075
1076 unsigned int r = current->addPlugin(RegisteredPlugin(factory, defaultName, interfaceType));
1077
1078 if (current == builtin)
1079 {
1080 PathName plugConfigFile = fb_utils::getPrefix(IConfigManager::DIR_PLUGINS, defaultName);
1081 changeExtension(plugConfigFile, "conf");
1082
1083 ConfiguredPlugin* p = FB_NEW ConfiguredPlugin(RefPtr<PluginModule>(builtin), r,
1084 findInPluginsConf("Plugin", defaultName), plugConfigFile, defaultName);
1085 p->addRef(); // Will never be unloaded
1086 plugins->put(MapKey(interfaceType, defaultName), p);
1087 }
1088 }
1089 catch(const Exception& ex)
1090 {
1091 // looks like something gone seriously wrong - therefore add more error handling here
1092 try
1093 {
1094 FbLocalStatus ls;
1095 ex.stuffException(&ls);
1096 char text[256];
1097 UtilInterfacePtr()->formatStatus(text, sizeof(text), &ls);
1098 Syslog::Record(Syslog::Error, text);
1099
1100 iscLogException("Plugin registration error", ex);
1101 }
1102 catch(const BadAlloc&)
1103 {
1104 Syslog::Record(Syslog::Error, "Plugin registration error - out of memory");
1105 }
1106 catch(...)
1107 {
1108 Syslog::Record(Syslog::Error, "Double fault during plugin registration");
1109 }
1110
1111#ifdef DEV_BUILD
1112 abort();
1113#endif
1114 }
1115}
1116
1117
1118void PluginManager::registerModule(IPluginModule* cleanup)

Callers 15

registerRedirectorFunction · 0.45
FB_PLUGIN_ENTRY_POINTFunction · 0.45
registerTrustedClientFunction · 0.45
registerTrustedServerFunction · 0.45
registerLegacyClientFunction · 0.45
registerLegacyServerFunction · 0.45
registerSrpClientFunction · 0.45
FB_PLUGIN_ENTRY_POINTFunction · 0.45
registerSrpServerFunction · 0.45
registerTraceFunction · 0.45
registerEngineFunction · 0.45
FB_PLUGIN_ENTRY_POINTFunction · 0.45

Calls 14

RegisteredPluginClass · 0.85
getPrefixFunction · 0.85
changeExtensionFunction · 0.85
ConfiguredPluginClass · 0.85
findInPluginsConfFunction · 0.85
MapKeyClass · 0.85
UtilInterfacePtrClass · 0.85
iscLogExceptionFunction · 0.85
addPluginMethod · 0.80
RecordClass · 0.50
addRefMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected