Class FileSystemRepository
java.lang.Object
i5.las2peer.classLoaders.libraries.FileSystemRepository
- All Implemented Interfaces:
Repository
implements a repository which loads all libraries from a given directory or from severeal ones. The search for
library files (jars) may be recursive.
-
Constructor Summary
ConstructorDescriptionFileSystemRepository
(Iterable<String> directories, boolean recursive) create a repository for the given directoriesFileSystemRepository
(String directory) create a repository for the given directory, non-recursiveFileSystemRepository
(String[] directories) create a repository for the given directories, non-recursiveFileSystemRepository
(String[] directories, boolean recursive) create a repository for the given directoriesFileSystemRepository
(String directory, boolean recursive) create a repository for the given directory -
Method Summary
Modifier and TypeMethodDescriptionget a library matching name and version of the given identifierfindLibrary
(String name) get the newest library for the given nameString[]
get an array with found jar files within this repositoryString[]
getAvailableVersions
(String libraryName) get an array with all versions found for the given library namegetAvailableVersionSet
(String libraryName) get a collection with all versions found for the given library namestatic long
getLastModified
(File dir, boolean recursive) helper method to get the last modification date of a directoryget a collection with all found jar files within this repositorytoString()
-
Constructor Details
-
FileSystemRepository
create a repository for the given directory, non-recursive- Parameters:
directory
- A directory path name to use as repository
-
FileSystemRepository
create a repository for the given directory- Parameters:
directory
- A directory path name to use as repositoryrecursive
- If true, recursion is used for sub-directories.
-
FileSystemRepository
create a repository for the given directories, non-recursive- Parameters:
directories
- An array of directory path names to use as repository
-
FileSystemRepository
create a repository for the given directories- Parameters:
directories
- An array of directory path names to use as repositoryrecursive
- If true, recursion is used for sub-directories.
-
FileSystemRepository
create a repository for the given directories- Parameters:
directories
- A bunch of directory path names to use as repositoryrecursive
- If true, recursion is used for sub-directories.
-
-
Method Details
-
findLibrary
get the newest library for the given name- Specified by:
findLibrary
in interfaceRepository
- Parameters:
name
- A library name to search for- Returns:
- Returns a LoadedLibrary for the requested library name
- Throws:
LibraryNotFoundException
- If the library could not be found in this repository
-
findLibrary
get a library matching name and version of the given identifier- Specified by:
findLibrary
in interfaceRepository
- Parameters:
lib
- A library identifier- Returns:
- Returns a LoadedLibrary for the requested library identifier
- Throws:
LibraryNotFoundException
- If the library could not be found in this repository
-
getAvailableVersions
get an array with all versions found for the given library name- Parameters:
libraryName
- A canonical library name- Returns:
- array with all available versions of the given library
-
getAvailableVersionSet
get a collection with all versions found for the given library name- Parameters:
libraryName
- A canonical library name- Returns:
- a collections with all versions of the given library
-
getAllLibraries
get an array with found jar files within this repository- Returns:
- an array with all libraries in this repository
-
getLibraryCollection
get a collection with all found jar files within this repository- Returns:
- a collection with all libraries in this repository
-
getLastModified
helper method to get the last modification date of a directory- Parameters:
dir
- A directoryrecursive
- If true also files inside the directory are considered- Returns:
- Returns the last modified date in epoch format
-
toString
-