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