private Path buildWatchService() throws IOException {
    // Get the directory for view Archives
    //Attach a file watcher at this directory, Extracted work directory will be ignored
    File viewsDir = configuration.getViewsDir();
    Path path = Paths.get(viewsDir.getAbsolutePath());

    watchService = path.getFileSystem().newWatchService();
    //Watch vews directory for creation events
    path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE);
    return path;

  }
Sanity check to validate if the detected path is a valid archive file
is not a directory, also check that the file is not empty

@param resolvedPath
@return
ambari-server/src/main/java/org/apache/ambari/server/view/ViewDirectoryWatcher.java