CommandFileWatcher
class
CommandFileWatcher
extends Thread
java.lang.Object | ||
↳ | java.lang.Thread | |
↳ | com.android.tradefed.command.CommandFileWatcher |
A simple class to watch a set of command files for changes, and to trigger a reload of _all_ manually-loaded command files when such a change happens.
Summary
Nested classes | |
---|---|
class |
CommandFileWatcher.CommandFile
A simple struct to store a command file as well as its extra args |
interface |
CommandFileWatcher.ICommandFileListener
|
Fields | |
---|---|
boolean |
mCancelled
|
Public constructors | |
---|---|
CommandFileWatcher(CommandFileWatcher.ICommandFileListener listener)
|
Public methods | |
---|---|
void
|
addCmdFile(File cmdFile, List<String> extraArgs, Collection<String> includedFiles)
Add a command file to watch, as well as its dependencies. |
void
|
cancel()
Terminate the watcher thread |
List<String>
|
getExtraArgsForFile(String cmdPath)
Retrieves the extra arguments associated with given file being watched. |
boolean
|
isCancelled()
Check if the thread has been signalled to stop. |
boolean
|
isFileWatched(File cmdFile)
Returns true if given command gile path is currently being watched |
void
|
removeAllFiles()
Remove all files from the watched list |
void
|
run()
|
Fields
mCancelled
boolean mCancelled
Public constructors
CommandFileWatcher
public CommandFileWatcher (CommandFileWatcher.ICommandFileListener listener)
Parameters | |
---|---|
listener |
CommandFileWatcher.ICommandFileListener |
Public methods
addCmdFile
public void addCmdFile (File cmdFile, List<String> extraArgs, Collection<String> includedFiles)
Add a command file to watch, as well as its dependencies. When either
the command file itself or any of its dependencies changes, notify the registered
CommandFileWatcher.ICommandFileListener
Parameters | |
---|---|
cmdFile |
File |
extraArgs |
List |
includedFiles |
Collection |
cancel
public void cancel ()
Terminate the watcher thread
getExtraArgsForFile
public List<String> getExtraArgsForFile (String cmdPath)
Retrieves the extra arguments associated with given file being watched.
TODO: extra args list should likely be stored elsewhere, and have this class just operate as a generic file watcher with dependencies
Parameters | |
---|---|
cmdPath |
String |
Returns | |
---|---|
List<String> |
the list of extra arguments associated with command file. Returns empty list if command path is not recognized |
isCancelled
public boolean isCancelled ()
Check if the thread has been signalled to stop.
Returns | |
---|---|
boolean |
isFileWatched
public boolean isFileWatched (File cmdFile)
Returns true if given command gile path is currently being watched
Parameters | |
---|---|
cmdFile |
File |
Returns | |
---|---|
boolean |
removeAllFiles
public void removeAllFiles ()
Remove all files from the watched list
run
public void run ()
Interfaces
Classes
- CommandFileParser
- CommandFileParser.Bitmask
- CommandFileParser.CommandLine
- CommandFileWatcher
- CommandFileWatcher.CommandFile
- CommandOptions
- CommandRunner
- CommandScheduler
- CommandScheduler.CommandTracker
- CommandScheduler.CommandTrackerIdComparator
- Console
- Console.ArgRunnable
- Console.CaptureList
- Verify
Enums
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.