下面列出了javax.management.MBeanOperationInfo#UNKNOWN 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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());
}
/**
* Creates an instance of {@code ModelMBeanOperationInfo} for the
* given method. Populates the parameter info for the operation.
* @param method the {@code Method} to create a {@code ModelMBeanOperationInfo} for
* @param name the logical name for the operation (method name or property name);
* not used by the default implementation but possibly by subclasses
* @param beanKey the key associated with the MBean in the beans map
* of the {@code MBeanExporter}
* @return the {@code ModelMBeanOperationInfo}
*/
protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, String name, String beanKey) {
MBeanParameterInfo[] params = getOperationParameters(method, beanKey);
if (params.length == 0) {
return new ModelMBeanOperationInfo(getOperationDescription(method, beanKey), method);
}
else {
return new ModelMBeanOperationInfo(method.getName(),
getOperationDescription(method, beanKey),
getOperationParameters(method, beanKey),
method.getReturnType().getName(),
MBeanOperationInfo.UNKNOWN);
}
}
/**
* Creates an instance of {@code ModelMBeanOperationInfo} for the
* given method. Populates the parameter info for the operation.
* @param method the {@code Method} to create a {@code ModelMBeanOperationInfo} for
* @param name the logical name for the operation (method name or property name);
* not used by the default implementation but possibly by subclasses
* @param beanKey the key associated with the MBean in the beans map
* of the {@code MBeanExporter}
* @return the {@code ModelMBeanOperationInfo}
*/
protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, String name, String beanKey) {
MBeanParameterInfo[] params = getOperationParameters(method, beanKey);
if (params.length == 0) {
return new ModelMBeanOperationInfo(getOperationDescription(method, beanKey), method);
}
else {
return new ModelMBeanOperationInfo(method.getName(),
getOperationDescription(method, beanKey),
getOperationParameters(method, beanKey),
method.getReturnType().getName(),
MBeanOperationInfo.UNKNOWN);
}
}
/**
* Creates an instance of {@code ModelMBeanOperationInfo} for the
* given method. Populates the parameter info for the operation.
* @param method the {@code Method} to create a {@code ModelMBeanOperationInfo} for
* @param name the logical name for the operation (method name or property name);
* not used by the default implementation but possibly by subclasses
* @param beanKey the key associated with the MBean in the beans map
* of the {@code MBeanExporter}
* @return the {@code ModelMBeanOperationInfo}
*/
protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, String name, String beanKey) {
MBeanParameterInfo[] params = getOperationParameters(method, beanKey);
if (params.length == 0) {
return new ModelMBeanOperationInfo(getOperationDescription(method, beanKey), method);
}
else {
return new ModelMBeanOperationInfo(method.getName(),
getOperationDescription(method, beanKey),
getOperationParameters(method, beanKey),
method.getReturnType().getName(),
MBeanOperationInfo.UNKNOWN);
}
}
/**
* Creates an instance of {@code ModelMBeanOperationInfo} for the
* given method. Populates the parameter info for the operation.
* @param method the {@code Method} to create a {@code ModelMBeanOperationInfo} for
* @param name the logical name for the operation (method name or property name);
* not used by the default implementation but possibly by subclasses
* @param beanKey the key associated with the MBean in the beans map
* of the {@code MBeanExporter}
* @return the {@code ModelMBeanOperationInfo}
*/
protected ModelMBeanOperationInfo createModelMBeanOperationInfo(Method method, String name, String beanKey) {
MBeanParameterInfo[] params = getOperationParameters(method, beanKey);
if (params.length == 0) {
return new ModelMBeanOperationInfo(getOperationDescription(method, beanKey), method);
}
else {
return new ModelMBeanOperationInfo(method.getName(),
getOperationDescription(method, beanKey),
getOperationParameters(method, beanKey),
method.getReturnType().getName(),
MBeanOperationInfo.UNKNOWN);
}
}
@Override
public MBeanInfo getMBeanInfo() {
return new MBeanInfo(
Dynamic.class.getName(), "MBean for RBAC testing of JMX non-core MBeans", null, null,
new MBeanOperationInfo[] {
new MBeanOperationInfo("helloReadOnly", "helloReadOnly", null, "void", MBeanOperationInfo.INFO),
new MBeanOperationInfo("helloWriteOnly", "helloWriteOnly", null, "void", MBeanOperationInfo.ACTION),
new MBeanOperationInfo("helloReadWrite", "helloReadWrite", null, "void", MBeanOperationInfo.ACTION_INFO),
new MBeanOperationInfo("helloUnknown", "helloUnknown", null, "void", MBeanOperationInfo.UNKNOWN)
},
null, null
);
}
private MBeanOperationInfo newMethodDescriptor(final String operationDescr, final Method m) {
final MBeanOperationInfo jvmInfo = new MBeanOperationInfo(operationDescr, m);
return new MBeanOperationInfo(
m.getName(),
operationDescr,
methodSignature(jvmInfo, m),
m.getReturnType().getName(),
MBeanOperationInfo.UNKNOWN,
jvmInfo.getDescriptor()); // avoid to copy the logic
}
@Operation(desc = "Force the server to stop and notify clients to failover", impact = MBeanOperationInfo.UNKNOWN)
void forceFailover() throws Exception;
@Operation(desc = "Force the server to stop and to scale down to another server", impact = MBeanOperationInfo.UNKNOWN)
void scaleDown(@Parameter(name = "name", desc = "The connector to use to scale down, if not provided the first appropriate connector will be used") String connector) throws Exception;