Java 类javax.management.openmbean.OpenMBeanInfoSupport 实例源码

项目:ChronoBike    文件:BaseOpenMBean.java   
private void registerOpenInfos(String csName, String csDescription)
{
    OpenMBeanAttributeInfo[] arrAttributes = null;
    if(m_arrOpenMBeanAttributeInfosWrapper != null)
    {
        int nNbItems = m_arrOpenMBeanAttributeInfosWrapper.size();
        arrAttributes = new OpenMBeanAttributeInfo[nNbItems]; 
        for(int n=0; n<nNbItems; n++)
        {
            OpenMBeanAttributeInfoWrapper wrapper = m_arrOpenMBeanAttributeInfosWrapper.get(n);
            arrAttributes[n] = wrapper.getAttribute();
        }
    } 

    m_OpenMBeanInfo = new OpenMBeanInfoSupport(csName, csDescription, arrAttributes, null, null, null); 
}
项目:tqdev-metrics    文件:JmxReporter.java   
@Override
public MBeanInfo getMBeanInfo() {

    ArrayList<OpenMBeanAttributeInfoSupport> attributes = new ArrayList<>();

    attributes.add(new OpenMBeanAttributeInfoSupport("enabled", "enabled", SimpleType.BOOLEAN, true, true, true));
    for (String type : registry.getTypes()) {
        attributes.add(new OpenMBeanAttributeInfoSupport(type, type, getCompositeType(type), true, false, false));
    }

    OpenMBeanParameterInfo[] params = new OpenMBeanParameterInfoSupport[0];
    OpenMBeanOperationInfoSupport reset = new OpenMBeanOperationInfoSupport("reset", "Reset all Metrics", params,
            SimpleType.VOID, MBeanOperationInfo.ACTION);

    OpenMBeanInfoSupport PSOMBInfo = new OpenMBeanInfoSupport(this.getClass().getName(), description,
            attributes.toArray(new OpenMBeanAttributeInfoSupport[0]), new OpenMBeanConstructorInfoSupport[0],
            new OpenMBeanOperationInfoSupport[] { reset }, new MBeanNotificationInfo[0]);

    return PSOMBInfo;
}
项目:Telepathology    文件:CacheManagerImpl.java   
private OpenMBeanInfoSupport createMBeanInfo() 
throws OpenDataException
{
        return new OpenMBeanInfoSupport(
                FileSystemCache.class.getName(), 
                "Cache Management (initializing, enabling, storing)", 
                createMBeanAttributeInfo(), 
                createMBeanConstructorInfo(), 
            createMBeanOperationInfo(), 
            createMBeanNotificationInfo()
        );
}
项目:wildfly-core    文件:MBeanInfoFactory.java   
private MBeanInfo createMBeanInfo() {
    return new OpenMBeanInfoSupport(ModelControllerMBeanHelper.CLASS_NAME,
            getDescription(providedDescription),
            getAttributes(),
            getConstructors(),
            getOperations(),
            getNotifications(),
            createMBeanDescriptor());
}
项目:freeVM    文件:RegistringOpenMBeanTest.java   
public MBeanInfo getMBeanInfo() {
    OpenMBeanParameterInfoSupport parameterInfoSupport = new OpenMBeanParameterInfoSupport(
        "par name", "descripttiosdf", SimpleType.STRING);
    OpenMBeanOperationInfo infoSupport = new OpenMBeanOperationInfoSupport(
        operationName, "desciption",
        new OpenMBeanParameterInfo[] { parameterInfoSupport },
        SimpleType.STRING, MBeanOperationInfo.ACTION);
    OpenMBeanAttributeInfoSupport attributeInfo = new OpenMBeanAttributeInfoSupport(
        attrName, "description", SimpleType.STRING, true, true, false);
    OpenMBeanInfoSupport beanInfoSupport = new OpenMBeanInfoSupport(this
        .getClass().getName(), "descriptor",
        new OpenMBeanAttributeInfo[] { attributeInfo }, null,
        new OpenMBeanOperationInfo[] { infoSupport }, null);
    return beanInfoSupport;
}
项目:freeVM    文件:CompositeDataSupportTest.java   
public MBeanInfo getMBeanInfo() {
    try {
        OpenMBeanOperationInfo infoSupport = new OpenMBeanOperationInfoSupport(
            operationName, "desciption", null, getCompositeType(),
            MBeanOperationInfo.ACTION);
        OpenMBeanInfoSupport beanInfoSupport = new OpenMBeanInfoSupport(
            this.getClass().getName(), "descriptor", null, null,
            new OpenMBeanOperationInfo[] { infoSupport }, null);
        return beanInfoSupport;
    } catch (OpenDataException e) {
        e.printStackTrace();
        assertTrue(false);
    }
    return null;
}
项目:freeVM    文件:TabularDataSupportTest.java   
public MBeanInfo getMBeanInfo() {
    try {
        OpenMBeanOperationInfo infoSupport = new OpenMBeanOperationInfoSupport(
            operationName, "desciption", null, getTabularType(),
            MBeanOperationInfo.ACTION);
        OpenMBeanInfoSupport beanInfoSupport = new OpenMBeanInfoSupport(
            this.getClass().getName(), "descriptor", null, null,
            new OpenMBeanOperationInfo[] { infoSupport }, null);
        return beanInfoSupport;
    } catch (Exception e) {
        e.printStackTrace();
        assertTrue(false);
    }
    return null;
}
项目:javify    文件:BeanImpl.java   
protected void cacheMBeanInfo(MBeanInfo info)
{
  if (info == null)
    return;
  try
    {
      MBeanAttributeInfo[] oldA = info.getAttributes();
      OpenMBeanAttributeInfo[] attribs =
        new OpenMBeanAttributeInfoSupport[oldA.length];
      for (int a = 0; a < oldA.length; ++a)
        {
          OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
          if (param.getMinValue() == null)
            {
              Object[] lv;
              if (param.getLegalValues() == null)
                lv = null;
              else
                lv = param.getLegalValues().toArray();
              attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                                                             oldA[a].getDescription(),
                                                             ((OpenType<Object>)
                                                              param.getOpenType()),
                                                             oldA[a].isReadable(),
                                                             oldA[a].isWritable(),
                                                             oldA[a].isIs(),
                                                             param.getDefaultValue(),
                                                             lv);
            }
          else
            attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                                                           oldA[a].getDescription(),
                                                           ((OpenType<Object>)
                                                            param.getOpenType()),
                                                           oldA[a].isReadable(),
                                                           oldA[a].isWritable(),
                                                           oldA[a].isIs(),
                                                           param.getDefaultValue(),
                                                           ((Comparable<Object>)
                                                             param.getMinValue()),
                                                           ((Comparable<Object>)
                                                             param.getMaxValue()));
        }
      MBeanConstructorInfo[] oldC = info.getConstructors();
      OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
      for (int a = 0; a < oldC.length; ++a)
        cons[a] =
          new OpenMBeanConstructorInfoSupport(oldC[a].getName(),
                                              oldC[a].getDescription(),
                                              translateSignature(oldC[a].getSignature()));
      MBeanOperationInfo[] oldO = info.getOperations();
      OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length];
      for (int a = 0; a < oldO.length; ++a)
        ops[a] =
      new OpenMBeanOperationInfoSupport(oldO[a].getName(),
                                        oldO[a].getDescription(),
                                        translateSignature(oldO[a].getSignature()),
                                        Translator.translate(oldO[a].getReturnType()).getOpenType(),
                                        oldO[a].getImpact());
      openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
                                          attribs, cons, ops, info.getNotifications());
    }
  catch (OpenDataException e)
    {
      throw (InternalError) (new InternalError("A problem occurred creating the open type " +
                                               "descriptors.").initCause(e));
    }
}
项目:jvm-stm    文件:BeanImpl.java   
protected void cacheMBeanInfo(MBeanInfo info)
 {
   if (info == null)
     return;
   try
     {
MBeanAttributeInfo[] oldA = info.getAttributes();
OpenMBeanAttributeInfo[] attribs =
  new OpenMBeanAttributeInfoSupport[oldA.length];
for (int a = 0; a < oldA.length; ++a)
  {
    OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
    if (param.getMinValue() == null)
      {
    Object[] lv;
    if (param.getLegalValues() == null)
      lv = null;
    else
      lv = param.getLegalValues().toArray();
    attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                               oldA[a].getDescription(),
                               ((OpenType<Object>)
                            param.getOpenType()),
                               oldA[a].isReadable(),
                               oldA[a].isWritable(),
                               oldA[a].isIs(),
                               param.getDefaultValue(),
                               lv);
      }
    else
      attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                             oldA[a].getDescription(),
                             ((OpenType<Object>)
                              param.getOpenType()),
                             oldA[a].isReadable(),
                             oldA[a].isWritable(),
                             oldA[a].isIs(),
                             param.getDefaultValue(),
                             ((Comparable<Object>)
                               param.getMinValue()),
                             ((Comparable<Object>)
                               param.getMaxValue()));
  }
