mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
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:
@@ -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();
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user