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,
String[] paths,
IObserver observer)
Main constructor which iterates over all the paths calling
DirectoryWalker.walk(File, Collection) and permitting a descent to the given
depth. |
ImportCandidates(OMEROWrapper reader,
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(String[] paths)
Method called during
ImportCandidates(OMEROWrapper, String[], IObserver)
to operate on all the given paths. |
List<ImportContainer> |
getContainers() |
List<String> |
getPaths() |
String |
getReaderType(String path)
Retrieve reader type for file specified in path
|
String[] |
getUsedFiles(String path)
Return string of files used by container item at path
|
void |
handleFile(File file,
int depth,
Collection collection)
Handle a file import
|
void |
print()
Prints the "standard" representation of the groups, which is parsed by
other software layers.
|
protected ImportContainer |
singleFile(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, 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, String[] paths, IObserver observer)
DirectoryWalker.walk(File, Collection)
and permitting a descent to the given
depth.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()
Groups#print()
but it does not
take the ordering of the used files into account.public int size()
public boolean wasCancelled()
public String getReaderType(String path)
path
- - absolute path for containerpublic String[] getUsedFiles(String path)
path
- - absolute path for containerpublic List<ImportContainer> getContainers()
protected void execute(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(File file, ImportConfig config)
file
- - single filepublic void handleFile(File file, int depth, Collection collection)
handleFile
in class org.apache.commons.io.DirectoryWalker
file
- - file selecteddepth
- - depth of scancollection
-
Version: 5.1.4-ice35-b55
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.