Skip to content

Commit c35d27e

Browse files
author
Dmytro Kulieshov
authored
Removing deprecated FileTreeWatcher (eclipse-che#6688)
1 parent 757dd97 commit c35d27e

14 files changed

Lines changed: 14 additions & 1209 deletions

File tree

plugins/plugin-java-debugger/che-plugin-java-debugger-server/src/test/java/org/eclipse/che/plugin/jdb/server/util/ProjectApiUtils.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import org.eclipse.che.api.project.server.importer.ProjectImporterRegistry;
3232
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
3333
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
34-
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
3534
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
3635
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
3736
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
@@ -91,8 +90,6 @@ private static void init() throws Exception {
9190
ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
9291
FileWatcherNotificationHandler fileWatcherNotificationHandler =
9392
new DefaultFileWatcherNotificationHandler(vfsProvider);
94-
FileTreeWatcher fileTreeWatcher =
95-
new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
9693
ProjectManager projectManager =
9794
new ProjectManager(
9895
vfsProvider,
@@ -102,7 +99,6 @@ private static void init() throws Exception {
10299
projectHandlerRegistry,
103100
importerRegistry,
104101
fileWatcherNotificationHandler,
105-
fileTreeWatcher,
106102
workspaceHolder,
107103
mock(FileWatcherManager.class));
108104

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

123119
private static class TestWorkspaceHolder extends WorkspaceProjectsSyncer {
120+
124121
private List<ProjectConfigDto> projects;
125122

126123
TestWorkspaceHolder(List<ProjectConfigDto> projects) {

plugins/plugin-java/che-plugin-java-ext-lang-server/src/test/java/org/eclipse/che/plugin/java/server/rest/JavaFormatterServiceTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import org.eclipse.che.api.project.server.importer.ProjectImporterRegistry;
4040
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
4141
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
42-
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
4342
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
4443
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
4544
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
@@ -60,6 +59,7 @@
6059
/** Test for the java formatter service. */
6160
@Listeners(value = {MockitoTestNGListener.class})
6261
public class JavaFormatterServiceTest {
62+
6363
private static final String FORMATTER_CONTENT =
6464
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
6565
+ "<profiles version=\"13\">\n"
@@ -109,8 +109,6 @@ protected void initProjectApi() throws Exception {
109109
ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
110110
FileWatcherNotificationHandler fileWatcherNotificationHandler =
111111
new DefaultFileWatcherNotificationHandler(vfsProvider);
112-
FileTreeWatcher fileTreeWatcher =
113-
new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
114112
projectManager =
115113
new ProjectManager(
116114
vfsProvider,
@@ -120,7 +118,6 @@ protected void initProjectApi() throws Exception {
120118
projectHandlerRegistry,
121119
importerRegistry,
122120
fileWatcherNotificationHandler,
123-
fileTreeWatcher,
124121
workspaceHolder,
125122
mock(FileWatcherManager.class));
126123

@@ -243,6 +240,7 @@ private void checkProjectFormatterFile() throws IOException {
243240
}
244241

245242
private static class TestWorkspaceHolder extends WorkspaceProjectsSyncer {
243+
246244
private List<ProjectConfigDto> projects;
247245

248246
TestWorkspaceHolder() {

plugins/plugin-java/che-plugin-java-plain/che-plugin-java-plain-server/src/test/java/org/eclipse/che/plugin/java/plain/server/BaseTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.eclipse.che.api.project.server.importer.ProjectImporterRegistry;
3535
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
3636
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
37-
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
3837
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
3938
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
4039
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
@@ -55,6 +54,7 @@
5554

5655
/** @author Valeriy Svydenko */
5756
public abstract class BaseTest {
57+
5858
private static final String wsPath = BaseTest.class.getResource("/projects").getFile();
5959
private static final String INDEX_PATH = "target/fs_index";
6060

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

7171
TestWorkspaceHolder workspaceHolder = new TestWorkspaceHolder();
7272

73-
if (root == null) root = new File(wsPath);
73+
if (root == null) {
74+
root = new File(wsPath);
75+
}
7476

7577
if (root.exists()) {
7678
IoUtil.deleteRecursive(root);
@@ -109,9 +111,6 @@ protected void initProjectApi() throws Exception {
109111
ProjectImporterRegistry importerRegistry = new ProjectImporterRegistry(new HashSet<>());
110112
FileWatcherNotificationHandler fileWatcherNotificationHandler =
111113
new DefaultFileWatcherNotificationHandler(vfsProvider);
112-
FileTreeWatcher fileTreeWatcher =
113-
new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
114-
115114
projectManager =
116115
new ProjectManager(
117116
vfsProvider,
@@ -121,7 +120,6 @@ protected void initProjectApi() throws Exception {
121120
projectHandlerRegistry,
122121
importerRegistry,
123122
fileWatcherNotificationHandler,
124-
fileTreeWatcher,
125123
new TestWorkspaceHolder(new ArrayList<>()),
126124
mock(FileWatcherManager.class));
127125

plugins/plugin-maven/che-plugin-maven-server/src/test/java/org/eclipse/che/plugin/maven/server/BaseTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import org.eclipse.che.api.project.server.type.ProjectTypeDef;
4141
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
4242
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
43-
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
4443
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
4544
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
4645
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
@@ -83,7 +82,6 @@ public abstract class BaseTest {
8382
protected LocalVirtualFileSystemProvider vfsProvider;
8483
protected ProjectRegistry projectRegistry;
8584
protected FileWatcherNotificationHandler fileWatcherNotificationHandler;
86-
protected FileTreeWatcher fileTreeWatcher;
8785
protected ProjectTypeRegistry projectTypeRegistry;
8886
protected ProjectHandlerRegistry projectHandlerRegistry;
8987
protected ProjectImporterRegistry importerRegistry;
@@ -111,7 +109,9 @@ protected void initProjectApi() throws Exception {
111109
mavenServerManager = new MavenServerManager(mavenServerPath);
112110
workspaceHolder = new TestWorkspaceHolder();
113111

114-
if (root == null) root = new File(wsPath);
112+
if (root == null) {
113+
root = new File(wsPath);
114+
}
115115

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

151151
fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
152-
fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
153152

154153
pm =
155154
new ProjectManager(
@@ -160,7 +159,6 @@ protected void initProjectApi() throws Exception {
160159
projectHandlerRegistry,
161160
importerRegistry,
162161
fileWatcherNotificationHandler,
163-
fileTreeWatcher,
164162
new TestWorkspaceHolder(new ArrayList<>()),
165163
mock(FileWatcherManager.class));
166164

plugins/plugin-testing-java/plugin-testing-testng/che-plugin-testing-testng-server/src/test/java/org/ecipse/che/plugin/testing/testng/server/BaseTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.eclipse.che.api.project.server.type.ProjectTypeDef;
3333
import org.eclipse.che.api.project.server.type.ProjectTypeRegistry;
3434
import org.eclipse.che.api.vfs.impl.file.DefaultFileWatcherNotificationHandler;
35-
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
3635
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
3736
import org.eclipse.che.api.vfs.impl.file.LocalVirtualFileSystemProvider;
3837
import org.eclipse.che.api.vfs.search.impl.FSLuceneSearcherProvider;
@@ -69,7 +68,6 @@ public abstract class BaseTest {
6968
protected LocalVirtualFileSystemProvider vfsProvider;
7069
protected ProjectRegistry projectRegistry;
7170
protected FileWatcherNotificationHandler fileWatcherNotificationHandler;
72-
protected FileTreeWatcher fileTreeWatcher;
7371
protected ProjectTypeRegistry projectTypeRegistry;
7472
protected ProjectHandlerRegistry projectHandlerRegistry;
7573
protected ProjectImporterRegistry importerRegistry;
@@ -131,7 +129,6 @@ protected void initProjectApi() throws Exception {
131129
importerRegistry = new ProjectImporterRegistry(new HashSet<>());
132130

133131
fileWatcherNotificationHandler = new DefaultFileWatcherNotificationHandler(vfsProvider);
134-
fileTreeWatcher = new FileTreeWatcher(root, new HashSet<>(), fileWatcherNotificationHandler);
135132

136133
pm =
137134
new ProjectManager(
@@ -142,7 +139,6 @@ protected void initProjectApi() throws Exception {
142139
projectHandlerRegistry,
143140
importerRegistry,
144141
fileWatcherNotificationHandler,
145-
fileTreeWatcher,
146142
new TestWorkspaceHolder(new ArrayList<>()),
147143
Mockito.mock(FileWatcherManager.class));
148144

wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/project/server/ProjectManager.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import org.eclipse.che.api.vfs.VirtualFile;
5656
import org.eclipse.che.api.vfs.VirtualFileSystem;
5757
import org.eclipse.che.api.vfs.VirtualFileSystemProvider;
58-
import org.eclipse.che.api.vfs.impl.file.FileTreeWatcher;
5958
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationHandler;
6059
import org.eclipse.che.api.vfs.impl.file.FileWatcherNotificationListener;
6160
import org.eclipse.che.api.vfs.search.Searcher;
@@ -81,7 +80,6 @@ public class ProjectManager {
8180
private final ProjectRegistry projectRegistry;
8281
private final ProjectHandlerRegistry handlers;
8382
private final ProjectImporterRegistry importers;
84-
private final FileTreeWatcher fileWatcher;
8583
private final FileWatcherNotificationHandler fileWatchNotifier;
8684
private final ExecutorService executor;
8785
private final WorkspaceProjectsSyncer workspaceProjectsHolder;
@@ -98,7 +96,6 @@ public ProjectManager(
9896
ProjectHandlerRegistry handlers,
9997
ProjectImporterRegistry importers,
10098
FileWatcherNotificationHandler fileWatcherNotificationHandler,
101-
FileTreeWatcher fileTreeWatcher,
10299
WorkspaceProjectsSyncer workspaceProjectsHolder,
103100
FileWatcherManager fileWatcherManager)
104101
throws ServerException {
@@ -109,7 +106,6 @@ public ProjectManager(
109106
this.handlers = handlers;
110107
this.importers = importers;
111108
this.fileWatchNotifier = fileWatcherNotificationHandler;
112-
this.fileWatcher = fileTreeWatcher;
113109
this.workspaceProjectsHolder = workspaceProjectsHolder;
114110
this.fileWatcherManager = fileWatcherManager;
115111

@@ -164,12 +160,6 @@ public void onFileWatcherEvent(VirtualFile virtualFile, FileWatcherEventType eve
164160
}
165161
};
166162
fileWatchNotifier.addNotificationListener(defaultListener);
167-
try {
168-
fileWatcher.startup();
169-
} catch (IOException e) {
170-
LOG.error(e.getMessage(), e);
171-
fileWatchNotifier.removeNotificationListener(defaultListener);
172-
}
173163
}
174164

175165
@PreDestroy
@@ -198,13 +188,9 @@ public void removeWatchListener(FileWatcherNotificationListener listener) {
198188
fileWatchNotifier.removeNotificationListener(listener);
199189
}
200190

201-
public void addWatchExcludeMatcher(PathMatcher matcher) {
202-
fileWatcher.addExcludeMatcher(matcher);
203-
}
191+
public void addWatchExcludeMatcher(PathMatcher matcher) {}
204192

205-
public void removeWatchExcludeMatcher(PathMatcher matcher) {
206-
fileWatcher.removeExcludeMatcher(matcher);
207-
}
193+
public void removeWatchExcludeMatcher(PathMatcher matcher) {}
208194

209195
/**
210196
* @return all the projects

wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/vfs/impl/file/DefaultFileWatcherNotificationHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
@Singleton
2929
public class DefaultFileWatcherNotificationHandler implements FileWatcherNotificationHandler {
30+
3031
private static final Logger LOG =
3132
LoggerFactory.getLogger(DefaultFileWatcherNotificationHandler.class);
3233

@@ -93,6 +94,7 @@ private VirtualFile convertToVirtualFile(File root, String subPath, boolean isDi
9394
}
9495

9596
private static class DeletedLocalVirtualFile extends LocalVirtualFile {
97+
9698
private final boolean isDir;
9799

98100
DeletedLocalVirtualFile(

0 commit comments

Comments
 (0)