|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.mj.impl.media; |
|
20 |
|
21 import java.security.Permission; |
|
22 import java.security.PermissionCollection; |
|
23 import com.nokia.mj.impl.security.common.PermissionBase; |
|
24 import com.nokia.mj.impl.security.utils.SecurityPromptMessage; |
|
25 |
|
26 public class PlayerPermission extends PermissionBase |
|
27 { |
|
28 String iAction; |
|
29 |
|
30 public PlayerPermission(String aUri, String aAction) |
|
31 { |
|
32 super(aUri); |
|
33 iAction = aAction ; |
|
34 } |
|
35 |
|
36 /** |
|
37 * Returns the question (as localized text) associated with the security |
|
38 * prompt |
|
39 * |
|
40 * @return the localized text associated with the security prompt |
|
41 */ |
|
42 public String getSecurityPromptQuestion(int aInteractionMode) |
|
43 { |
|
44 return (SecurityPromptMessage.getInstance()).getText( |
|
45 SecurityPromptMessage.QUESTION_ID_AUDIO_VIDEO_RECORDING, |
|
46 null); |
|
47 } |
|
48 |
|
49 |
|
50 public String toString() |
|
51 { |
|
52 if (iAction.compareTo("record") == 0) |
|
53 { |
|
54 return "javax.microedition.media.control.RecordControl"; |
|
55 } |
|
56 else if (iAction.compareTo("snapshot") == 0) |
|
57 { |
|
58 return "javax.microedition.media.control.VideoControl.getSnapshot"; |
|
59 } |
|
60 return ""; |
|
61 } |
|
62 |
|
63 public boolean implies(Permission p) |
|
64 { |
|
65 if (p instanceof PlayerPermission) |
|
66 { |
|
67 PlayerPermission per = (PlayerPermission)p; |
|
68 return matchActions(iAction, per.iAction); |
|
69 } |
|
70 return false; |
|
71 } |
|
72 |
|
73 public boolean equals(Object obj) |
|
74 { |
|
75 return true; |
|
76 } |
|
77 |
|
78 public int hashCode() |
|
79 { |
|
80 return 0; |
|
81 } |
|
82 |
|
83 public String getActions() |
|
84 { |
|
85 return iAction; |
|
86 } |
|
87 |
|
88 public PermissionCollection newPermissionCollection() |
|
89 { |
|
90 return null; |
|
91 } |
|
92 } |