MBeanConstructorInfo[] oldC = info.getConstructors();
OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
for (int a = 0; a < oldC.length; ++a)
  cons[a] =
    new OpenMBeanConstructorInfoSupport(oldC[a].getName(),
                    oldC[a].getDescription(),
                    translateSignature(oldC[a].getSignature()));
MBeanOperationInfo[] oldO = info.getOperations();
OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length];
for (int a = 0; a < oldO.length; ++a)
  ops[a] =
new OpenMBeanOperationInfoSupport(oldO[a].getName(),
                  oldO[a].getDescription(),
                  translateSignature(oldO[a].getSignature()),
                  Translator.translate(oldO[a].getReturnType()).getOpenType(),
                  oldO[a].getImpact());
openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
                    attribs, cons, ops, info.getNotifications());
     }
   catch (OpenDataException e)
     {
throw (InternalError) (new InternalError("A problem occurred creating the open type " +
                     "descriptors.").initCause(e));
     }
 }
项目:JamVM-PH    文件:BeanImpl.java   
protected void cacheMBeanInfo(MBeanInfo info)
 {
   if (info == null)
     return;
   try
     {
MBeanAttributeInfo[] oldA = info.getAttributes();
OpenMBeanAttributeInfo[] attribs =
  new OpenMBeanAttributeInfoSupport[oldA.length];
for (int a = 0; a < oldA.length; ++a)
  {
    OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
    if (param.getMinValue() == null)
      {
    Object[] lv;
    if (param.getLegalValues() == null)
      lv = null;
    else
      lv = param.getLegalValues().toArray();
    attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                               oldA[a].getDescription(),
                               ((OpenType<Object>)
                            param.getOpenType()),
                               oldA[a].isReadable(),
                               oldA[a].isWritable(),
                               oldA[a].isIs(),
                               param.getDefaultValue(),
                               lv);
      }
    else
      attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                             oldA[a].getDescription(),
                             ((OpenType<Object>)
                              param.getOpenType()),
                             oldA[a].isReadable(),
                             oldA[a].isWritable(),
                             oldA[a].isIs(),
                             param.getDefaultValue(),
                             ((Comparable<Object>)
                               param.getMinValue()),
                             ((Comparable<Object>)
                               param.getMaxValue()));
  }
