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

changes on the REST directory are now detected #113

Merged
merged 1 commit into from
Mar 14, 2016
Merged
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 @@ -28,8 +28,6 @@ public class SyncStatusService implements InitializingBean {

private PropertiesModuleManager moduleManager;

private boolean synched = false;

@Override
public void afterPropertiesSet() throws Exception {
File assetInstallTimeFile = new File(environmentConfiguration.getAssetInstallTimeFilePath());
Expand All @@ -54,32 +52,36 @@ public boolean isFlowSynched(String entityName, FlowType flowType, String flowNa
String pluginDir = environmentConfiguration.getUserPluginDir();
Path flowDir = Paths.get(pluginDir, "entities", entityName, flowType.toString(), flowName);

this.synched = true;
boolean synched = false;
try {
Files.walkFileTree(new File(flowDir.toString()).toPath(), new PluginDirectoryVisitor());
PluginDirectoryVisitor visitor = new PluginDirectoryVisitor();
Files.walkFileTree(new File(flowDir.toString()).toPath(), visitor);

synched = visitor.isSynched();
} catch (IOException e) {
// TODO Auto-generated catch block
this.synched = false;
synched = false;
}

return this.synched;
return synched;
}

private class PluginDirectoryVisitor implements FileVisitor<Path> {

private boolean synched = true;

public boolean isSynched() {
return synched;
}

@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
if (dir.endsWith("REST")) {
return FileVisitResult.SKIP_SUBTREE;
}
return FileVisitResult.CONTINUE;
}

@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
// don't look at hidden files like .DS_Store
if (!file.getFileName().toString().startsWith(".")) {
synched = synched && isSynched(file.normalize().toAbsolutePath().toFile());
synched = synched && SyncStatusService.this.isSynched(file.normalize().toAbsolutePath().toFile());
if (!synched) {
return FileVisitResult.TERMINATE;
}
Expand Down