Java 8 MBeanOperationInfo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 MBeanOperationInfo class.

This code example shows how to use the following methods:getSignature
 
	@Test
	public void testOperationParameterMetadata() throws Exception {
		ModelMBeanInfo info = getMBeanInfoFromAssembler();
		ModelMBeanOperationInfo oper = info.getOperation("add");
		MBeanParameterInfo[] params = oper.getSignature();
 
		assertEquals("Invalid number of params", 2, params.length);
		assertEquals("Incorrect name for x param", "x", params[0].getName());
		assertEquals("Incorrect type for x param", int.class.getName(), params[0].getType());
 
		assertEquals("Incorrect name for y param", "y", params[1].getName());
		assertEquals("Incorrect type for y param", int.class.getName(), params[1].getType());
	} 
 
	@Test
	public void testWithCglibProxy() throws Exception {
		IJmxTestBean tb = createJmxTestBean();
		ProxyFactory pf = new ProxyFactory();
		pf.setTarget(tb);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
                throw new IllegalArgumentException();
            } 
        } 
 
        public MBeanOperationInfo getOperationInfo() {
            return new MBeanOperationInfo(description, method);
        } 
    } 
 
    @Override 
    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
        try { 
            scan(); 
        } catch (Exception e) {
            throw new IllegalArgumentException(e);
        } 
        return objectName;
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getReturnType
    @Test
    public void testAttributeHasCorrespondingOperations() throws Exception {
        ModelMBeanInfo info = getMBeanInfoFromAssembler();
 
        ModelMBeanOperationInfo myOperation = info.getOperation("myOperation");
        assertNotNull("get operation should not be null", myOperation);
        assertEquals("Incorrect myOperation return type", "long", myOperation.getReturnType());
                 
        ModelMBeanOperationInfo add = info.getOperation("add");                
        assertNotNull("set operation should not be null", add);
        assertEquals("Incorrect add method description", "Add Two Numbers Together", add.getDescription());
                 
    } 
 
    @Test
    public void testNotificationMetadata() throws Exception {
        ModelMBeanInfo info = getMBeanInfoFromAssembler();
        MBeanNotificationInfo[] notifications = info.getNotifications();
        assertEquals("Incorrect number of notifications", 1, notifications.length);
        assertEquals("Incorrect notification name", "My Notification", notifications[0].getName());
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    private MBeanAttributeInfo[] attributeInfos;
    private boolean dirtyAttributeInfoCache = true;
 
    private static final MBeanConstructorInfo[] ctors = null;
    private static final MBeanOperationInfo[] ops = {new MBeanOperationInfo("reset",
        "Sets the values of all Attributes to 0", null, "void", MBeanOperationInfo.ACTION)};
    private static final MBeanNotificationInfo[] notifs = null;
 
    @Override 
    public Object getAttribute(String arg0) throws AttributeNotFoundException,
            MBeanException, ReflectionException {
      synchronized(metricsMap) { 
        if (metricsMap.containsKey(arg0)) { 
          return metricsMap.get(arg0); 
        } else { 
          throw new AttributeNotFoundException("Key [" + arg0 + "] not found/tracked"); 
        } 
      } 
    } 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
				       "Create a logger MBean" ); 
    dOperations[0] = new MBeanOperationInfo("addLoggerMBean",
				    "addLoggerMBean(): add a loggerMBean", 
				    params ,
				    "javax.management.ObjectName", 
				    MBeanOperationInfo.ACTION);
  } 
 
 
  public 
  ObjectName addLoggerMBean(String name) {
    Logger cat = LogManager.exists(name);
 
    if(cat != null) { 
      return addLoggerMBean(cat);
    } else { 
      return null; 
    } 
  } 
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
    dOperations[0] = new MBeanOperationInfo("addAppender",
					    "addAppender(): add an appender", 
					    params,
					    "void", 
					    MBeanOperationInfo.ACTION);
  } 
 
  protected 
  Logger getLogger() { 
    return logger; 
  } 
 
 
  public 
  MBeanInfo getMBeanInfo() {
    //cat.debug("getMBeanInfo called."); 
 
    MBeanAttributeInfo[] attribs = new MBeanAttributeInfo[dAttributes.size()];
    dAttributes.toArray(attribs);
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        mbni1 =
            new MBeanNotificationInfo(null, "name", "descr");
        mbni2 =
            new MBeanNotificationInfo(new String[] {"type"}, "name", "descr");
        mboi1 =
            new MBeanOperationInfo("name", "descr", null, "type", ACTION);
        mboi2 =
            new MBeanOperationInfo("name", "descr", params, "type", INFO);
        mbi1 =
            new MBeanInfo("class", "descr", null, null, null, null);
        mbi2 =
            new MBeanInfo(
                "class", "descr", 
                new MBeanAttributeInfo[] {mbai},
                new MBeanConstructorInfo[] {mbci1, mbci2},
                new MBeanOperationInfo[] {mboi1, mboi2},
                new MBeanNotificationInfo[] {mbni1, mbni2});
 
        ombai1 =
            new OpenMBeanAttributeInfoSupport("name", "descr", INTEGER,
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getName
        return s == null ? super.getDescription(info) : s;
    } 
 
    @Override 
    protected String getDescription(MBeanOperationInfo op) {
        String s = getResources().getProperty(interfaceName + "." + op.getName());
        return s == null ? super.getDescription(op) : s;
    } 
 
    @Override 
    protected String getDescription(MBeanAttributeInfo info) {
        String prefix = info.isIs() ? "is" : "get";
        String s = getResources().getProperty(
                interfaceName + "." + prefix + info.getName());
        return s == null ? super.getDescription(info) : s;
    } 
 
    @Override 
    protected int getImpact(MBeanOperationInfo info) {
        if (info.getName().startsWith("list")) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getName
  // Implementation methods 
  // ---------------------------------------------------------------------- 
 
  @Override 
  protected final String getParameterName(final MBeanOperationInfo op, final MBeanParameterInfo param, final int seq) {
    return op.getName().endsWith("Resources") ? "thread id #" : "resource name";
  } 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            attName=attName.substring(2);
        } 
        //expose unless we already exposed matching attribute field 
        boolean isAlreadyExposed=atts.containsKey(attName);
        if(!isAlreadyExposed) {
            ops.add(new MBeanOperationInfo(op != null? op.description() : "", method));
        } 
    } 
     
    private void exposeManagedAttribute(Method method){
        String methodName=method.getName();
        if(!methodName.startsWith("get") && !methodName.startsWith("set") && !methodName.startsWith("is")) {
            if(log.isWarnEnabled())
                log.warn("method name " + methodName + " doesn't start with \"get\", \"set\", or \"is\""
                        + ", but is annotated with @ManagedAttribute: will be ignored"); 
            return; 
        } 
        ManagedAttribute attr = method.getAnnotation(ManagedAttribute.class);
        Property prop=method.getAnnotation(Property.class);
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 MBeanOperationInfo Methods: