本文整理汇总了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 + "]");
}
}