Git Product home page Git Product logo

pojo-mbean's People

Watchers

 avatar

pojo-mbean's Issues

All exceptions from invoked methods are wrapped in IllegalArgumentException

The invoke method in IntrospectedDynamicMBean wraps all exceptions from 
method.invoke(...) in IllegalArgumentException.

This makes it harder to signal error messages to the client.

Possible solution:
Method.invoke throws InvocationTargetException where the original exception can 
be accessed with getCause(). Rethrow the original exception wrapped in  an 
MBeanException. JConsole will then correctly show the cause.

Original issue reported on code.google.com by [email protected] on 22 Apr 2013 at 8:58

MessagingMBean: Change duration handling to allow specifying TimeUnit

Currently, the duration notification notifyStop() and reporting 
(getDurationXxxMillis()) are hardcoded to report durations in milliseconds.

Certain systems may prefer or demand reporting in alternative time units 
(microseconds or seconds), so we should separate duration metrics from its 
units, and let units be settable with TimeUnit.MILLISECONDS default.

A new MBean attribute: (durationUnit?) should be added.
Existing MBean attributes should be renamed, removing the "Millis" suffix.

Original issue reported on code.google.com by [email protected] on 16 Jul 2011 at 8:27

Support JSK-255 annotations (package javax.management)

Again, great project!

Would you update IntrospectedDynamicMBean to match annotations by simple class 
name rather than full class name?

This is tricky in that you need to scan all annotations on a method & only 
check the simple class name, rather than simply lookup a particular annotation.

The other tricky bit is working out how to recover the annotation fields (e.g., 
Description, etc.).

It might be easier to have two mbeans - one for org.softee annotations & one 
for JDK annotations.  Long term I'd expect your codebase to recommend to the 
standard annotations for new code.

I may be able to help here, if you need some coding time.

Original issue reported on code.google.com by [email protected] on 7 Aug 2013 at 1:10

Automatic discovery of attributes and operations via @MBean(automatic={ATTRIBUTE, OPERATION})

Heavily inspired by Project Lombok's @Data annotation that, when applied to a 
class, will automatically generate getters and setters for all appropriate 
fields, we should support something similar on pojo-mbean.

A class that is annotated with @MBean(automatic=ATTRIBUTE), any bean compliant 
accessor method (getter/setter) on the class and any superclass with the same 
@MBean annotation will be automatically treated as if they were annotated with 
@ManagedAttribute.

Any method on a class, and all of its superclasses that satisfies all of:
1. its class is annotated with @MBean(automatic=OPERATION)
2. it is NOT considered a bean accessor (getter/setter)
3. it is a public instance (non static) method
Will be automatically treated as if they were annotated with @ManagedOperation.

Original issue reported on code.google.com by [email protected] on 14 Jul 2011 at 10:18

Consider compiling with JRE 1.5 as target platform

Currently, IntrospectedDynamicMBean uses @Override annotation to indicate 
implementation of DynamicMBean interface methods, otherwise we could have 1.5 
target platform.

But to support Descriptors (see issue 4) we'd have to use JDK 6 API's. 
Possibly, we could use subclassing to leave base-functionality JRE 5 compatible.

Original issue reported on code.google.com by [email protected] on 10 Jul 2011 at 3:37

Register mBean to another MBeanServer than ManagementFactory.getPlatformMBeanServer()

Id like to register my mBeans to a specific mBeanServer
not to the default one ManagementFactory.getPlatformMBeanServer()

This could be done by adding a new constructor MBeanRegistration that takes a 
MBeanServer as a parameter

<code>
/**
  * @param mBean
  *            an MBean instance in the form of a traditional MBean (implementing a sibling *MBean interface) or an
  *            MXBean (implementing an interface annotated with {@code @MXBean}), or an instance implementing the
  *            DynamicMBean interface.
  * @param mBeanObjectName
  *            the object name with which {@code mBean} will be registered
  * @param mBeanServer
  *            the MBeanServer to register the mBean in
  */
public MBeanRegistration(Object mBean, ObjectName mBeanObjectName, MBeanServer 
mBeanServer)
{
   this.mBean = mBean;
   this.mBeanObjectName = mBeanObjectName;
   this.mBeanServer = mBeanServer;
}
</code>

Original issue reported on code.google.com by [email protected] on 8 Feb 2013 at 10:13

add capability to generate names for objects with multiple instance

my solution is to add an optional attribute to @MBean which names an operation 
returning an string which would be added to beans name.

here are 3 changes needed to do so:

1) add new attribute

public @interface MBean {
...
   String instanceName() default "";
...
}

