os/security/contentmgmt/contentaccessfwfordrm/engineering/dox/CafRecognizer.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
// <hr>
sl@0
    15
// The Apparc framework uses data type recognizers derived from \c CApaDataRecognizerType 
sl@0
    16
// to determine the MIME type of files in Symbian OS. Apparc supplies the filename and 
sl@0
    17
// a buffer containing bytes read from the start of the file. If a file is recognized, 
sl@0
    18
// the recognizer must return the MIME type and the degree of confidence in recognizing 
sl@0
    19
// the file (a \c TInt ranging from <code>"KMinInt=Not Recognized"</code> to <code>"KMaxInt=Certain"</code>).
sl@0
    20
// The implementation of DRM presents a problem when determinining the MIME type. Usually, a DRM 
sl@0
    21
// file stores one or more content objects. For example, an OMA file with 
sl@0
    22
// MIME type <code>application/vnd.oma.drm.content</code> might store an image file with 
sl@0
    23
// MIME type <code>image/jpeg</code>. Apparc expects only one MIME type to be returned, not two. 
sl@0
    24
// The CAF recognizer <code>RECCAF.DLL</code> uses the 
sl@0
    25
// to determine whether or not a file is recognized by the content access framework and 
sl@0
    26
// if so retrieves these two MIME types.
sl@0
    27
// The mapping of these two MIME types returned by CAF to a single MIME type follows these rules:
sl@0
    28
// <table border=1>
sl@0
    29
// <tr><th> File MIME Type </th><th> Content MIME Type              </th><th> Apparc MIME Type                         </th></tr>
sl@0
    30
// <tr><td> Present        </td><td> Present                        </td><td> <code><i>x-caf-</i>ContentMimeType</code></td></tr>
sl@0
    31
// <tr><td> Present        </td><td> Not Present                    </td><td> <code>FileMimeType</code>                </td></tr>
sl@0
    32
// <tr><td> Present        </td><td> <code>application/x-caf</code> </td><td> <code>application/x-caf</code>           </td></tr>
sl@0
    33
// </table>
sl@0
    34
// The rationale for the above mapping is as follows:
sl@0
    35
// Access Framework. A file is either recognized by an agent or it is not recognized.
sl@0
    36
// <hr>
sl@0
    37
// When recognizing a file, Apparc supplies the name of the file to be recognized, and a 
sl@0
    38
// buffer containing the start of the file, to all <code>CApaDataRecognizerType::DoRecognizeL()</code> 
sl@0
    39
// implementations. These two parameters can be passed to the <code>ContentAccess::CAgentResolver::DoRecognize()</code> 
sl@0
    40
// function to determine whether one of the Content Access Agents recognizes the file. 
sl@0
    41
// CApaDataRecognizer::DoRecognize(TDesC& aFilename, TDesC8& aBuffer)
sl@0
    42
// TBool recognized;
sl@0
    43
// CAgentResolver *resolver = CAgentResolver::NewL();
sl@0
    44
// recognized = resolver->DoRecognize(filename, buffer, fileMimeType, contentMimeType);
sl@0
    45
// <code>ContentAccess::CAgentResolver::DoRecognize()</code> passes the filename and buffer to each of the  
sl@0
    46
// agents in turn. The agents perform the recognition, and the result is returned 
sl@0
    47
// as either \c ETrue if the file was recognized, or \c EFalse if it was not. If the file 
sl@0
    48
// is recognized, the \c fileMimeType and \c contentMimeType parameters are populated 
sl@0
    49
// with the correct MIME types.
sl@0
    50
// The recognition is distributed to the agents because they are able to recognize 
sl@0
    51
// a file belonging to their agent. They are also able to examine the contents to 
sl@0
    52
// work out the content MIME type. This allows one generic CAF recognizer to be used 
sl@0
    53
// for all the agents implemented with the content access framework.
sl@0
    54
// <hr>
sl@0
    55
// The following diagram illustrates the recognition of an OMA file with 
sl@0
    56
// JPEG content.
sl@0
    57
// <hr>
sl@0
    58
// The CAF recognizer configuration file is stored in the Apparc server's
sl@0
    59
