@ThreadSafe public class Repository extends java.lang.Object implements Universe
| Modifier and Type | Class and Description |
|---|---|
static class |
Repository.AlreadyInstalledException
Exception raised when trying to install a package already installed.
|
static class |
Repository.HttpException
Exception raised when receiving 404 when trying to read a package on the web.
|
static class |
Repository.NotFoundException
Exception raised when receiving 404 when trying to read a package on the web.
|
static class |
Repository.OnlineException
Exception raised when receiving an error when trying to read a package on the web.
|
| Constructor and Description |
|---|
Repository(Storage storage) |
| Modifier and Type | Method and Description |
|---|---|
static Repository |
createRepository(java.nio.file.Path dir)
Create a repository.
|
Packages |
getPackages(java.lang.String name) |
Storage |
getStorage()
Get the repository storage.
|
java.util.List<PackageException> |
init()
Initialise the repository.
|
Package |
installPackage(java.net.URI pkg,
boolean force,
UserInteractionStrategy interact)
Install a XAR package into this repository, from a URI location.
|
Package |
installPackage(XarSource xarSource,
boolean force,
UserInteractionStrategy interact)
Install a XAR package into this repository.
|
java.util.Collection<Packages> |
listPackages() |
static Repository |
makeDefaultRepo()
Shortcut for
makeDefaultRepo(null). |
static Repository |
makeDefaultRepo(java.lang.String dir)
Return a repository instantiated from default location.
|
void |
registerExtension(Extension ext)
Register an extension.
|
java.util.List<PackageException> |
reload()
Reload the repository configuration, so parse again the package descriptors.
|
boolean |
removePackage(java.lang.String pkg,
boolean force,
UserInteractionStrategy interact)
Remove a package from the repository, by name.
|
boolean |
removePackage(java.lang.String pkg,
java.lang.String version,
boolean force,
UserInteractionStrategy interact)
Remove a package from the repository, by name and version.
|
javax.xml.transform.Source |
resolve(java.lang.String href,
URISpace space)
Resolve a URI in this repository, in the specified space, return a File.
|
javax.xml.transform.Source |
resolve(java.lang.String href,
URISpace space,
boolean transitive)
Resolve a specific URI, in a specific space, into a stream source.
|
public Repository(Storage storage)
public java.util.List<PackageException> init()
public static Repository makeDefaultRepo() throws PackageException
makeDefaultRepo(null).PackageException - if an error occurspublic static Repository makeDefaultRepo(java.lang.String dir) throws PackageException
expath.repo, and if it is not set at the
environment variable EXPATH_REPO. This string is interpreted
as a directory path, which must point to a repository.
It throws an exception if the the directory does not exist (or is not a
directory), or if there is any error creating the repository object from
it.dir - the repository dirPackageException - if an error occurspublic final void registerExtension(Extension ext) throws PackageException
ext - the extensionPackageException - if an error occurspublic java.util.List<PackageException> reload()
public Storage getStorage()
Storage object this repository is based upon.public java.util.Collection<Packages> listPackages()
public Packages getPackages(java.lang.String name)
public static Repository createRepository(java.nio.file.Path dir) throws PackageException
dir - the repository dirPackageException - if an error occurspublic Package installPackage(java.net.URI pkg, boolean force, UserInteractionStrategy interact) throws PackageException
pkg - The package file (typically a *.xar or *.xaw file).force - If force is false, this is an error if the same package has
already been installed in the repository. If it is true, it is first
deleted if existing.interact - How the repository interacts with the user.PackageException - If any error occurs.public Package installPackage(XarSource xarSource, boolean force, UserInteractionStrategy interact) throws PackageException
xarSource - A source for the package file (typically a *.xar or *.xaw file).force - If force is false, this is an error if the same package has
already been installed in the repository. If it is true, it is first
deleted if existing.interact - How the repository interacts with the user.PackageException - If any error occurs.public boolean removePackage(java.lang.String pkg,
boolean force,
UserInteractionStrategy interact)
throws PackageException
force is true, then simply returns false).pkg - The package name.force - To silently ignore a non existing package (simply returns
false in that case).interact - How the repository interacts with the user.force is true).PackageException - If any error occurs during removal.public boolean removePackage(java.lang.String pkg,
java.lang.String version,
boolean force,
UserInteractionStrategy interact)
throws PackageException
force is true (then it simply returns false).pkg - The package name.version - The package version.force - To silently ignore a non existing package (simply returns
false in that case).interact - How the repository interacts with the user.force is true).PackageException - If any error occurs during removal.public javax.xml.transform.Source resolve(java.lang.String href,
URISpace space)
throws PackageException
resolve in interface Universehref - the URIspace - the URI spacePackageException - if an error occurspublic javax.xml.transform.Source resolve(java.lang.String href,
URISpace space,
boolean transitive)
throws PackageException
Universeresolve in interface Universehref - the URIspace - the URI spacetransitive - true if package dependencies are used to resolve the hrefPackageException - if an error occursCopyright © 2015-2023 EXPath. All Rights Reserved