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

项目:OpenJSharp    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:ChronoBike    文件:BaseOpenMBean.java   
protected void addOpenAttribute(String csDescription, Class cls, String csMethodName, CompositeType compositeType)
{
    Method methodGet = MethodFinder.getMethod(cls, "get"+csMethodName);
    boolean bCanGet = true;
    if(methodGet == null)
        bCanGet = false;
    Method methodSet = MethodFinder.getMethod(cls, "set"+csMethodName, CompositeData.class);
    boolean bCanSet = true;
    if(methodSet == null)
        bCanSet = false;

    OpenMBeanAttributeInfoSupport attrOpen = new OpenMBeanAttributeInfoSupport(csMethodName, csDescription, compositeType, bCanGet, bCanSet, false); 
    OpenMBeanAttributeInfoWrapper attr = new OpenMBeanAttributeInfoWrapper(csMethodName, csDescription, attrOpen, methodGet, methodSet);

    if(m_arrOpenMBeanAttributeInfosWrapper == null)
        m_arrOpenMBeanAttributeInfosWrapper = new ArrayList<OpenMBeanAttributeInfoWrapper>();
    m_arrOpenMBeanAttributeInfosWrapper.add(attr);
}
项目:ChronoBike    文件:BaseOpenMBean.java   
protected void addOpenAttribute(String csDescription, Class cls, String csMethodName, TabularType tabularType)
{
    Method methodGet = MethodFinder.getMethod(cls, "get"+csMethodName);
    boolean bCanGet = true;
    if(methodGet == null)
        bCanGet = false;
    Method methodSet = MethodFinder.getMethod(cls, "set"+csMethodName, CompositeData.class);
    boolean bCanSet = true;
    if(methodSet == null)
        bCanSet = false;

    OpenMBeanAttributeInfoSupport attrOpen = new OpenMBeanAttributeInfoSupport(csMethodName, csDescription, tabularType, bCanGet, bCanSet, false); 
    OpenMBeanAttributeInfoWrapper attr = new OpenMBeanAttributeInfoWrapper(csMethodName, csDescription, attrOpen, methodGet, methodSet);

    if(m_arrOpenMBeanAttributeInfosWrapper == null)
        m_arrOpenMBeanAttributeInfosWrapper = new ArrayList<OpenMBeanAttributeInfoWrapper>();
    m_arrOpenMBeanAttributeInfosWrapper.add(attr);
}
项目:jdk8u-jdk    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:openjdk-jdk10    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目: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;
}
项目:openjdk9    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:Java8CN    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:jdk8u_jdk    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:infobip-open-jdk-8    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:jdk8u-dev-jdk    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:jdk7-jdk    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:openjdk-source-code-learn    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:OLD-OpenJDK8    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:wildfly-core    文件:MBeanInfoFactory.java   
private OpenMBeanAttributeInfo getAttribute(String name) {
    final String escapedName = NameConverter.convertToCamelCase(name);
    ModelNode attribute = providedDescription.require(ATTRIBUTES).require(name);
    AttributeAccess access = resourceRegistration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name);
    if (access == null) {
        // Check for a bogus attribute in the description that's really a child
        Set<String> childTypes = resourceRegistration.getChildNames(PathAddress.EMPTY_ADDRESS);
        if (childTypes.contains(name)) {
            return null;
        }
    }
    final boolean writable = mutabilityChecker.mutable(pathAddress) && (access != null && access.getAccessType() == AccessType.READ_WRITE);

    return new OpenMBeanAttributeInfoSupport(
            escapedName,
            getDescription(attribute),
            converters.convertToMBeanType(attribute),
            true,
            writable,
            false,
            createAttributeDescriptor(attribute));
}
项目:openjdk-jdk7u-jdk    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:openjdk-icedtea7    文件:StandardMBean.java   
private static MBeanAttributeInfo
        customize(MBeanAttributeInfo ai,
                  String description) {
    if (equal(description, ai.getDescription()))
        return ai;
    if (ai instanceof OpenMBeanAttributeInfo) {
        OpenMBeanAttributeInfo oai = (OpenMBeanAttributeInfo) ai;
        return new OpenMBeanAttributeInfoSupport(ai.getName(),
                                                 description,
                                                 oai.getOpenType(),
                                                 ai.isReadable(),
                                                 ai.isWritable(),
                                                 ai.isIs(),
                                                 ai.getDescriptor());
    } else {
        return new MBeanAttributeInfo(ai.getName(),
                                      ai.getType(),
                                      description,
                                      ai.isReadable(),
                                      ai.isWritable(),
                                      ai.isIs(),
                                      ai.getDescriptor());
    }
}
项目:Telepathology    文件:CacheManagerImpl.java   
/**
 * 
 * @param cache
 * @throws OpenDataException 
 */
