Update contrib.
2 * Copyright (c) 2003 - 2007,2009-2010 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
27 #ifndef __AGENTFACTORY_H__
28 #define __AGENTFACTORY_H__
31 #include <ecom/ecom.h>
32 #include <caf/caftypes.h>
34 namespace ContentAccess
39 class CAgentImportFile;
41 class CAgentRightsManager;
46 class TVirtualPathPtr;
49 /** The CAF 2.0 agent interface UID */
50 const TUid KCAAgentInterfaceUid = {0x10204740};
53 Abstract interface handed out by an ECOM agent
54 implementation by REComSession::CreateImplementationL().
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
64 Derived classes will hand out concrete product implementations which are
65 specific for that particular agent.
67 Derived classes effectively represent the ECOM session handle
70 @see ContentAccess::CF32AgentFactory. This implements
71 ContentAccess::CAgentFactory to handle unrestricted content.
76 class CAgentFactory : public CBase
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
86 static CAgentFactory* NewL(TUid aUid);
88 /** Destructor, calls REComSession::DestroyedImplementation(); to destroy
89 the ECOM implementation. When all implementations are destroyed
90 ECOM will unload the agent DLL
92 IMPORT_C virtual ~CAgentFactory();
95 Factory function creates a CAgentContent object for browsing
96 the contents of a file belonging to this agent.
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.
102 virtual CAgentContent* CreateContentBrowserL(const TDesC& aURI, TContentShareMode aShareMode) = 0;
105 Creates a CAgentContent object for browsing the contents of a file
106 belonging to this agent
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.
111 virtual CAgentContent* CreateContentBrowserL(RFile& aFile) = 0;
114 Factory function creates a CAgentData object for reading
115 from a content object
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.
121 virtual CAgentData* CreateDataConsumerL(const TVirtualPathPtr& aVirtualPath, TContentShareMode aShareMode) = 0;
124 Factory function creates a CAgentData object for reading
125 from a content object.
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.
131 virtual CAgentData* CreateDataConsumerL(RFile& aFile, const TDesC& aUniqueId) = 0;
134 Factory function creates an object for performing management
135 functions with this particular agent
137 CAgentManager objects are stateless so they require no
138 construction parameters.
140 @return A pointer to a CAgentManager object.
142 virtual CAgentManager* CreateManagerL() = 0;
145 Factory function creates an object that allows the agent to import
146 or transform content. The agent will supply output files where necessary
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
155 virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray, const TDesC& aOutputDirectory, const TDesC& aSuggestedFileName) = 0;
158 Factory function creates an object that allows the agent to import
159 or transform content. The caller will supply output files where necessary
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
166 virtual CAgentImportFile* CreateImporterL(const TDesC8& aMimeType, const CMetaDataArray& aMetaDataArray) = 0;
169 Factory function that creates an rights manager object for this agent
171 @return A pointer to a ContentAccess::CAgentRightsManager object.
172 @leave KErrCANotSupported If the agent does not provide any rights management functions
174 virtual CAgentRightsManager* CreateRightsManagerL() = 0;
176 #ifdef SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
178 Factory function creates a CAgentData object from header data of WMDRM file or stream content
179 for reading/decrypting WMDRM data packets.
181 @param aHeaderData Header data of WMDRM file or stream content.
182 @return A pointer to CAgentData object.
184 IMPORT_C virtual CAgentData* CreateDataConsumerL(const TDesC8& aHeaderData);
187 Factory function creates a CAgentContent object from header data of WMDRM file or stream content
188 for browsing WMDRM content.
190 @param aHeaderData Header data of WMDRM file or stream content.
191 @return A pointer to CAgentContent object.
193 IMPORT_C virtual CAgentContent* CreateContentBrowserL(const TDesC8& aHeaderData);
194 #endif //SYMBIAN_ENABLE_SDP_WMDRM_SUPPORT
197 // ECOM session key. This is set by
198 // REComSession::CreateImplementationL() during construction
202 } // namespace ContentAccess
203 #endif // __AGENTFACTORY_H__