Juha, Ok, that sounds cool. I'll try it on Monday.
Have a good weekend. - Matt -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Juha-P Lindfors Sent: Friday, September 27, 2002 11:05 PM To: JBoss Developers Group Subject: Re: [JBoss-dev] creating persistent MBeans dynamically make the mbean registry persistent (it's already an mbean) triggering store() on registerMBean() calls, and have your widget factory register mbeans using the registry mbean operation registerMBean(Object, ObjectName, Map) where you pass in the valueMap the additional info to store for recreating the mbeans (constructor signature, args, other config info). At registry load() read and recreate mbeans, and then mbeans each load() their state. -- Juha On Fri, 27 Sep 2002, Matt Munz wrote: > Hi all, > > I have two questions here, a specific one relating to the subject, and a > more general question pertaining to the larger problem that I'm trying to > solve. > > First off, what is the best way to create new MBeans while the server is > running, in a persistent fashion? Say, for example, I have a class Widget, > and a class WidgetFactory. Suppose I create a WidgetFactoryMBean that has a > method > > createNewWidget(String mbeanName, Object[] widgetFeatures); > > that has the purpose of creating a new instance of Widget, wrapping it in > a ModelMBean with the name <mbeanName>, and adding that mbean to the server. > > If I use the mbean server API for this, then the new MBean is loaded in > the VM, but dissapears on server restart. > > One solution for this, I imagine, would be, instead of using the mbean > server API, to actually write a *-service.xml file to the deploy folder each > time createNewWidget() is called. Another solution might be to maintain > references to the widgets in the widget factory, and serialize and load them > through it. There are likely many more solutions. > > Have any of you tried something like this before? Is there code that does > this in the JBoss source tree? > > Now for the more general question... > > What I am trying to do is to allow dynamic generation of persistent > objects in the server. These objects need to be exposed as web services, > and have access to databases, other web services, and JMS topics. As > instances of the same class, all of these ojects will have the same > interface, yet will have different state, and need to expose this through > the web service protocol. Once I have created these instances, I don't want > them to go away unless I specifically remove them. If I restart the server, > they should show up again (technically different instances with identical > state). > > Ultimately, all I want to do is to say "create a widget named foo" via web > services, restart the server, say "tell me something about the widget named > foo" via web services, and get a response. > > I know that there are many ways to skin a cat. Is there a better way > here? Would EJB or some other structure make more sense? I am generally > trying to stay away from EJB for the moment to avoid the overhead of RMI (I > don't need distributed objects), but I am open to any solution that makes > sense. > > - Matt > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > -- Juha Lindfors Author of "JMX: Managing J2EE with Java Management Extensions" ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development