smf/smfservermodule/smfserver/pluginmgr/smfpluginmanagerutil.h
changeset 10 1d94eb8df9c2
parent 9 b85b0c039c14
equal deleted inserted replaced
9:b85b0c039c14 10:1d94eb8df9c2
     1 /**
       
     2  * Copyright (c) 2010 Sasken Communication Technologies Ltd.
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the "Eclipse Public License v1.0" 
       
     6  * which accompanies  this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html"
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
       
    11  *
       
    12  * Contributors:
       
    13  * Manasij Roy, Nalina Hariharan
       
    14  * 
       
    15  * Description:
       
    16  * The Plugin Manager util class performs all plugin functional 
       
    17  * specific functionalities
       
    18  *
       
    19  */
       
    20 
       
    21 #ifndef SMFPLUGINMANAGERUTIL_H_
       
    22 #define SMFPLUGINMANAGERUTIL_H_
       
    23 
       
    24 #include <smfpluginbase.h>
       
    25 #include <smfserverglobal.h>
       
    26 
       
    27 // Forward declaration
       
    28 class SmfPluginManager;
       
    29 
       
    30 /**
       
    31  * The Plugin Manager util class performs all plugin functional 
       
    32  * specific functionalities
       
    33  */
       
    34 class SmfPluginManagerUtil : public QObject
       
    35 	{
       
    36 	Q_OBJECT
       
    37 	
       
    38 public:
       
    39 	/**
       
    40 	 * Method to get the instance of SmfPluginManagerUtil class
       
    41 	 * @param aParent The parent object
       
    42 	 * @return The instance of SmfPluginManagerUtil class
       
    43 	 */
       
    44 	static SmfPluginManagerUtil* getInstance ( QObject *aParent = 0 );
       
    45 	
       
    46 	/**
       
    47 	 * Destructor
       
    48 	 */
       
    49 	~SmfPluginManagerUtil ( );
       
    50 	
       
    51 private:
       
    52 	/**
       
    53 	 * Constructor with default argument
       
    54 	 * @param aParent The parent object
       
    55 	 */
       
    56 	SmfPluginManagerUtil ( QObject *aParent = 0 );
       
    57 	
       
    58 private:
       
    59 	/**
       
    60 	 * Method called by Plugin Manager to create a web query.
       
    61 	 * This method calls the respective plugin methods for creation of 
       
    62 	 * web queries using the aOperation and aInputData parameters.
       
    63 	 * @param aInstance Instance of the loaded plugin that perform this operation
       
    64 	 * @param aOperation The type of operation to be performed
       
    65 	 * @param aInputData The data required to create the web query
       
    66 	 * @param aReqData [out] The request data created by the plugin
       
    67 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
    68 	 * @see smfglobal.h
       
    69 	 */
       
    70 	void createRequest ( QObject* aInstance, 
       
    71 			const SmfRequestTypeID &aOperation, 
       
    72 			QByteArray &aInputData,
       
    73 			SmfPluginRequestData &aReqData,
       
    74 			SmfPluginManagerResult &aResult );
       
    75 
       
    76 	/**
       
    77 	 * Method to create a web query to fetch contact details.
       
    78 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
    79 	 * contact fetch operation.
       
    80 	 * @param aOperation The type of operation to be performed
       
    81 	 * @param aInputData The data required to create the web query
       
    82 	 * @param aReqData [out] The request data created by the plugin
       
    83 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
    84 	 * @return SmfPluginError
       
    85 	 * @see smfglobal.h
       
    86 	 */
       
    87 	SmfPluginError createContactFetcherRequest ( QObject *aPlugin, 
       
    88 			const SmfRequestTypeID &aOperation, 
       
    89 			QByteArray &aInputData,
       
    90 			SmfPluginRequestData &aReqData,
       
    91 			SmfPluginManagerResult &aResult );
       
    92 	
       
    93 	/**
       
    94 	 * Method to create a web query to do post operation on contacts 
       
    95 	 * (like scraps or messages)
       
    96 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
    97 	 * contact fetch operation.
       
    98 	 * @param aOperation The type of operation to be performed
       
    99 	 * @param aInputData The data required to create the web query
       
   100 	 * @param aReqData [out] The request data created by the plugin
       
   101 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   102 	 * @return SmfPluginError
       
   103 	 * @see smfglobal.h
       
   104 	 */
       
   105 	SmfPluginError createContactPostRequest ( QObject *aPlugin, 
       
   106 			const SmfRequestTypeID &aOperation, 
       
   107 			QByteArray &aInputData,
       
   108 			SmfPluginRequestData &aReqData,
       
   109 			SmfPluginManagerResult &aResult );
       
   110 
       
   111 	/**
       
   112 	 * Method to create a web query to do music lyrics or subtitle search
       
   113 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
   114 	 * contact fetch operation.
       
   115 	 * @param aOperation The type of operation to be performed
       
   116 	 * @param aInputData The data required to create the web query
       
   117 	 * @param aReqData [out] The request data created by the plugin
       
   118 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   119 	 * @return SmfPluginError
       
   120 	 * @see smfglobal.h
       
   121 	 */
       
   122 	SmfPluginError createMusicLyricsRequest ( QObject *aPlugin, 
       
   123 			const SmfRequestTypeID &aOperation, 
       
   124 			QByteArray &aInputData,
       
   125 			SmfPluginRequestData &aReqData,
       
   126 			SmfPluginManagerResult &aResult );
       
   127 
       
   128 
       
   129 	/**
       
   130 	 * Method to create a web query to do music event search or event post operation 
       
   131 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
   132 	 * contact fetch operation.
       
   133 	 * @param aOperation The type of operation to be performed
       
   134 	 * @param aInputData The data required to create the web query
       
   135 	 * @param aReqData [out] The request data created by the plugin
       
   136 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   137 	 * @return SmfPluginError
       
   138 	 * @see smfglobal.h
       
   139 	 */
       
   140 	SmfPluginError createMusicEventsRequest ( QObject *aPlugin, 
       
   141 			const SmfRequestTypeID &aOperation, 
       
   142 			QByteArray &aInputData,
       
   143 			SmfPluginRequestData &aReqData,
       
   144 			SmfPluginManagerResult &aResult );
       
   145 
       
   146 	/**
       
   147 	 * Method to create a web query to do music search operation 
       
   148 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
   149 	 * contact fetch operation.
       
   150 	 * @param aOperation The type of operation to be performed
       
   151 	 * @param aInputData The data required to create the web query
       
   152 	 * @param aReqData [out] The request data created by the plugin
       
   153 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   154 	 * @return SmfPluginError
       
   155 	 * @see smfglobal.h
       
   156 	 */
       
   157 	SmfPluginError createMusicSearchRequest ( QObject *aPlugin, 
       
   158 			const SmfRequestTypeID &aOperation, 
       
   159 			QByteArray &aInputData,
       
   160 			SmfPluginRequestData &aReqData,
       
   161 			SmfPluginManagerResult &aResult );
       
   162 
       
   163 
       
   164 	/**
       
   165 	 * Method to create a web query to do music service request operation 
       
   166 	 * like getting self profile or search profiles of other users
       
   167 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
   168 	 * contact fetch operation.
       
   169 	 * @param aOperation The type of operation to be performed
       
   170 	 * @param aInputData The data required to create the web query
       
   171 	 * @param aReqData [out] The request data created by the plugin
       
   172 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   173 	 * @return SmfPluginError
       
   174 	 * @see smfglobal.h
       
   175 	 */
       
   176 	SmfPluginError createMusicServiceRequest ( QObject *aPlugin, 
       
   177 			const SmfRequestTypeID &aOperation, 
       
   178 			QByteArray &aInputData,
       
   179 			SmfPluginRequestData &aReqData,
       
   180 			SmfPluginManagerResult &aResult );
       
   181 
       
   182 
       
   183 	/**
       
   184 	 * Method to create a web query to do music playlist related operation
       
   185 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
   186 	 * contact fetch operation.
       
   187 	 * @param aOperation The type of operation to be performed
       
   188 	 * @param aInputData The data required to create the web query
       
   189 	 * @param aReqData [out] The request data created by the plugin
       
   190 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   191 	 * @return SmfPluginError
       
   192 	 * @see smfglobal.h
       
   193 	 */
       
   194 	SmfPluginError createMusicPlaylistRequest ( QObject *aPlugin, 
       
   195 			const SmfRequestTypeID &aOperation, 
       
   196 			QByteArray &aInputData,
       
   197 			SmfPluginRequestData &aReqData,
       
   198 			SmfPluginManagerResult &aResult );
       
   199 
       
   200 	/**
       
   201 	 * Method to create a web query to do gallery related operation
       
   202 	 * @param aPlugin The instance of the loaded plugin that performs the 
       
   203 	 * contact fetch operation.
       
   204 	 * @param aOperation The type of operation to be performed
       
   205 	 * @param aInputData The data required to create the web query
       
   206 	 * @param aReqData [out] The request data created by the plugin
       
   207 	 * @param aResult [out] SmfPluginManagerResult, The result of the operation
       
   208 	 * @return SmfPluginError
       
   209 	 * @see smfglobal.h
       
   210 	 */
       
   211 	SmfPluginError createGalleryRequest ( QObject *aPlugin, 
       
   212 			const SmfRequestTypeID &aOperation, 
       
   213 			QByteArray &aInputData,
       
   214 			SmfPluginRequestData &aReqData,
       
   215 			SmfPluginManagerResult &aResult );
       
   216 	
       
   217 	/**
       
   218 	 * Method called by Plugin Manager when network response is available
       
   219 	 * @param aInstance The instance of the loaded plugin that requested 
       
   220 	 * the network operation.
       
   221 	 * @param aOperation The type of operation to be performed
       
   222 	 * @param aTransportResult The result of Transport Operation
       
   223 	 * @param aResponse The network response data
       
   224 	 * @param aResult [out] An output parameter to the plugin manager 
       
   225 	 * containing the data parsed by the plugins
       
   226 	 * @param aRetType [out] The Plugin return value
       
   227 	 * @param aPageResult [out] The page information filled by the plugins
       
   228 	 * @return SmfPluginManagerResult, The result of the operation
       
   229 	 * @see smfglobal.h
       
   230 	 */
       
   231 	SmfPluginManagerResult responseAvailable ( SmfPluginBase *aInstance,
       
   232 			const SmfRequestTypeID &aOperation,
       
   233 			const SmfTransportResult &aTransportResult, 
       
   234 			QByteArray *aResponse,
       
   235 			QVariant *aResult,
       
   236 			SmfPluginRetType &aRetType,
       
   237 			SmfResultPage &aPageResult );
       
   238 	
       
   239 	/**
       
   240 	 * Method to serialize the result of parsing (which is done by the 
       
   241 	 * plugins) to QByteArray to be sent to Smf server.
       
   242 	 * @param aOperation The type of operation to be performed
       
   243 	 * @param aResult The data to be serialized
       
   244 	 * @param aDataStream Stream to be written
       
   245 	 */
       
   246 	void serializeResult ( const SmfRequestTypeID &aOperation, 
       
   247 			QVariant* aResult,
       
   248 			QDataStream &aDataStream );
       
   249 
       
   250 	friend class SmfPluginManager;
       
   251 	
       
   252 private:
       
   253 	/**
       
   254 	 * The single instance of SmfPluginManagerUtil
       
   255 	 */
       
   256 	static SmfPluginManagerUtil* m_myInstance;
       
   257 	
       
   258 	};
       
   259 
       
   260 #endif /* SMFPLUGINMANAGERUTIL_H_ */