Package ai.djl.repository
Class SimpleRepository
java.lang.Object
ai.djl.repository.AbstractRepository
ai.djl.repository.SimpleRepository
- All Implemented Interfaces:
Repository
A
SimpleRepository
is a Repository
containing only a single artifact without
requiring a "metadata.json" file.- See Also:
-
Field Summary
Fields inherited from class ai.djl.repository.AbstractRepository
arguments, name, uri
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SimpleRepository
(String name, URI uri, Path path) (Internal) Constructs a SimpleRepository. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
download
(Path tmp, URI baseUri, Artifact.Item item, ai.djl.util.Progress progress) Returns the URI to the base of the repository.Returns the cache directory for the repository.getResourceDirectory
(Artifact artifact) Returns the resource directory for the an artifact.Returns a list ofMRL
s in the repository.boolean
isRemote()
Returns whether the repository is remote repository.Returns the metadata at a mrl.void
Prepares the artifact for use with progress tracking.Returns the artifact matching a mrl, version, and property filter.protected URI
resolvePath
(Artifact.Item item, String path) Methods inherited from class ai.djl.repository.AbstractRepository
addResource, getFile, getName, listDirectory, openStream, save
-
Constructor Details
-
SimpleRepository
(Internal) Constructs a SimpleRepository.- Parameters:
name
- the name of the repositoryuri
- the base URI of the repositorypath
- the path to the repository
-
-
Method Details
-
isRemote
public boolean isRemote()Returns whether the repository is remote repository.- Returns:
- whether the repository is remote repository
-
getBaseUri
Returns the URI to the base of the repository.- Specified by:
getBaseUri
in interfaceRepository
- Overrides:
getBaseUri
in classAbstractRepository
- Returns:
- the URI
-
locate
Returns the metadata at a mrl.- Parameters:
mrl
- the mrl of the metadata to retrieve- Returns:
- the metadata
- Throws:
IOException
- if it failed to load the metadata
-
resolve
Returns the artifact matching a mrl, version, and property filter.- Parameters:
mrl
- the mrl to match the artifact againstfilter
- the property filter- Returns:
- the matched artifact
- Throws:
IOException
- if it failed to load the artifact
-
getResourceDirectory
Returns the resource directory for the an artifact.- Parameters:
artifact
- the artifact whose resource directory to return- Returns:
- the resource directory path
- Throws:
IOException
- if it failed to ensure the creation of the cache directory
-
download
protected void download(Path tmp, URI baseUri, Artifact.Item item, ai.djl.util.Progress progress) throws IOException - Overrides:
download
in classAbstractRepository
- Throws:
IOException
-
prepare
Prepares the artifact for use with progress tracking.- Specified by:
prepare
in interfaceRepository
- Overrides:
prepare
in classAbstractRepository
- Parameters:
artifact
- the artifact to prepareprogress
- the progress tracker- Throws:
IOException
- if it failed to prepare
-
getCacheDirectory
Returns the cache directory for the repository.- Specified by:
getCacheDirectory
in interfaceRepository
- Overrides:
getCacheDirectory
in classAbstractRepository
- Returns:
- the cache directory path
- Throws:
IOException
- if it failed to ensure the creation of the cache directory
-
resolvePath
- Overrides:
resolvePath
in classAbstractRepository
- Throws:
IOException
-
getResources
Returns a list ofMRL
s in the repository.An empty list will be returned if underlying
Repository
implementation does not support this feature.- Returns:
- a list of
MRL
s in the repository
-