[jBoss-Dev] Adding MBeans dynamically and SaveConfiguration

2001-03-14 Thread Vladimir Blagojevic



Hi ,

The problem synopsis:

1) Start JBoss.
2) Using HTMLAdaptor admin dynamically create, init and start new MBean not
currently present in JBoss configuration.  Go to ServiceControl MBean View in
HTMLAdaptor invoke  "saveConfiguration".
3) Stop JBoss.
4) Start JBoss again, MBean dynamically added in previous "run" is neither
registered nor started although configuration was saved.

Is this desired behaviour?  It seems not, at least to me.

If not here is how to fix it:

1)When saving configuration of MBeans to xml in ConfigurationService.save()
also save "code" attribute of the mbean element with the value of
MBeanInfo.getClasName().

2)When loading configuration in ConfigurationService.loadConfiguration()
method, invoke
ConfigurationService.create() with both jboss.jcml and jboss-auto.jcml xml
document.

Any comments?

Vladimir

Diff:

--- ConfigurationService.java   Wed Mar 14 15:10:24 2001
+++ ConfigurationService1.java  Wed Mar 14 15:16:24 2001
@@ -175,6 +175,7 @@
 mbeanElement.setAttribute("name",name.toString());

 MBeanInfo info = server.getMBeanInfo(name);
+   mbeanElement.setAttribute("code",info.getClassName());
 MBeanAttributeInfo[] attributes = info.getAttributes();
 boolean hasAttributes = true;
 for (int i = 0; i  attributes.length; i++)
@@ -290,7 +291,7 @@
   {
throw new IOException(se.getMessage());
   }
-
+ create(autoConf);
   load(autoConf);
}







RE: [jBoss-Dev] Adding MBeans dynamically and SaveConfiguration

2001-03-14 Thread marc fleury

commit it you have rw

marc


|-Original Message-
|From: [EMAIL PROTECTED]
|[mailto:[EMAIL PROTECTED]]On Behalf Of Vladimir Blagojevic
|Sent: Wednesday, March 14, 2001 7:25 PM
|To: JBoss-Dev
|Subject: [jBoss-Dev] Adding MBeans dynamically and SaveConfiguration
|
|
|
|
|Hi ,
|
|The problem synopsis:
|
|1) Start JBoss.
|2) Using HTMLAdaptor admin dynamically create, init and start new MBean not
|currently present in JBoss configuration.  Go to ServiceControl
|MBean View in
|HTMLAdaptor invoke  "saveConfiguration".
|3) Stop JBoss.
|4) Start JBoss again, MBean dynamically added in previous "run" is neither
|registered nor started although configuration was saved.
|
|Is this desired behaviour?  It seems not, at least to me.
|
|If not here is how to fix it:
|
|1)When saving configuration of MBeans to xml in ConfigurationService.save()
|also save "code" attribute of the mbean element with the value of
|MBeanInfo.getClasName().
|
|2)When loading configuration in ConfigurationService.loadConfiguration()
|method, invoke
|ConfigurationService.create() with both jboss.jcml and jboss-auto.jcml xml
|document.
|
|Any comments?
|
|Vladimir
|
|Diff:
|
|--- ConfigurationService.java   Wed Mar 14 15:10:24 2001
|+++ ConfigurationService1.java  Wed Mar 14 15:16:24 2001
|@@ -175,6 +175,7 @@
| mbeanElement.setAttribute("name",name.toString());
|
| MBeanInfo info = server.getMBeanInfo(name);
|+   mbeanElement.setAttribute("code",info.getClassName());
| MBeanAttributeInfo[] attributes = info.getAttributes();
| boolean hasAttributes = true;
| for (int i = 0; i  attributes.length; i++)
|@@ -290,7 +291,7 @@
|   {
|throw new IOException(se.getMessage());
|   }
|-
|+ create(autoConf);
|   load(autoConf);
|}
|
|
|
|