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

项目: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;
}
项目:wildfly-core    文件:MBeanInfoFactory.java   
private OpenMBeanOperationInfo getOperation(String name, OpenMBeanParameterInfo addWildcardChildName, OperationEntry entry) {
    ModelNode opNode = entry.getDescriptionProvider().getModelDescription(null);
    OpenMBeanParameterInfo[] params = getParameterInfos(opNode);
    if (addWildcardChildName != null) {
        OpenMBeanParameterInfo[] newParams = new OpenMBeanParameterInfo[params.length + 1];
        newParams[0] = addWildcardChildName;
        System.arraycopy(params, 0, newParams, 1, params.length);
        params = newParams;
    }
    return new OpenMBeanOperationInfoSupport(
            name,
            getDescription(opNode),
            params,
            getReturnType(opNode),
            entry.getFlags().contains(Flag.READ_ONLY) ? MBeanOperationInfo.INFO : MBeanOperationInfo.UNKNOWN,
            createOperationDescriptor());
}
项目:OpenJSharp    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:jdk8u-jdk    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:openjdk-jdk10    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:openjdk9    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:Java8CN    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:jdk8u_jdk    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:infobip-open-jdk-8    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:jdk8u-dev-jdk    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:jdk7-jdk    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:openjdk-source-code-learn    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:OLD-OpenJDK8    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目:openjdk-jdk7u-jdk    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目: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;
}
项目:openjdk-icedtea7    文件:StandardMBean.java   
private static MBeanOperationInfo
        customize(MBeanOperationInfo oi,
                  String description,
                  MBeanParameterInfo[] signature,
                  int impact) {
    if (equal(description, oi.getDescription()) &&
            identicalArrays(signature, oi.getSignature()) &&
            impact == oi.getImpact())
        return oi;
    if (oi instanceof OpenMBeanOperationInfo) {
        OpenMBeanOperationInfo ooi = (OpenMBeanOperationInfo) oi;
        OpenMBeanParameterInfo[] oparams =
            paramsToOpenParams(signature);
        return new OpenMBeanOperationInfoSupport(oi.getName(),
                                                 description,
                                                 oparams,
                                                 ooi.getReturnOpenType(),
                                                 impact,
                                                 oi.getDescriptor());
    } else {
        return new MBeanOperationInfo(oi.getName(),
                                      description,
                                      signature,
                                      oi.getReturnType(),
                                      impact,
                                      oi.getDescriptor());
    }
}
项目: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));
     }
 }
项目:Telepathology    文件:CacheManagerImpl.java   
/**
 * 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()]);
}
项目: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));
    }
}