Package javax.management

Examples of javax.management.MBeanInfo


            MBeanGBeanBridge mbeanGBeanBridge = null;
            synchronized (this) {
                if (registry.containsKey(objectName)) {
                    return;
                }
                MBeanInfo mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(objectName));
                mbeanGBeanBridge = new MBeanGBeanBridge(kernel, objectName, mbeanInfo);
                registry.put(objectName, mbeanGBeanBridge);
            }
            mbeanServer.registerMBean(mbeanGBeanBridge, objectName);
        } catch (GBeanNotFoundException e) {
View Full Code Here


                        while ( iter.hasNext() && this.next == null ) {
                            final String name = iter.next();
                            if ( name.startsWith(":") ) {
                                try {
                                    final ObjectName on = new ObjectName(name.substring(1));
                                    final MBeanInfo info = mbeanServer.getMBeanInfo(on);
                                    final String path = convertObjectNameToResourcePath(on);
                                    final int sep = path.lastIndexOf('/');
                                    this.next = new MBeanResource(mbeanServer, parent.getResourceResolver(), path, parent.getPath() + "/" + path.substring(sep + 1), info, on);
                                } catch (final IntrospectionException e) {
                                    // ignore
View Full Code Here

                // MBean name / path
                String checkPath = subPath;
                String pathInfo = null;

                ObjectName objectName = null;
                MBeanInfo mbi = null;

                while ( checkPath.length() > 0 && mbi == null ) {
                    try {
                        objectName = this.convertResourcePathToObjectName(checkPath);
                        if ( objectName != null ) {
View Full Code Here

     *
     * @see javax.management.DynamicMBean#getMBeanInfo()
     */
    public MBeanInfo getMBeanInfo() {
        if ( statistics == null ) {
            return new MBeanInfo(this.getClass().getName(),
                "Repository Statistics Unavailable", null, null, null, null);
        }
        List<MBeanAttributeInfo> attributesList = new ArrayList<MBeanAttributeInfo>();
        Set<String> typeNames = new HashSet<String>();
        Iterator<Entry<String, TimeSeries>> statIter = statistics.iterator();
        while (statIter.hasNext()) {
            Entry<String, TimeSeries> entry = statIter.next();
            attributesList.add(new MBeanAttributeInfo("PerSecond_"
                    + entry.getKey(), long.class.getName(),
                    "Current per second value of " + entry.getKey(),
                    true, false, false));
            attributesList.add(new MBeanAttributeInfo("LastMinutePerSecond_"
                    + entry.getKey(), long[].class.getName(),
                    "Last minute of per seconds values of "
                            + entry.getKey(), true, false, false));
            attributesList.add(new MBeanAttributeInfo("PerMinute"
                    + entry.getKey(), long.class.getName(),
                    "Current per minute value of " + entry.getKey(),
                    true, false, false));
            attributesList.add(new MBeanAttributeInfo("LastHourPerMinute_"
                    + entry.getKey(), long[].class.getName(),
                    "Last hour of per minute values of "
                            + entry.getKey(), true, false, false));
            attributesList.add(new MBeanAttributeInfo("PerHour_"
                    + entry.getKey(), long.class.getName(),
                    "Current per hour value of " + entry.getKey(), true,
                    false, false));
            attributesList.add(new MBeanAttributeInfo("LastWeekPerHour_"
                    + entry.getKey(), long[].class.getName(),
                    "Last week of per hour values of " + entry.getKey(),
                    true, false, false));
            attributesList.add(new MBeanAttributeInfo("PerWeek_"
                    + entry.getKey(), long.class.getName(),
                    "Current per week value of " + entry.getKey(), true,
                    false, false));
            attributesList.add(new MBeanAttributeInfo("LastYearPerWeek_"
                    + entry.getKey(), long[].class.getName(),
                    "Last year of per week values of " + entry.getKey(),
                    true, false, false));
            typeNames.add(entry.getKey());
        }
        for (Type t : Type.values()) {
            final String name = t.name();
            if (!typeNames.contains(name)) {
                attributesList.add(new MBeanAttributeInfo(name, long.class
                        .getName(), "Current counter value of " + name,
                        true, false, false));
                typeNames.add(name);
            }
        }
        MBeanAttributeInfo[] attributes = attributesList
                .toArray(new MBeanAttributeInfo[attributesList.size()]);
        return new MBeanInfo(this.getClass().getName(),
                "Repository Statistics", attributes, null, null, null);
    }
View Full Code Here

   * @throws IntrospectionException
   * @throws InstanceNotFoundException
   */
  private List<Signature> getSignatures(ObjectName objectName)throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException{
    List<Signature> methods=new ArrayList<Signature>();
    MBeanInfo minfo;
    MBeanAttributeInfo[] attributes=null;
      minfo = mbeanServer.getMBeanInfo(objectName);
      attributes=minfo.getAttributes();
   
    for (MBeanAttributeInfo info : attributes) {
      String name=info.getName().substring(0, 1).toUpperCase()+info.getName().substring(1);
      if(info.isReadable()){
        //For each readable attribute, we generate a getter method (following the isXX for booleans
        //when it is being used on the remote side)
      if(info.isIs()){
        methods.add(new Signature("is"+name, Type.BOOLEAN_TYPE, new Type[0]));
      }
      else{
        try{
        methods.add(new Signature("get"+name, getType(info.getType()), new Type[0]));
        }catch(ClassNotFoundException cnfe){
          System.out.println("JMXINTROSPECTOR WARNING: "+info.getType()+" could not be found. Attribute will not be added to proxy.");
          continue;
       
        }
      }
      //Same with each writable att, but with setters.
      if(info.isWritable()){
        try{
        Type [] params=new Type[]{getType(info.getType())};
        Signature s=new Signature("set"+name, Type.VOID_TYPE, params);
        methods.add(s);
        }catch(ClassNotFoundException cnfe){
          System.out.println("JMXINTROSPECTOR WARNING: "+info.getType()+" could not be found. Attribute will not be added to proxy.");
          continue;
       
      }
    }
    //same for each operation
    for (MBeanOperationInfo info : minfo.getOperations()) {
      try{
      Type[] params=new Type[info.getSignature().length];
      for (int i = 0; i < params.length; i++) {
        params[i]=getType(info.getSignature()[i].getType());
      }
View Full Code Here

   * @throws Exception
   */
  public Object newProxyInstance(String oname) throws MalformedObjectNameException, InstanceNotFoundException, IntrospectionException, ReflectionException, IOException{
    ObjectName objectName=ObjectName.getInstance(oname);
    Class iface=getInterface(oname);
    MBeanInfo info=mbeanServer.getMBeanInfo(objectName);
    boolean isBroadcaster=false;
    MBeanNotificationInfo[] notifs=info.getNotifications();
    if (notifs!=null && notifs.length!=0) isBroadcaster=true;
    //We first create the proxy for the remote mbean. If broadcasting supported, then it adds the broadcasting interface
    Object proxy=MBeanServerInvocationHandler.newProxyInstance(mbeanServer, objectName, iface, isBroadcaster);
    //We get the underlying invocation handler, needed for the wrapper handler. The wrapper adds the mbean interface functionality
    //and integrates JMX invocation handler.
View Full Code Here

      throw new MBeanException(e);
    }
  }

  public synchronized MBeanInfo getMBeanInfo() {
    return new MBeanInfo(getObject().getClass().getCanonicalName(),
                description,
                attrInfo,
                null,
                opInfo,
                null);
View Full Code Here

            }
            dNotification = lNotifications
                .toArray(new MBeanNotificationInfo[lNotifications.size()]);
        }

        m_mBeanInfo = new MBeanInfo(this.m_className, dDescription,
            dAttributes, null, // No constructor
            dOperations, dNotification);
    }
View Full Code Here

   private MBeanInfo getDynamicMBeanInfo(MBeanMetaData metadata)
   {
      Logger logger = getLogger();

      MBeanInfo info = null;
     
    try {
     info = ((DynamicMBean) metadata.mbean).getMBeanInfo();
    } catch (Exception x) {
       if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("getMBeanInfo threw: " + x.toString());
View Full Code Here

      MBeanOperationInfo[] opers = createMBeanOperationInfo(metadata, description);
      if (opers == null) return null;
      MBeanNotificationInfo[] notifs = createMBeanNotificationInfo(metadata);
      if (notifs == null) return null;

      return new MBeanInfo(metadata.mbean.getClass().getName(), description.getMBeanDescription(), attrs, ctors, opers, notifs);
   }
View Full Code Here

TOP

Related Classes of javax.management.MBeanInfo

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.