2) add code to use it in creating name as ObjectNameBuilder constructor

   public ObjectNameBuilder(Object mbean) throws MalformedObjectNameException {
        Class<?> mBeanClass = mbean.getClass();
        MBean annotation = mBeanClass.getAnnotation(MBean.class);
        if (annotation == null) {
            throw new IllegalArgumentException(mBeanClass + " is not annotated with " + MBean.class);
        }
        String name = annotation.objectName();
        if (!"".equals(annotation.instanceName())) {
            try {
                Method m = mBeanClass.getMethod(annotation.instanceName());
                m.setAccessible(true);
                Object instanceName = m.invoke(mbean);
                // ,instance=xxx
                name = name + instanceName;
            } 
            catch (Exception x) {
                throw new IllegalArgumentException("error calling instance name operation in bean " + MBean.class);
            }
        }
        this.objectName = ObjectName.getInstance(name);
    }


3) change MBeanRegistration constructor to use it

    public MBeanRegistration(Object mBean) throws MalformedObjectNameException {
        this(mBean, new ObjectNameBuilder(mBean).build());
    }

Original issue reported on code.google.com by [email protected] on 25 Oct 2012 at 10:19

Annotate annotations with @Documented

The annotations should themselves be annotated with @Documented 
(java.lang.annotations).  That an interface/class participates in JMX should be 
part of the javadocs, e.g.:

@MBean
public class CoolThing {
    // ...
}

If @MBean were annotated with @Documented, then generated javadocs for 
"CoolThing" would note the @MBean annotation.

Original issue reported on code.google.com by [email protected] on 1 Feb 2013 at 9:45

Add support for annotating fields @Property

If a field is annotated with @Property, it should also be explicitly marked as 
READ, WRITE or READ_WRITE.

Using field @Property annotations means you don't need getters/setters for 
simple beans.

Access in the IntrospectedDynamicMBean will be by means of field reflection

Original issue reported on code.google.com by [email protected] on 8 Jul 2011 at 9:10

Next release

The current public release in maven central is version 1.1 from 2011.

Is there a next release to push out to maven central?  What plans do you have 
around that?

Thanks

Original issue reported on code.google.com by [email protected] on 25 Jun 2013 at 11:36

Unable to generate an ObjectName based on a class reference

It is not currently possible to construct an ObjectName by way of an annotated 
class, when using ObjectNameFactory. An instance of the class is required.

This presents a problem when having to construct an ObjectName from within the 
constructor of an annotated MBean.

Original issue reported on code.google.com by [email protected] on 12 Jul 2011 at 3:01

Change the annotation structure (multiple @Attribute annotations and separate @Description)

Currently, one and only one of...
- Field
- Getter method
- Setter method
... should be annotated with @ManagedAttribute, and the access level may be 
defined using @ManagedAttribute(access=Access.READ_WRITE)

So you could see a setter method annotated with @ManagedAttribute which would 
in fact make the related field available for READ only, since Access.READ is 
the default access.

A couple of suggestions:

