Source Code Cross Referenced for SecurityConstants.java in  » 6.0-JDK-Modules » j2me » sun » security » util » 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 » sun.security.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * @(#)SecurityConstants.java	1.12 06/10/10
003:         *
004:         * Copyright  1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006:         * 
007:         * This program is free software; you can redistribute it and/or
008:         * modify it under the terms of the GNU General Public License version
009:         * 2 only, as published by the Free Software Foundation. 
010:         * 
011:         * This program is distributed in the hope that it will be useful, but
012:         * WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014:         * General Public License version 2 for more details (a copy is
015:         * included at /legal/license.txt). 
016:         * 
017:         * You should have received a copy of the GNU General Public License
018:         * version 2 along with this work; if not, write to the Free Software
019:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020:         * 02110-1301 USA 
021:         * 
022:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023:         * Clara, CA 95054 or visit www.sun.com if you need additional
024:         * information or have any questions. 
025:         */
026:
027:        package sun.security.util;
028:
029:        import java.io.FilePermission;
030:        import java.lang.RuntimePermission;
031:        import java.net.SocketPermission;
032:        import java.net.NetPermission;
033:        import java.security.SecurityPermission;
034:        import java.security.AllPermission;
035:        import java.security.BasicPermission;
036:        import java.lang.reflect.Constructor;
037:        import java.lang.reflect.InvocationTargetException;
038:
039:        /* javax.security.auth.AuthPermission subsetted out
040:         * of CDC
041:         import javax.security.auth.AuthPermission;
042:         */
043:
044:        /*
045:         * Note that there are two versions of this file, this subsetted
046:         * version for CDC and another for the security optional package.
047:         * Be sure you're editting the right one!
048:         */
049:
050:        /**
051:         * Permission constants and string constants used to create permissions
052:         * used throughout the JDK.
053:         */
054:        public final class SecurityConstants {
055:            // Cannot create one of these
056:            private SecurityConstants() {
057:            }
058:
059:            // Commonly used string constants for permission actions used by
060:            // SecurityManager. Declare here for shortcut when checking permissions
061:            // in FilePermssion, SocketPermission, and PropertyPermission.
062:
063:            public static final String FILE_DELETE_ACTION = "delete";
064:            public static final String FILE_EXECUTE_ACTION = "execute";
065:            public static final String FILE_READ_ACTION = "read";
066:            public static final String FILE_WRITE_ACTION = "write";
067:
068:            public static final String SOCKET_RESOLVE_ACTION = "resolve";
069:            public static final String SOCKET_CONNECT_ACTION = "connect";
070:            public static final String SOCKET_LISTEN_ACTION = "listen";
071:            public static final String SOCKET_ACCEPT_ACTION = "accept";
072:            public static final String SOCKET_CONNECT_ACCEPT_ACTION = "connect,accept";
073:
074:            public static final String PROPERTY_RW_ACTION = "read,write";
075:            public static final String PROPERTY_READ_ACTION = "read";
076:            public static final String PROPERTY_WRITE_ACTION = "write";
077:
078:            // Permission constants used in the various checkPermission() calls in JDK.
079:
080:            // java.lang.Class, java.lang.SecurityManager, java.lang.System,
081:            // java.net.URLConnection, java.security.AllPermission, java.security.Policy,
082:            // sun.security.provider.PolicyFile
083:            public static final AllPermission ALL_PERMISSION = new AllPermission();
084:
085:            // java.net.URL
086:            public static final NetPermission SPECIFY_HANDLER_PERMISSION = new NetPermission(
087:                    "specifyStreamHandler");
088:
089:            // java.lang.SecurityManager, sun.applet.AppletPanel, sun.misc.Launcher
090:            public static final RuntimePermission CREATE_CLASSLOADER_PERMISSION = new RuntimePermission(
091:                    "createClassLoader");
092:
093:            // java.lang.SecurityManager
094:            public static final RuntimePermission CHECK_MEMBER_ACCESS_PERMISSION = new RuntimePermission(
095:                    "accessDeclaredMembers");
096:
097:            // java.lang.SecurityManager, sun.applet.AppletSecurity
098:            public static final RuntimePermission MODIFY_THREAD_PERMISSION = new RuntimePermission(
099:                    "modifyThread");
100:
101:            // java.lang.SecurityManager, sun.applet.AppletSecurity
102:            public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION = new RuntimePermission(
103:                    "modifyThreadGroup");
104:
105:            // java.lang.Class
106:            public static final RuntimePermission GET_PD_PERMISSION = new RuntimePermission(
107:                    "getProtectionDomain");
108:
109:            // java.lang.Class, java.lang.ClassLoader, java.lang.Thread
110:            public static final RuntimePermission GET_CLASSLOADER_PERMISSION = new RuntimePermission(
111:                    "getClassLoader");
112:
113:            // java.lang.Thread
114:            public static final RuntimePermission STOP_THREAD_PERMISSION = new RuntimePermission(
115:                    "stopThread");
116:
117:            // java.security.AccessControlContext
118:            public static final SecurityPermission CREATE_ACC_PERMISSION = new SecurityPermission(
119:                    "createAccessControlContext");
120:
121:            // java.security.AccessControlContext
122:            public static final SecurityPermission GET_COMBINER_PERMISSION = new SecurityPermission(
123:                    "getDomainCombiner");
124:
125:            // java.security.Policy, java.security.ProtectionDomain
126:            public static final SecurityPermission GET_POLICY_PERMISSION = new SecurityPermission(
127:                    "getPolicy");
128:
129:            // java.lang.SecurityManager
130:            public static final SocketPermission LOCAL_LISTEN_PERMISSION = new SocketPermission(
131:                    "localhost:1024-", SOCKET_LISTEN_ACTION);
132:
133:            /* javax.security.auth.AuthPermission subsetted out of CDC.
134:            // javax.security.auth.Subject
135:            public static final AuthPermission DO_AS_PERMISSION =
136:                new AuthPermission("doAs");
137:            
138:            // javax.security.auth.Subject
139:            public static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
140:                new AuthPermission("doAsPrivileged");
141:             */
142:
143:            // Make this class more friendly for mTASK:
144:            // To eagerly initialize topLevelWindowPermission,
145:            // accessClipboardPermission and checkAwtEventQueuePermission,
146:            // the private static method initAwtPerms() is now changed to
147:            // be a static initializer. 
148:            //
149:            // The static variable, isAwtPermInitialized is no longer in use.
150:            //
151:            //private static boolean isAwtPermInitialized = false;
152:            private static BasicPermission topLevelWindowPermission;
153:
154:            private static BasicPermission accessClipboardPermission;
155:
156:            private static BasicPermission checkAwtEventQueuePermission;
157:
158:            public static BasicPermission getTopLevelWindowPermission() {
159:                //if (!isAwtPermInitialized)
160:                //    initAwtPerms();
161:                return topLevelWindowPermission;
162:            }
163:
164:            public static BasicPermission getAccessClipboardPermission() {
165:                //if (!isAwtPermInitialized)
166:                //    initAwtPerms();
167:                return accessClipboardPermission;
168:            }
169:
170:            public static BasicPermission getCheckAwtEventQueuePermission() {
171:                //if (!isAwtPermInitialized)
172:                //    initAwtPerms();
173:                return checkAwtEventQueuePermission;
174:            }
175:
176:            // use reflection to find out whether AWT classes are available
177:            static {
178:                Constructor AwtPermissionCtor = null;
179:                try {
180:                    AwtPermissionCtor = Class.forName("java.awt.AWTPermission")
181:                            .getConstructor(new Class[] { String.class });
182:                } catch (ClassNotFoundException ce) {
183:                    // No AWT, so what are you playing with windows for?
184:                    //isAwtPermInitialized = true; // no longer need
185:                    //return; 
186:                } catch (NoSuchMethodException ne) {
187:                    throw new SecurityException(
188:                            "AWTPermission constructor changed");
189:                }
190:
191:                if (AwtPermissionCtor != null) {
192:                    try {
193:                        topLevelWindowPermission = (BasicPermission) AwtPermissionCtor
194:                                .newInstance(new Object[] { "showWindowWithoutWarningBanner" });
195:                    } catch (InstantiationException ie) {
196:                    } catch (IllegalAccessException iae) {
197:                    } catch (InvocationTargetException ite) {
198:                    }
199:                    try {
200:                        checkAwtEventQueuePermission = (BasicPermission) AwtPermissionCtor
201:                                .newInstance(new Object[] { "accessEventQueue" });
202:                    } catch (InstantiationException ie) {
203:                    } catch (IllegalAccessException iae) {
204:                    } catch (InvocationTargetException ite) {
205:                    }
206:                    try {
207:                        accessClipboardPermission = (BasicPermission) AwtPermissionCtor
208:                                .newInstance(new Object[] { "accessClipboard" });
209:                    } catch (InstantiationException ie) {
210:                    } catch (IllegalAccessException iae) {
211:                    } catch (InvocationTargetException ite) {
212:                    }
213:
214:                    //isAwtPermInitialized = true; // no longer need
215:                    //return; 
216:                }
217:            }
218:
219:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.