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
ConstructorsModifierConstructorDescriptionprotectedSimpleRepository(String name, URI uri, Path path) (Internal) Constructs a SimpleRepository. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddownload(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 ofMRLs in the repository.booleanisRemote()Returns whether the repository is remote repository.Returns the metadata at a mrl.voidPrepares the artifact for use with progress tracking.Returns the artifact matching a mrl, version, and property filter.protected URIresolvePath(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:
getBaseUriin interfaceRepository- Overrides:
getBaseUriin 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:
downloadin classAbstractRepository- Throws:
IOException
-
prepare
Prepares the artifact for use with progress tracking.- Specified by:
preparein interfaceRepository- Overrides:
preparein 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:
getCacheDirectoryin interfaceRepository- Overrides:
getCacheDirectoryin classAbstractRepository- Returns:
- the cache directory path
- Throws:
IOException- if it failed to ensure the creation of the cache directory
-
resolvePath
- Overrides:
resolvePathin classAbstractRepository- Throws:
IOException
-
getResources
Returns a list ofMRLs in the repository.An empty list will be returned if underlying
Repositoryimplementation does not support this feature.- Returns:
- a list of
MRLs in the repository
-