Hardwire initialization and destruction of Browse tables into IntializeDatabase.

git-svn-id: http://scm.dspace.org/svn/repo/trunk@2200 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Mark Diggory
2007-09-17 18:44:55 +00:00
parent c9561398b0
commit 08d4b0c908
2 changed files with 41 additions and 3 deletions

View File

@@ -700,7 +700,7 @@ public class IndexBrowse
*
* @throws BrowseException
*/
private void clearDatabase()
public void clearDatabase()
throws BrowseException
{
try
@@ -983,7 +983,7 @@ public class IndexBrowse
* @throws SQLException
* @throws BrowseException
*/
private void initBrowse()
public void initBrowse()
throws SQLException, BrowseException
{
Date start = new Date();

View File

@@ -45,6 +45,8 @@ import java.io.FileReader;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.dspace.browse.BrowseException;
import org.dspace.browse.IndexBrowse;
import org.dspace.core.ConfigurationManager;
/**
@@ -73,7 +75,43 @@ public class InitializeDatabase
try
{
DatabaseManager.loadSql(getScript(argv[0]));
if("clean-database.sql".equals(argv[0]))
{
try
{
IndexBrowse browse = new IndexBrowse();
browse.setDelete(true);
browse.setExecute(true);
browse.clearDatabase();
}
catch (BrowseException e)
{
log.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e);
}
DatabaseManager.loadSql(getScript(argv[0]));
}
else if("database_schema.sql".equals(argv[0]))
{
DatabaseManager.loadSql(getScript(argv[0]));
try
{
IndexBrowse browse = new IndexBrowse();
browse.setRebuild(true);
browse.setExecute(true);
browse.initBrowse();
}
catch (BrowseException e)
{
log.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e);
}
}
System.exit(0);
}
catch (Exception e)