it.tidalwave.netbeans.filesystem.sync.FileSystemSynchronizer Maven / Gradle / Ivy
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package it.tidalwave.netbeans.filesystem.sync;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import org.openide.util.Lookup;
import org.openide.filesystems.FileObject;
/**
*
* @author fritz
*/
public interface FileSystemSynchronizer
{
/***************************************************************************
*
**************************************************************************/
public static interface Context
{
@Nonnull
public FileObject getSourceFolder();
@Nonnull
public FileObject getTargetFolder();
}
/***************************************************************************
*
**************************************************************************/
public static interface Strategy
{
public void synchronize (@CheckForNull FileObject source,
@CheckForNull FileObject target,
@Nonnull Context context);
}
/***************************************************************************
*
**************************************************************************/
public void synchronize (@Nonnull FileObject source,
@Nonnull FileObject target,
@Nonnull Strategy strategy)
throws IOException;
/***************************************************************************
*
**************************************************************************/
@Nonnegative
public int getFileCount();
/***************************************************************************
*
**************************************************************************/
@Nonnegative
public int getProcessedFileCount();
/***************************************************************************
*
**************************************************************************/
public void addPropertyChangeListener (@Nonnull PropertyChangeListener listener);
/***************************************************************************
*
**************************************************************************/
public void removePropertyChangeListener (@Nonnull PropertyChangeListener listener);
/***************************************************************************
*
**************************************************************************/
public final static class Locator
{
private Locator()
{
}
/***********************************************************************
*
* Returns a reference to a GeoViewer.View. This method can be
* called by any thread.
*
* @return the view
*
**********************************************************************/
@Nonnull
public static synchronized FileSystemSynchronizer findFileSystemSynchronizer()
{
final FileSystemSynchronizer fileSystemSynchronized = Lookup.getDefault().lookup(FileSystemSynchronizer.class);
if (fileSystemSynchronized == null)
{
throw new RuntimeException("Cannot find FileSystemSynchronizer");
}
return fileSystemSynchronized;
}
}
}