|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.module.Repository
public abstract class Repository
This class represents the repository in the module system.
ModuleDefinition
,
ModuleSystemPermission
,
Query
,
VersionConstraint
Constructor Summary | |
---|---|
protected |
Repository(Repository parent,
String name,
URL source,
ModuleSystem system)
Creates a repository instance. |
protected |
Repository(String name,
URL source,
ModuleSystem system)
Creates a repository instance. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
Compares the specified object with this Repository for equality. |
List<ModuleDefinition> |
find(Query constraint)
Find all matching module definitions that match the specified constraint. |
ModuleDefinition |
find(String name)
Find a module definition. |
ModuleDefinition |
find(String name,
VersionConstraint versionConstraint)
Find a module definition. |
List<ModuleDefinition> |
findAll()
Find all module definitions. |
protected abstract List<ModuleDefinition> |
findModuleDefinitions(Query constraint)
Find all matching module definitions in the repository. |
static Repository |
getBootstrapRepository()
Returns the bootstrap repository for delegation. |
ModuleSystem |
getModuleSystem()
Returns this Repository's ModuleSystem . |
String |
getName()
Returns the name of this repository. |
Repository |
getParent()
Returns the parent repository for delegation. |
URL |
getSourceLocation()
Returns the source location of this repository. |
static Repository |
getSystemRepository()
Returns the system repository for delegation. |
int |
hashCode()
Returns a hash code for this Repository . |
void |
initialize()
Initializes the repository using the default configuration. |
abstract void |
initialize(Map<String,String> config)
Initializes the repository instance using the supplied configuration. |
abstract ModuleArchiveInfo |
install(URL u)
Install a module archive with the module definition into the repository. |
abstract boolean |
isActive()
Returns whether or not the repository instance is active. |
abstract boolean |
isReadOnly()
Returns whether or not this repository is read-only. |
abstract List<ModuleArchiveInfo> |
list()
Returns an unmodifiable list of the installed module archives' information in the repository. |
abstract void |
reload()
Reload the repository. |
abstract void |
shutdown()
Shutdown the repository. |
void |
shutdownOnExit(boolean value)
Enable or disable that the repository is shutdown when the module system terminates. |
String |
toString()
|
abstract boolean |
uninstall(ModuleArchiveInfo m)
Uninstall a module archive from the repository. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected Repository(Repository parent, String name, URL source, ModuleSystem system)
If a security manager is present, this method calls the security
manager's checkPermission
method with
ModuleSystemPermission("createRepository")
permission to
ensure it's ok to create a repository.
parent
- the parent repository for delegation.name
- the repository name.source
- the source location.
SecurityException
- if a security manager exists and its
checkPermission method denies access to create a new
instance of repository.
NullPointerException
- if parent
is null,
name
is null, source
is null,
or system
is null.
IllegalArgumentException
- if a circularity is detected.protected Repository(String name, URL source, ModuleSystem system)
If a security manager is present, this method calls the security
manager's checkPermission
method with
ModuleSystemPermission("createRepository")
permission to
ensure it's ok to create a repository.
name
- the repository name.source
- the source location.
SecurityException
- if a security manager exists and its
checkPermission method denies access to create a new
instance of repository.
NullPointerException
- if name
is null,
source
is null, or system
is null.
IllegalArgumentException
- if a circularity is detected.Method Detail |
---|
public final String getName()
public final URL getSourceLocation()
public final Repository getParent()
Repository.
.public final ModuleSystem getModuleSystem()
ModuleSystem
.
ModuleSystem
public static Repository getBootstrapRepository()
public static Repository getSystemRepository()
public void initialize() throws IOException
IOException
- if an I/O error occurs.
IllegalStateException
- if the repository instance has been
initialized or has been shutdown.public abstract void initialize(Map<String,String> config) throws IOException
This method will not modify config
or save a reference to
it, but may save a clone.
config
- - config used to initialize the repository instance.
IOException
- if an I/O error occurs.
IllegalStateException
- if the repository instance has been
initialized or has been shutdown.
NullPointerException
- if config
is null.public abstract void shutdown() throws IOException
checkPermission
method with a
ModuleSystemPermission("shutdownRepository")
permission
to ensure it's ok to shutdown a repository.
SecurityException
- if a security manager exists and its
checkPermission method denies access to shutdown the
repository.
IOException
- if an I/O error occurs.
IllegalStateException
- if the repository instance has not been
initialized or has been shutdown.public void shutdownOnExit(boolean value)
checkPermission
method with
a ModuleSystemPermission("shutdownRepository")
permission to ensure it's ok to shutdown a repository.
value
- indicating enabling or disabling of shutdown.
SecurityException
- if a security manager exists and
its checkPermission method denies access
to shutdown the repository.public abstract boolean isActive()
A repository instance is active if it has been initialized but has not been shutdown.
public abstract boolean isReadOnly()
public final ModuleDefinition find(String name)
find(moduleName, VersionConstraint.DEFAULT);If this repository instance has not been initialized when this method is called, it will be initialized automatically by calling the initialize method with no argument.
name
- the module definition's name.
IllegalStateException
- if the repository instance has been
shutdown.public final ModuleDefinition find(String name, VersionConstraint versionConstraint)
name
- the module definition's name.versionConstraint
- the version constraint.
IllegalStateException
- if the repository instance has been
shutdown.public final List<ModuleDefinition> findAll()
find(Query.ANY);If this repository instance has not been initialized when this method is called, it will be initialized automatically by calling the initialize method with no argument.
IllegalStateException
- if the repository instance has been
shutdown.public final List<ModuleDefinition> find(Query constraint)
constraint
- the constraint.
IllegalStateException
- if the repository instance has been
shutdown.protected abstract List<ModuleDefinition> findModuleDefinitions(Query constraint)
If this repository instance has not been initialized when this method is called, it will be initialized automatically by calling the initialize method with no argument.
constraint
- the constraint.
IllegalStateException
- if the repository instance has
not been initialized or has been shutdown.public abstract List<ModuleArchiveInfo> list()
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.
SecurityException
- if a security manager exists and its
checkPermission method denies access to return the
the information of the installed module archives.
IllegalStateException
- if the repository instance has not
been initialized or it has been shutdown.public abstract ModuleArchiveInfo install(URL u) throws IOException
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.
u
- the URL to the module archive.
ModuleArchiveInfo
object that represents
the installed module archive.
SecurityException
- if a security manager exists and its
checkPermission method denies access to install a
module archive in the repository.
IOException
- if an error occurs while installing the module archive.
ModuleFormatException
- if the module archive format is not
supported by this implementation.
UnsupportedOperationException
- if the repositoryis read-only.
IllegalStateException
- if a module definition with the same name,
version and platform binding is already installed, or if the
repository instance has not been initialized or it has been
shutdown.public abstract boolean uninstall(ModuleArchiveInfo m) throws IOException
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.
m
- the module archive to be uninstalled.
SecurityException
- if a security manager exists and
its checkPermission method denies access
to uninstall the module archive in the repository.
IllegalStateException
- if the module definition in the specified
specified module archive is in use, or
if the repository instance has not been
initialized or it has been shutdown.
UnsupportedOperationException
- if the repository is read-only.
IOException
- If an error occurs while uninstalling the module archive.public abstract void reload() throws IOException
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.
SecurityException
- if a security manager exists and
its checkPermission method denies access
to reload module definitions in the repository.
UnsupportedOperationException
- if the repository
does not support reload.
IllegalStateException
- if a module definition is in use
thus cannot be reloaded.
IOException
- If an error occurs while reloading the
module definitions.public final boolean equals(Object obj)
Repository
for equality.
Returns true
if and only if obj
is the same object as
this object.
equals
in class Object
obj
- the object to be compared for equality with this repository.
true
if the specified object is equal to this repositorypublic final int hashCode()
Repository
.
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |