public class AbsoluteNameLocationStrategy extends Object implements FileLocationStrategy
A specialized implementation of FileLocationStrategy
which checks whether the provided file name is already
an absolute file name.
This strategy ignores the URL and the base path stored in the passed in FileLocator
. It is only triggered by
absolute names in the locator's fileName
component.
Constructor and Description |
---|
AbsoluteNameLocationStrategy() |
Modifier and Type | Method and Description |
---|---|
URL |
locate(FileSystem fileSystem,
FileLocator locator)
Tries to locate the specified file.
|
public AbsoluteNameLocationStrategy()
public URL locate(FileSystem fileSystem, FileLocator locator)
FileSystem
to be used. Note that the
FileLocator
object may also contain a FileSystem
, but this is optional. The passed in
FileSystem
should be used, and callers must not pass a null reference for this argument. A concrete
implementation has to evaluate the properties stored in the FileLocator
object and try to match them to an
existing file. If this can be done, a corresponding URL is returned. Otherwise, result is null.
Implementations should not throw an exception (unless parameters are null) as there might be alternative
strategies which can find the file in question. This implementation constructs a File
object from the locator's file name (if defined). If this
results in an absolute file name pointing to an existing file, the corresponding URL is returned.locate
in interface FileLocationStrategy
fileSystem
- the FileSystem
to be used for this operationlocator
- the object describing the file to be locatedCopyright © 2001–2022 The Apache Software Foundation. All rights reserved.