throws IOException, XMLStreamException
{
UserDatabase database = new UserDatabase();
database.setUsers( PlexusJdoUtils.getAllObjectsDetached( getPersistenceManager(), JdoUser.class ) );
UserManagementStaxWriter writer = new UserManagementStaxWriter();
FileWriter fileWriter = new FileWriter( new File( backupDirectory, USERS_XML_NAME ) );
try
{
writer.write( fileWriter, database );
}
finally
{
IOUtil.close( fileWriter );
}