Exemplo n.º 1
0
   /// Wrapper around the constructor to do error checking and return NULL for errors
   static ConfiguredHook* newHook(const UtlString& hookName,
                                  const UtlString& hookFactoryName,
                                  const UtlString& libName
                                  )
      {
         ConfiguredHook* theNewHook = NULL;

         if (! libName.isNull())
         {
            theNewHook = new ConfiguredHook(hookName, hookFactoryName, libName);
            // check if the ConfiguredHook constructor actually managed to create a plug-in
            if( !theNewHook->plugin() )
            {
               // an error happened while trying to create the plug-in - 
               // de-allocate the ConfiguredHook and return NULL to convey
               // the failure to the caller.
               delete theNewHook;
               theNewHook = NULL;
            }
         }
         else
         {
            OsSysLog::add(FAC_KERNEL, PRI_CRIT,
                          "PluginHooks: no library configured for hook '%s': ignored",
                          hookName.data()
                          );
         }

         return theNewHook;
      }
Exemplo n.º 2
0
Plugin* PluginIterator::next(UtlString* name)
{
   Plugin* nextPlugin = NULL;
   
   // make sure that name is cleared if passed in case this is the last hook
   if (name)
   {
      name->remove(0);
   }
   
   // step the parent iterator on the mConfiguredHooks list
   ConfiguredHook* nextHook = static_cast<ConfiguredHook*>(mConfiguredHooksIterator());
   if (nextHook)
   {
      nextHook->name(name); // return the name, if it's been asked for
      nextPlugin = nextHook->plugin();
   }

   return nextPlugin;
}