java类javax.management.openmbean.OpenMBeanParameterInfoSupport的实例源码

StandardMBean.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 19 收藏 0 点赞 0 评论 0
private static OpenMBeanParameterInfo[]
        paramsToOpenParams(MBeanParameterInfo[] params) {
    if (params instanceof OpenMBeanParameterInfo[])
        return (OpenMBeanParameterInfo[]) params;
    OpenMBeanParameterInfo[] oparams =
        new OpenMBeanParameterInfoSupport[params.length];
    System.arraycopy(params, 0, oparams, 0, params.length);
    return oparams;
}
BeanImpl.java 文件源码 项目:classpath 阅读 24 收藏 0 点赞 0 评论 0
private OpenMBeanParameterInfo[] translateSignature(MBeanParameterInfo[] oldS)
  throws OpenDataException
{
  OpenMBeanParameterInfo[] sig = new OpenMBeanParameterInfoSupport[oldS.length];
  for (int a = 0; a < oldS.length; ++a)
    {
      OpenMBeanParameterInfo param = Translator.translate(oldS[a].getType());
      if (param.getMinValue() == null)
        {
          Object[] lv;
          if (param.getLegalValues() == null)
            lv = null;
          else
            lv = param.getLegalValues().toArray();
          sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
                                                     oldS[a].getDescription(),
                                                     ((OpenType<Object>)
                                                      param.getOpenType()),
                                                     param.getDefaultValue(),
                                                     lv);
        }
      else
        sig[a] = new OpenMBeanParameterInfoSupport(oldS[a].getName(),
                                                   oldS[a].getDescription(),
                                                   ((OpenType<Object>)
                                                    param.getOpenType()),
                                                   param.getDefaultValue(),
                                                   ((Comparable<Object>)
                                                    param.getMinValue()),
                                                   ((Comparable<Object>)
                                                    param.getMaxValue()));
    }
  return sig;
}
RegistringOpenMBeanTest.java 文件源码 项目:freeVM 阅读 28 收藏 0 点赞 0 评论 0
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;
}
StandardMBean.java 文件源码 项目:openjdk-icedtea7 阅读 21 收藏 0 点赞 0 评论 0
private static OpenMBeanParameterInfo[]
        paramsToOpenParams(MBeanParameterInfo[] params) {
    if (params instanceof OpenMBeanParameterInfo[])
        return (OpenMBeanParameterInfo[]) params;
    OpenMBeanParameterInfo[] oparams =
        new OpenMBeanParameterInfoSupport[params.length];
    System.arraycopy(params, 0, oparams, 0, params.length);
    return oparams;
}
CacheManagerImpl.java 文件源码 项目:Telepathology 阅读 20 收藏 0 点赞 0 评论 0
/**
 * The operations are pulled from the core cache and the member regions.
 * @param cache 
 *
 */
