Examples of MBeanInfo


Examples of javax.management.MBeanInfo

   }

   public MBeanInfo getMBeanInfo(ObjectName name)
      throws InstanceNotFoundException, IntrospectionException, ReflectionException {

      MBeanInfo info = x.getMBeanInfo(name);
      return  new MBeanInfo(
         info.getClassName(),
         info.getDescription(),
         deepCopy(info.getAttributes()), // Strip the Descriptors
         info.getConstructors(),
         info.getOperations(),
         info.getNotifications());
   }
View Full Code Here

Examples of javax.management.MBeanInfo

      log.debug("Invoke " + name);

      MBeanServerConnection server = getMBeanServer();
     
      // get mbean info for this mbean
      MBeanInfo info = server.getMBeanInfo(name);
     
      // does it even have an operation of this name?
      MBeanOperationInfo[] ops = info.getOperations();
      MBeanOp inputOp = new MBeanOp(opName, opArgs.size());
      MBeanOp matchOp = null;
      ArrayList opList = new ArrayList();
      for (int i = 0; i < ops.length; i++)
      {
View Full Code Here

Examples of javax.management.MBeanInfo

      if (objectName == null)
         throw new CommandException("Missing object name");

      MBeanServerConnection server = getMBeanServer();
      MBeanInfo mbeanInfo = server.getMBeanInfo(objectName);
      MBeanAttributeInfo[] attrInfo = mbeanInfo.getAttributes();
      MBeanOperationInfo[] opInfo = mbeanInfo.getOperations();

      PrintWriter out = context.getWriter();
      out.println("Description: "+mbeanInfo.getDescription());
      out.println("+++ Attributes:");
      int length = attrInfo != null ? attrInfo.length : 0;
      for(int n = 0; n < length; n ++)
      {
         MBeanAttributeInfo info = attrInfo[n];
View Full Code Here

Examples of javax.management.MBeanInfo

      MBeanServerConnection server = getMBeanServer();
      if (attributeNames.size() == 0)
      {
         // Display all readable attributes
         attributeNames.clear();
         MBeanInfo info = server.getMBeanInfo(objectName);
         MBeanAttributeInfo[] attrInfos = info.getAttributes();
         for (int a = 0; a < attrInfos.length; a++)
         {
            MBeanAttributeInfo attrInfo = attrInfos[a];
            if (attrInfo.isReadable())
               attributeNames.add(attrInfo.getName());
View Full Code Here

Examples of javax.management.MBeanInfo

    {
      throw new CommandException("Wrong number of arguments");
    }
    MBeanServerConnection server = getMBeanServer();

    MBeanInfo info = server.getMBeanInfo(objectName);
   
    MBeanAttributeInfo[] attrs = info.getAttributes();
   
    MBeanAttributeInfo attr=null;

    boolean found = false;
    for (int i=0;i < attrs.length ; i++ )
View Full Code Here

Examples of javax.management.MBeanInfo

      {
         throw new CommandException("Missing object name");
      }
      ObjectName target = super.createObjectName(args[0]);

      MBeanInfo mbeanInfo = getMBeanServer().getMBeanInfo(target);
      MBeanConstructorInfo[] ctors = mbeanInfo.getConstructors();
      MBeanAttributeInfo[] attrs = mbeanInfo.getAttributes();
      MBeanOperationInfo[] ops = mbeanInfo.getOperations();
      MBeanNotificationInfo[] notifs = mbeanInfo.getNotifications();
     
      PrintWriter out = context.getWriter();

      // header
      out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
      out.println("<!DOCTYPE mbean PUBLIC");
      out.println("   \"-//JBoss//DTD JBOSS XMBEAN 1.2//EN\"");
      out.println("   \"http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_2.dtd\">");
      out.println("<!--");
      out.println("   xmbean descriptor generated by 'twiddle'");
      out.println("   on " new Date());
      out.println("   for '" + target + "'");
      out.println("-->");
     
      out.println("<mbean>");
     
      // mbean
      out.println("   <description>" + mbeanInfo.getDescription() + "</description>");
      out.println("   <class>" + mbeanInfo.getClassName() + "</class>");
      out.println();
     
      // constructors
      if (ctors.length > 0)
      {
View Full Code Here

Examples of javax.management.MBeanInfo

      if (attributeNames.size() == 0)
      {
         throw new CommandException("at least 1 attribute and value needs to be defined");
      }

      MBeanInfo info = server.getMBeanInfo(objectName);
      MBeanAttributeInfo[] attribute_info = info.getAttributes();
      String type;
      AttributeList attrs = new AttributeList(attributeNames.size());
      Attribute attr;
      String attr_name;
      Object attr_value, real_value;
View Full Code Here

Examples of javax.management.MBeanInfo

      {
      }
      MBeanOperationInfo[] opInfo = {
         new MBeanOperationInfo("Access the LoginConfiguration", getConfiguration)
      };
      MBeanInfo info = new MBeanInfo(c.getName(), "Default JAAS LoginConfig",
         attrInfo, ctorInfo, opInfo, null);
      return info;
   }
View Full Code Here

Examples of javax.management.MBeanInfo

   }

   protected MBeanInfo generateMBeanInfo (Class[] intfs)
      throws IntrospectionException
   {
      MBeanInfo result = super.getMBeanInfo();

      if (intfs != null && intfs.length > 0)
      {
         ArrayList attrs = new ArrayList (Arrays.asList(result.getAttributes()));
         ArrayList ops = new ArrayList (Arrays.asList(result.getOperations()));

         HashMap readAttr = new HashMap ();
         HashMap writeAttr = new HashMap ();

         //  we now populate the MBeanInfo with information from our script
         //
         for (int i=0; i<intfs.length; i++)
         {
            Class clazz = intfs[i];
            Method[] methods = clazz.getMethods();
            for (int m=0; m<methods.length; m++)
            {
               Method meth = methods[m];
               String name = meth.getName();
               Class[] params = meth.getParameterTypes();

               if (name.startsWith("get") && params.length == 0)
               {
                  readAttr.put (name, meth);
               }
               else if (name.startsWith("set") && params.length == 1)
               {
                  writeAttr.put (name, meth);
               }
               else
               {
                  ops.add(new MBeanOperationInfo
                     (
                     "Method " + name + " from class/interface " + clazz.getName(), meth
                     )
                  );

               }
            }
         }

         // we now combine the getters and setters in single RW attributes
         //
         Iterator readKeys = readAttr.keySet().iterator();
         while (readKeys.hasNext())
         {
            String getter = (String)readKeys.next();
            Method getterMethod = (Method)readAttr.get( getter );

            String attribute = getter.substring(3);
            String setter = "set" + attribute;

            Method setterMethod = (Method)writeAttr.remove(setter);
            attrs.add (new MBeanAttributeInfo (attribute, "", getterMethod, setterMethod));
         }

         // we  add the remaining WO attributes
         //
         Iterator writeKeys = writeAttr.keySet().iterator();
         while (writeKeys.hasNext())
         {
            String setter = (String)writeKeys.next();
            Method setterMethod = (Method)writeAttr.get( setter );
            String attribute = setter.substring(3);

            attrs.add (new MBeanAttributeInfo (attribute, "", null, setterMethod));
         }


         result = new MBeanInfo(this.name,
                           "Dynamic MBean Service around BSH script " + this.name,
                           (MBeanAttributeInfo[])attrs.toArray(new MBeanAttributeInfo[attrs.size()]),
                           result.getConstructors(),
                           (MBeanOperationInfo[])ops.toArray(new MBeanOperationInfo[ops.size()]),
                           result.getNotifications());
      }

      return result;
   }
View Full Code Here

Examples of javax.management.MBeanInfo

         ServiceFactory factory = (ServiceFactory) clazz.newInstance();
         service = factory.createService(server, objectName);
      }
      else
      {
         MBeanInfo info = server.getMBeanInfo(objectName);
         MBeanOperationInfo[] opInfo = info.getOperations();
         Class[] interfaces = {Service.class};
         InvocationHandler handler = new ServiceProxy(objectName, opInfo);
         service = (Service) Proxy.newProxyInstance(Service.class.getClassLoader(), interfaces, handler);
      }
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.