Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing deprecated FileTreeWatcher #6688

Merged
merged 1 commit into from
Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.eclipse.che.api.project.server.importer.ProjectImporterRegistry;
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
Expand Down Expand Up @@ -91,8 +90,6 @@ private static void init() throws Exception {
ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
FileWatcherNotificationHandler fileWatcherNotificationHandler =
new DefaultFileWatcherNotificationHandler(vfsProvider);
FileTreeWatcher fileTreeWatcher =
new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
ProjectManager projectManager =
new ProjectManager(
vfsProvider,
Expand All @@ -102,7 +99,6 @@ private static void init() throws Exception {
projectHandlerRegistry,
importerRegistry,
fileWatcherNotificationHandler,
fileTreeWatcher,
workspaceHolder,
mock(FileWatcherManager.class));

Expand All @@ -121,6 +117,7 @@ private static void init() throws Exception {
}

private static class TestWorkspaceHolder extends WorkspaceProjectsSyncer {

private List<ProjectConfigDto> projects;

TestWorkspaceHolder(List<ProjectConfigDto> projects) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.eclipse.che.api.project.server.importer.ProjectImporterRegistry;
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
Expand All @@ -60,6 +59,7 @@
/** Test for the java formatter service. */
@Listeners(value = {MockitoTestNGListener.class})
public class JavaFormatterServiceTest {

private static final String FORMATTER_CONTENT =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
+ "<profiles version=\"13\">\n"
Expand Down Expand Up @@ -109,8 +109,6 @@ protected void initProjectApi() throws Exception {
ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
FileWatcherNotificationHandler fileWatcherNotificationHandler =
new DefaultFileWatcherNotificationHandler(vfsProvider);
FileTreeWatcher fileTreeWatcher =
new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
projectManager =
new ProjectManager(
vfsProvider,
Expand All @@ -120,7 +118,6 @@ protected void initProjectApi() throws Exception {
projectHandlerRegistry,
importerRegistry,
fileWatcherNotificationHandler,
fileTreeWatcher,
workspaceHolder,
mock(FileWatcherManager.class));

Expand Down Expand Up @@ -243,6 +240,7 @@ private void checkProjectFormatterFile() throws IOException {
}

private static class TestWorkspaceHolder extends WorkspaceProjectsSyncer {

private List<ProjectConfigDto> projects;

TestWorkspaceHolder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.eclipse.che.api.project.server.importer.ProjectImporterRegistry;
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
Expand All @@ -55,6 +54,7 @@

/** @author Valeriy Svydenko */
public abstract class BaseTest {

private static final String wsPath = BaseTest.class.getResource("/projects").getFile();
private static final String INDEX_PATH = "target/fs_index";

Expand All @@ -70,7 +70,9 @@ protected void initProjectApi() throws Exception {

TestWorkspaceHolder workspaceHolder = new TestWorkspaceHolder();

if (root == null) root = new File(wsPath);
if (root == null) {
root = new File(wsPath);
}

if (root.exists()) {
IoUtil.deleteRecursive(root);
Expand Down Expand Up @@ -109,9 +111,6 @@ protected void initProjectApi() throws Exception {
ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
FileWatcherNotificationHandler fileWatcherNotificationHandler =
new DefaultFileWatcherNotificationHandler(vfsProvider);
FileTreeWatcher fileTreeWatcher =
new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);

projectManager =
new ProjectManager(
vfsProvider,
Expand All @@ -121,7 +120,6 @@ protected void initProjectApi() throws Exception {
projectHandlerRegistry,
importerRegistry,
fileWatcherNotificationHandler,
fileTreeWatcher,
new TestWorkspaceHolder(new ArrayList<>()),
mock(FileWatcherManager.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.eclipse.che.api.project.server.type.ProjectTypeDef;
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
Expand Down Expand Up @@ -83,7 +82,6 @@ public abstract class BaseTest {
protected LocalVirtualFileSystemProvider vfsProvider;
protected ProjectRegistry projectRegistry;
protected FileWatcherNotificationHandler fileWatcherNotificationHandler;
protected FileTreeWatcher fileTreeWatcher;
protected ProjectTypeRegistry projectTypeRegistry;
protected ProjectHandlerRegistry projectHandlerRegistry;
protected ProjectImporterRegistry importerRegistry;
Expand Down Expand Up @@ -111,7 +109,9 @@ protected void initProjectApi() throws Exception {
mavenServerManager = new MavenServerManager(mavenServerPath);
workspaceHolder = new TestWorkspaceHolder();

if (root == null) root = new File(wsPath);
if (root == null) {
root = new File(wsPath);
}

if (root.exists()) {
IoUtil.deleteRecursive(root);
Expand Down Expand Up @@ -149,7 +149,6 @@ protected void initProjectApi() throws Exception {
importerRegistry = new ProjectImporterRegistry(new HashSet<>());

fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);

pm =
new ProjectManager(
Expand All @@ -160,7 +159,6 @@ protected void initProjectApi() throws Exception {
projectHandlerRegistry,
importerRegistry,
fileWatcherNotificationHandler,
fileTreeWatcher,
new TestWorkspaceHolder(new ArrayList<>()),
mock(FileWatcherManager.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.eclipse.che.api.project.server.type.ProjectTypeDef;
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
Expand Down Expand Up @@ -69,7 +68,6 @@ public abstract class BaseTest {
protected LocalVirtualFileSystemProvider vfsProvider;
protected ProjectRegistry projectRegistry;
protected FileWatcherNotificationHandler fileWatcherNotificationHandler;
protected FileTreeWatcher fileTreeWatcher;
protected ProjectTypeRegistry projectTypeRegistry;
protected ProjectHandlerRegistry projectHandlerRegistry;
protected ProjectImporterRegistry importerRegistry;
Expand Down Expand Up @@ -131,7 +129,6 @@ protected void initProjectApi() throws Exception {
importerRegistry = new ProjectImporterRegistry(new HashSet<>());

fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);

pm =
new ProjectManager(
Expand All @@ -142,7 +139,6 @@ protected void initProjectApi() throws Exception {
projectHandlerRegistry,
importerRegistry,
fileWatcherNotificationHandler,
fileTreeWatcher,
new TestWorkspaceHolder(new ArrayList<>()),
Mockito.mock(FileWatcherManager.class));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.eclipse.che.api.vfs.VirtualFile;
import org.eclipse.che.api.vfs.VirtualFileSystem;
import org.eclipse.che.api.vfs.VirtualFileSystemProvider;
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationListener;
import org.eclipse.che.api.vfs.search.Searcher;
Expand All @@ -81,7 +80,6 @@ public class ProjectManager {
private final ProjectRegistry projectRegistry;
private final ProjectHandlerRegistry handlers;
private final ProjectImporterRegistry importers;
private final FileTreeWatcher fileWatcher;
private final FileWatcherNotificationHandler fileWatchNotifier;
private final ExecutorService executor;
private final WorkspaceProjectsSyncer workspaceProjectsHolder;
Expand All @@ -98,7 +96,6 @@ public ProjectManager(
ProjectHandlerRegistry handlers,
ProjectImporterRegistry importers,
FileWatcherNotificationHandler fileWatcherNotificationHandler,
FileTreeWatcher fileTreeWatcher,
WorkspaceProjectsSyncer workspaceProjectsHolder,
FileWatcherManager fileWatcherManager)
throws ServerException {
Expand All @@ -109,7 +106,6 @@ public ProjectManager(
this.handlers = handlers;
this.importers = importers;
this.fileWatchNotifier = fileWatcherNotificationHandler;
this.fileWatcher = fileTreeWatcher;
this.workspaceProjectsHolder = workspaceProjectsHolder;
this.fileWatcherManager = fileWatcherManager;

Expand Down Expand Up @@ -164,12 +160,6 @@ public void onFileWatcherEvent(VirtualFile virtualFile, FileWatcherEventType eve
}
};
fileWatchNotifier.addNotificationListener(defaultListener);
try {
fileWatcher.startup();
} catch (IOException e) {
LOG.error(e.getMessage(), e);
fileWatchNotifier.removeNotificationListener(defaultListener);
}
}

@PreDestroy
Expand Down Expand Up @@ -198,13 +188,9 @@ public void removeWatchListener(FileWatcherNotificationListener listener) {
fileWatchNotifier.removeNotificationListener(listener);
}

public void addWatchExcludeMatcher(PathMatcher matcher) {
fileWatcher.addExcludeMatcher(matcher);
}
public void addWatchExcludeMatcher(PathMatcher matcher) {}

public void removeWatchExcludeMatcher(PathMatcher matcher) {
fileWatcher.removeExcludeMatcher(matcher);
}
public void removeWatchExcludeMatcher(PathMatcher matcher) {}

/**
* @return all the projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

@Singleton
public class DefaultFileWatcherNotificationHandler implements FileWatcherNotificationHandler {

private static final Logger LOG =
LoggerFactory.getLogger(DefaultFileWatcherNotificationHandler.class);

Expand Down Expand Up @@ -93,6 +94,7 @@ private VirtualFile convertToVirtualFile(File root, String subPath, boolean isDi
}

private static class DeletedLocalVirtualFile extends LocalVirtualFile {

private final boolean isDir;

DeletedLocalVirtualFile(
Expand Down
Loading