当前位置: 首页>>代码示例>>Java>>正文


Java MBeanOperationInfo.getDescriptor方法代码示例

本文整理汇总了Java中javax.management.MBeanOperationInfo.getDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java MBeanOperationInfo.getDescriptor方法的具体用法?Java MBeanOperationInfo.getDescriptor怎么用?Java MBeanOperationInfo.getDescriptor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.MBeanOperationInfo的用法示例。


在下文中一共展示了MBeanOperationInfo.getDescriptor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printOperation

import javax.management.MBeanOperationInfo; //导入方法依赖的package包/类
static void printOperation(MBeanOperationInfo info) {
    System.out.println("Name: "+info.getName());
    System.out.println("Description: "+info.getDescription());
    System.out.println("Return Type: "+info.getReturnType());
    System.out.println("Impact: "+info.getImpact());
    Descriptor desc = info.getDescriptor();
    System.out.println("Descriptor");
    for(int i=0; i<desc.getFieldNames().length; i++) {
        if(desc.getFieldNames()[i].compareTo("dcmd.arguments") == 0) {
            System.out.println("\t"+desc.getFieldNames()[i]+":");
            Descriptor desc2 =
                    (Descriptor)desc.getFieldValue(desc.getFieldNames()[i]);
            for(int j=0; j<desc2.getFieldNames().length; j++) {
                System.out.println("\t\t"+desc2.getFieldNames()[j]+"=");
                Descriptor desc3 =
                        (Descriptor)desc2.getFieldValue(desc2.getFieldNames()[j]);
                for(int k=0; k<desc3.getFieldNames().length; k++) {
                    System.out.println("\t\t\t"+desc3.getFieldNames()[k]+"="
                                       +desc3.getFieldValue(desc3.getFieldNames()[k]));
                }
            }
        } else {
            System.out.println("\t"+desc.getFieldNames()[i]+"="
                    +desc.getFieldValue(desc.getFieldNames()[i]));
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:DcmdMBeanTest.java

示例2: testOperation

import javax.management.MBeanOperationInfo; //导入方法依赖的package包/类
static void testOperation(MBeanServer mbs, CustomSecurityManager sm,
        ObjectName on, MBeanOperationInfo opInfo) {
    System.out.println("Testing " + opInfo.getName());
    Descriptor desc = opInfo.getDescriptor();
    if (desc.getFieldValue("dcmd.permissionClass") == null) {
    // No special permission required, execution should not trigger
    // any security exception
        if (invokeOperation(mbs, on, opInfo)) {
            throw new RuntimeException("TEST FAILED");
        }
    } else {
        // Building the required permission
        Permission reqPerm = createPermission(
                (String)desc.getFieldValue("dcmd.permissionClass"),
                (String)desc.getFieldValue("dcmd.permissionName"),
                (String)desc.getFieldValue("dcmd.permissionAction"));
        // Paranoid mode: check that the SecurityManager has not already
        // been granted the permission
        sm.denyPermission(reqPerm);
        // A special permission is required for this operation,
        // invoking it without the permission granted must trigger
        // a security exception
        if(!invokeOperation(mbs, on, opInfo)) {
            throw new RuntimeException("TEST FAILED");
        }
        // grant the permission and re-try invoking the operation
        sm.grantPermission(reqPerm);
        if(invokeOperation(mbs, on, opInfo)) {
            throw new RuntimeException("TEST FAILED");
        }
        // Clean up
        sm.denyPermission(reqPerm);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:35,代码来源:DcmdMBeanPermissionsTest.java


注:本文中的javax.management.MBeanOperationInfo.getDescriptor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。