|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: JNI Layer for File DRM Handler |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "logger.h" |
|
19 #include "jstringutils.h" |
|
20 |
|
21 #include "com_nokia_mj_impl_fileutils_FileDRMContentHandler.h" |
|
22 #include "filedrmcontenthandler.h" |
|
23 #include "fileextendedcommon.h" // To be removed once common utility is fixed |
|
24 |
|
25 using namespace java::fileutils; |
|
26 |
|
27 /* |
|
28 * Class: com_nokia_mj_impl_fileutils_FileDRMContentHandler |
|
29 * Method: _isProtectedFile |
|
30 * Signature: (Ljava/lang/String;)Z |
|
31 */ |
|
32 JNIEXPORT jboolean JNICALL Java_com_nokia_mj_impl_fileutils_FileDRMContentHandler__1isProtectedFile |
|
33 (JNIEnv *aJni, jclass, jstring aName) |
|
34 { |
|
35 JStringUtils name(*aJni, aName); |
|
36 return FileDRMContentHandler::isDRMProtectedFile(name); |
|
37 } |
|
38 |
|
39 /* |
|
40 * Class: com_nokia_mj_impl_fileutils_FileDRMContentHandler |
|
41 * Method: _setDrmArguments |
|
42 * Signature: (IZI)I |
|
43 */ |
|
44 JNIEXPORT void JNICALL Java_com_nokia_mj_impl_fileutils_FileDRMContentHandler__1setDrmArguments |
|
45 (JNIEnv *, jobject, jint aHandle, jboolean aExecuteIntent, jint aIntent) |
|
46 { |
|
47 FileDRMContentHandler* handler = |
|
48 reinterpret_cast<FileDRMContentHandler*>(aHandle); |
|
49 return handler->setDrmArguments(aIntent, aExecuteIntent); |
|
50 } |
|
51 |
|
52 /* |
|
53 * Class: com_nokia_mj_impl_fileutils_FileDRMContentHandler |
|
54 * Method: _createDrmHandler |
|
55 * Signature: (Ljava/lang/String;)I |
|
56 */ |
|
57 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_fileutils_FileDRMContentHandler__1createDrmHandler |
|
58 (JNIEnv *aJni, jobject, jstring aName) |
|
59 { |
|
60 try |
|
61 { |
|
62 std::wstring name = java::fileutility::FileUtil::jstringToWstring(aJni, aName); |
|
63 FileDRMContentHandler* handler = new FileDRMContentHandler(name); |
|
64 return reinterpret_cast<jint>(handler); |
|
65 } |
|
66 catch (...) |
|
67 { |
|
68 ELOG(EJavaFile, |
|
69 "FileDRMContentHandler: JNI: exists caught exception. Return 0"); |
|
70 return 0; |
|
71 } |
|
72 } |