public class ImportCandidates
extends org.apache.commons.io.DirectoryWalker
File
object will determine the correct
number and members of a given import. This facility permits iterating over a
directory.
This class is NOT thread-safe.Modifier and Type | Class and Description |
---|---|
static class |
ImportCandidates.CANCEL
Marker exception raised if the
ImportCandidates.SCANNING.cancel() method is
called by an IObserver instance. |
static class |
ImportCandidates.SCANNING
Event raised during a pass through the directory structure given to
ImportCandidates . |
Modifier and Type | Field and Description |
---|---|
static int |
DEPTH |
static loci.formats.in.MetadataLevel |
METADATA_LEVEL |
Constructor and Description |
---|
ImportCandidates(int depth,
OMEROWrapper reader,
java.lang.String[] paths,
IObserver observer)
Main constructor which starts depth-first descent into all the paths
and permits a descent to the given depth.
|
ImportCandidates(OMEROWrapper reader,
java.lang.String[] paths,
IObserver observer)
Calls
ImportCandidates(int, OMEROWrapper, String[], IObserver)
with DEPTH as the first argument. |
Modifier and Type | Method and Description |
---|---|
protected void |
execute(java.lang.String[] paths)
Method called during
ImportCandidates(OMEROWrapper, String[], IObserver)
to operate on all the given paths. |
java.util.List<ImportContainer> |
getContainers() |
java.util.List<java.lang.String> |
getPaths() |
java.lang.String |
getReaderType(java.lang.String path)
Retrieve reader type for file specified in path
|
java.lang.String[] |
getUsedFiles(java.lang.String path)
Return string of files used by container item at path
|
void |
handleFile(java.io.File file,
int depth,
java.util.Collection collection)
Handle a file import
|
void |
print()
Prints the "standard" representation of the groups, which is parsed by
other software layers.
|
void |
printYaml() |
protected ImportContainer |
singleFile(java.io.File file,
ImportConfig config)
Return an import container for a single file
|
int |
size() |
boolean |
wasCancelled() |
public static final int DEPTH
public static final loci.formats.in.MetadataLevel METADATA_LEVEL
public ImportCandidates(OMEROWrapper reader, java.lang.String[] paths, IObserver observer)
ImportCandidates(int, OMEROWrapper, String[], IObserver)
with DEPTH
as the first argument.reader
- instance used for parsing each of the paths. Not used once the
constructor completes.paths
- file paths which are searched. May be directories.observer
- IObserver
which will monitor any exceptions during
ReaderWrapper.setId(String)
. Otherwise no error
reporting takes place.public ImportCandidates(int depth, OMEROWrapper reader, java.lang.String[] paths, IObserver observer)
depth
- number of directory levels to search down.reader
- instance used for parsing each of the paths. Not used once the
constructor completes.paths
- file paths which are searched. May be directories.observer
- IObserver
which will monitor any exceptions during
ReaderWrapper.setId(String)
. Otherwise no error
reporting takes place.public void print()
public void printYaml()
public int size()
public boolean wasCancelled()
public java.util.List<java.lang.String> getPaths()
public java.lang.String getReaderType(java.lang.String path)
path
- - absolute path for containerpublic java.lang.String[] getUsedFiles(java.lang.String path)
path
- - absolute path for containerpublic java.util.List<ImportContainer> getContainers()
protected void execute(java.lang.String[] paths)
ImportCandidates(OMEROWrapper, String[], IObserver)
to operate on all the given paths. This will be called twice: once
without reading the files, and once (with the known total) using
reader
paths
- protected ImportContainer singleFile(java.io.File file, ImportConfig config)
file
- - single filepublic void handleFile(java.io.File file, int depth, java.util.Collection collection)
handleFile
in class org.apache.commons.io.DirectoryWalker
file
- the selected filedepth
- the depth of the scancollection
- the result objects, ignored