private OpenMBeanAttributeInfo[] createMBeanAttributeInfo() 
throws OpenDataException
{
    List<OpenMBeanAttributeInfo> attributes = new ArrayList<OpenMBeanAttributeInfo>();

    attributes.add(
        new OpenMBeanAttributeInfoSupport("knownCacheNames", "A comma seperated list of known cache names", SimpleType.STRING, true, false, false)
    );

    return attributes.toArray(new OpenMBeanAttributeInfo[attributes.size()]);
}
项目: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;
}
项目:ChronoBike    文件:OpenMBeanAttributeInfoWrapper.java   
public OpenMBeanAttributeInfoWrapper(String csName, String csDescription, OpenMBeanAttributeInfoSupport openType, Method getter, Method setter)
{
    m_openType = openType;
    m_getter = getter;
    m_setter = setter;
}
项目: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));
     }
 }
项目:search    文件:JmxMonitoredMap.java   
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<>();

  for (String stat : staticStats) {
    attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
            null, true, false, false));
  }

  // add core's hashcode
  attrInfoList.add(new MBeanAttributeInfo("coreHashCode", String.class.getName(),
            null, true, false, false));

  try {
    NamedList dynamicStats = infoBean.getStatistics();
    if (dynamicStats != null) {
      for (int i = 0; i < dynamicStats.size(); i++) {
        String name = dynamicStats.getName(i);
        if (staticStats.contains(name)) {
          continue;
        }
        Class type = dynamicStats.get(name).getClass();
        OpenType typeBox = determineType(type);
        if (type.equals(String.class) || typeBox == null) {
          attrInfoList.add(new MBeanAttributeInfo(dynamicStats.getName(i),
              String.class.getName(), null, true, false, false));
        } else {
          attrInfoList.add(new OpenMBeanAttributeInfoSupport(
              dynamicStats.getName(i), dynamicStats.getName(i), typeBox,
              true, false, false));
        }
      }
    }
  } catch (Exception e) {
    LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
  }

  MBeanAttributeInfo[] attrInfoArr = attrInfoList
          .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), infoBean
          .getDescription(), attrInfoArr, null, null, null);
}
项目: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));
     }
 }
