|
From: Carlos Q. <car...@we...> - 2002-01-30 22:39:05
|
On Thursday 31 January 2002 00:26, Bordet, Simone wrote:
> Hi,
>
> > Hi all
> >
> > I just added what I believe is a crucial feature of the
> > HttpAdaptor. Now the
> > default MBean view will lead you to a page where you can query the
> > constructors of a given class. As an answer you will get the class'
> > constructors and you can create MBeans.
> >
> > Please give it a try.
> >
> > Some things open:
> > First:
> > How to handle classloaders?
> > Should the classloader be a MBean?
> > I guess so since the createMBean and instantiate methods
> > allow only an
> > ObjectName as loaderName.
>
> The classloader can be an MBean or the classloader of the MBeanServer class
> (on the server), if you specify it null, or the DLR, is you don't specify
> it. Jar must be available through an URL; so or local to the server, or
> served by an http server.
Now is working by using a null classloader
>
> > If so, how can you create a ClassLoader which is MBean and
> > has ObjectName?
> > AFAIK there is no such MBean, please correct me if I'm wrong.
>
> Aaaahhhhhh ! :)
> javax.management.loading.MLet
Right, this is the one. I knew it couldn't be missing :-)
I guess I will add an interface to create MLets, where you can pass a list of
URLs
>
> > Should we
> > create one in none is available?
>
> You can always do that: subclass URLClassLoader and give it a management
> interface (empty for that matters), and register it.
I guess the MLet is enough
>
> > Second question:
> > What's the best way to do this. Do a createMBean (current
> > option) or do a
> > instantiate and then a registerMBean
>
> So, I did not totally get your feature.
> You can create objects of whatever class that will be stored along with the
> http session that then you can pass to constructors or setter methods ? Or
> you just display MBeanConstructorInfo metadata ?
No session ever, never :-)
the constructor request will return the constructors for a given class (any
class). Then you get a GUI for using that constructor, that is fiels to set
params and an objectname. Obviously if you query for java.lang.String you
will get some constructor but if you try to construct it there will be a
problem because it is not an MBean
A more refined version could do the cheking beforehand
> If the latter, then parameter to constructor must be simple types (int,
> strings), right ? Do you use JavaBeans API to convert (PropertyEditors) ?
Now is only basic types + ObjectName. I'm thinking how to do it for adding
custom types in principle is not a problem as fas as you can have an empty
constructor or a constructor that takes a String, that includes things like
ObjectName, URL, Date.
This requires a bit more thinking tough
>
> Finally, unless you perform instantiate and register in 2 http requests (I
> guess you don't), doing createMBean or instantiate + registerMBean is the
> same. One call is probably simpler.
Ok. I'm doing registerMBean, that's also better since if the class is not
MBean it won't be instantiated, will be?
>
> One question: if you have this MBean:
>
> public class Service implements ServiceMBean
> {
> public Service(Info info) {...}
> }
> public class Info
> {
> public Info(String date, String user) {...}
> }
>
> it is not yet possible to create an Info object, store it along with http
> session and tell the adaptor to use that object to create the MBean, right
> ? Just curious.
No. Again no session has been implemented
>
> However, great job Carlos !
>
> Simon
>
> _______________________________________________
> Openjmx-devel mailing list
> Ope...@li...
> https://lists.sourceforge.net/lists/listinfo/openjmx-devel
|