Source Code Cross Referenced for TrustedMIDletSuiteInfo.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » jump » installer » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.midp.jump.installer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
004:         * 
005:         * This program is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU General Public License version
007:         * 2 only, as published by the Free Software Foundation.
008:         * 
009:         * This program is distributed in the hope that it will be useful, but
010:         * WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012:         * General Public License version 2 for more details (a copy is
013:         * included at /legal/license.txt).
014:         * 
015:         * You should have received a copy of the GNU General Public License
016:         * version 2 along with this work; if not, write to the Free Software
017:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
018:         * 02110-1301 USA
019:         * 
020:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
021:         * Clara, CA 95054 or visit www.sun.com if you need additional
022:         * information or have any questions.
023:         */
024:
025:        package com.sun.midp.jump.installer;
026:
027:        import com.sun.midp.midlet.MIDletSuite;
028:        import com.sun.midp.security.Permissions;
029:        import com.sun.midp.security.SecurityToken;
030:
031:        import com.sun.midp.installer.InternalMIDletSuiteImpl;
032:
033:        /**
034:         * A proxy for InternalMIDletSuiteImpl to bypass the security check.
035:         * Used by the JUMP exective to bypass NullPointerException 
036:         * thrown at various ams secuirty check code through MIDletStateHandler like 
037:         * listed below.  See JumpInit.init() for the code that 
038:         * sets MIDletStateHandler.java's MIDletSuite field value.
039:         *
040:         *    MIDletStateHandler midletStateHandler =
041:         *          MIDletStateHandler.getMidletStateHandler();
042:         *    MIDletSuite midletSuite = midletStateHandler.getMIDletSuite();
043:         *    midletSuite.checkIfPermissionAllowed(Permissions.AMS);
044:         *
045:         * This is a temporary fix until the security architecture in ams s replaced 
046:         * with more CDC centric AccessController syntax.
047:         **/
048:        public class TrustedMIDletSuiteInfo implements  MIDletSuite {
049:
050:            MIDletSuite suite;
051:
052:            public TrustedMIDletSuiteInfo() {
053:                suite = InternalMIDletSuiteImpl.create("executive", 0);
054:            }
055:
056:            public void checkIfPermissionAllowed(int permission) {
057:                return; // trusted, don't throw SecurityException.
058:            }
059:
060:            /**
061:             * Get a property of the suite. A property is an attribute from
062:             * either the application descriptor or JAR Manifest.
063:             *
064:             * @param key the name of the property
065:             * @return A string with the value of the property.
066:             *    <code>null</code> is returned if no value is available for
067:             *          the key.
068:             */
069:            public String getProperty(String key) {
070:                return suite.getProperty(key);
071:            }
072:
073:            /**
074:             * Gets push setting for interrupting other MIDlets.
075:             * Reuses the Permissions.
076:             *
077:             * @return push setting for interrupting MIDlets the value
078:             *        will be permission level from {@link Permissions}
079:             */
080:            public byte getPushInterruptSetting() {
081:                return suite.getPushInterruptSetting();
082:            }
083:
084:            /**
085:             * Gets push options for this suite.
086:             *
087:             * @return push options are defined in {@link PushRegistryImpl}
088:             */
089:            public int getPushOptions() {
090:                return suite.getPushOptions();
091:            }
092:
093:            /**
094:             * Gets list of permissions for this suite.
095:             *
096:             * @return array of permissions from {@link Permissions}
097:             */
098:            public byte[] getPermissions() {
099:                return suite.getPermissions();
100:            }
101:
102:            /**
103:             * Replace or add a property to the suite for this run only.
104:             *
105:             * @param token token with the AMS permission set to allowed,
106:             *        can be null to use the suite's permission
107:             * @param key the name of the property
108:             * @param value the value of the property
109:             *
110:             * @exception SecurityException if the caller's token does not have
111:             *            internal AMS permission
112:             */
113:            public void setTempProperty(SecurityToken token, String key,
114:                    String value) {
115:                suite.setTempProperty(token, key, value);
116:            }
117:
118:            /**
119:             * Get the name of a MIDlet to display to the user.
120:             *
121:             * @param className classname of a MIDlet in the suite
122:             *
123:             * @return name to display to the user
124:             */
125:            public String getMIDletName(String className) {
126:                return suite.getMIDletName(className);
127:            }
128:
129:            /**
130:             * Check to see the suite has the ALLOW level for specific permission.
131:             * This is used for by internal APIs that only provide access to
132:             * trusted system applications.
133:             * <p>
134:             * Only trust this method if the object has been obtained from the
135:             * Scheduler of the suite.
136:             *
137:             * @param permission permission ID from
138:             *      {@link com.sun.midp.security.Permissions}
139:             *
140:             * @exception SecurityException if the suite is not
141:             *            allowed to perform the specified action.
142:             */
143:            //public void checkIfPermissionAllowed(int permission);
144:            /**
145:             * Check for permission and throw an exception if not allowed.
146:             * May block to ask the user a question.
147:             *
148:             * @param permission ID of the permission to check for,
149:             *      the ID must be from
150:             *      {@link com.sun.midp.security.Permissions}
151:             * @param resource string to insert into the question, can be null if
152:             *        no %2 in the question
153:             *
154:             * @exception SecurityException if the permission is not
155:             *            allowed by this token
156:             * @exception InterruptedException if another thread interrupts the
157:             *   calling thread while this method is waiting to preempt the
158:             *   display.
159:             */
160:            public void checkForPermission(int permission, String resource)
161:                    throws InterruptedException {
162:                suite.checkForPermission(permission, resource);
163:            }
164:
165:            /**
166:             * Checks for permission and throw an exception if not allowed.
167:             * May block to ask the user a question.
168:             *
169:             * @param permission ID of the permission to check for,
170:             *      the ID must be from
171:             *      {@link com.sun.midp.security.Permissions}
172:             * @param resource string to insert into the question, can be null if
173:             *        no %2 in the question
174:             * @param extraValue string to insert into the question,
175:             *        can be null if no %3 in the question
176:             *
177:             * @exception SecurityException if the permission is not
178:             *            allowed by this token
179:             * @exception InterruptedException if another thread interrupts the
180:             *   calling thread while this method is waiting to preempt the
181:             *   display.
182:             */
183:            public void checkForPermission(int permission, String resource,
184:                    String extraValue) throws InterruptedException {
185:                suite.checkForPermission(permission, resource, extraValue);
186:            }
187:
188:            /**
189:             * Get the status of the specified permission.
190:             * If no API on the device defines the specific permission
191:             * requested then it must be reported as denied.
192:             * If the status of the permission is not known because it might
193:             * require a user interaction then it should be reported as unknown.
194:             *
195:             * @param permission to check if denied, allowed, or unknown.
196:             * @return 0 if the permission is denied; 1 if the permission is allowed;
197:             *  -1 if the status is unknown
198:             */
199:            public int checkPermission(String permission) {
200:                return suite.checkPermission(permission);
201:            }
202:
203:            /**
204:             * Gets the unique ID of the suite.
205:             *
206:             * @return suite ID
207:             */
208:            public int getID() {
209:                return suite.getID();
210:            }
211:
212:            /**
213:             * Ask the user want to interrupt the current MIDlet with
214:             * a new MIDlet that has received network data.
215:             *
216:             * @param connection connection to place in the permission question or
217:             *        null for alarm
218:             *
219:             * @return true if the use wants interrupt the current MIDlet, else false
220:             */
221:            public boolean permissionToInterrupt(String connection) {
222:                return suite.permissionToInterrupt(connection);
223:            }
224:
225:            /**
226:             * Indicates if the named MIDlet is registered in the suite
227:             * with MIDlet-&lt;n&gt; record in the manifest or
228:             * application descriptor.
229:             * @param midletClassName class name of the MIDlet to be checked
230:             *
231:             * @return true if the MIDlet is registered
232:             */
233:            public boolean isRegistered(String midletClassName) {
234:                return suite.isRegistered(midletClassName);
235:            }
236:
237:            /**
238:             * Indicates if this suite is trusted.
239:             * (not to be confused with a domain named "trusted",
240:             * this is used for extra checks beyond permission checking)
241:             *
242:             * @return true if the suite is trusted false if not
243:             */
244:            public boolean isTrusted() {
245:                return suite.isTrusted();
246:            }
247:
248:            /**
249:             * Check whether the suite classes are preverified and
250:             * the suite content hasn't been changed since installation
251:             *
252:             * @return true if no more verification needed, false otherwise
253:             */
254:            public boolean isVerified() {
255:                return suite.isVerified();
256:            }
257:
258:            /**
259:             * Determine if the a MIDlet from this suite can be run. Note that
260:             * disable suites can still have their settings changed and their
261:             * install info displayed.
262:             *
263:             * @return true if suite is enabled, false otherwise
264:             */
265:            public boolean isEnabled() {
266:                return suite.isEnabled();
267:            }
268:
269:            /**
270:             * Close the opened MIDletSuite
271:             */
272:            public void close() {
273:                suite.close();
274:            }
275:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.