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