Source Code Cross Referenced for MBeanServerPermission.java in  » JMX » jfoxmx » javax » management » 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 » JMX » jfoxmx » javax.management 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* JFox, the OpenSource J2EE Application Server
002:         *
003:         * Copyright (C) 2002 huihoo.org
004:         * Distributable under GNU LGPL license
005:         * See the GNU Lesser General Public License for more details.
006:         */
007:
008:        package javax.management;
009:
010:        import java.security.BasicPermission;
011:
012:        /**
013:         * A Permission to perform actions related to MBeanServers.
014:         * The <em>name</em> of the permission specifies the operation requested
015:         * or granted by the permission.  For a granted permission, it can be
016:         * <code>*</code> to allow all of the MBeanServer operations specified below.
017:         * Otherwise, for a granted or requested permission, it must be one of the
018:         * following:
019:         * <dl>
020:         * <dt>createMBeanServer</dt>
021:         * <dd>Create a new MBeanServer object using the method
022:         * {@link javax.management.MBeanServerFactory#createMBeanServer()} or
023:         * {@link javax.management.MBeanServerFactory#createMBeanServer(java.lang.String)}.
024:         * <dt>findMBeanServer</dt>
025:         * <dd>Find an MBeanServer with a given name, or all MBeanServers in this
026:         * JVM, using the method {@link javax.management.MBeanServerFactory#findMBeanServer}.
027:         * <dt>newMBeanServer</dt>
028:         * <dd>Create a new MBeanServer object without keeping a reference to it,
029:         * using the method {@link javax.management.MBeanServerFactory#newMBeanServer()} or
030:         * {@link javax.management.MBeanServerFactory#newMBeanServer(java.lang.String)}.
031:         * <dt>releaseMBeanServer</dt>
032:         * <dd>Remove the MBeanServerFactory's reference to an MBeanServer,
033:         * using the method {@link javax.management.MBeanServerFactory#releaseMBeanServer}.
034:         * </dl>
035:         * The <em>name</em> of the permission can also denote a list of one or more
036:         * comma-separated operations.  Spaces are allowed at the beginning and
037:         * end of the <em>name</em> and before and after commas.
038:         * <p>
039:         * <code>MBeanServerPermission("createMBeanServer")</code> implies
040:         * <code>MBeanServerPermission("newMBeanServer")</code>.
041:         *
042:         * @author <a href="mailto:young_yy@hotmail.org">Young Yang</a>
043:         */
044:
045:        public class MBeanServerPermission extends BasicPermission {
046:
047:            public static final String CREATE_MBEAN_SERVER = "createMBeanServer";
048:            public static final String FIND_MBEAN_SERVER = "findMBeanServer";
049:            public static final String NEW_MBEAN_SERVER = "newMBeanServer";
050:            public static final String RELEASE_MBEAN_SERVER = "releaseMBeanServer";
051:            private static final String knownNames[] = { CREATE_MBEAN_SERVER,
052:                    FIND_MBEAN_SERVER, NEW_MBEAN_SERVER, RELEASE_MBEAN_SERVER };
053:
054:            private final static MBeanServerPermission CREATE_MBEAN_SERVER_PERMISSION = new MBeanServerPermission(
055:                    CREATE_MBEAN_SERVER);
056:            private final static MBeanServerPermission FIND_MBEAN_SERVER_PERMISSION = new MBeanServerPermission(
057:                    FIND_MBEAN_SERVER);
058:            private final static MBeanServerPermission NEW_MBEAN_SERVER_PERMISSION = new MBeanServerPermission(
059:                    NEW_MBEAN_SERVER);
060:            private final static MBeanServerPermission RELEASE_MBEAN_SERVER_PERMISSION = new MBeanServerPermission(
061:                    RELEASE_MBEAN_SERVER);
062:
063:            /**
064:             * Create a new MBeanServerPermission with the given name.
065:             * This constructor is equivalent to MBeanServerPermission(name,null).
066:             *
067:             * @param name the name of the granted permission.
068:             *             It must respect the constraints spelt out in the description of the MBeanServerPermission class.
069:             */
070:            public MBeanServerPermission(String name) {
071:                this (name, null);
072:            }
073:
074:            /**
075:             * Create a new MBeanServerPermission with the given name.
076:             *
077:             * @param name the name of the granted permission.
078:             *             It must respect the constraints spelt out in the description of the MBeanServerPermission class.
079:             * @param action the associated actions.
080:             *               This parameter is not currently used and must be null or the empty string.
081:             */
082:            public MBeanServerPermission(String name, String action) {
083:                super (name);
084:                if (action != null && action.length() > 0)
085:                    throw new IllegalArgumentException(
086:                            "MBeanServerPermission actions must be null: "
087:                                    + action);
088:                if (name.equals("*"))
089:                    return;
090:                for (int i = 0; i < knownNames.length; i++) {
091:                    if (name.equals(knownNames[i]))
092:                        return;
093:                }
094:                throw new IllegalArgumentException(
095:                        "unknown MBeanServerPermission: " + name);
096:            }
097:
098:            static MBeanServerPermission getInstance(String name)
099:                    throws SecurityException {
100:                if (name.equalsIgnoreCase(CREATE_MBEAN_SERVER)) {
101:                    return CREATE_MBEAN_SERVER_PERMISSION;
102:                } else if (name.equalsIgnoreCase(FIND_MBEAN_SERVER)) {
103:                    return FIND_MBEAN_SERVER_PERMISSION;
104:                } else if (name.equalsIgnoreCase(NEW_MBEAN_SERVER)) {
105:                    return NEW_MBEAN_SERVER_PERMISSION;
106:                } else if (name.equalsIgnoreCase(RELEASE_MBEAN_SERVER)) {
107:                    return RELEASE_MBEAN_SERVER_PERMISSION;
108:                } else {
109:                    throw new SecurityException(
110:                            "No such MBeanServerPermission: " + name);
111:                }
112:            }
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.