{
ContinuumStaxReader reader = new ContinuumStaxReader();
FileReader fileReader = new FileReader( new File( backupDirectory, BUILDS_XML ) );
ContinuumDatabase database;
try
{
database = reader.read( fileReader, strict );
}
catch ( XMLStreamException e )
{
throw new DataManagementException( e );
}
finally
{
IOUtil.close( fileReader );
}
PersistenceManagerFactory pmf = getPersistenceManagerFactory( "jdorepl109" );
PlexusJdoUtils.addObject( pmf.getPersistenceManager(), database.getSystemConfiguration() );
Map<Integer, Schedule> schedules = new HashMap<Integer, Schedule>();
for ( Iterator i = database.getSchedules().iterator(); i.hasNext(); )
{
Schedule schedule = (Schedule) i.next();
schedule = (Schedule) PlexusJdoUtils.addObject( pmf.getPersistenceManager(), schedule );
schedules.put( Integer.valueOf( schedule.getId() ), schedule );
}
for ( Iterator i = database.getProjectGroups().iterator(); i.hasNext(); )
{
ProjectGroup projectGroup = (ProjectGroup) i.next();
// first, we must map up any schedules, etc.
processBuildDefinitions( projectGroup.getBuildDefinitions(), schedules );