RepositoryConfiguration repoConfig = (RepositoryConfiguration) it.next();
try
{
try
{
ArchivaRepository repository = dao.getRepositoryDAO().getRepository( repoConfig.getId() );
// Found repository. Update it.
repository.getModel().setName( repoConfig.getName() );
repository.getModel().setUrl( repoConfig.getUrl() );
repository.getModel().setLayoutName( repoConfig.getLayout() );
repository.getModel().setCreationSource( "configuration" );
repository.getModel().setReleasePolicy( repoConfig.isReleases() );
repository.getModel().setSnapshotPolicy( repoConfig.isSnapshots() );
dao.getRepositoryDAO().saveRepository( repository );
}
catch ( ObjectNotFoundException e )
{
// Add the repository to the database.
getLogger().info( "Adding repository configuration to DB: " + repoConfig );
ArchivaRepository drepo = ArchivaConfigurationAdaptor.toArchivaRepository( repoConfig );
drepo.getModel().setCreationSource( "configuration" );
dao.getRepositoryDAO().saveRepository( drepo );
}
}
catch ( ArchivaDatabaseException e )
{