If a method is annotated with @ManagedAttribute, that method is made available 
(e.g. if only the setter method has the annotation the attribute would be WRITE 
only. This would require default access to be "IMPLIED" or "CONTEXT". And it 
would be considered an error, if a @ManagedAttribute annotated method would 
have any explicit READ/WRITE/READ_WRITE access. These would be reserved for 
@ManagedAttribute anotations on fields.

Having two @ManagedAttribute annotation for a single attribute (getter and 
setter method) would cause another problem: Which description to use, if both 
annotations define a description attribute.

Possibly, it would be better to remove the description attribute from the 
@ManagedAttribute annotation, and move it into a separate @Description 
annotation which would also replace the description attribute for 
@ManagedOperation and @Parameter. It would be considered an error, if more than 
one @Description attribute was added 

This last change would also solve the issue of using the "value" annotation 
attribute for adding description. This is not ideal, since ...
@ManagedAttribute(value="This is the description", access=Access.READ_WRITE)
... just doesn't seem fluent. I'd rather see ...
@ManagedAttribute(Access.READ_WRITE) @Description("This is the description")

An added bonus is that the above change gets us a little closer to the 
(defunct) JMX 2.0/JSR 255 proposal.

Original issue reported on code.google.com by [email protected] on 9 Jul 2011 at 11:37

Add attribute and operation sort order to @ManagedAttribute and @ManagedOperation

Default sorting of MBean attributes and operations are alphabetically (String 
comparator order).

We could allow a sort order override attribute to either @ManagedOperation/ 
@ManagedAttribute or to the @Description annotation, since we can only have one 
sort order per attribute, whereas we can have two @ManagedAttribute annotations 
(Read + Write).

Possibly...

@Description(value="This is ordered as x1", order="x1");

Default ordering should still be by operation/attribute name.

TODO: Should ordering be case insensitive?

Original issue reported on code.google.com by [email protected] on 13 Jul 2011 at 10:50

Change annotation names in line with JMX 2.0 / JSR 255

@Property -> @ManagedAttribute
@Operation -> @ManagedOperation (impact parameter seems OK)

JMX 2.0 @Description seems more complex than simply continuing with using an 
annotation parameter, but for forward compatibility, I could be swayed...


Original issue reported on code.google.com by [email protected] on 9 Jul 2011 at 1:54

Use @MBean parameters to define domain, type and name

Consider using the @MBean annotation could be used for specifying domain, type 
and possibly name, e.g.

@MBean(domain="com.loremipsum", type="org.softee.management.ProcessingMbean", 
name="MyMBean")

... resulting in the ObjectName:

"com.loremipsum:name=MyMBean,type=org.softee.management.ProcessingMbean"

Original issue reported on code.google.com by [email protected] on 9 Jul 2011 at 1:58

Consider using "objectName" atrtribute on @MBean

Rather than using separate "domain", "type" and "name" attributes on the @MBean 
annotation, consider having a single "objectName" attribute containing the 
entire ObjectName.

This would allow adding alternate attributes, such as "application", similar to 
what is available in Spring, see 
http://static.springsource.com/projects/instrumentation/instrument/html/ch05.htm
l#exportexample

Original issue reported on code.google.com by [email protected] on 9 Jul 2011 at 5:21

Unable to find annotations on JDK proxy

The annotated methods on an interface implemented by a JDK dynamic proxy 
handler are not discoverable presently.

Suggestion:

A. Use Proxy.isProxyClass
B. When proxy use Proxy.getInvocationHandler

From here it gets tricky.  At a minimum the handler should be annotated with 
@MBean.  Potentially you could scan the handler for annotated methods.

I'm happy to kick out a prototype if intersted.

Original issue reported on code.google.com by [email protected] on 25 Jun 2013 at 11:40

Improve atomicity of notifyXxxx() operations

Currently virtually no synchronized blocks are used to ensure atomicity of 
notifyXxx() operations.

This could lead to marginal inconsistencies in the statistics of the 
ProcessingPojoMBean

It should be investigated how to improve atomicity while maintaining 
concurrency of operation.

Original issue reported on code.google.com by [email protected] on 8 Jul 2011 at 6:18

Proposal of enhancement : make pojo-mbean OSGi-compliant

Hello,

It is proposal of enhancement because we would like pojo-mbean to be 
OSGi-compliant.

To do so, we've just repackaged the framework as a bundle using 
maven-bundle-plugin and we have separated the annotation layer from the 
implementation layer. By this way, only the annotations are available (and 
visible) to the user and the registration process is delegated to the OSGi 
framework.

Please find the patch enclosed.

Regards,

Hugo Loos


Original issue reported on code.google.com by [email protected] on 6 Oct 2014 at 9:16

Attachments:

Add usage examples in Wiki

Add usage examples on the wiki:

1. Java code examples
1.1 An annotated MBean that extends AbstractMBean
1.2 Instantiating, starting and stopping the MBean
2. Screen-dumps
2.1 JConsole
2.2 JMX console (JBoss)

Original issue reported on code.google.com by [email protected] on 8 Jul 2011 at 6:11

Create sample annotated MBeans to show off various annotation techniques/options

To serve as examples, we should create a number of "demo" MBeans that contain 
all variations of permitted annotations:

@MBean (with and without specification of domain, type and name)
@Property (on getters, is'ers, setters and fields)
@Operation (with and without impact attribute)
@Parameter (on @Operation)

Also, various techniques for extending/overriding annotated beans, including: 
adding MBean annotations, overriding methods and removing MBean annotations.

The MBeans should probably reside in src/test/java, and each should have a 
matching unit test alongside the MBean.

MBeans that are generally usable should, however, be located in src/main/java 
to allow use and extension by API client users.

Original issue reported on code.google.com by [email protected] on 9 Jul 2011 at 12:38

Add support for MBeanRegistration callbacks

The IntrospectedDynamicMBean should implement MBeanRegistration 
http://download.oracle.com/javase/6/docs/api/javax/management/MBeanRegistration.
html and delegate calls to the interface methods to the POJO MBean being 
introspected, provided the POJO MBean implements this very interface.

This way we allow client programmers to receive lifecycle callbacks without 
imposing any requirements or conceptual footprint to the 99+% who won't need it.

Original issue reported on code.google.com by [email protected] on 11 Jul 2011 at 11:55

IllegalArgumentException accessing @ManagedAttributes and @ManagedOperations

When an annotated MBean's accessor methods (attributes and operations) are not 
visible (methods are private or MBean class is a private inner class), the 
following happens:

# Readable attributes are shown as "Unavailable" in jconsole
# Operations return an "IllegalArgumentException" without further info.

Original issue reported on code.google.com by [email protected] on 12 Jul 2011 at 2:49

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.