os/security/contentmgmt/contentaccessfwfordrm/engineering/dox/HowToManageFiles.dox
First public contribution.
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
15 // Files are managed by the <code>ContentAccess::CManager</code> class in the content
18 // Some agents may choose to store content files inside their server private directories. For example:
19 // \private\<process SID>\protectedfile.ext
20 // If an agent wishes to publish the existence of its private directory, it should fill in the name of
21 // the private directory (its SecureID of the process) in the \c opaque_data section of the agents ECOM resource file.
22 // CAF will map the path to one based on the agent name so that it's human-readable. For example:
23 // \private\<agent_name>\protectedfile.ext
25 // The <code>ContentAccess::CManager::DeleteFileL()</code> allows a client to delete a specified file managed by a DRM agent.
26 // The agent responsible for the content can display a dialog to confirm that
27 // the user wants to delete the file. This is particularly important if the content still has valid rights.
28 // The agent implementation must decide whether to delete the rights or only the content.
29 // TFileName filename;
30 // // create a manager object
31 // CManager* manager = CManager::NewL();
32 // // Use the manager to delete a file
33 // // CAF will ask the agent who actually owns the file to delete it.
34 // TInt result = manager->DeleteFile(filename);
36 // <code>ContentAccess::CManager::CopyFile()</code> allows a user to make a copy of the file. For example, the user may wish
37 // to make a copy of the file on removable media. When copying content managed by a DRM agent, the agent will only copy the
38 // content, it will not copy the rights.
39 // TInt result = manager->CopyFile(source, destination);
41 // <code>ContentAccess::CManager::RenameFile()</code> allows a user to move or rename a file.
42 // For example, the user may wish to move the file to removable media.
43 // TInt result = manager->RenameFile(oldFilename, newFilename);
45 // <code>ContentAccess::CManager::MkDir()</code> allows a user to create a directory.
46 // TInt result = manager->MkDir(fullpath);
48 // <code>ContentAccess::CManager::MkDirAll()</code> allows a user to create a directory.
49 // If one or more of the sub-directories do not exist they will be created too.
50 // TInt result = manager->MkDirAll(fullpath);
52 // <code>ContentAccess::CManager::RmDir()</code> allows a user to remove a directory.
53 // TInt result = manager->RmDir(fullpath);
55 // There a three variations of the <code>ContentAccess::CManager::GetDir()</code> function. They each allow a client
56 // to list the contents of an agent's private directory.
57 // As mentioned earlier it is optional for agents to provide this information.
59 // TInt result = manager->GetDir(aName, aEntryAttMask, aEntrySortKey, aDir);
61 // The CAF Apparc recognizer provides a MIME type that is a combination of the file MIME type and
62 // the content within the file. In some circumstances, such as forwarding DRM content to another
63 // device, it will be important to make sure the content is sent with the correct MIME type.
64 // Using the <code>""</code> empty string <code>UniqueId</code> allows an application to determine the MIME type of the file.
65 // TBuf <256> aMimeType;
66 // TInt result = manager->GetStringAttribute(EMimeType, aMimeType, TVirtualPathPtr(aURI,KNullDesC16()));
68 // The <code>CManager</code> API allows applications to retrieve attributes or string attributes from a content object
74 @page CAFManageFiles Managing files with the Content Access Framework
75 - @ref CAFPrivateDirectories
83 - @ref GetRealMimeType
84 - @ref ManagerGetAttribute
85 @section CAFPrivateDirectories Agents using Private directories
88 See @ref CAA_Configuration.
91 @section Deleteing Deleting a File
94 @section Copying Copying a file
97 @section Moving Move or Rename a file
100 @section MkDir Creating a Directory
103 @section MkDirAll Creating all directories
106 @section RemoveDir Removing a Directory
109 @section GetDir List the contents of a directory
112 @section GetRealMimeType Find out the real MIME type of the file
115 @section ManagerGetAttribute Get the attributes of the Content object
116 as described in @ref ContentAttributes.