sun.module.core
Class ModuleSystemImpl

java.lang.Object
  extended by java.module.ModuleSystem
      extended by sun.module.core.ModuleSystemImpl

public final class ModuleSystemImpl
extends ModuleSystem

Module system implementation.

Since:
1.7
Author:
Andreas Sterbenz

Field Summary
static ModuleSystem INSTANCE
           
 
Method Summary
 void disableModuleDefinition(ModuleDefinition definition)
          Disables the specified ModuleDefinition in the ModuleSystem.
 Module getModule(ModuleDefinition definition)
          Returns a Module instance for the specified ModuleDefinition in the ModuleSystem.
 void releaseModule(ModuleDefinition definition)
          Releases an existing Module instance corresponding to the specified ModuleDefinition in the ModuleSystem.
 
Methods inherited from class java.module.ModuleSystem
getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ModuleSystem INSTANCE
Method Detail

releaseModule

public void releaseModule(ModuleDefinition definition)
Description copied from class: ModuleSystem
Releases an existing 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.

Specified by:
releaseModule in class ModuleSystem
Parameters:
definition - a ModuleDefinition.

disableModuleDefinition

public void disableModuleDefinition(ModuleDefinition definition)
Description copied from class: ModuleSystem
Disables the specified 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.

Specified by:
disableModuleDefinition in class ModuleSystem
Parameters:
definition - a ModuleDefinition.

getModule

public Module getModule(ModuleDefinition definition)
                 throws ModuleInitializationException
Description copied from class: ModuleSystem
Returns a 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.

Specified by:
getModule in class ModuleSystem
Parameters:
definition - a ModuleDefinition
Returns:
a Module instance of the ModuleDefinition.
Throws:
ModuleInitializationException - if the module instance cannot be initialized.