Package javax.management

Examples of javax.management.MBeanServer.createMBean()


            MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();

            // Deploy an MBean of our own to run additional tests with a custom-jmx-plugin
            try {
                ObjectName mBeanName = new ObjectName("rhq.test:name=TestTarget");
                mBeanServer.createMBean(TestTarget.class.getName(), mBeanName);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            String jvmName = runtimeMXBean.getName();
            int atIndex = jvmName.indexOf('@');
View Full Code Here


      // The MBeanServer
      MBeanServer server = MBeanServerFactory.createMBeanServer();

      // Register and start the rmiregistry MBean, needed by JSR 160 RMIConnectorServer
      ObjectName namingName = ObjectName.getInstance("naming:type=rmiregistry");
      server.createMBean("mx4j.tools.naming.NamingService", namingName, null);
      server.invoke(namingName, "start", null, null);
      int namingPort = ((Integer)server.getAttribute(namingName, "Port")).intValue();

      String jndiPath = "/jmxconnector";
      JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost/jndi/rmi://localhost:" + namingPort + jndiPath);
View Full Code Here

      // Register and start the tnameserv MBean, needed by JSR 160 RMIConnectorServer over IIOP
      // You can also start the new JDK 1.4 'orbd' daemon, but you should do so externally
      // as there are no MBeans that wrap it.
      ObjectName namingName = ObjectName.getInstance("naming:type=tnameserv");
      server.createMBean("mx4j.tools.naming.CosNamingService", namingName, null);
      // Standard port for the COS naming service is 900, but that's a restricted port on Unix/Linux systems
      int namingPort = 1199;
      server.setAttribute(namingName, new Attribute("Port", new Integer(namingPort)));
      server.invoke(namingName, "start", null, null);
View Full Code Here

   {
      MBeanServer server = MBeanServerFactory.createMBeanServer();

      // Register and start the rmiregistry MBean
      ObjectName namingName = ObjectName.getInstance("naming:type=rmiregistry");
      server.createMBean("mx4j.tools.naming.NamingService", namingName, null);
      server.invoke(namingName, "start", null, null);
      int namingPort = ((Integer)server.getAttribute(namingName, "Port")).intValue();

      String jndiPath = "/ssljmxconnector";
      JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://localhost/jndi/rmi://localhost:" + namingPort + jndiPath);
View Full Code Here

      MBeanServer server = MBeanServerFactory.createMBeanServer("Mail");
      ObjectName beanName = new ObjectName("Test:name=test");
      server.registerMBean(new TestClass("original"), beanName);

      ObjectName monitorName = new ObjectName("Test:name=monitor");
      server.createMBean("javax.management.monitor.StringMonitor", monitorName, null);

      server.setAttribute(monitorName, new Attribute("ObservedObject", beanName));
      server.setAttribute(monitorName, new Attribute("ObservedAttribute", "Str"));
      server.setAttribute(monitorName, new Attribute("StringToCompare", "original"));
      server.setAttribute(monitorName, new Attribute("GranularityPeriod", new Integer(100)));
View Full Code Here

      server.setAttribute(monitorName, new Attribute("NotifyDiffer", Boolean.TRUE));

      server.invoke(monitorName, "start", null, null);

      ObjectName mailerName = new ObjectName("Test:name=mailer");
      server.createMBean("mx4j.tools.mail.SMTP", mailerName, null);

      // Sets attributes
      server.setAttribute(mailerName, new Attribute("ObservedObject", monitorName));
      server.setAttribute(mailerName, new Attribute("NotificationName", "jmx.monitor.string.differs"));
      server.setAttribute(mailerName, new Attribute("FromAddress", "monitor@someserver"));
View Full Code Here

   public void start() throws JMException, MalformedURLException
   {
      // creates new server
      MBeanServer server = MBeanServerFactory.createMBeanServer("Script");
      ObjectName scriptingName = new ObjectName("Test:name=script");
      server.createMBean("mx4j.tools.jython.JythonRunner", scriptingName, null);

      // Sample. Starts all monitors
      server.setAttribute(scriptingName, new Attribute("Script", "[proxy(name).start() for name in server.queryNames(None, None) if server.isInstanceOf(name, 'javax.management.monitor.Monitor')]"));
      server.invoke(scriptingName, "runScript", null, null);
View Full Code Here

   public void start() throws JMException, MalformedURLException
   {
      // creates new server
      MBeanServer server = MBeanServerFactory.createMBeanServer("test");
      ObjectName serverName = new ObjectName("Http:name=HttpAdaptor");
      server.createMBean("mx4j.tools.adaptor.http.HttpAdaptor", serverName, null);
      // set attributes
      if (port > 0)
      {
         server.setAttribute(serverName, new Attribute("Port", new Integer(port)));
      }
View Full Code Here

      {
         System.out.println("Incorrect null hostname");
      }
      // set the XSLTProcessor. If you want to use pure XML comment this out
      ObjectName processorName = new ObjectName("Http:name=XSLTProcessor");
      server.createMBean("mx4j.tools.adaptor.http.XSLTProcessor", processorName, null);
      if (path != null)
      {
         server.setAttribute(processorName, new Attribute("File", path));
      }
      server.setAttribute(processorName, new Attribute("UseCache", new Boolean(false)));
View Full Code Here

   public void start() throws JMException
   {
      // creates new server
      MBeanServer server = MBeanServerFactory.createMBeanServer("test");
      ObjectName serverName = new ObjectName("Http:name=HttpAdaptor");
      server.createMBean("mx4j.tools.adaptor.http.HttpAdaptor", serverName, null);
      // set attributes
      if (port > 0)
      {
         server.setAttribute(serverName, new Attribute("Port", new Integer(port)));
      }
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.