Esempio n. 1
0
        private ObjectInstance RegisterMBeanExternal(object bean, ObjectName name)
        {
            IDynamicMBean dynBean = bean as IDynamicMBean;

            if (dynBean != null)
            {
                return(RegisterMBeanInternal(name, dynBean));
            }
            else
            {
                Type beanType = bean.GetType();
                Type intfType = null;
                while (beanType != null)
                {
                    intfType = beanType.GetInterface(beanType.Name + "MBean", false);
                    if (intfType != null)
                    {
                        break;
                    }
                    beanType = beanType.BaseType;
                }
                if (intfType == null)
                {
                    throw new NotCompliantMBeanException(beanType.AssemblyQualifiedName);
                }
                StandardMBean stdBean = new StandardMBean(bean, intfType);
                return(RegisterMBeanInternal(name, stdBean));
            }
        }
Esempio n. 2
0
 private ObjectInstance RegisterMBeanExternal(object bean, ObjectName name)
 {
     IDynamicMBean dynBean = bean as IDynamicMBean;
     if (dynBean != null)
     {
         return RegisterMBeanInternal(name, dynBean);
     }
     else
     {
         Type beanType = bean.GetType();
         Type intfType = null;
         while (beanType != null)
         {
             intfType = beanType.GetInterface(beanType.Name + "MBean", false);
             if (intfType != null)
             {
                 break;
             }
             beanType = beanType.BaseType;
         }
         if (intfType == null)
         {
             throw new NotCompliantMBeanException(beanType.AssemblyQualifiedName);
         }
         StandardMBean stdBean = new StandardMBean(bean, intfType);
         return RegisterMBeanInternal(name, stdBean);
     }
 }