diff -r 106a4bfcb866 -r 013a02bf2bb0 smf/smfservermodule/smfserver/pluginmgr/smfpluginmanager.cpp --- a/smf/smfservermodule/smfserver/pluginmgr/smfpluginmanager.cpp Thu Aug 05 16:46:37 2010 +0530 +++ b/smf/smfservermodule/smfserver/pluginmgr/smfpluginmanager.cpp Thu Aug 05 16:48:48 2010 +0530 @@ -26,6 +26,7 @@ #include #include #include +#include #include "smfpluginmanager.h" #include "smfpluginmanagerutil.h" @@ -155,19 +156,18 @@ if(instance) { - // Get the registration token of the plugin - QString regToken = instance->getProviderInfo()->smfRegistrationId(); QList urlList; SmfPluginRequestData reqData; // check if the plugin is authorised (with CSM) - if( authorisePlugin(regToken, urlList )) + if( authorisePlugin(aPluginID, urlList )) { qDebug()<<"Plugin authorised"; // call the utility method to create plugin specific request result = SmfUnknownError; - m_util->createRequest(plugin, aOperation, aInputData, reqData, result); + QByteArray notused; + m_util->createRequest(plugin, aOperation, aInputData, reqData, result, notused); // If the request is created successfully, call the TM method to send the request if( SmfNoError == result ) @@ -215,6 +215,84 @@ /** + * Method called by Smf server to create a synchronous plugin request. + * @param aPluginID The plugin ID that need to perform this operation + * @param aOperation The type of operation to be performed + * @param aInputData The data required by the plugins + * @param aOutputData [out] The output data to be filled by the plugins + * @return SmfError The result of the operation. It can be :- + * SmfPluginNoError (if the request is success) or + * SmfPluginLoadError (if plugin could not be loaded) or + * SmfPluginNotAuthorised (if the plugin is not authorised) or + * SmfPluginUnknownPluginService (if the requested service is not known or unsupported) + */ +SmfError SmfPluginManager::createSyncRequest ( const QString& aPluginID, + const SmfRequestTypeID& aOperation, + QByteArray& aInputData, + QByteArray& aOutputData ) + { + qDebug()<<"Inside SmfPluginManager::createSyncRequest()"; + + SmfError result = SmfUnknownError; + + // Load the plugin + QObject *plugin = load(aPluginID, result); + + // Check if plugin is loaded + if(plugin && (SmfNoError == result)) + { + SmfPluginBase* instance = qobject_cast(plugin); + + if(instance) + { + QList urlList; + SmfPluginRequestData reqData; + + // check if the plugin is authorised (with CSM) + if( authorisePlugin(aPluginID, urlList )) + { + qDebug()<<"Plugin authorised"; + + // call the utility method to create plugin specific request + result = SmfUnknownError; + m_util->createRequest(plugin, aOperation, aInputData, reqData, result, aOutputData ); + + // If the request is created successfully, call the TM method to send the request + if( SmfNoError == result ) + qDebug()<<"Plugin request creation successful"; + else + qDebug()<<"Plugin request creation failed!!!, error = "<initialize(SmfPluginUtil::getInstance()); + plugin->initialize(); // get the plugin id QString id = plugin->getProviderInfo()->pluginId(); @@ -551,7 +629,7 @@ if( pluginLoader->isLoaded() && plugin ) { // Initialize the plugin - plugin->initialize(SmfPluginUtil::getInstance()); + plugin->initialize(); // update the plugin loader and the loaded plugin lists m_pluginLoaderHash.insertMulti(plugin, pluginLoader); @@ -746,42 +824,26 @@ * This method communicates with Credential and Settings Manager * through Smf server, giving the registration token and getting * the valid url list if available for this plugin. - * @param aRegToken The registration token given by the plugin + * @param aPluginId The ID of the plugin * @param aUrlList [out] The list of Urls that the plugin can send * request to (to be filled by CSM). This list will be empty if - * aRegToken is empty + * aPluginId is not valid or not authorised. * @return Returns true if plugin is authorised, else returns false. * Also returns false if aRegToken is empty. */ -bool SmfPluginManager::authorisePlugin( const QString &aRegToken, +bool SmfPluginManager::authorisePlugin( const QString &aPluginId, QList &aUrlList ) { - Q_UNUSED(aRegToken) qDebug()<<"Inside SmfPluginManager::authorisePlugin()"; -#ifdef CSM_INTEGRATED - aUrlList.clear(); - -// Get the valid URL list from CSM, giving the reg token - if(aRegToken.size()) - return m_server->authorisePlugin(aRegToken, aUrlList); - else - return false; -#else + bool authorised = false; + SmfCredMgrClient csmClient; -// CSM STUBBING - start - QUrl url1 ("http://www.example.com"); - QUrl url2 ("http://api.facebook.com"); - QUrl url3 ("http://api.flickr.com"); - - aUrlList.append(url1); - aUrlList.append(url2); - aUrlList.append(url3); - - return true; -// CSM STUBBING - end -#endif - + aUrlList = csmClient.URLList(aPluginId); + if(aUrlList.count()) + authorised = true; + + return authorised; } @@ -882,7 +944,7 @@ if(instance && (SmfNoError == result)) { - instance->initialize(SmfPluginUtil::getInstance()); + instance->initialize(); serviceProv = instance->getProviderInfo()->serviceName(); interfaceName = dir.dirName(); } @@ -926,7 +988,7 @@ if(instance && (SmfNoError == result)) { - instance->initialize(SmfPluginUtil::getInstance()); + instance->initialize(); serviceProv = instance->getProviderInfo()->serviceName(); interfaceName = dir.dirName(); interfaceName.prepend("org.symbian.smf.plugin."); @@ -993,7 +1055,7 @@ if(instance && (SmfNoError == result)) { - instance->initialize(SmfPluginUtil::getInstance()); + instance->initialize(); serviceProv = instance->getProviderInfo()->serviceName(); interfaceName = dir.dirName(); }