public class SimpleRepository extends AbstractRepository
SimpleRepository
is a Repository
containing only a single artifact without
requiring a "metadata.json" file.Repository
Modifier | Constructor and Description |
---|---|
protected |
SimpleRepository(java.lang.String name,
java.nio.file.Path path,
java.lang.String artifactId,
java.lang.String modelName)
(Internal) Constructs a SimpleRepository.
|
Modifier and Type | Method and Description |
---|---|
protected void |
download(java.nio.file.Path tmp,
java.net.URI baseUri,
Artifact.Item item,
ai.djl.util.Progress progress) |
java.net.URI |
getBaseUri()
Returns the URI to the base of the repository.
|
java.nio.file.Path |
getCacheDirectory()
Returns the cache directory for the repository.
|
java.lang.String |
getName()
Returns the repository name.
|
java.nio.file.Path |
getResourceDirectory(Artifact artifact)
Returns the resource directory for the an artifact.
|
java.util.List<MRL> |
getResources()
Returns a list of
MRL s in the repository. |
boolean |
isRemote()
Returns whether the repository is remote repository.
|
Metadata |
locate(MRL mrl)
Returns the metadata at a mrl.
|
void |
prepare(Artifact artifact,
ai.djl.util.Progress progress)
Prepares the artifact for use with progress tracking.
|
Artifact |
resolve(MRL mrl,
java.lang.String version,
java.util.Map<java.lang.String,java.lang.String> filter)
Returns the artifact matching a mrl, version, and property filter.
|
protected java.net.URI |
resolvePath(Artifact.Item item,
java.lang.String path) |
getFile, listDirectory, md5hash, openStream, save
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
newInstance, newInstance, prepare, registerRepositoryFactory
protected SimpleRepository(java.lang.String name, java.nio.file.Path path, java.lang.String artifactId, java.lang.String modelName)
name
- the name of the repositorypath
- the path to the repositoryartifactId
- the artifatId of the repositorymodelName
- the modelName of the repositorypublic boolean isRemote()
public java.lang.String getName()
public java.net.URI getBaseUri()
public Metadata locate(MRL mrl) throws java.io.IOException
mrl
- the mrl of the metadata to retrievejava.io.IOException
- if it failed to load the metadatapublic Artifact resolve(MRL mrl, java.lang.String version, java.util.Map<java.lang.String,java.lang.String> filter) throws java.io.IOException
mrl
- the mrl to match the artifact againstversion
- the version of the artifactfilter
- the property filterjava.io.IOException
- if it failed to load the artifactpublic java.nio.file.Path getResourceDirectory(Artifact artifact) throws java.io.IOException
artifact
- the artifact whose resource directory to returnjava.io.IOException
- if it failed to ensure the creation of the cache directoryprotected void download(java.nio.file.Path tmp, java.net.URI baseUri, Artifact.Item item, ai.djl.util.Progress progress) throws java.io.IOException
download
in class AbstractRepository
java.io.IOException
public void prepare(Artifact artifact, ai.djl.util.Progress progress) throws java.io.IOException
prepare
in interface Repository
prepare
in class AbstractRepository
artifact
- the artifact to prepareprogress
- the progress trackerjava.io.IOException
- if it failed to preparepublic java.nio.file.Path getCacheDirectory() throws java.io.IOException
getCacheDirectory
in interface Repository
getCacheDirectory
in class AbstractRepository
java.io.IOException
- if it failed to ensure the creation of the cache directoryprotected java.net.URI resolvePath(Artifact.Item item, java.lang.String path) throws java.io.IOException
resolvePath
in class AbstractRepository
java.io.IOException
public java.util.List<MRL> getResources()
MRL
s in the repository.
An empty list will be returned if underlying Repository
implementation does not
support this feature.
getResources
in interface Repository
getResources
in class AbstractRepository
MRL
s in the repository