Skip to content

Commit 2b4f7c5

Browse files
committed
Create service interfaces for services that were directly under com.kodeku.service
1 parent fcf3017 commit 2b4f7c5

16 files changed

+265
-21
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package com.kodedu.service;
2+
3+
import javafx.stage.DirectoryChooser;
4+
import javafx.stage.FileChooser;
5+
6+
import java.io.File;
7+
import java.nio.file.Path;
8+
import java.util.Optional;
9+
import java.util.function.Supplier;
10+
11+
/**
12+
* Created by usta on 25.12.2014.
13+
*/
14+
public interface DirectoryService {
15+
16+
public DirectoryChooser newDirectoryChooser(String title);
17+
18+
public FileChooser newFileChooser(String title);
19+
20+
public Path workingDirectory();
21+
22+
public Path currentPath();
23+
24+
public Supplier<Path> getPathSaveSupplier();
25+
26+
public void setPathSaveSupplier(Supplier<Path> pathSaveSupplier);
27+
28+
public void setWorkingDirectory(Optional<Path> workingDirectory);
29+
30+
public Optional<Path> getWorkingDirectory();
31+
32+
public Optional<File> getInitialDirectory();
33+
34+
public void setInitialDirectory(Optional<File> initialDirectory);
35+
36+
public void askWorkingDir();
37+
38+
public void changeWorkigDir(Path path);
39+
40+
public void goUp();
41+
42+
public void refreshWorkingDir();
43+
44+
public String interPath();
45+
46+
public String interPath(Path path);
47+
48+
public Path getSaveOutputPath(FileChooser.ExtensionFilter extensionFilter, boolean askPath);
49+
50+
public Path findPathInCurrentOrWorkDir(String uri);
51+
52+
public Path findPathInPublic(String finalUri);
53+
54+
public Path findPathInWorkdirOrLookup(Path uri);
55+
56+
public Path currentParentOrWorkdir();
57+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.kodedu.service;
2+
3+
import java.nio.file.Path;
4+
import java.nio.file.WatchKey;
5+
import java.util.Map;
6+
7+
/**
8+
* Created by usta on 31.12.2014.
9+
*/
10+
public interface FileWatchService {
11+
12+
public void reCreateWatchService();
13+
14+
public void unRegisterAllPath();
15+
16+
public void registerPathWatcher(final Path path);
17+
18+
public boolean isRegisteredPath(Path finalPath, Map<WatchKey, Path> watchKeys);
19+
20+
public void unRegisterPath(Path path);
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.kodedu.service;
2+
3+
import javafx.scene.image.Image;
4+
import java.io.File;
5+
import java.util.List;
6+
import java.util.Optional;
7+
8+
/**
9+
* Created by usta on 16.12.2014.
10+
*/
11+
public interface ParserService {
12+
13+
public Optional<String> toIncludeBlock(List<File> dropFiles);
14+
15+
public Optional<String> toImageBlock(Image image);
16+
17+
public Optional<String> toImageBlock(List<File> dropFiles);
18+
19+
public Optional<String> toWebImageBlock(String html);
20+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.kodedu.service;
2+
3+
import java.nio.file.Path;
4+
5+
/**
6+
* Created by usta on 20.05.2015.
7+
*/
8+
public interface PathFinderService {
9+
10+
public Path findPath(String uri, Integer parent);
11+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.kodedu.service;
2+
3+
import java.nio.file.Path;
4+
5+
/**
6+
* Created by usta on 01.01.2015.
7+
*/
8+
public interface PathOrderService {
9+
10+
public int comparePaths(Path first, Path second);
11+
12+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.kodedu.service;
2+
3+
import java.nio.file.Path;
4+
5+
/**
6+
* Created by usta on 07.09.2014.
7+
*/
8+
public interface PathResolverService {
9+
10+
public boolean isPDF(Path path);
11+
12+
public boolean isImage(Path path);
13+
14+
public boolean isHidden(Path path);
15+
16+
public boolean isMarkdown(Path path);
17+
18+
public boolean isXML(Path path);
19+
20+
public boolean isHTML(Path path);
21+
22+
public boolean isAsciidoc(Path path);
23+
24+
public boolean isViewable(Path path);
25+
26+
public boolean isOffice(Path path);
27+
28+
29+
public boolean isBook(Path path);
30+
31+
public boolean isMobi(Path path);
32+
33+
public boolean isPPT(Path path);
34+
35+
public boolean isExcel(Path path);
36+
37+
public boolean isArchive(Path path);
38+
39+
public boolean isVideo(Path path);
40+
41+
public boolean isCSS(Path path);
42+
43+
public boolean isBash(Path path);
44+
45+
public boolean isCode(Path path);
46+
47+
public boolean isAny(Path path);
48+
49+
public boolean isEpub(Path path);
50+
51+
public boolean isWord(Path path);
52+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.kodedu.service;
2+
3+
import java.nio.file.Path;
4+
5+
/**
6+
* Created by usta on 02.09.2014.
7+
*/
8+
public interface SampleBookService {
9+
10+
public void produceSampleBook(Path configPath, Path outputPath);
11+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package com.kodedu.service;
2+
3+
import javafx.event.ActionEvent;
4+
5+
import java.util.concurrent.Executor;
6+
import java.util.concurrent.Future;
7+
import java.util.concurrent.ScheduledFuture;
8+
import java.util.concurrent.TimeUnit;
9+
import java.util.function.Consumer;
10+
import java.util.function.Supplier;
11+
12+
/**
13+
* Created by usta on 25.12.2014.
14+
*/
15+
public interface ThreadService {
16+
17+
public ScheduledFuture<?> schedule(Runnable runnable, long delay, TimeUnit timeUnit);
18+
19+
public ScheduledFuture<?> scheduleWithDelay(Runnable runnable, long initialDelay, long delay, TimeUnit timeUnit);
20+
21+
// Runs Task in background thread pool
22+
public <T> Future<?> runTaskLater(Runnable runnable);
23+
24+
// Runs task in JavaFX Thread
25+
public void runActionLater(Consumer<ActionEvent> consumer);
26+
27+
// Runs task in JavaFX Thread
28+
public void runActionLater(final Runnable runnable);
29+
30+
public void runActionLater(Runnable runnable, boolean force);
31+
32+
public void start(Runnable runnable);
33+
34+
public Executor executor();
35+
36+
public Buff buff(String id);
37+
38+
public <T> T supply(Supplier<T> supplier);
39+
40+
public <T> void runActionLater(Consumer<T> consumer, T t);
41+
42+
public ScheduledFuture<?> scheduleWithDelay(Runnable runnable, int timeBetweenFramesMS, TimeUnit milliseconds);
43+
}

src/main/java/com/kodedu/service/impl/DirectoryServiceImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
package com.kodedu.service;
1+
package com.kodedu.service.impl;
22

33
import com.kodedu.config.StoredConfigBean;
44
import com.kodedu.controller.ApplicationController;
55
import com.kodedu.helper.IOHelper;
66
import com.kodedu.other.Current;
7+
import com.kodedu.service.DirectoryService;
78
import com.kodedu.service.ui.FileBrowseService;
89
import javafx.application.Platform;
910
import javafx.stage.DirectoryChooser;
@@ -31,7 +32,7 @@
3132
* Created by usta on 25.12.2014.
3233
*/
3334
@Component
34-
public class DirectoryService {
35+
public class DirectoryServiceImpl implements DirectoryService {
3536

3637
private final ApplicationController controller;
3738
private final FileBrowseService fileBrowser;
@@ -51,7 +52,7 @@ public class DirectoryService {
5152

5253

5354
@Autowired
54-
public DirectoryService(final ApplicationController controller, final FileBrowseService fileBrowser, final Current current, PathResolverService pathResolver, StoredConfigBean storedConfigBean, FileWatchService fileWatchService, ThreadService threadService, PathMapper pathMapper) {
55+
public DirectoryServiceImpl(final ApplicationController controller, final FileBrowseService fileBrowser, final Current current, PathResolverService pathResolver, StoredConfigBean storedConfigBean, FileWatchService fileWatchService, ThreadService threadService, PathMapper pathMapper) {
5556
this.controller = controller;
5657
this.fileBrowser = fileBrowser;
5758
this.current = current;

src/main/java/com/kodedu/service/impl/FileWatchServiceImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package com.kodedu.service;
1+
package com.kodedu.service.impl;
22

33
import com.kodedu.component.MyTab;
44
import com.kodedu.controller.ApplicationController;
55
import com.kodedu.helper.IOHelper;
6+
import com.kodedu.service.FileWatchService;
67
import com.kodedu.service.ui.FileBrowseService;
78
import com.kodedu.service.ui.TabService;
89
import javafx.collections.ObservableList;
@@ -26,7 +27,7 @@
2627
* Created by usta on 31.12.2014.
2728
*/
2829
@Component
29-
public class FileWatchService {
30+
public class FileWatchServiceImpl implements FileWatchService {
3031

3132
private final Logger logger = LoggerFactory.getLogger(FileWatchService.class);
3233

@@ -44,7 +45,7 @@ public class FileWatchService {
4445
private final PathMapper pathMapper;
4546

4647
@Autowired
47-
public FileWatchService(ApplicationController controller, ThreadService threadService, PathMapper pathMapper) {
48+
public FileWatchServiceImpl(ApplicationController controller, ThreadService threadService, PathMapper pathMapper) {
4849
this.controller = controller;
4950
this.threadService = threadService;
5051
this.pathMapper = pathMapper;

0 commit comments

Comments
 (0)