项目:NYBC    文件:JmxMonitoredMap.java   
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<MBeanAttributeInfo>();

  for (String stat : staticStats) {
    attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
            null, true, false, false));
  }

  // add core's hashcode
  attrInfoList.add(new MBeanAttributeInfo("coreHashCode", String.class.getName(),
            null, true, false, false));

  try {
    NamedList dynamicStats = infoBean.getStatistics();
    if (dynamicStats != null) {
      for (int i = 0; i < dynamicStats.size(); i++) {
        String name = dynamicStats.getName(i);
        if (staticStats.contains(name)) {
          continue;
        }
        Class type = dynamicStats.get(name).getClass();
        OpenType typeBox = determineType(type);
        if (type.equals(String.class) || typeBox == null) {
          attrInfoList.add(new MBeanAttributeInfo(dynamicStats.getName(i),
              String.class.getName(), null, true, false, false));
        } else {
          attrInfoList.add(new OpenMBeanAttributeInfoSupport(
              dynamicStats.getName(i), dynamicStats.getName(i), typeBox,
              true, false, false));
        }
      }
    }
  } catch (Exception e) {
    LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
  }

  MBeanAttributeInfo[] attrInfoArr = attrInfoList
          .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), infoBean
          .getDescription(), attrInfoArr, null, null, null);
}
项目:search-core    文件:JmxMonitoredMap.java   
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<MBeanAttributeInfo>();

  for (String stat : staticStats) {
    attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
            null, true, false, false));
  }

  // add core's hashcode
  attrInfoList.add(new MBeanAttributeInfo("coreHashCode", String.class.getName(),
            null, true, false, false));

  try {
    NamedList dynamicStats = infoBean.getStatistics();
    if (dynamicStats != null) {
      for (int i = 0; i < dynamicStats.size(); i++) {
        String name = dynamicStats.getName(i);
        if (staticStats.contains(name)) {
          continue;
        }
        Class type = dynamicStats.get(name).getClass();
        OpenType typeBox = determineType(type);
        if (type.equals(String.class) || typeBox == null) {
          attrInfoList.add(new MBeanAttributeInfo(dynamicStats.getName(i),
              String.class.getName(), null, true, false, false));
        } else {
          attrInfoList.add(new OpenMBeanAttributeInfoSupport(
              dynamicStats.getName(i), dynamicStats.getName(i), typeBox,
              true, false, false));
        }
      }
    }
  } catch (Exception e) {
    LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
  }

  MBeanAttributeInfo[] attrInfoArr = attrInfoList
          .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), infoBean
          .getDescription(), attrInfoArr, null, null, null);
}
项目:read-open-source-code    文件:JmxMonitoredMap.java   
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<MBeanAttributeInfo>();

  for (String stat : staticStats) {
    attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
            null, true, false, false));
  }

  // add core's hashcode
  attrInfoList.add(new MBeanAttributeInfo("coreHashCode", String.class.getName(),
            null, true, false, false));

  try {
    NamedList dynamicStats = infoBean.getStatistics();
    if (dynamicStats != null) {
      for (int i = 0; i < dynamicStats.size(); i++) {
        String name = dynamicStats.getName(i);
        if (staticStats.contains(name)) {
          continue;
        }
        Class type = dynamicStats.get(name).getClass();
        OpenType typeBox = determineType(type);
        if (type.equals(String.class) || typeBox == null) {
          attrInfoList.add(new MBeanAttributeInfo(dynamicStats.getName(i),
              String.class.getName(), null, true, false, false));
        } else {
          attrInfoList.add(new OpenMBeanAttributeInfoSupport(
              dynamicStats.getName(i), dynamicStats.getName(i), typeBox,
              true, false, false));
        }
      }
    }
  } catch (Exception e) {
    LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
  }

  MBeanAttributeInfo[] attrInfoArr = attrInfoList
          .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), infoBean
          .getDescription(), attrInfoArr, null, null, null);
}
项目:read-open-source-code    文件:JmxMonitoredMap.java   
@Override
public MBeanInfo getMBeanInfo() {
  ArrayList<MBeanAttributeInfo> attrInfoList = new ArrayList<>();

  for (String stat : staticStats) {
    attrInfoList.add(new MBeanAttributeInfo(stat, String.class.getName(),
            null, true, false, false));
  }

  // add core's hashcode
  attrInfoList.add(new MBeanAttributeInfo("coreHashCode", String.class.getName(),
            null, true, false, false));

  try {
    NamedList dynamicStats = infoBean.getStatistics();
    if (dynamicStats != null) {
      for (int i = 0; i < dynamicStats.size(); i++) {
        String name = dynamicStats.getName(i);
        if (staticStats.contains(name)) {
          continue;
        }
        Class type = dynamicStats.get(name).getClass();
        OpenType typeBox = determineType(type);
        if (type.equals(String.class) || typeBox == null) {
          attrInfoList.add(new MBeanAttributeInfo(dynamicStats.getName(i),
              String.class.getName(), null, true, false, false));
        } else {
          attrInfoList.add(new OpenMBeanAttributeInfoSupport(
              dynamicStats.getName(i), dynamicStats.getName(i), typeBox,
              true, false, false));
        }
      }
    }
  } catch (Exception e) {
    LOG.warn("Could not getStatistics on info bean {}", infoBean.getName(), e);
  }

  MBeanAttributeInfo[] attrInfoArr = attrInfoList
          .toArray(new MBeanAttributeInfo[attrInfoList.size()]);
  return new MBeanInfo(getClass().getName(), infoBean
          .getDescription(), attrInfoArr, null, null, null);
}
项目: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));
    }
}