sl@0: /* sl@0: * Copyright (c) 2003 - 2007,2009-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: /** sl@0: @file sl@0: sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __AGENTFACTORY_H__ sl@0: #define __AGENTFACTORY_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: namespace ContentAccess sl@0: { sl@0: // Products sl@0: class CAgentContent; sl@0: class CAgentData; sl@0: class CAgentImportFile; sl@0: class CAgentManager; sl@0: class CAgentRightsManager; sl@0: sl@0: // Other CAF classes sl@0: class CMetaData; sl@0: class CMetaDataArray; sl@0: class TVirtualPathPtr; sl@0: sl@0: sl@0: /** The CAF 2.0 agent interface UID */ sl@0: const TUid KCAAgentInterfaceUid = {0x10204740}; sl@0: sl@0: /** sl@0: Abstract interface handed out by an ECOM agent sl@0: implementation by REComSession::CreateImplementationL(). sl@0: sl@0: CAgentFactory defines an abstract factory that is responsible for sl@0: creating the abstract products: sl@0: @li ContentAccess::CAgentContent sl@0: @li ContentAccess::CAgentData sl@0: @li ContentAccess::CAgentImportFile sl@0: @li ContentAccess::CAgentManager sl@0: @li ContentAccess::CAgentRightsManager sl@0: sl@0: Derived classes will hand out concrete product implementations which are sl@0: specific for that particular agent. sl@0: sl@0: Derived classes effectively represent the ECOM session handle sl@0: used by CAF classes sl@0: sl@0: @see ContentAccess::CF32AgentFactory. This implements sl@0: ContentAccess::CAgentFactory to handle unrestricted content. sl@0: sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: class CAgentFactory : public CBase sl@0: { sl@0: public: sl@0: /** Create a new instance of a particular agent using its DLL implementation Uid sl@0: @param aUid The Uid of the agent to create an instance of its CAgentFactory sl@0: @return a new CAgentFactory sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: static CAgentFactory* NewL(TUid aUid); sl@0: sl@0: /** Destructor, calls REComSession::DestroyedImplementation(); to destroy sl@0: the ECOM implementation. When all implementations are destroyed sl@0: ECOM will unload the agent DLL sl@0: */ sl@0: IMPORT_C virtual ~CAgentFactory(); sl@0: sl@0: /** sl@0: Factory function creates a CAgentContent object for browsing sl@0: the contents of a file belonging to this agent. sl@0: sl@0: @param aURI The location of the file. sl@0: @param aShareMode The share mode used for opening this content sl@0: @return A pointer to the CAgentContent object. sl@0: */ sl@0: virtual CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode) = 0; sl@0: sl@0: /** sl@0: Creates a CAgentContent object for browsing the contents of a file sl@0: belonging to this agent sl@0: sl@0: @param aFile An open file handle for reading from the file, the agent must make its own duplicate of the file handle. sl@0: @return A pointer to the CAgentContent object. sl@0: */ sl@0: virtual CAgentContent* CreateContentBrowserL(RFile& aFile) = 0; sl@0: sl@0: /** sl@0: Factory function creates a CAgentData object for reading sl@0: from a content object sl@0: sl@0: @param aVirtualPath The content object to read from sl@0: @param aShareMode The share mode for opening the file containing the content object sl@0: @return A pointer to the CAgentData object. sl@0: */ sl@0: virtual CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode) = 0; sl@0: sl@0: /** sl@0: Factory function creates a CAgentData object for reading sl@0: from a content object. sl@0: sl@0: @param aFile An open file handle used by the agent to read from the file. The agent MUST make its own duplicate of this file handle, either in the same process or a server process sl@0: @param aUniqueId The agent specific unique ID of object within the file to read. sl@0: @return A pointer to the CAgentData object. sl@0: */ sl@0: virtual CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId) = 0; sl@0: sl@0: /** sl@0: Factory function creates an object for performing management sl@0: functions with this particular agent sl@0: sl@0: CAgentManager objects are stateless so they require no sl@0: construction parameters. sl@0: sl@0: @return A pointer to a CAgentManager object. sl@0: */ sl@0: virtual CAgentManager* CreateManagerL() = 0; sl@0: sl@0: /** sl@0: Factory function creates an object that allows the agent to import sl@0: or transform content. The agent will supply output files where necessary sl@0: sl@0: @param aMimeType The mime type of the file to be imported sl@0: @param aMetaDataArray Array of metadata associated with the file to import sl@0: @param aOutputDirectory Preferred directory to store output files sl@0: @param aSuggestedFileName Suggested filename for the output file(s) sl@0: @return A pointer to a ContentAccess::CAgentImportFile object. sl@0: @leave KErrCANotSupported If the agent does not support importing or transforming content sl@0: */ sl@0: virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) = 0; sl@0: sl@0: /** sl@0: Factory function creates an object that allows the agent to import sl@0: or transform content. The caller will supply output files where necessary sl@0: sl@0: @param aMimeType The mime type of the file to be imported sl@0: @param aMetaDataArray Array of metadata associated with the file to import sl@0: @return A pointer to a ContentAccess::CAgentImportFile object. sl@0: @leave KErrCANotSupported If the agent does not support importing or transforming content sl@0: */ sl@0: virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray) = 0; sl@0: sl@0: /** sl@0: Factory function that creates an rights manager object for this agent sl@0: sl@0: @return A pointer to a ContentAccess::CAgentRightsManager object. sl@0: @leave KErrCANotSupported If the agent does not provide any rights management functions sl@0: */ sl@0: virtual CAgentRightsManager* CreateRightsManagerL() = 0; sl@0: sl@0: #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT sl@0: /** sl@0: Factory function creates a CAgentData object from header data of WMDRM file or stream content sl@0: for reading/decrypting WMDRM data packets. sl@0: sl@0: @param aHeaderData Header data of WMDRM file or stream content. sl@0: @return A pointer to CAgentData object. sl@0: */ sl@0: IMPORT_C virtual CAgentData* CreateDataConsumerL(const TDesC8& aHeaderData); sl@0: sl@0: /** sl@0: Factory function creates a CAgentContent object from header data of WMDRM file or stream content sl@0: for browsing WMDRM content. sl@0: sl@0: @param aHeaderData Header data of WMDRM file or stream content. sl@0: @return A pointer to CAgentContent object. sl@0: */ sl@0: IMPORT_C virtual CAgentContent* CreateContentBrowserL(const TDesC8& aHeaderData); sl@0: #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT sl@0: sl@0: private: sl@0: // ECOM session key. This is set by sl@0: // REComSession::CreateImplementationL() during construction sl@0: TUid iEcomKey; sl@0: }; sl@0: sl@0: } // namespace ContentAccess sl@0: #endif // __AGENTFACTORY_H__