use of org.neo4j.server.rest.management.repr.JmxMBeanRepresentation in project neo4j by neo4j.
the class JmxService method queryBeans.
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Path(QUERY_PATH)
@SuppressWarnings("unchecked")
public Response queryBeans(String query) {
try {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
String json = dodgeStartingUnicodeMarker(query);
Collection<Object> queries = (Collection<Object>) JsonHelper.readJson(json);
ArrayList<JmxMBeanRepresentation> beans = new ArrayList<JmxMBeanRepresentation>();
for (Object queryObj : queries) {
assert queryObj instanceof String;
for (Object objName : server.queryNames(new ObjectName((String) queryObj), null)) {
beans.add(new JmxMBeanRepresentation((ObjectName) objName));
}
}
return output.ok(new ListRepresentation("jmxBean", beans));
} catch (JsonParseException e) {
return output.badRequest(e);
} catch (MalformedObjectNameException e) {
return output.badRequest(e);
}
}
use of org.neo4j.server.rest.management.repr.JmxMBeanRepresentation in project neo4j by neo4j.
the class JmxService method getBean.
@GET
@Path(BEAN_TEMPLATE)
public Response getBean(@PathParam("domain") String domainName, @PathParam("objectName") String objectName) {
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
ArrayList<JmxMBeanRepresentation> beans = new ArrayList<JmxMBeanRepresentation>();
for (Object objName : server.queryNames(createObjectName(domainName, objectName), null)) {
beans.add(new JmxMBeanRepresentation((ObjectName) objName));
}
return output.ok(new ListRepresentation("bean", beans));
}
Aggregations