// private directory \c \\private\\10003a3f\\RecCaf\\RecCafMimeTypes.txt.
sl@0
    60
// It is just a list of all known content MIME types. The list allows the 
sl@0
    61
// recognizer to return a fixed set of MIME types when 
sl@0
    62
// Apparc calls the recognizer's <code>CApaCafRecognizer::SupportedDataTypeL()</code> fuction.
sl@0
    63
// image/jpeg
sl@0
    64
// image/gif
sl@0
    65
// text/plain
sl@0
    66
// text/html
sl@0
    67
// ... etc
sl@0
    68
// If this file is replaced (to support new content types), the recognizer 
sl@0
    69
// will only implement the changes during the next power on. Similarly if a new agent 
sl@0
    70
// is added, the recognizer will only rebuild its list of agents after the next power on.
sl@0
    71
// <hr>
sl@0
    72
// In order to use CAF content, applications will need to update their registration resource files (e.g. 
sl@0
    73
// <code>AppName_reg.rss</code>) to include the new CAF MIME types. For example, in the past an image 
sl@0
    74
// viewer may have only included <code>image/jpeg</code> in the list of MIME types it could open. 
sl@0
    75
// If the application is updated to use the Content Access Framework, it should support 
sl@0
    76
// <code>image/jpeg</code> and <code>x-caf-image/jpeg</code> in order to support 
sl@0
    77
// unprotected and protected content respectively. See the registration file examples below.
sl@0
    78
// All file operations should be conducted through the CAF framework, so that the 
sl@0
    79
// application will not need to know anything about a specific DRM scheme.
sl@0
    80
// <b>Registration file that doesn't use CAF</b>
sl@0
    81
// datatype_list = 
sl@0
    82
// DATATYPE { priority= EDataTypePriorityHigh ; type="image/jpeg"; },
sl@0
    83
// <b>Registration file that does use CAF</b>
sl@0
    84
// datatype_list = 
sl@0
    85
// DATATYPE { priority= EDataTypePriorityHigh ; type="image/jpeg"; },
sl@0
    86
// DATATYPE { priority= EDataTypePriorityHigh ; type="x-caf-image/jpeg"; },
sl@0
    87
// <hr>
sl@0
    88
// 
sl@0
    89
//
sl@0
    90
sl@0
    91
/**
sl@0
    92
 @page CAFRecognizer How to write an Apparc recognizer for the Content Access Framework
sl@0
    93
 - @ref RecognizerOverview
sl@0
    94
 - @ref DoRecognize
sl@0
    95
 - @ref ConfigFile
sl@0
    96
 - @ref AppRegFiles
sl@0
    97
 @section RecognizerOverview Overview 
sl@0
    98
 <code>ContentAccess::CAgentResolver::DoRecognize()</code> function @ref DoRecognize "(see below)"  
sl@0
    99
 @li Users and applications will be interested in the MIME type of the content within a file not the packaging. CAF abstracts the packaging.
sl@0
   100
 @li If the content is recognized with only the MIME type of the content within the file, it would confuse legacy applications who thought the entire file was that MIME type
sl@0
   101
 @li Prefixing the content type with <code>"x-caf-"</code> shows it is a file that can be opened by CAF to read that content type without confusing legacy applications
sl@0
   102
 @li A file that needs to be passed through the supplier interface before it can be used will just be recognized as the file MIME type, the content type is irrelevant before the supply operation.
sl@0
   103
 @li A file containing many content objects should just be recognized as <code>application/x-caf</code> since the packaging of the archive is irrelevant. CAF abstracts the packaging.
sl@0
   104
 @note The concept of "confidence" has also been eliminated for the files within the Content 
sl@0
   105
 @section DoRecognize How to determine the file and content MIME types of a DRM file
sl@0
   106
 @code
sl@0
   107
 @endcode
sl@0
   108
 @image html recognizer.gif
sl@0
   109
 @section ConfigFile CAF Recognizer Configuration File
sl@0
   110
 @code
sl@0
   111
 @endcode
sl@0
   112
 @section AppRegFiles Application Registration files
sl@0
   113
 @code
sl@0
   114
 @endcode	
sl@0
   115
 @code
sl@0
   116
 @endcode	
sl@0
   117
*/