I have a simple test where i deploy a .ear with a single datasource,
use profileService to update the jndi-name and restart AS:
ManagedComponent comp = child.getComponent("ProfileServiceTestDS");
ManagedProperty p = comp.getProperty("jndi-name");
p.setValue(SimpleValueSupport.wrap("FooDsJNDIName"));
mgtView.updateComponent(comp);
mgtView.process();
profileService persists the whole ManagedConnectionFactoryDeploymentGroup object as attachment, with the local-ds and the mbean.
When i restart AS it fails with:
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="jboss:database=profileserviceTestDB,service=Hypersonic",type=Component already registered.
In the log i see:
2008-10-20 14:22:15,055 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] (main) Added component jboss:database=profileserviceTestDB,service=Hypersonic to vfszip:/home/emuckenh/svn/as/trunk/build/output/jboss-5.0.0.GA/server/profileservice/deploy/profilservice-datasource.ear
...
2008-10-20 14:22:15,071 DEBUG [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] (main) Added component jboss:database=profileserviceTestDB,service=Hypersonic to vfszip:/home/emuckenh/svn/as/trunk/build/output/jboss-5.0.0.GA/server/profileservice/deploy/profilservice-datasource.ear/test-ds.xml
Which looks like it is deploying the persisted ManagedConnectionFactoryDeploymentGroup for the .ear and the unmodified test-ds.xml. And fails, because the mbean is then specified twice :)
Without the parent deployment it uses the predetermined attachment and deploys the datasource with the changed jndi-name.
So basically what happens to restore the attachment is:
* createVFSDeployment(profilservice-datasource.ear)
* deployment.setPredeterminedManagedObjects(...)
* mainDeployer.add(deployment)
Now i'm wondering how those attachments should get populated to the child(s)?