|
From: Bordet, S. <Sim...@co...> - 2002-01-30 22:26:49
|
Hi,
> Hi all
>=20
> I just added what I believe is a crucial feature of the=20
> HttpAdaptor. Now the=20
> default MBean view will lead you to a page where you can query the=20
> constructors of a given class. As an answer you will get the class'=20
> constructors and you can create MBeans.
>=20
> Please give it a try.
>=20
> Some things open:
> First:
> How to handle classloaders?
> Should the classloader be a MBean?
> I guess so since the createMBean and instantiate methods=20
> allow only an=20
> 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.
> If so, how can you create a ClassLoader which is MBean and=20
> has ObjectName?=20
> AFAIK there is no such MBean, please correct me if I'm wrong.=20
Aaaahhhhhh ! :)
javax.management.loading.MLet
> Should we=20
> 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.
> Second question:
> What's the best way to do this. Do a createMBean (current=20
> option) or do a=20
> 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 ?
If the latter, then parameter to constructor must be simple types (int, =
strings), right ?
Do you use JavaBeans API to convert (PropertyEditors) ?
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.
One question: if you have this MBean:
public class Service implements ServiceMBean
{
public Service(Info info) {...}
}
public class Info=20
{
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.
However, great job Carlos !
Simon
|
|
From: Bordet, S. <Sim...@co...> - 2002-01-31 10:17:46
|
Hi, > > > 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=20 > stored along with the > > http session that then you can pass to constructors or=20 > setter methods ? Or > > you just display MBeanConstructorInfo metadata ? > No session ever, never :-) > the constructor request will return the constructors for a=20 > given class (any=20 > class). Then you get a GUI for using that constructor, that=20 > is fiels to set=20 > params and an objectname. Obviously if you query for=20 > java.lang.String you=20 > will get some constructor but if you try to construct it=20 > there will be a=20 > problem because it is not an MBean Ok, so it is useful only for MBeans. > A more refined version could do the cheking beforehand Well, if you use it only for MBeans, no check: use MBeanConstructorInfo = metadata. > > Finally, unless you perform instantiate and register in 2=20 > http requests (I > > guess you don't), doing createMBean or instantiate +=20 > registerMBean is the > > same. One call is probably simpler. > Ok. I'm doing registerMBean, that's also better since if the=20 > class is not=20 > MBean it won't be instantiated, will be? No, it will be instantiated. Checks are done upon registration. You can = create whatever class with instantiate. Simon |
|
From: Carlos Q. <car...@ge...> - 2002-01-31 11:13:35
|
Hi >Hi, <snip> > >Ok, so it is useful only for MBeans. Yes that's the idea > >> A more refined version could do the cheking beforehand > >Well, if you use it only for MBeans, no check: use MBeanConstructorInfo=20 metadata. How can you get a MBeanConstructorInfo if your only data is classname? I was thinking to use you MBeanIntrospector class > >> > Finally, unless you perform instantiate and register in 2=20 >> http requests (I >> > guess you don't), doing createMBean or instantiate +=20 >> registerMBean is the >> > same. One call is probably simpler. >> Ok. I'm doing registerMBean, that's also better since if the=20 >> class is not=20 >> MBean it won't be instantiated, will be? > >No, it will be instantiated. Checks are done upon registration. You can=20 create whatever class with instantiate. Perhaps this is not desirable in this case. You would like the object not= to=20 be create unless it can be a MBean. This can be enforced outside the=20 registerMBean method tough > >Simon > > >_______________________________________________ >Openjmx-devel mailing list >Ope...@li... >https://lists.sourceforge.net/lists/listinfo/openjmx-devel > |
|
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
|