Examples of MLet


Examples of javax.management.loading.MLet

      {
         // expected
      }
    
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      server.registerMBean(mlet, name);
     
      Set mbeans = (Set)server.invoke(name, "getMBeansFromURL",
                                      new Object[] { MLET_URL },
                                      new String[] { String.class.getName() }
      );

      try
      {        
         assertTrue(server.isRegistered(new ObjectName("test:name=Trivial")));
         assertTrue(server.isRegistered(new ObjectName("test:name=Trivial2")));
      }
      catch (AssertionFailedError e)
      {
         URL[] urls = mlet.getURLs();
         URL url = null;
        
         if (urls != null && urls.length > 0)
            url = urls[0];
        
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // NOTE:
      // the urls used here are relative to the location of the build.xml
     
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      try
      {
         server.registerMBean(mlet, name);
        
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // NOTE:
      // the urls used here are relative to the location of the build.xml
     
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      try
      {
         server.registerMBean(mlet, name);
        
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // NOTE:
      // the urls used here are relative to the location of the build.xml
     
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      try
      {
         server.registerMBean(mlet, name);
        
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // NOTE:
      // the urls used here are relative to the location of the build.xml
     
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      try
      {
         server.registerMBean(mlet, name);
        
View Full Code Here

Examples of javax.management.loading.MLet

      // the urls used here are relative to the location of the build.xml
     
      final String MLET_URL = "file:./output/etc/test/compliance/loading/ArchiveList.mlet";
  
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");

      try
      {
         server.registerMBean(mlet, name);
     
         server.invoke(name, "getMBeansFromURL",
         new Object[] { MLET_URL },
         new String[] { String.class.getName() }
         );
     
         Class c = null;
     
         try
         {
            c  = mlet.loadClass("test.compliance.loading.support.AClass");
         }
         catch (ClassNotFoundException e)
         {
            URL[] urls = mlet.getURLs();
            fail("FAILS IN RI: SUN JMX RI builds a malformed URL from an MLet text file URL '" +
                 MLET_URL + "' resulting into MLET codebase URL '" + urls[0] + "' and therefore fails " +
                 "to load the required classes from the Java archive.");           
         }
     
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // NOTE:
      // the urls used here are relative to the location of the build.xml
     
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      try
      {
         server.registerMBean(mlet, name);
        
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // NOTE:
      // the urls used here are relative to the location of the build.xml
     
      MBeanServer server = MBeanServerFactory.createMBeanServer();
      MLet mlet = new MLet();
      ObjectName name = new ObjectName("test:name=mlet");
      try
      {
         server.registerMBean(mlet, name);
        
View Full Code Here

Examples of javax.management.loading.MLet

   {
      // Create the MBeanServer
      MBeanServer server = MBeanServerFactory.createMBeanServer();

      // Register the MLet in the MBeanServer
      MLet mlet = new MLet();
      ObjectName mletName = new ObjectName("system:mbean=loader");
      server.registerMBean(mlet, mletName);

      // Set the MLet as context classloader
      // Can be useful for the loaded services that want to access this classloader.
      Thread.currentThread().setContextClassLoader(mlet);

      // Resolve the file to load MBeans from
      // If we got a program argument, we load it from there, otherwise
      // we assume we have a 'mbeans.mlet' file in this example's directory
      URL mbeansURL = null;
      if (args.length == 1)
      {
         String file = args[0];
         mbeansURL = new File(file).toURL();
      }
      else
      {
         mbeansURL = mlet.getResource("examples/services/loading/mbeans.mlet");
      }

      // If the URL is still null, abort
      if (mbeansURL == null) throw new ServiceNotFoundException("Could not find MBeans to load");

      // Load the MBeans
      Set mbeans = mlet.getMBeansFromURL(mbeansURL);

      System.out.println("MLet has now the following classpath: " + Arrays.asList(mlet.getURLs()));

      // Now let's check everything is ok.
      checkMBeansLoadedSuccessfully(mbeans);

      // Now the system is loaded, but maybe we should initialize and start them
View Full Code Here

Examples of javax.management.loading.MLet

      m_server = MBeanServerFactory.createMBeanServer("test");
      try
      {
         // register the mlet used to load the MBeans MLet one
         ObjectName mName1 = new ObjectName("loading:test=mlet1");
         MLet mlet1 = new MLet();
         m_server.registerMBean(mlet1, mName1);
         mlet1.addURL(jarPath1);
//      mlet1.addURL(new File("one.jar").toURL());

         ObjectName mName2 = new ObjectName("loading:test=mlet2");
         MLet mlet2 = new MLet();
         m_server.registerMBean(mlet2, mName2);
         mlet2.addURL(jarPath2);
//      mlet2.addURL(new File("two.jar").toURL());

         String mbeanClass1 = "mx4j.examples.tools.persister.MBeanOne";
         ObjectName mbeanName1 = new ObjectName("test:name=MBeanOne");
         m_server.createMBean(mbeanClass1, mbeanName1, mName1,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.