smf/smfservermodule/smfserver/pluginmgr/smfpluginmanager.cpp
changeset 26 83d6a149c755
parent 25 a180113055cb
--- a/smf/smfservermodule/smfserver/pluginmgr/smfpluginmanager.cpp	Thu Sep 23 17:43:31 2010 +0530
+++ b/smf/smfservermodule/smfserver/pluginmgr/smfpluginmanager.cpp	Mon Oct 11 21:59:54 2010 +0530
@@ -356,7 +356,6 @@
 				qDebug()<<"Plugin responseAvailable() failed!!!, error = "<<retValue;
 				
 				// Error in parsing, sent to server
-// ToDo :- For testing:-
 				stream<<result.toString();
 				m_server->resultsAvailable(sessionId, &arr, retValue);
 			}
@@ -471,7 +470,7 @@
 
 	tableCreated = query.exec("CREATE TABLE IF NOT EXISTS pluginDetails ("
 			"pluginId TEXT PRIMARY KEY, interfaceName TEXT, serviceProvider TEXT, "
-			"description TEXT, serviceUrl TEXT, authAppId TEXT)");
+			"description TEXT, serviceUrl TEXT, authAppId TEXT, authAppName TEXT)");
 
 	// Error - table not created, Plugin Manager might not work properly
 	if(!tableCreated)
@@ -545,6 +544,9 @@
 						// get the service URL
 						QString servURL = plugin->getProviderInfo()->serviceUrl().toString();
 						
+						// get the auth application process name
+						QString authAppName = plugin->getProviderInfo()->authenticationAppName();
+								
 						// get the authentication application id
 						QString str;
 						QStringList list;
@@ -557,16 +559,19 @@
 						QSqlQuery rowInsertQuery;
 						
 						// insert into database
-						bool rowInserted = rowInsertQuery.exec(QString("INSERT INTO pluginDetails VALUES ('%1', "
-								"'%2', '%3', '%4', '%5', '%6')").arg(id).arg(intfImplemented).arg(serProv)
-								.arg(desc).arg(servURL).arg(authAppId));
+						bool rowInserted = rowInsertQuery.exec(QString("INSERT INTO pluginDetails VALUES ("
+								"'%1', '%2', '%3', '%4', '%5', '%6', '%7')").arg(id).arg(intfImplemented)
+								.arg(serProv).arg(desc).arg(servURL).arg(authAppId).arg(authAppName));
 						
 						if(rowInserted)
-							qDebug()<<QString("This Plugin's information is added to database : '%1' '%2' '%3'")
-											.arg(id).arg(intfImplemented).arg(serProv);
+							qDebug()<<QString("This Plugin's information is added to database : '%1' '%2' '%3' '%4'")
+											.arg(id).arg(intfImplemented).arg(serProv).arg(authAppId);
 						else
+							{
+							qDebug()<<"Data base insert statement returned = "<<rowInserted;
 							if(0 != query.lastError().text().size())
 								qDebug()<<"plugins data not written to database!!!, error = "<<query.lastError().text();
+							}
 				    	}
 				    else
 				    	{
@@ -594,7 +599,11 @@
 			}
 		}
 	else
-		qDebug()<<"No Smf plugins installed!!!";
+		{
+			qDebug()<<"No Smf plugins installed!!!";
+			return false;
+		}
+	
 	
 	// Close the database
 	m_pluginDataBase.close();
@@ -908,6 +917,7 @@
 	QString interfaceName;
 	QString serviceProv;
 	QString authAppId;
+	QString authAppName;
 
 	// Get all the files in the directory at a specified path(sorted)
 	QStringList newPlugins = dir.entryList(QDir::Files, QDir::Name);
@@ -1019,6 +1029,7 @@
 			QString prgm;
 			QStringList list;
 			authAppId = instance->getProviderInfo()->authenticationApp(prgm, list, QIODevice::ReadWrite);
+			authAppName = instance->getProviderInfo()->authenticationAppName();
 			}
 		
 		unload(instance);
@@ -1026,7 +1037,7 @@
 		// Also add to the database the value newListIterator and aPath
 		QSqlQuery insertRowQuery;
 		bool rowInserted = insertRowQuery.exec(QString("INSERT INTO pluginDetails VALUES "
-				"('%1', '%2', '%3', '%4')").arg(pluginId).arg(interfaceName).arg(serviceProv).arg(authAppId));
+				"('%1', '%2', '%3', '%4', '%5')").arg(pluginId).arg(interfaceName).arg(serviceProv).arg(authAppId).arg(authAppName));
 
 		 // Error
 		if (!rowInserted)
@@ -1133,7 +1144,7 @@
 	
 	// Query the database for all pluginIDs that implement the given interface
 	QSqlQuery query(QString("SELECT pluginId, interfaceName, serviceProvider, description, "
-			"serviceUrl FROM pluginDetails where interfaceName = '%1'").arg(aInterface));
+			"serviceUrl, authAppId, authAppName FROM pluginDetails where interfaceName = '%1'").arg(aInterface));
 	
 	while(query.next())
 		{
@@ -1176,6 +1187,20 @@
 		qDebug()<<"  Its url = "<<url.toString();
 #endif
 
+		// Get the auth app ID
+		QString id(query.value(5).toString());
+		prov.setAuthenticationAppId(id);
+#ifdef DETAILEDDEBUGGING
+		qDebug()<<"  Its auth app id = "<<id;
+#endif
+		
+		// Get the auth app name
+		QString name (query.value(6).toString());
+		prov.setAuthenticationAppName(name);
+#ifdef DETAILEDDEBUGGING
+		qDebug()<<"  Its auth app name = "<<name;
+#endif
+
 		aMap.insert(pluginId, prov);
 		}