use of org.apache.geode.management.internal.web.domain.QueryParameterSource in project geode by apache.
the class AbstractHttpOperationInvoker method queryNames.
/**
* This method searches the MBean server, based on the OperationsInvoker's JMX-based or remoting
* capable MBean server connection, for MBeans matching a specific ObjectName or matching an
* ObjectName pattern along with satisfying criteria from the Query expression.
*
* @param objectName the ObjectName or pattern for which matching MBeans in the target MBean
* server will be returned.
* @param queryExpression the JMX-based query expression used to filter matching MBeans.
* @return a set of ObjectName's matching MBeans in the MBean server matching the ObjectName and
* Query expression criteria.
* @see #createHttpRequest(org.apache.geode.management.internal.web.domain.Link)
* @see #findLink(String)
* @see #send(org.apache.geode.management.internal.web.http.ClientHttpRequest, Class)
* @see javax.management.ObjectName
* @see javax.management.QueryExp
*/
@Override
@SuppressWarnings("unchecked")
public Set<ObjectName> queryNames(final ObjectName objectName, final QueryExp queryExpression) {
final Link link = findLink(MBEAN_QUERY_LINK_RELATION);
if (link != null) {
final ClientHttpRequest request = createHttpRequest(link);
request.setContent(new QueryParameterSource(objectName, queryExpression));
try {
return (Set<ObjectName>) IOUtils.deserializeObject(send(request, byte[].class));
} catch (Exception e) {
throw new MBeanAccessException(String.format("An error occurred while querying for MBean names using ObjectName pattern (%1$s) and Query expression (%2$s)!", objectName, queryExpression), e);
}
} else {
printSevere("Running a query to get the ObjectNames of all MBeans matching the ObjectName pattern (%1$s) and Query expression (%2$s) is currently unsupported!", objectName, queryExpression);
throw new RestApiCallForCommandNotFoundException(MBEAN_QUERY_LINK_RELATION);
}
}
Aggregations