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


Java ModelType.UNDEFINED属性代码示例

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


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

示例1: findNodeInList

/**
 * This tries to find specific node within a list of nodes. Given an address and a named node
 * at that address (the "haystack"), it is assumed that haystack is actually a list of other
 * nodes. This method looks in the haystack and tries to find the named needle. If it finds it,
 * that list item is returned. If it does not find the needle in the haystack, it returns null.
 *
 * For example, if you want to find a specific datasource in the list of datasources, you
 * can pass in the address for the datasource subsystem, and ask to look in the data-source
 * node list (the haystack) and return the named datasource (the needle).
 *
 * @param addr resource address
 * @param haystack the collection
 * @param needle the item to find in the collection
 * @return the found item or null if not found
 * @throws Exception if the lookup fails for some reason
 */
public ModelNode findNodeInList(Address addr, String haystack, String needle) throws Exception {
    final ModelNode queryNode = createRequest(READ_RESOURCE, addr);
    final ModelNode results = execute(queryNode);
    if (isSuccess(results)) {
        final ModelNode haystackNode = getResults(results).get(haystack);
        if (haystackNode.getType() != ModelType.UNDEFINED) {
            final List<ModelNode> haystackList = haystackNode.asList();
            for (ModelNode needleNode : haystackList) {
                if (needleNode.has(needle)) {
                    return needleNode;
                }
            }
        }
        return null;
    } else {
        throw new FailureException(results, "Failed to get data for [" + addr + "]");
    }
}
 
开发者ID:hawkular,项目名称:hawkular-agent,代码行数:34,代码来源:JBossASClient.java


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