private OpenMBeanOperationInfo[] createMBeanOperationInfo()
{
    List<OpenMBeanOperationInfo> operations = new ArrayList<OpenMBeanOperationInfo>();

    for(Cache cache : getKnownCaches())
    {
        if(cache != null && !cache.isInitialized())
            operations.add(
                new OpenMBeanOperationInfoSupport(initializePrefix + cache.getName(), 
                        "Initialize the cache (root directory must be set first) \n" +
                        "This action is ignored if the cache is initialized.\n" + 
                        "If the cache has been started with a valid configuration state available \n" +
                        "it will start in an initialized state.  Changes to configuration will then require a restart of the server.", 
                        new OpenMBeanParameterInfo[]{}, 
                        SimpleType.VOID, MBeanOperationInfo.ACTION)
            );

        if(cache != null && cache.isInitialized() && !cache.isEnabled() )
            operations.add(
                new OpenMBeanOperationInfoSupport(enablePrefix + cache.getName(), 
                        "Enable the cache (cache must be initialized)", 
                        new OpenMBeanParameterInfo[]{}, 
                        SimpleType.VOID, MBeanOperationInfo.ACTION)
            );

        else if(cache != null && cache.isEnabled())
            operations.add(
                new OpenMBeanOperationInfoSupport(disablePrefix + cache.getName(), 
                        "Disable the cache (cache must be initialized and enabled)", 
                        new OpenMBeanParameterInfo[]{}, 
                        SimpleType.VOID, MBeanOperationInfo.ACTION)
            );
    }

    operations.add(
            new OpenMBeanOperationInfoSupport(storeOperation, 
                    "Store the named cache configuration to persistent storage", 
                    new OpenMBeanParameterInfo[]{new OpenMBeanParameterInfoSupport("name", "the bname of the cache to save configuration of", SimpleType.STRING)}, 
                    SimpleType.VOID, MBeanOperationInfo.ACTION)
        );

    operations.add(
            new OpenMBeanOperationInfoSupport(storeAllOperation, 
                    "Store all current cache configuration to persistent storage", 
                    new OpenMBeanParameterInfo[]{}, 
                    SimpleType.VOID, MBeanOperationInfo.ACTION)
        );

    operations.add(
            new OpenMBeanOperationInfoSupport(createOperation, 
                    "Create a new cache at the specified location.", 
                new OpenMBeanParameterInfo[]
                {
                    new OpenMBeanParameterInfoSupport("cacheName", "The name of the cache (and the root of the configuration file name)", SimpleType.STRING),
                    new OpenMBeanParameterInfoSupport("cacheLocation", "The URI of the cache location (e.g. 'file:///vix/cache' or 'smb://server/cacheroot')", SimpleType.STRING),
                    new OpenMBeanParameterInfoSupport("prototypeName", "The name of the prototype or blank(e.g. 'VixPrototype', 'TestWithEvictionPrototype')", SimpleType.STRING)
                }, 
                SimpleType.STRING, 
                MBeanOperationInfo.ACTION)
        );

    return operations.toArray(new OpenMBeanOperationInfoSupport[operations.size()]);
}
MBeanInfoFactory.java 文件源码 项目:wildfly-core 阅读 23 收藏 0 点赞 0 评论 0
private OpenMBeanParameterInfo[] getParameterInfos(ModelNode opNode) {
    if (!opNode.hasDefined(REQUEST_PROPERTIES)) {
        return EMPTY_PARAMETERS;
    }
    List<Property> propertyList = opNode.get(REQUEST_PROPERTIES).asPropertyList();
    List<OpenMBeanParameterInfo> params = new ArrayList<OpenMBeanParameterInfo>(propertyList.size());

    for (Property prop : propertyList) {
        ModelNode value = prop.getValue();
        String paramName = NameConverter.convertToCamelCase(prop.getName());

        Map<String, Object> descriptions = new HashMap<String, Object>(4);

        boolean expressionsAllowed = prop.getValue().hasDefined(EXPRESSIONS_ALLOWED) && prop.getValue().get(EXPRESSIONS_ALLOWED).asBoolean();
        descriptions.put(DESC_EXPRESSIONS_ALLOWED, String.valueOf(expressionsAllowed));

        if (!expressionsAllowed) {
            Object defaultValue = getIfExists(value, DEFAULT);
            descriptions.put(DEFAULT_VALUE_FIELD, defaultValue);
            if (value.has(ALLOWED)) {
                if (value.get(TYPE).asType()!=ModelType.LIST){
                    List<ModelNode> allowed = value.get(ALLOWED).asList();
                    descriptions.put(LEGAL_VALUES_FIELD, fromModelNodes(allowed));
                }
            } else {
                if (value.has(MIN)) {
                    Comparable minC = getIfExistsAsComparable(value, MIN);
                    if (minC instanceof Number) {
                        descriptions.put(MIN_VALUE_FIELD, minC);
                    }
                }
                if (value.has(MAX)) {
                    Comparable maxC = getIfExistsAsComparable(value, MAX);
                    if (maxC instanceof Number) {
                        descriptions.put(MAX_VALUE_FIELD, maxC);
                    }
                }
            }
        }


        params.add(
                new OpenMBeanParameterInfoSupport(
                        paramName,
                        getDescription(prop.getValue()),
                        converters.convertToMBeanType(value),
                        new ImmutableDescriptor(descriptions)));

    }
    return params.toArray(new OpenMBeanParameterInfo[params.size()]);
}


问题


面经


文章

微信
公众号

扫码关注公众号