Package javax.management

Examples of javax.management.MBeanServerPermission


      server.registerMBean(mbean, name);
   }

   public void testSetAttribute() throws Exception
   {
      addPermission(new MBeanServerPermission("newMBeanServer"));
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      testSetAttribute(server);
   }


      testSetAttribute(server);
   }

   public void testSetAttributes() throws Exception
   {
      addPermission(new MBeanServerPermission("newMBeanServer"));
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      testSetAttributes(server);
   }

      testSetAttributes(server);
   }

   public void testUnregisterMBean() throws Exception
   {
      addPermission(new MBeanServerPermission("newMBeanServer"));
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      testUnregisterMBean(server);
   }

      testUnregisterMBean(server);
   }

   public void testGetClassLoader() throws Exception
   {
      addPermission(new MBeanServerPermission("newMBeanServer"));
      MBeanServer server = MBeanServerFactory.newMBeanServer();

      // Needed to create an MLet, which is a ClassLoader
      addPermission(new RuntimePermission("createClassLoader"));
      ObjectName name = new ObjectName(server.getDefaultDomain(), "mbean", "mlet");

      assertSame(result, mlet);
   }

   public void testGetClassLoaderFor() throws Exception
   {
      addPermission(new MBeanServerPermission("newMBeanServer"));
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      ObjectName delegate = ObjectName.getInstance("JMImplementation", "type", "MBeanServerDelegate");
      try
      {
         server.getClassLoaderFor(delegate);

      assertNotNull(loader);
   }

   public void testGetClassLoaderRepository() throws Exception
   {
      addPermission(new MBeanServerPermission("newMBeanServer"));
      MBeanServer server = MBeanServerFactory.newMBeanServer();
      try
      {
         server.getClassLoaderRepository();
         fail();

     * @see javax.management.MBeanServerFactory#createMBeanServer
     */
    public static synchronized MBeanServer getPlatformMBeanServer() {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            Permission perm = new MBeanServerPermission("createMBeanServer");
            sm.checkPermission(perm);
        }

        if (platformMBeanServer == null) {
            platformMBeanServer = MBeanServerFactory.createMBeanServer();

     * @see javax.management.MBeanServerPermission
     */
    public static MBeanServer getPlatformMBeanServer() {
        SecurityManager security = System.getSecurityManager();
        if (security != null) {
            security.checkPermission(new MBeanServerPermission(
                    "createMBeanServer"));
        }

        synchronized (ManagementFactory.class) {
            if (platformServer == null) {

     * @see javax.management.MBeanServerPermission
     */
    public static MBeanServer getPlatformMBeanServer() {
        SecurityManager security = System.getSecurityManager();
        if (security != null) {
            security.checkPermission(new MBeanServerPermission(
                    "createMBeanServer"));
        }

        synchronized (ManagementFactory.class) {
            if (platformServer == null) {

     * @see javax.management.MBeanServerFactory#createMBeanServer
     */
    public static synchronized MBeanServer getPlatformMBeanServer() {
        SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            Permission perm = new MBeanServerPermission("createMBeanServer");
            sm.checkPermission(perm);
        }

        if (platformMBeanServer == null) {
            platformMBeanServer =

TOP

Related Classes of javax.management.MBeanServerPermission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.