Symbian3/PDK/Source/GUID-7B5DBFBC-E67F-56F8-AFF8-DFF5019D707F.dita
changeset 5 f345bda72bc4
parent 1 25a17d01db0c
child 14 578be2adaf3e
equal deleted inserted replaced
4:4816d766a08a 5:f345bda72bc4
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept id="GUID-7B5DBFBC-E67F-56F8-AFF8-DFF5019D707F" xml:lang="en"><title>Managing
    12 <concept id="GUID-7B5DBFBC-E67F-56F8-AFF8-DFF5019D707F" xml:lang="en"><title>Managing
    13 Files</title><shortdesc>Applications can use the <apiname>ContentAccess::CManager</apiname> class
    13 Files</title><shortdesc>Applications can use the <codeph>ContentAccess::CManager</codeph> class
    14 to manage files. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    14 to manage files. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
    15 <section><title>Introduction</title> <p>Some agents may choose to store content
    15 <section id="GUID-3DA2A7D7-CD81-4E1B-8146-5C1166BF9F9F"><title>Introduction</title> <p>Some agents may choose to store content
    16 files inside their server private directories. In the file system the private
    16 files inside their server private directories. In the file system the private
    17 directories have the following format: </p> <p> <filepath>\private\&lt;process
    17 directories have the following format: </p> <p> <filepath>\private\&lt;process
    18 SID&gt;\protectedfile.ext</filepath>  </p> <p>If an agent want to publish the
    18 SID&gt;\protectedfile.ext</filepath>  </p> <p>If an agent want to publish the
    19 existence of its private directory, it specify the name of the private directory
    19 existence of its private directory, it specify the name of the private directory
    20 (the SecureID of the process) in the <codeph>opaque_data</codeph> section
    20 (the SecureID of the process) in the <codeph>opaque_data</codeph> section
    26 When an application opens a file stored in the private directory, CAF selects
    26 When an application opens a file stored in the private directory, CAF selects
    27 the agent which handles that content based upon the name in the path. If the
    27 the agent which handles that content based upon the name in the path. If the
    28 file is not stored in a private directory, CAF checks each of the agents whether
    28 file is not stored in a private directory, CAF checks each of the agents whether
    29 they support the file. If no agent supports the file, it reads as plaintext
    29 they support the file. If no agent supports the file, it reads as plaintext
    30 using F32Agent. </p> </section>
    30 using F32Agent. </p> </section>
    31 <section><title>Required background</title> <p>Before you start, you must
    31 <section id="GUID-AB27A412-9F81-4D92-A5E5-92EDA66CAE0D"><title>Required background</title> <p>Before you start, you must
    32 understand: </p> <ul>
    32 understand: </p> <ul>
    33 <li id="GUID-E7B3F1D9-8642-5DC2-911F-C1AB89B02C46"><p><xref href="GUID-84B6389A-55CC-53EB-8725-65F753FD7217.dita">Content
    33 <li id="GUID-E7B3F1D9-8642-5DC2-911F-C1AB89B02C46"><p><xref href="GUID-84B6389A-55CC-53EB-8725-65F753FD7217.dita">Content
    34 Access Framework for DRM</xref>  </p> </li>
    34 Access Framework for DRM</xref>  </p> </li>
    35 <li id="GUID-BDCB532C-22AB-5CF0-9499-363480AB8E4A"><p><xref href="GUID-B6912FE7-4C2A-5FC7-BDA8-702CA2C0214A.dita">Content
    35 <li id="GUID-BDCB532C-22AB-5CF0-9499-363480AB8E4A"><p><xref href="GUID-B6912FE7-4C2A-5FC7-BDA8-702CA2C0214A.dita">Content
    36 Object Attributes</xref>  </p> </li>
    36 Object Attributes</xref>  </p> </li>
    37 </ul> </section>
    37 </ul> </section>
    38 <section><title>Procedure</title> <ol id="GUID-0E77D596-02DA-5024-A607-4DD96FDC9AD1">
    38 <section id="GUID-DCB92023-4479-470D-BCAD-399FE7B09E05"><title>Procedure</title> <ol id="GUID-0E77D596-02DA-5024-A607-4DD96FDC9AD1">
    39 <li id="GUID-6AE6D7DF-B2A2-5B10-BE92-4A268FA7E74E"><p>Create a manager object
    39 <li id="GUID-6AE6D7DF-B2A2-5B10-BE92-4A268FA7E74E"><p>Create a manager object
    40 using the <xref href="GUID-7F3D9E35-A8FC-35A6-8036-23396BAADFDC.dita#GUID-7F3D9E35-A8FC-35A6-8036-23396BAADFDC/GUID-2F4CB027-777F-3F16-AE9A-8902F4AE87E7"><apiname>CManager::NewL()</apiname></xref> function. </p> </li>
    40 using the <xref href="GUID-7F3D9E35-A8FC-35A6-8036-23396BAADFDC.dita#GUID-7F3D9E35-A8FC-35A6-8036-23396BAADFDC/GUID-2F4CB027-777F-3F16-AE9A-8902F4AE87E7"><apiname>CManager::NewL()</apiname></xref> function. </p> </li>
    41 <li id="GUID-CBBF33EB-EFB8-5996-9DE6-914F705C36E0"><p>Perform one or more
    41 <li id="GUID-CBBF33EB-EFB8-5996-9DE6-914F705C36E0"><p>Perform one or more
    42 of the following tasks as per your requirement: </p> <ul>
    42 of the following tasks as per your requirement: </p> <ul>
    43 <li id="GUID-A3827F88-086A-52F6-8053-BA4CD185D354"><p>Copy a file </p> </li>
    43 <li id="GUID-A3827F88-086A-52F6-8053-BA4CD185D354"><p>Copy a file </p> </li>
    51 <li id="GUID-B073B5BE-D492-5A07-A02F-E744B90303A2"><p>Get the attributes of
    51 <li id="GUID-B073B5BE-D492-5A07-A02F-E744B90303A2"><p>Get the attributes of
    52 the content object</p> </li>
    52 the content object</p> </li>
    53 <li id="GUID-A643A08C-98F8-5BC4-BA0E-A5E6E946CE8C"><p>Remove a directory </p> </li>
    53 <li id="GUID-A643A08C-98F8-5BC4-BA0E-A5E6E946CE8C"><p>Remove a directory </p> </li>
    54 </ul> </li>
    54 </ul> </li>
    55 </ol> </section>
    55 </ol> </section>
    56 <section><title>Copy a file</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-61AA708F-8EE5-3D54-AD7A-2E4E7A253877"><apiname>ContentAccess::CManager::CopyFile()</apiname></xref> allows
    56 <section id="GUID-34A573A8-7D60-4064-8F9E-C2651FA041FD"><title>Copy a file</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-61AA708F-8EE5-3D54-AD7A-2E4E7A253877"><apiname>ContentAccess::CManager::CopyFile()</apiname></xref> allows
    57 a user to make a copy of the file. For example, the user may wish to make
    57 a user to make a copy of the file. For example, the user may wish to make
    58 a copy of the file onto removable media. When copying content managed by a
    58 a copy of the file onto removable media. When copying content managed by a
    59 DRM agent, the agent only copies the content, it does not copy the rights.
    59 DRM agent, the agent only copies the content, it does not copy the rights.
    60  <codeblock id="GUID-63550964-EEDD-51A2-8316-4B33F794E060" xml:space="preserve">// create a manager object
    60  <codeblock id="GUID-63550964-EEDD-51A2-8316-4B33F794E060" xml:space="preserve">// create a manager object
    61 CManager *manager = CManager::NewL();
    61 CManager *manager = CManager::NewL();
    62 
    62 
    63 // Use the manager to copy a file
    63 // Use the manager to copy a file
    64 TInt result = manager-&gt;CopyFile(source, destination);</codeblock></p></section>
    64 TInt result = manager-&gt;CopyFile(source, destination);</codeblock></p></section>
    65 <section><title>Move or rename a file</title><p><xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-234C24A5-5C9E-3575-9FF3-8BC6F1C09902"><apiname>ContentAccess::CManager::RenameFile()</apiname></xref> allows
    65 <section id="GUID-E2C128C6-C655-4327-8251-FBD8FF0F4D53"><title>Move or rename a file</title><p><xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-234C24A5-5C9E-3575-9FF3-8BC6F1C09902"><apiname>ContentAccess::CManager::RenameFile()</apiname></xref> allows
    66 a user to move or rename a file. For example, the user may wish to move the
    66 a user to move or rename a file. For example, the user may wish to move the
    67 file to removable media.  <codeblock id="GUID-25D923DF-CA66-5E8F-87D8-44AFCE75E04E" xml:space="preserve">TInt result = manager-&gt;RenameFile(oldFilename, newFilename);</codeblock></p></section>
    67 file to removable media.  <codeblock id="GUID-25D923DF-CA66-5E8F-87D8-44AFCE75E04E" xml:space="preserve">TInt result = manager-&gt;RenameFile(oldFilename, newFilename);</codeblock></p></section>
    68 <section><title>Delete a file</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-CCE97FF8-FE23-3A16-A093-B2C9388EABDC"><apiname>ContentAccess::CManager::DeleteFileL()</apiname></xref> allows
    68 <section id="GUID-D66E8C1F-2A84-4A6B-B84E-737E5E9C0254"><title>Delete a file</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-CCE97FF8-FE23-3A16-A093-B2C9388EABDC"><apiname>ContentAccess::CManager::DeleteFileL()</apiname></xref> allows
    69 a client to delete a specified file managed by a DRM agent. </p> <p>The agent
    69 a client to delete a specified file managed by a DRM agent. </p> <p>The agent
    70 responsible for the content can display a dialog to confirm that the user
    70 responsible for the content can display a dialog to confirm that the user
    71 wants to delete the file. This is particularly important if the content still
    71 wants to delete the file. This is particularly important if the content still
    72 has valid rights. </p> <p>The agent implementation must decide whether to
    72 has valid rights. </p> <p>The agent implementation must decide whether to
    73 delete the rights or only the content. </p> <codeblock id="GUID-BBEBA78E-6BBD-5179-9C1E-7329BCCAED73" xml:space="preserve">TFileName filename;
    73 delete the rights or only the content. </p> <codeblock id="GUID-BBEBA78E-6BBD-5179-9C1E-7329BCCAED73" xml:space="preserve">TFileName filename;
    74 
    74 
    75 // Use the manager to delete a file
    75 // Use the manager to delete a file
    76 // CAF asks the agent which actually owns the file to delete it.
    76 // CAF asks the agent which actually owns the file to delete it.
    77 TInt result = manager-&gt;DeleteFile(filename);</codeblock></section>
    77 TInt result = manager-&gt;DeleteFile(filename);</codeblock></section>
    78 <section><title>Create a directory</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-218ADCB8-25BA-31E0-83D2-8E2315CAD3C3"><apiname>ContentAccess::CManager::MkDir()</apiname></xref> allows
    78 <section id="GUID-FDACCD5A-623E-4DF5-A949-D931B3286CB7"><title>Create a directory</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-218ADCB8-25BA-31E0-83D2-8E2315CAD3C3"><apiname>ContentAccess::CManager::MkDir()</apiname></xref> allows
    79 a user to create a directory. </p> <codeblock id="GUID-886A4120-8A50-5740-98EA-B389C590F226" xml:space="preserve">TInt result = manager-&gt;MkDir(fullpath);</codeblock> <p>If one or more of the sub-directories do not exist they are created too using
    79 a user to create a directory. </p> <codeblock id="GUID-886A4120-8A50-5740-98EA-B389C590F226" xml:space="preserve">TInt result = manager-&gt;MkDir(fullpath);</codeblock> <p>If one or more of the sub-directories do not exist they are created too using
    80 the <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-83D7D7A2-3046-381F-A856-04FA661F37CD"><apiname> ContentAccess::CManager::MkDirAll()</apiname></xref> function. </p> <codeblock id="GUID-E83DD3C2-6816-5834-8561-565EAC7FEE26" xml:space="preserve">TInt result = manager-&gt;MkDirAll(fullpath);</codeblock></section>
    80 the <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-83D7D7A2-3046-381F-A856-04FA661F37CD"><apiname> ContentAccess::CManager::MkDirAll()</apiname></xref> function. </p> <codeblock id="GUID-E83DD3C2-6816-5834-8561-565EAC7FEE26" xml:space="preserve">TInt result = manager-&gt;MkDirAll(fullpath);</codeblock></section>
    81 <section><title>List the contents of a directory</title><p>There are three
    81 <section id="GUID-9E2629F6-FB0D-4051-B41A-E90E2658A967"><title>List the contents of a directory</title><p>There are three
    82 variations of the <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-BAA97FAB-5DEA-3FCB-93AD-8157D1AF6AC7"><apiname>ContentAccess::CManager::GetDir()</apiname></xref> function.
    82 variations of the <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-BAA97FAB-5DEA-3FCB-93AD-8157D1AF6AC7"><apiname>ContentAccess::CManager::GetDir()</apiname></xref> function.
    83 They each allow a client to list the contents of an agent's private directory. </p> <p>As
    83 They each allow a client to list the contents of an agent's private directory. </p> <p>As
    84 mentioned earlier, it is optional for agents to provide this information. </p> <codeblock id="GUID-5AB17FAF-83A1-518B-9D1D-B00C8818BFC2" xml:space="preserve">CDir *aDir;
    84 mentioned earlier, it is optional for agents to provide this information. </p> <codeblock id="GUID-5AB17FAF-83A1-518B-9D1D-B00C8818BFC2" xml:space="preserve">CDir *aDir;
    85 TInt result = manager-&gt;GetDir (aName, aEntryAttMask, aEntrySortKey, aDir);</codeblock></section>
    85 TInt result = manager-&gt;GetDir (aName, aEntryAttMask, aEntrySortKey, aDir);</codeblock></section>
    86 <section><title>Find the real MIME type of the file</title><p>The CAF Apparc
    86 <section id="GUID-27433169-1E69-422F-9E8D-B1F9E508FE3B"><title>Find the real MIME type of the file</title><p>The CAF Apparc
    87 recognizer provides a MIME type that is a combination of the file MIME type
    87 recognizer provides a MIME type that is a combination of the file MIME type
    88 and the content within the file. In some cases, such as forwarding DRM content
    88 and the content within the file. In some cases, such as forwarding DRM content
    89 to another device, it is important to make sure the content is sent with the
    89 to another device, it is important to make sure the content is sent with the
    90 correct MIME type. </p> <p>Using the <codeph>""</codeph> empty string <codeph>UniqueId</codeph> allows
    90 correct MIME type. </p> <p>Using the <codeph>""</codeph> empty string <codeph>UniqueId</codeph> allows
    91 an application to determine the MIME type of the file. </p> <codeblock id="GUID-CF389440-3AE5-5AC2-97E1-57E0D30901D6" xml:space="preserve">TBuf &lt;256&gt; mimeType;
    91 an application to determine the MIME type of the file. </p> <codeblock id="GUID-CF389440-3AE5-5AC2-97E1-57E0D30901D6" xml:space="preserve">TBuf &lt;256&gt; mimeType;
    92 TInt result = manager-&gt;GetStringAttribute(EMimeType, mimeType, TVirtualPathPtr(aURI,KNullDesC16()));</codeblock></section>
    92 TInt result = manager-&gt;GetStringAttribute(EMimeType, mimeType, TVirtualPathPtr(aURI,KNullDesC16()));</codeblock></section>
    93 <section><title>Get the attributes of the content object</title><p>The <xref href="GUID-7F3D9E35-A8FC-35A6-8036-23396BAADFDC.dita"><apiname>CManager</apiname></xref> API
    93 <section id="GUID-9FE3CA6E-642B-4921-8062-369E4295BB89"><title>Get the attributes of the content object</title><p>The <xref href="GUID-7F3D9E35-A8FC-35A6-8036-23396BAADFDC.dita"><apiname>CManager</apiname></xref> API
    94 allows applications to retrieve attributes or string attributes from a content
    94 allows applications to retrieve attributes or string attributes from a content
    95 object as described in <xref href="GUID-B6912FE7-4C2A-5FC7-BDA8-702CA2C0214A.dita">Content
    95 object as described in <xref href="GUID-B6912FE7-4C2A-5FC7-BDA8-702CA2C0214A.dita">Content
    96 Object Attributes</xref>. </p></section>
    96 Object Attributes</xref>. </p></section>
    97 <section><title>Remove a directory</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-BB1AE25D-11DD-3599-902D-BE5B2D414C26"><apiname> ContentAccess::CManager::RmDir()</apiname></xref> allows
    97 <section id="GUID-58B7E657-6A12-4CA4-AFEE-27E62ACDEAB7"><title>Remove a directory</title><p> <xref href="GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8.dita#GUID-671191B1-B249-3DD3-A5E8-6F1A41A371C8/GUID-BB1AE25D-11DD-3599-902D-BE5B2D414C26"><apiname> ContentAccess::CManager::RmDir()</apiname></xref> allows
    98 a user to remove a directory. </p> <codeblock id="GUID-9350BEDB-5767-5CD2-9456-8AC1B9DF374F" xml:space="preserve">TInt result = manager-&gt;RmDir(fullpath);</codeblock></section>
    98 a user to remove a directory. </p> <codeblock id="GUID-9350BEDB-5767-5CD2-9456-8AC1B9DF374F" xml:space="preserve">TInt result = manager-&gt;RmDir(fullpath);</codeblock></section>
    99 <section><title>See also</title> <p><xref href="GUID-E99E0092-5F1D-5715-945E-E83C307357C3.dita">Managing
    99 <section id="GUID-C8600066-0D5D-4372-942D-F6C47B27CAD2"><title>See also</title> <p><xref href="GUID-E99E0092-5F1D-5715-945E-E83C307357C3.dita">Managing
   100 CAF Agents</xref>  </p> </section>
   100 CAF Agents</xref>  </p> </section>
   101 </conbody></concept>
   101 </conbody></concept>