public static void main(String[] args) throws Exception
{
DSpace dspace = new DSpace();
SolrLogger indexer = dspace.getServiceManager().getServiceByName(
SolrLogger.class.getName(), SolrLogger.class);
CommandLineParser parser = new PosixParser();
Options options = new Options();
options.addOption("u", "update-spider-files", false,
"Update Spider IP Files from internet into "
+ ConfigurationManager.getProperty("dspace.dir")
+ "/config/spiders");
options.addOption("m", "mark-spiders", false,
"Update isBog Flag in Solr");
options.addOption("f", "delete-spiders-by-flag", false,
"Delete Spiders in Solr By isBot Flag");
options.addOption("i", "delete-spiders-by-ip", false,
"Delete Spiders in Solr By IP Address");
options.addOption("h", "help", false, "help");
options.addOption("b", "mark-spiders-by-useragent", true,
"Update isBot Flag in Solr By User Agent");
CommandLine line = parser.parse(options, args);
// Did the user ask to see the help?
if (line.hasOption('h'))
{
printHelp(options, 0);
}
if (line.hasOption("u"))
{
// StatisticsClient.updateSpiderFiles();
}
else if (line.hasOption('m'))
{
indexer.markRobotsByIP();
}
else if (line.hasOption('f'))
{
indexer.deleteRobotsByIsBotFlag();
}
else if (line.hasOption('i'))
{
indexer.deleteRobotsByIP();
}
else if (line.hasOption('b'))
{
if (line.getOptionValue('b') != null)
indexer.markRobotByUserAgent(line.getOptionValue('b'));
}
else
{
printHelp(options, 0);
}