List of usage examples for javax.management MBeanOperationInfo getName
public String getName()
From source file:com.springsource.hq.plugin.tcserver.plugin.appmgmt.TomcatJmxApplicationManager.java
private boolean isTcRuntime250OrLater(String objectName, String operationName, int expected25OrLaterArgumentCount, Properties config) throws PluginException { try {//w w w . j a v a2s. co m MBeanServerConnection mBeanServer = mxUtil.getMBeanServer(config); MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(new ObjectName(objectName)); for (MBeanOperationInfo operationInfo : mBeanInfo.getOperations()) { if (operationName.equals(operationInfo.getName()) && expected25OrLaterArgumentCount == operationInfo.getSignature().length) { return true; } } return false; } catch (Exception e) { throw createPluginException(e); } }
From source file:org.sakaiproject.status.StatusServlet.java
protected void reportAllMBeanDetails(HttpServletResponse response) throws Exception { PrintWriter pw = response.getWriter(); Set<ObjectInstance> allBeans = mbs.queryMBeans(null, null); SortedSet sortedBeanNames = new TreeSet(); for (ObjectInstance bean : allBeans) { sortedBeanNames.add(bean.getObjectName().toString()); }/*from w w w. ja v a 2 s .c om*/ for (Object beanName : sortedBeanNames) { pw.print(beanName.toString() + "\n"); ObjectName beanObjectName = new ObjectName(beanName.toString()); for (MBeanAttributeInfo mbai : mbs.getMBeanInfo(beanObjectName).getAttributes()) { pw.print(" "); pw.print(mbai.getName() + ","); pw.print(mbai.getType() + ","); pw.print(mbai.getDescription() + ","); pw.print(mbs.getAttribute(beanObjectName, mbai.getName()) + "\n"); } pw.print("\n"); for (MBeanOperationInfo mboi : mbs.getMBeanInfo(beanObjectName).getOperations()) { pw.print(" "); pw.print(mboi.getReturnType() + ","); pw.print(mboi.getName() + "("); for (MBeanParameterInfo mbpi : mboi.getSignature()) { pw.print(mbpi.getType() + " " + mbpi.getName() + ","); } pw.print("),"); pw.print(mboi.getDescription() + "\n"); } pw.print("\n-----------------------------\n\n"); } }
From source file:com.tesora.dve.tools.DVEConfigCLI.java
public void cmd_jmx_list_operations() throws PEException { checkJMXConnected();/*from w w w . j a v a2 s . c o m*/ checkJMXDomain(); checkJMXMBean(); for (final MBeanOperationInfo operation : jmxMBeanInfo.getOperations()) { final String name = operation.getName(); final StringBuilder sParam = new StringBuilder(); for (final MBeanParameterInfo param : operation.getSignature()) { if (sParam.length() > 0) { sParam.append(", "); } sParam.append(formatType(param.getType())).append(" ").append(param.getName()); } final StringBuilder builder = new StringBuilder(); println(builder.append(name).append("(").append(sParam.toString()).append(")").toString()); } }
From source file:com.tesora.dve.tools.DVEConfigCLI.java
public void cmd_jmx_invoke(Scanner scanner) throws PEException { checkJMXConnected();/* w ww . ja v a2 s.com*/ checkJMXDomain(); checkJMXMBean(); final String opName = scan(scanner, "operation"); // First lookup the operation to ensure it exists MBeanOperationInfo found = null; for (final MBeanOperationInfo operation : jmxMBeanInfo.getOperations()) { if (operation.getName().equals(opName)) { found = operation; break; } } if (found == null) { throw new PEException("'" + opName + "' isn't a valid operation on '" + jmxMBean + "'"); } final MBeanParameterInfo[] params = found.getSignature(); final Object[] paramO = params.length == 0 ? null : new Object[params.length]; final String[] paramT = params.length == 0 ? null : new String[params.length]; for (int i = 0; i < params.length; i++) { // For each parameter we expect to have a matching item in the // scanner final String val = scan(scanner, params[i].getName()); paramO[i] = jmxConnector.stringToObject(val, params[i].getType()); paramT[i] = params[i].getType(); } jmxConnector.invokeOperation(jmxMBean, found, paramO, paramT); }
From source file:com.cyberway.issue.crawler.admin.CrawlJob.java
protected void addBdbjeOperations(final List<OpenMBeanOperationInfo> operations, final List<MBeanOperationInfo> bdbjeOperations, final List<String> bdbjeNamesToAdd) { for (MBeanOperationInfo info : bdbjeOperations) { if (bdbjeNamesToAdd.contains(info.getName())) { OpenMBeanOperationInfo omboi = null; if (info.getName().equals(OP_DB_STAT)) { // Db stats needs special handling. The published // signature is wrong and its return type is awkward. // Handle it. omboi = JmxUtils.convertToOpenMBeanOperation(info, null, SimpleType.STRING); MBeanParameterInfo[] params = omboi.getSignature(); OpenMBeanParameterInfo[] args = new OpenMBeanParameterInfoSupport[params.length + 1]; for (int ii = 0; ii < params.length; ii++) { args[ii] = (OpenMBeanParameterInfo) params[ii]; }// www. j av a 2 s.c o m args[params.length] = new OpenMBeanParameterInfoSupport("name", "Database name", SimpleType.STRING); omboi = new OpenMBeanOperationInfoSupport(omboi.getName(), omboi.getDescription(), args, omboi.getReturnOpenType(), omboi.getImpact()); } else { omboi = JmxUtils.convertToOpenMBeanOperation(info); } operations.add(omboi); } } }