![Symbian Developer Library](../../../../a_stock/images/mainheading.gif)
![]() |
![]() |
|
Files are managed by the ContentAccess::CManager
class in the content access framework.
Some agents may choose to store content files inside their server private directories. For example:
\private\<process SID>\protectedfile.ext
If an agent wishes to publish the existence of its private directory,
it should fill in the name of the private directory (the SecureID of the
process) in the opaque_data
section of the agent's ECOM resource
file. See Content Access Agent ECOM Resource File.
CAF will map the path to one based on the agent name so that it is human-readable. For example:
\private\<agent_name>\protectedfile.ext
ContentAccess::CManager::DeleteFileL()
allows a
client to delete a specified file managed by a DRM agent.
The agent responsible for the content can display a dialog to confirm that the user wants to delete the file. This is particularly important if the content still has valid rights.
The agent implementation must decide whether to delete the rights or only the content.
TFileName filename;
// create a manager object
CManager *manager = CManager::NewL();
// Use the manager to delete a file
// CAF will ask the agent which actually owns the file to delete it.
TInt result = manager->DeleteFile(filename);
ContentAccess::CManager::CopyFile()
allows a user
to make a copy of the file. For example, the user may wish to make a copy of
the file onto removable media. When copying content managed by a DRM agent, the
agent will only copy the content, it will not copy the rights.
TInt result = manager->CopyFile(source, destination);
ContentAccess::CManager::RenameFile()
allows a
user to move or rename a file. For example, the user may wish to move the file
to removable media.
TInt result = manager->RenameFile(oldFilename, newFilename);
ContentAccess::CManager::MkDir()
allows a user to
create a directory.
TInt result = manager->MkDir(fullpath);
ContentAccess::CManager::MkDirAll()
allows a user
to create a directory. If one or more of the sub-directories do not exist they
will be created too.
TInt result = manager->MkDirAll(fullpath);
ContentAccess::CManager::RmDir()
allows a user to
remove a directory.
TInt result = manager->RmDir(fullpath);
There are three variations of the
ContentAccess::CManager::GetDir()
function. They each
allow a client to list the contents of an agent's private directory.
As mentioned earlier, it is optional for agents to provide this information.
CDir *aDir;
TInt result = manager->GetDir (aName, aEntryAttMask, aEntrySortKey, aDir);
The CAF Apparc recognizer provides a MIME type that is a combination of the file MIME type and the content within the file. In some circumstances, such as forwarding DRM content to another device, it will be important to make sure the content is sent with the correct MIME type.
Using the ""
empty string UniqueId
allows an
application to determine the MIME type of the file.
TBuf <256> mimeType;
TInt result = manager->GetStringAttribute(EMimeType, mimeType, TVirtualPathPtr(aURI,KNullDesC16()));
The CManager
API allows applications to retrieve
attributes or string attributes from a content object as described in
Content Object Attributes.