/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pdfdb.indexing.fileservice;
import java.sql.SQLException;
import pdfdb.indexing.plugins.Indexer;
import pdfdb.indexing.plugins.IndexingProvider;
import pdfdb.structure.ChangeType;
/**
*
* @author chris
*/
public class TestFileChangeMonitor extends AbstractFileChangeMonitor
implements Runnable
{
private String path = null;
private static int i= 0;
public TestFileChangeMonitor()
{
}
public TestFileChangeMonitor(String path)
{
this.path = path;
}
@Override
protected ChangeType getChangeType(String path)
{
return ChangeType.ADDED;
}
@Override
protected boolean hasChanged(String path)
{
return true;
}
@Override
protected void fileChange(String path, ChangeType type)
{
System.out.println(i + ": " + path);
i++;
}
@Override
protected boolean isUsed(String path)
{
Indexer x = IndexingProvider.getIndexer(path);
return x != null;
}
@Override
public void run()
{
try
{
this.reindex(this.path);
}
catch (SQLException ex)
{
ex.printStackTrace();
}
}
public static void main(String[] args) throws SQLException
{
String path = "/Users/chris";
AbstractFileChangeMonitor monitor = new TestFileChangeMonitor();
monitor.reindex(path);
}
}