View Javadoc
1 /* 2 Bloof - visualize the evolution of your software project 3 Copyright ( C ) 2003 Lukasz Pekacki <lukasz@pekacki.de> 4 http://bloof.sf.net/ 5 6 This program is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along with 15 this program; if not, write to the Free Software Foundation, Inc., 16 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 18 $RCSfile: UpdateProject.java,v $ 19 Created on $Date: 2003/09/06 08:35:06 $ 20 */ 21 package net.sf.bloof; 22 23 import java.io.IOException; 24 import java.sql.SQLException; 25 import java.util.Date; 26 27 import net.sf.bloof.db.Database; 28 import net.sf.bloof.events.BloofEvent; 29 import net.sf.bloof.scm.ScmAccess; 30 import net.sf.bloof.scm.ScmAccessException; 31 import net.sf.bloof.scm.ScmRevisionIterator; 32 import net.sf.bloof.scm.cvsplugin.CvsPlugin; 33 import net.sf.bloof.util.ProgressEvent; 34 import net.sf.bloof.util.intl.Messages; 35 import net.sf.bloof.util.intl.Text; 36 37 /*** 38 * Updates the data of an existing project 39 * @author Lukasz Pekacki <pekacki@users.sourceforge.net> 40 * @version $Id: UpdateProject.java,v 1.3 2003/09/06 08:35:06 pekacki Exp $ 41 */ 42 public class UpdateProject implements Runnable { 43 /*** 44 * Constructs a ImportProject class 45 * @param aDb database object 46 * @param aScmAccess access to the version control system 47 * @param aFromDate update project data with SCM log information from this date 48 */ 49 public UpdateProject(Database aDb, ScmAccess aScmAccess, Date aFromDate) { 50 mDb = aDb; 51 mScmAccess = aScmAccess; 52 mFromDate = aFromDate; 53 } 54 private synchronized void updateProject() 55 throws SQLException, ScmAccessException, IOException { 56 Bloof.propagateProgressEvent( 57 new ProgressEvent(Messages.getString(Text.CONNECTING_DATABASE), 10)); 58 Bloof.propagateProgressEvent( 59 new ProgressEvent(Messages.getString(Text.FETCHING_VCS_DATA), 40)); 60 CvsPlugin cvsPlugin = new CvsPlugin(); 61 ScmRevisionIterator revisonIter = cvsPlugin.getRevisionsUpdate(mScmAccess, mFromDate); 62 Bloof.propagateProgressEvent(new ProgressEvent(Messages.getString(Text.POPULATE_DB), 60)); 63 mDb.updateDatabase(revisonIter); 64 } 65 /*** 66 * Starts the import 67 * @see java.lang.Runnable#run( ) 68 */ 69 public void run() { 70 71 try { 72 updateProject(); 73 } catch (SQLException e) { 74 Bloof.propagateBloofException( 75 new BloofException("SQL error on importing project." + e.toString())); 76 return; 77 78 } catch (IOException e) { 79 Bloof.propagateBloofException( 80 new BloofException("IO error on importing project." + e.toString())); 81 return; 82 } catch (ScmAccessException e) { 83 Bloof.propagateBloofException( 84 new BloofException("Scm access error on importing project." + e.toString())); 85 return; 86 } 87 Bloof.collectGarbage(); 88 Bloof.propagateProgressEvent(new ProgressEvent("Update finshed.", 100)); 89 Bloof.propagateBloofEvent(BloofEvent.UPDATE_FINISHED); 90 91 } 92 93 private ScmAccess mScmAccess; 94 private Date mFromDate; 95 private Database mDb; 96 }

This page was automatically generated by Maven