I'm working a java tool to export RHQ configuration and import in a new instance - which should help migrating instance between version and/or databases. I managed to export group definition, by tricking a little bit the Remote API (2.4.2):
resources = getResourceGroupManager().findResourceGroupsByCriteria(baseRemote.getSubject(), criteria);
for ( ResourceGroup resource : resources ) {
definitions.add(resource.getGroupDefinition());
}
However, I'm pretty much stuck right now, when it comes to importing those group. I've tried to "pass them along" with a dummy group definition...
ResourceGroup resGroup = new ResourceGroup("dummy2");
for ( GroupDefinition groupDefinition : groupDefinitions )
resGroup.setGroupDefinition(groupDefinition);
... but it failed as Hibernate is complaining (rightfullly) that those entities are transient...
Any proper way to do this ? Would it be difficult to change RHQ code to allow that ? If so, I'll be happy to be pointed to the right direction...
Thanks a lot !
--
Romain PELISSE,
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it" -- Terry Pratchetthttp://belaran.eu/wordpress/belaran