|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.module.Repository sun.module.repository.URLRepository
public final class URLRepository
This class represents a repository that loads module definitions from a codebase URL.
Information about the module definitions available from the codebase URL must be published in a repository metadata file. The contents of the file must follow the schema of the URL Repository metadata for the Java Module System.
{codebase}/repository-metadata.xml
When the repository is initialized, the repository metadata file (i.e. repository-metadata.xml) would be downloaded from the codebase URL.
In the repository metadata file, each module definition is described with a name, a version, a platform binding, and a path (relative to the codebase URL where the module file, the module archive, and/or the packed module archive are located). If no path and no platform binding is specified, the default path is "{name}/{version}". If the path is not specified and the module definition has platform binding, the default path is "{name}/{version}/{platform}-{arch}".
After the URL repository instance successfully downloads the repository metadata file, the module file of each module definition (i.e. MODULE.METADATA file) in the repository is downloaded based on the information in the repository metadata file:
{codebase}/{path}/MODULE.METADATA
If a module definition is platform-specific, its module file is downloaded if and only if the platform binding described in the repository metadata file matches the platform and the architecture of the system.
Module definitions are available for searches after the URL repository instance is initialized. If a module instance is instantiated from a module definition that has no platform binding, the module archive is downloaded by probing in the following order:
{codebase}/{path}/{name}-{version}.jam.pack.gz
{codebase}/{path}/{name}-{version}.jam
On the other hand, if a module instance is instantiated from a platform-specific module definition, the module archive is downloaded by probing in the following order:
{codebase}/{path}/{name}-{version}-{platform}-{arch}.jam.pack.gz
{codebase}/{path}/{name}-{version}-{platform}-{arch}.jam
To ensure the integrity of the separately-hosted module file is in sync with that in the module archive of the same module definition, they are compared bit-wise against each other after the module archive is downloaded.
ModuleDefinition
,
ModuleSystemPermission
,
Query
Constructor Summary | |
---|---|
URLRepository(Repository parent,
String name,
URL codebase)
Creates a new URLRepository instance. |
|
URLRepository(String name,
URL codebase)
Creates a new URLRepository instance using the
Repository returned by the method
getSystemRepository() as the parent repository. |
Method Summary | |
---|---|
List<ModuleDefinition> |
findModuleDefinitions(Query constraint)
Finds all matching module definitions in this repository. |
void |
initialize()
Initializes the repository instance using the default configuration. |
void |
initialize(Map<String,String> config)
Initializes the repository instance using the supplied configuration. |
ModuleArchiveInfo |
install(URL u)
Install a module archive with the module definition into the repository. |
boolean |
isActive()
Returns whether or not the repository instance is active. |
boolean |
isReadOnly()
Always returns true, since the URLRepository cannot be modified
via install, uninstall, etc.. |
List<ModuleArchiveInfo> |
list()
Returns an unmodifiable list of the installed module archives' information in the repository. |
void |
reload()
Reload the repository. |
void |
shutdown()
Shutdown the repository. |
boolean |
uninstall(ModuleArchiveInfo m)
Uninstall a module archive from the repository. |
Methods inherited from class java.module.Repository |
---|
equals, find, find, find, findAll, getBootstrapRepository, getModuleSystem, getName, getParent, getSourceLocation, getSystemRepository, hashCode, shutdownOnExit, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public URLRepository(Repository parent, String name, URL codebase)
URLRepository
instance.
If a security manager is present, this method calls the
security manager's checkPermission
method with
a ModuleSystemPermission("createRepository")
permission to ensure it's ok to create a repository.
parent
- the parent repository for delegation.name
- the repository name.codebase
- the source location.
SecurityException
- if a security manager exists and
its checkPermission method denies access
to create a new instance of repository.public URLRepository(String name, URL codebase)
URLRepository
instance using the
Repository
returned by the method
getSystemRepository()
as the parent repository.
If a security manager is present, this method calls the
security manager's checkPermission
method with
a ModuleSystemPermission("createRepository")
permission to ensure it's ok to create a repository.
name
- the repository name.codebase
- the source location.
SecurityException
- if a security manager exists and
its checkPermission method denies access
to create a new instance of repository.Method Detail |
---|
public void initialize() throws IOException
MODULE.METADATA
and .jam files are downloaded are the metadata
and modules
subdirectories of a directory named
URLRepository
which is in the system's temporary directory. The
directories are created if needed. IOExceptions may occur if they
already exist and are not writeable, etc.
initialize
in class Repository
IOException
- if an I/O error occurs.public void initialize(Map<String,String> config) throws IOException
Map
. Only
examines entries that start with
sun.module.repository.URLRepository.
.
These keys are checked for in the Map
:
sun.module.repository.URLRepository.metadataDirectory
:
Specifies the directory into which the contents of
MODULE.METADATA
files is downloaded. Will be created if it
does not already exist.
sun.module.repository.URLRepository.moduleDirectory
:
Specifies the directory into which the contents of
JAM files are downloaded. Will be created if it
does not already exist.
See Repository.initialize(Map)
.
initialize
in class Repository
config
- - config used to initialize the repository instance.
IOException
- if an I/O error occurs.public void shutdown() throws IOException
shutdown
in class Repository
IOException
- if an I/O error occurs.Repository.shutdown().
public List<ModuleDefinition> findModuleDefinitions(Query constraint)
findModuleDefinitions
in class Repository
constraint
- the constraint.
public boolean isReadOnly()
URLRepository
cannot be modified
via install, uninstall, etc..
isReadOnly
in class Repository
Repository.initialize()
.public void reload() throws IOException
Repository
If a security manager is present, this method calls the
security manager's checkPermission
method with
a ModuleSystemPermission("reloadRepository")
permission to ensure it's ok to reload module
definitions in a repository.
reload
in class Repository
IOException
- If an error occurs while reloading the
module definitions.public ModuleArchiveInfo install(URL u) throws IOException
Repository
If a security manager is present, this method calls the
security manager's checkPermission
method with
a ModuleSystemPermission("installModuleArchive")
permission to ensure it's ok to install a module
archive into a repository.
install
in class Repository
u
- the URL to the module archive.
ModuleArchiveInfo
object that represents
the installed module archive.
IOException
- if an error occurs while installing the module archive.
ModuleFormatException
- if the module archive format is not
supported by this implementation.public boolean uninstall(ModuleArchiveInfo m) throws IOException
Repository
If a security manager is present, this method calls the
security manager's checkPermission
method with
a ModuleSystemPermission("uninstallModuleArchive")
permission to ensure it's ok to uninstall a module
archive from a repository.
uninstall
in class Repository
m
- the module archive to be uninstalled.
IOException
- If an error occurs while uninstalling the module archive.public List<ModuleArchiveInfo> list()
Repository
If a security manager is present, this method calls the
security manager's checkPermission
method with
a ModuleSystemPermission("listModuleArchive")
permission to ensure it's ok to return the information of the
installed module archives in a repository.
list
in class Repository
public boolean isActive()
Repository
A repository instance is active if it has been initialized but has not been shutdown.
isActive
in class Repository
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |