Package org.eclipse.jetty.start
Class FileInitializer
- java.lang.Object
-
- org.eclipse.jetty.start.FileInitializer
-
- Direct Known Subclasses:
BaseHomeFileInitializer
,LocalFileInitializer
,MavenLocalRepoFileInitializer
,TestFileInitializer
,UriFileInitializer
public abstract class FileInitializer extends java.lang.Object
Interface for initializing a file resource.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FileInitializer(BaseHome basehome, java.lang.String... scheme)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
check(java.net.URI uri, java.lang.String location)
boolean
copyDirectory(java.nio.file.Path source, java.nio.file.Path destination)
abstract boolean
create(java.net.URI uri, java.lang.String location)
Initialize a file resourceprotected void
download(java.net.URI uri, java.nio.file.Path destination)
protected java.nio.file.Path
getDestination(java.net.URI uri, java.lang.String location)
boolean
isApplicable(java.net.URI uri)
protected boolean
isFilePresent(java.nio.file.Path... paths)
Test if any of the Paths exist (as files)
-
-
-
Field Detail
-
_scheme
protected final java.util.Set<java.lang.String> _scheme
-
_basehome
protected final BaseHome _basehome
-
-
Constructor Detail
-
FileInitializer
protected FileInitializer(BaseHome basehome, java.lang.String... scheme)
-
-
Method Detail
-
isApplicable
public boolean isApplicable(java.net.URI uri)
-
create
public abstract boolean create(java.net.URI uri, java.lang.String location) throws java.io.IOException
Initialize a file resource- Parameters:
uri
- the URI of the resource acting as its sourcelocation
- the simple string reference to the output file, suitable for searching for the file in other locations (like ${jetty.home} or ${jetty.dir}) *- Returns:
- true if local file system is modified.
- Throws:
java.io.IOException
- if there was an attempt to initialize, but an error occurred.
-
check
public boolean check(java.net.URI uri, java.lang.String location) throws java.io.IOException
- Throws:
java.io.IOException
-
getDestination
protected java.nio.file.Path getDestination(java.net.URI uri, java.lang.String location) throws java.io.IOException
- Throws:
java.io.IOException
-
download
protected void download(java.net.URI uri, java.nio.file.Path destination) throws java.io.IOException
- Throws:
java.io.IOException
-
isFilePresent
protected boolean isFilePresent(java.nio.file.Path... paths) throws java.io.IOException
Test if any of the Paths exist (as files)- Parameters:
paths
- the list of paths to check- Returns:
- true if the path exist (as a file), false if it doesn't exist
- Throws:
java.io.IOException
- if the path points to a non-file, or is not readable.
-
copyDirectory
public boolean copyDirectory(java.nio.file.Path source, java.nio.file.Path destination) throws java.io.IOException
- Throws:
java.io.IOException
-
-