MBeanConstructorInfo[] oldC = info.getConstructors();
OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
for (int a = 0; a < oldC.length; ++a)
  cons[a] =
    new OpenMBeanConstructorInfoSupport(oldC[a].getName(),
                    oldC[a].getDescription(),
                    translateSignature(oldC[a].getSignature()));
MBeanOperationInfo[] oldO = info.getOperations();
OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length];
for (int a = 0; a < oldO.length; ++a)
  ops[a] =
new OpenMBeanOperationInfoSupport(oldO[a].getName(),
                  oldO[a].getDescription(),
                  translateSignature(oldO[a].getSignature()),
                  Translator.translate(oldO[a].getReturnType()).getOpenType(),
                  oldO[a].getImpact());
openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
                    attribs, cons, ops, info.getNotifications());
     }
   catch (OpenDataException e)
     {
throw (InternalError) (new InternalError("A problem occurred creating the open type " +
                     "descriptors.").initCause(e));
     }
 }
项目:classpath    文件:BeanImpl.java   
protected void cacheMBeanInfo(MBeanInfo info)
{
  if (info == null)
    return;
  try
    {
      MBeanAttributeInfo[] oldA = info.getAttributes();
      OpenMBeanAttributeInfo[] attribs =
        new OpenMBeanAttributeInfoSupport[oldA.length];
      for (int a = 0; a < oldA.length; ++a)
        {
          OpenMBeanParameterInfo param = Translator.translate(oldA[a].getType());
          if (param.getMinValue() == null)
            {
              Object[] lv;
              if (param.getLegalValues() == null)
                lv = null;
              else
                lv = param.getLegalValues().toArray();
              attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                                                             oldA[a].getDescription(),
                                                             ((OpenType<Object>)
                                                              param.getOpenType()),
                                                             oldA[a].isReadable(),
                                                             oldA[a].isWritable(),
                                                             oldA[a].isIs(),
                                                             param.getDefaultValue(),
                                                             lv);
            }
          else
            attribs[a] = new OpenMBeanAttributeInfoSupport(oldA[a].getName(),
                                                           oldA[a].getDescription(),
                                                           ((OpenType<Object>)
                                                            param.getOpenType()),
                                                           oldA[a].isReadable(),
                                                           oldA[a].isWritable(),
                                                           oldA[a].isIs(),
                                                           param.getDefaultValue(),
                                                           ((Comparable<Object>)
                                                             param.getMinValue()),
                                                           ((Comparable<Object>)
                                                             param.getMaxValue()));
        }
      MBeanConstructorInfo[] oldC = info.getConstructors();
      OpenMBeanConstructorInfo[] cons = new OpenMBeanConstructorInfoSupport[oldC.length];
      for (int a = 0; a < oldC.length; ++a)
        cons[a] =
          new OpenMBeanConstructorInfoSupport(oldC[a].getName(),
                                              oldC[a].getDescription(),
                                              translateSignature(oldC[a].getSignature()));
      MBeanOperationInfo[] oldO = info.getOperations();
      OpenMBeanOperationInfo[] ops = new OpenMBeanOperationInfoSupport[oldO.length];
      for (int a = 0; a < oldO.length; ++a)
        ops[a] =
      new OpenMBeanOperationInfoSupport(oldO[a].getName(),
                                        oldO[a].getDescription(),
                                        translateSignature(oldO[a].getSignature()),
                                        Translator.translate(oldO[a].getReturnType()).getOpenType(),
                                        oldO[a].getImpact());
      openInfo = new OpenMBeanInfoSupport(info.getClassName(), info.getDescription(),
                                          attribs, cons, ops, info.getNotifications());
    }
  catch (OpenDataException e)
    {
      throw (InternalError) (new InternalError("A problem occurred creating the open type " +
                                               "descriptors.").initCause(e));
    }
}