|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.module.ModuleSystem
public abstract class ModuleSystem
This class represents the module system which constructs a module instance from a module definition.
Module
,
ModuleDefinition
Constructor Summary | |
---|---|
protected |
ModuleSystem()
Constructor used by subclasses. |
Method Summary | |
---|---|
abstract void |
disableModuleDefinition(ModuleDefinition moduleDef)
Disables the specified ModuleDefinition in the
ModuleSystem . |
static ModuleSystem |
getDefault()
Returns the system's default module system. |
abstract Module |
getModule(ModuleDefinition moduleDef)
Returns a Module instance for the specified ModuleDefinition
in the ModuleSystem . |
abstract void |
releaseModule(ModuleDefinition moduleDef)
Releases an existing Module instance corresponding to the
specified ModuleDefinition in the ModuleSystem . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ModuleSystem()
Method Detail |
---|
public abstract Module getModule(ModuleDefinition moduleDef) throws ModuleInitializationException
Module
instance for the specified ModuleDefinition
in the ModuleSystem
. The module is initialized and ready to use.
If there is an existing module instance for the specified
ModuleDefinition
, that instance is returned. Otherwise, a new module
instance is instantiated and returned.
moduleDef
- a ModuleDefinition
Module
instance of the ModuleDefinition
.
ModuleInitializationException
- if the module instance cannot be initialized.
IllegalStateException
- if the specified module definition
has already been disabled.public abstract void releaseModule(ModuleDefinition moduleDef)
Module
instance corresponding to the
specified ModuleDefinition
in the ModuleSystem
.
If there is an existing module instance for the specified module
definition, it will never be returned by the ModuleSystem
after this method returns. Further, if that module instance is
imported by other module instances, each of these importing module
instance will also be released.
If there is no module instance corresponding to the module definition, calling this method has no effect.
Module
instances corresponding to the ModuleDefinition
with name that begins with "java.", or from the bootstrap repository
cannot be released.
If a security manager is present, this method calls the security manager's checkPermission method with a ModuleSystemPermission("releaseModule") permission to ensure it's ok to release the existing module instance of the specified module definition.
moduleDef
- a ModuleDefinition
.
SecurityException
- if a security manager exists and its
checkPermission method denies access to release the
module instance of the specified module definition.
UnsupportedOperationException
- if the existing module
instance cannot be released.public abstract void disableModuleDefinition(ModuleDefinition moduleDef)
ModuleDefinition
in the
ModuleSystem
.
The ModuleDefinition is released
and marked to
disallow creation of new Module
instances. Subsequent calls
to getModule
with this ModuleDefinition throw an
IllegalStateException.
ModuleDefinition
with name that begins with "java.",
or from the bootstrap repository cannot be disabled.
If a security manager is present, this method calls the security manager's checkPermission method with a ModuleSystemPermission("disableModuleDefinition") permission to ensure it's ok to disable the specified module definition in the module system.
moduleDef
- a ModuleDefinition
.
SecurityException
- if a security manager exists and its
checkPermission method denies access to disable the
specified module definition in the module system.
UnsupportedOperationException
- if the specified module
definition cannot be disabled.
IllegalStateException
- if the specified module definition
has already been disabled.public static ModuleSystem getDefault()
The default class of the module system can be overridden using the
java.module.ModuleSystem
system property.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |