os/security/contentmgmt/contentaccessfwfordrm/inc/agentfactory.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2003 - 2007,2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "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 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 
    20 /** 
    21 @file 
    22 
    23 @publishedPartner
    24 @released
    25 */
    26 
    27 #ifndef __AGENTFACTORY_H__
    28 #define __AGENTFACTORY_H__
    29 
    30 #include <e32base.h>
    31 #include <ecom/ecom.h>
    32 #include <caf/caftypes.h>
    33 
    34 namespace ContentAccess
    35 {
    36 	// Products
    37 	 class CAgentContent;
    38 	 class CAgentData;
    39 	 class CAgentImportFile;
    40 	 class CAgentManager;
    41 	 class CAgentRightsManager;
    42 
    43 	// Other CAF classes
    44 	class CMetaData;
    45 	class CMetaDataArray;
    46 	class TVirtualPathPtr;
    47 
    48 
    49 	/** The CAF 2.0 agent interface UID */
    50 	const TUid KCAAgentInterfaceUid = {0x10204740};
    51 
    52 	/**
    53 	 Abstract interface handed out by an ECOM agent
    54 	 implementation by REComSession::CreateImplementationL().
    55 
    56 	 CAgentFactory defines an abstract factory that is responsible for
    57 	 creating the abstract products: 
    58 	 @li ContentAccess::CAgentContent
    59 	 @li ContentAccess::CAgentData
    60 	 @li ContentAccess::CAgentImportFile
    61 	 @li ContentAccess::CAgentManager
    62 	 @li ContentAccess::CAgentRightsManager
    63 	 
    64 	 Derived classes will hand out concrete product implementations which are 
    65 	 specific for that particular agent.
    66 
    67 	 Derived classes effectively represent the ECOM session handle
    68 	 used by CAF classes
    69 	  
    70 	 @see ContentAccess::CF32AgentFactory. This implements 
    71 	 ContentAccess::CAgentFactory to handle unrestricted content.
    72 	 
    73  	 @publishedPartner
    74 	 @released
    75 	 */
    76 	class CAgentFactory : public CBase
    77 		{
    78 	public:
    79 		/** Create a new instance of a particular agent using its DLL implementation Uid
    80 		@param aUid The Uid of the agent to create an instance of its CAgentFactory
    81 		@return a new CAgentFactory
    82 
    83 		@internalComponent
    84 		@released
    85 		*/
    86 		static CAgentFactory* NewL(TUid aUid);
    87 	
    88 	/** Destructor, calls REComSession::DestroyedImplementation(); to destroy 
    89 		the ECOM implementation. When all implementations are destroyed
    90 		ECOM will unload the agent DLL
    91 		*/
    92 		IMPORT_C virtual ~CAgentFactory(); 
    93 
    94 		/**
    95 		Factory function creates a CAgentContent object for browsing
    96 		the contents of a file belonging to this agent.
    97 		 
    98 		@param aURI	The location of the file.
    99 		@param aShareMode The share mode used for opening this content
   100 		@return A pointer to the CAgentContent object.
   101 		*/
   102 		virtual CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode)  = 0;
   103 
   104 		/**
   105 		Creates a CAgentContent object for browsing the contents of a file 
   106 		belonging to this agent
   107 
   108 		@param aFile An open file handle for reading from the file, the agent must make its own duplicate of the file handle.
   109 		@return A pointer to the CAgentContent object.
   110 		*/
   111 		virtual CAgentContent* CreateContentBrowserL(RFile& aFile) = 0;
   112 
   113 		/**
   114 		 Factory function creates a CAgentData object for reading 
   115 		 from a content object
   116 		 
   117 		 @param aVirtualPath The content object to read from
   118 		 @param aShareMode The share mode for opening the file containing the content object
   119 		 @return A pointer to the CAgentData object.
   120 		 */
   121 		 virtual CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode)  = 0;
   122 
   123 		/**
   124 		 Factory function creates a CAgentData object for reading 
   125 		 from a content object.
   126 		 
   127 		 @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
   128 		 @param aUniqueId The agent specific unique ID of object within the file to read.
   129 		 @return A pointer to the CAgentData object.
   130 		 */
   131 		virtual CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId)  = 0;
   132 
   133 		/** 
   134 		 Factory function creates an object for performing management 
   135 		 functions with this particular agent
   136 
   137 		 CAgentManager objects are stateless so they require no 
   138 		 construction parameters.
   139 		 
   140 		 @return A pointer to a CAgentManager object.
   141 		 */
   142 		virtual CAgentManager*  CreateManagerL()   = 0;
   143 		
   144 		/** 
   145 		 Factory function creates an object that allows the agent to import 
   146 		 or transform content. The agent will supply output files where necessary
   147 		 
   148 		 @param aMimeType The mime type of the file to be imported
   149 		 @param aMetaDataArray Array of metadata associated with the file to import
   150 		 @param aOutputDirectory Preferred directory to store output files
   151 		 @param aSuggestedFileName Suggested filename for the output file(s)
   152 		 @return A pointer to a ContentAccess::CAgentImportFile object.
   153 		 @leave KErrCANotSupported If the agent does not support importing or transforming content
   154 		 */
   155 		virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) = 0;
   156 
   157 		/** 
   158 		 Factory function creates an object that allows the agent to import 
   159 		 or transform content. The caller will supply output files where necessary
   160 		 
   161 		 @param aMimeType The mime type of the file to be imported
   162 		 @param aMetaDataArray Array of metadata associated with the file to import
   163 		 @return A pointer to a ContentAccess::CAgentImportFile object.
   164 		 @leave KErrCANotSupported If the agent does not support importing or transforming content
   165 		 */
   166 		virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray) = 0;
   167 		
   168 		/** 
   169 		Factory function that creates an rights manager object for this agent
   170 
   171 		@return A pointer to a ContentAccess::CAgentRightsManager object.
   172 		@leave KErrCANotSupported If the agent does not provide any rights management functions
   173 		*/
   174 		virtual CAgentRightsManager* CreateRightsManagerL() = 0;
   175 
   176 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT		
   177 		/**
   178 		Factory function creates a CAgentData object from header data of WMDRM file or stream content
   179 		for reading/decrypting WMDRM data packets.
   180 		 
   181 		@param aHeaderData	Header data of WMDRM file or stream content.
   182 		@return				A pointer to CAgentData object.
   183 		*/
   184 		IMPORT_C virtual CAgentData* CreateDataConsumerL(const TDesC8& aHeaderData);
   185 		
   186 		/**
   187 		Factory function creates a CAgentContent object from header data of WMDRM file or stream content
   188 		for browsing WMDRM content.
   189 		 
   190 		@param aHeaderData	Header data of WMDRM file or stream content.
   191 		@return 			A pointer to CAgentContent object.
   192 		*/
   193 		IMPORT_C virtual CAgentContent* CreateContentBrowserL(const TDesC8& aHeaderData);
   194 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
   195 
   196 	private:
   197 		// ECOM session key. This is set by 
   198 		// REComSession::CreateImplementationL() during construction
   199 		TUid iEcomKey;
   200 		};
   201 
   202 	} // namespace ContentAccess
   203 #endif // __AGENTFACTORY_H__