下面列出了javax.management.MBeanOperationInfo#ACTION_INFO 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
/**
* Returns operations defined for this MBean as an array of
* MBeanOperationInfo objects.
*
* @return operations defined as an array of MBeanOperationInfo objects.
*/
@Override
protected MBeanOperationInfo[] createMBeanOperationInfo() {
MBeanOperationInfo[] operationsInfo = new MBeanOperationInfo[MAX_OPERATIONS_COUNT];
operationsInfo[0] = new MBeanOperationInfo("getMembers",
"Returns ids as strings for all the members - Application Peers & Cache Servers.",
new MBeanParameterInfo[] {},
String[].class.getName(),
MBeanOperationInfo.ACTION_INFO);
MBeanParameterInfo[] getMemberDetailsArgs = new MBeanParameterInfo[1];
getMemberDetailsArgs[0] = new MBeanParameterInfo("memberId", String.class.getName(), "Id of the member for all the details are to be retrieved.");
operationsInfo[1] = new MBeanOperationInfo("getMemberDetails",
"Returns details for a given member",
getMemberDetailsArgs,
Map.class.getName(),
MBeanOperationInfo.ACTION_INFO);
/* For retrieving ObjectNames of existing Region MBeans, MBeanServerConnection.queryMBeans(), could be called */
MBeanParameterInfo[] getRegionSnapArgs = new MBeanParameterInfo[1];
getRegionSnapArgs[0] = new MBeanParameterInfo("memberId", String.class.getName(), "Id of the member on which we want to discover all the region MBean.");
operationsInfo[2] = new MBeanOperationInfo("getRegions",
"Returns a java.util.Map of details of regions on a member",
getRegionSnapArgs,
Map.class.getName(),
MBeanOperationInfo.ACTION_INFO);
return operationsInfo;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
/**
* Returns operations defined for this MBean as an array of
* MBeanOperationInfo objects.
*
* @return operations defined as an array of MBeanOperationInfo objects.
*/
@Override
protected MBeanOperationInfo[] createMBeanOperationInfo() {
MBeanOperationInfo[] operationsInfo = new MBeanOperationInfo[MAX_OPERATIONS_COUNT];
operationsInfo[0] = new MBeanOperationInfo("getMembers",
"Returns ids as strings for all the members - Application Peers & Cache Servers.",
new MBeanParameterInfo[] {},
String[].class.getName(),
MBeanOperationInfo.ACTION_INFO);
MBeanParameterInfo[] getMemberDetailsArgs = new MBeanParameterInfo[1];
getMemberDetailsArgs[0] = new MBeanParameterInfo("memberId", String.class.getName(), "Id of the member for all the details are to be retrieved.");
operationsInfo[1] = new MBeanOperationInfo("getMemberDetails",
"Returns details for a given member",
getMemberDetailsArgs,
Map.class.getName(),
MBeanOperationInfo.ACTION_INFO);
/* For retrieving ObjectNames of existing Region MBeans, MBeanServerConnection.queryMBeans(), could be called */
MBeanParameterInfo[] getRegionSnapArgs = new MBeanParameterInfo[1];
getRegionSnapArgs[0] = new MBeanParameterInfo("memberId", String.class.getName(), "Id of the member on which we want to discover all the region MBean.");
operationsInfo[2] = new MBeanOperationInfo("getRegions",
"Returns a java.util.Map of details of regions on a member",
getRegionSnapArgs,
Map.class.getName(),
MBeanOperationInfo.ACTION_INFO);
return operationsInfo;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
static private MBeanOperationInfo[] makeOpInfos(String[][] spec) {
final MBeanOperationInfo[] result =
new MBeanOperationInfo[spec.length];
final MBeanParameterInfo[] pars = makeParInfos(parameters);
for (int i=0;i<result.length;i++) {
System.out.println("\tCreate an MBeanOperationInfo: " +
spec[i][0]);
final MBeanOperationInfo item =
new MBeanOperationInfo(spec[i][2],spec[i][0],pars,spec[i][1],
MBeanOperationInfo.ACTION_INFO);
result[i]=item;
}
return result;
}
@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
);
}
@Override
public LineRenderer renderer(Iterator<MBeanInfo> stream) {
List<LineRenderer> renderers = new ArrayList<LineRenderer>();
while (stream.hasNext()) {
MBeanInfo info = stream.next();
//
TreeElement root = new TreeElement(info.getClassName());
// Descriptor
TableElement descriptor = new TableElement().
overflow(Overflow.HIDDEN).
rightCellPadding(1);
Descriptor descriptorInfo = info.getDescriptor();
if (descriptorInfo != null) {
for (String fieldName : descriptorInfo.getFieldNames()) {
String fieldValue = String.valueOf(descriptorInfo.getFieldValue(fieldName));
descriptor.row(fieldName, fieldValue);
}
}
// Attributes
TableElement attributes = new TableElement().
overflow(Overflow.HIDDEN).
rightCellPadding(1).
add(new RowElement().style(Decoration.bold.fg(Color.black).bg(Color.white)).add("NAME", "TYPE", "DESCRIPTION"));
for (MBeanAttributeInfo attributeInfo : info.getAttributes()) {
attributes.row(attributeInfo.getName(), attributeInfo.getType(), attributeInfo.getDescription());
}
// Operations
TreeElement operations = new TreeElement("Operations");
for (MBeanOperationInfo operationInfo : info.getOperations()) {
TableElement signature = new TableElement().
overflow(Overflow.HIDDEN).
rightCellPadding(1);
MBeanParameterInfo[] parameterInfos = operationInfo.getSignature();
for (MBeanParameterInfo parameterInfo : parameterInfos) {
signature.row(parameterInfo.getName(), parameterInfo.getType(), parameterInfo.getDescription());
}
TreeElement operation = new TreeElement(operationInfo.getName());
String impact;
switch (operationInfo.getImpact()) {
case MBeanOperationInfo.ACTION:
impact = "ACTION";
break;
case MBeanOperationInfo.INFO:
impact = "INFO";
break;
case MBeanOperationInfo.ACTION_INFO:
impact = "ACTION_INFO";
break;
default:
impact = "UNKNOWN";
}
operation.addChild(new TableElement().
add(
new RowElement().add("Type: ", operationInfo.getReturnType()),
new RowElement().add("Description: ", operationInfo.getDescription()),
new RowElement().add("Impact: ", impact),
new RowElement().add(new LabelElement("Signature: "), signature)
)
);
operations.addChild(operation);
}
//
root.addChild(
new TableElement().leftCellPadding(1).overflow(Overflow.HIDDEN).
row("ClassName", info.getClassName()).
row("Description", info.getDescription()
)
);
root.addChild(new TreeElement("Descriptor").addChild(descriptor));
root.addChild(new TreeElement("Attributes").addChild(attributes));
root.addChild(operations);
//
renderers.add(root.renderer());
}
return LineRenderer.vertical(renderers);
}