Qwylt

java.lang.module.spi
Class Configuration.Default

java.lang.Object
  extended by java.lang.module.spi.Configuration
      extended by java.lang.module.spi.Configuration.Default
Enclosing class:
Configuration

public static class Configuration.Default
extends Configuration

The default Configuration implementation.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.module.spi.Configuration
Configuration.Default
 
Field Summary
 
Fields inherited from class java.lang.module.spi.Configuration
CONFIGURATION_CLASS_KEY, HOST_ARCHIVE_KEY, REPOSITORY_PATH_KEY, ROOT_MODULE_NAME, ROOT_MODULE_PREFIX, ROOT_PACKAGE_PREFIX
 
Constructor Summary
Configuration.Default()
           
 
Method Summary
 java.io.File deleteRepositoryConfiguration(java.io.File repositoryDir)
          Delete a repository configuration file.
 ConnectionCoordinator getConnectionCoordinator()
          Returns the ConnectionCoordinator.
 ModuleSystem getModuleSystem(ModuleInfo.Term... required)
          Returns the named module system.
 java.util.List<ModuleSystem> getModuleSystems()
          Returns a list of the available module systems.
 java.lang.String[] getOSArchNames()
          Returns the value of the os.arch system property and any known aliases of it, with the value of the system property as the first element.
 java.lang.String[] getOSNames()
          Returns the value of the os.name system property and any known aliases of it, with the value of the system property as the first element.
protected  java.lang.String[] getOSNames(java.lang.String key, java.util.Properties values)
           
 java.util.List<ModuleRepository> getRepositories()
          Returns a list of all registered repositories.
 ModuleRepository getRepository(java.lang.String repositoryName)
          Returns the named repository.
 ModuleRepository getRepositoryFor(java.net.URI location)
          Returns the registered repository with the specified location.
 ModuleArchive getRootArchive()
          Returns the root ModuleArchive, which is the sole exporter of packages with the "java." prefix.
 Module getRootModule()
          Returns the root ClassSpace, which is the sole exporter of packages with the "java." prefix.
 ModuleSystem getRootModuleSystem()
          Returns the root ModuleSystem.
 ModuleRepository getRootRepository()
          Returns the root repository.
 java.io.File getRootRepositoryDirectory()
          Get the root repository directory.
 ModuleRepository getSystemRepository()
          Returns the system repository.
 java.io.File getSystemRepositoryDirectory()
          Get the system repository directory.
 void load()
          Load the configuration.
protected  java.util.Properties loadOSNameProperties()
          Load the os names properties.
 ModuleRepository loadRepository(java.io.File repositoryDir)
          Load a repository from a repository configuration file.
 void register(ModuleRepository repository)
          Register a repository by location.
 void registerModuleSystem(ModuleSystem moduleSystem)
          Register a module system.
 java.io.File storeRepositoryConfiguration(java.io.File repositoryDir, java.lang.String repositoryName, java.lang.String moduleSystemID, java.lang.String... searchSequence)
          Store a repository configuration file.
 java.lang.String toString()
          Returns a string description of this configuration.
 void unregister(ModuleRepository repository)
          Unregister a repository by location.
 
Methods inherited from class java.lang.module.spi.Configuration
findRepository, getConfiguration, getModuleSystem, getProperties, getProperty, getProperty, getProperty, loadProperties, main, newInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Configuration.Default

public Configuration.Default()
Method Detail

load

public void load()
          throws java.lang.Exception
Load the configuration.

Specified by:
load in class Configuration
Throws:
java.lang.Exception - if a failure occurs.

getRootRepositoryDirectory

public java.io.File getRootRepositoryDirectory()
Get the root repository directory.

Specified by:
getRootRepositoryDirectory in class Configuration
Returns:
The directory.

getSystemRepositoryDirectory

public java.io.File getSystemRepositoryDirectory()
Get the system repository directory.

Specified by:
getSystemRepositoryDirectory in class Configuration
Returns:
The directory.

loadRepository

public ModuleRepository loadRepository(java.io.File repositoryDir)
                                throws java.lang.Exception
Load a repository from a repository configuration file.

Specified by:
loadRepository in class Configuration
Parameters:
repositoryDir - The repository directory.
Returns:
The repository.
Throws:
java.lang.Exception - If a failure occurs.

storeRepositoryConfiguration

public java.io.File storeRepositoryConfiguration(java.io.File repositoryDir,
                                                 java.lang.String repositoryName,
                                                 java.lang.String moduleSystemID,
                                                 java.lang.String... searchSequence)
                                          throws java.io.IOException
Store a repository configuration file.

Specified by:
storeRepositoryConfiguration in class Configuration
Parameters:
repositoryDir - The directory in which to store the configuration.
repositoryName - The repository name.
moduleSystemID - The module system id.
searchSequence - The repository search sequence. Each element is either a path to a repository directory, or a repository name. The sequence must contain repositoryName.
Returns:
The stored configuration file.
Throws:
java.io.IOException - If a failure occurs.

deleteRepositoryConfiguration

public java.io.File deleteRepositoryConfiguration(java.io.File repositoryDir)
                                           throws java.io.IOException
Delete a repository configuration file.

Specified by:
deleteRepositoryConfiguration in class Configuration
Parameters:
repositoryDir - The repository directory.
Returns:
File the deleted file.
Throws:
java.io.IOException - If a failure occurs.

registerModuleSystem

public void registerModuleSystem(ModuleSystem moduleSystem)
Register a module system.

Specified by:
registerModuleSystem in class Configuration
Parameters:
moduleSystem - The ModuleSystem.

getRootModuleSystem

public ModuleSystem getRootModuleSystem()
Returns the root ModuleSystem.

Specified by:
getRootModuleSystem in class Configuration
Returns:
The root ModuleSystem.

getModuleSystem

public ModuleSystem getModuleSystem(ModuleInfo.Term... required)
Returns the named module system.

Specified by:
getModuleSystem in class Configuration
Parameters:
required - The required module system terms. Each term must either exactly match one provided by a candidate module system or the names must match; exact match is checked first.
Returns:
The module system or null if not found.

getModuleSystems

public java.util.List<ModuleSystem> getModuleSystems()
Returns a list of the available module systems.

Specified by:
getModuleSystems in class Configuration
Returns:
The available module systems.

register

public void register(ModuleRepository repository)
Register a repository by location.

Specified by:
register in class Configuration
Parameters:
repository - The repository.
Throws:
java.lang.IllegalArgumentException - if repository name already registered.

unregister

public void unregister(ModuleRepository repository)
Unregister a repository by location.

Specified by:
unregister in class Configuration
Parameters:
repository - The repository.

getRootRepository

public ModuleRepository getRootRepository()
Returns the root repository.

Specified by:
getRootRepository in class Configuration
Returns:
The root repository.

getSystemRepository

public ModuleRepository getSystemRepository()
Returns the system repository.

Specified by:
getSystemRepository in class Configuration
Returns:
The system repository.

getRepositoryFor

public ModuleRepository getRepositoryFor(java.net.URI location)
Returns the registered repository with the specified location.

Specified by:
getRepositoryFor in class Configuration
Parameters:
location - The location.
Returns:
The repository or null if not found.

getRepository

public ModuleRepository getRepository(java.lang.String repositoryName)
Returns the named repository.

Specified by:
getRepository in class Configuration
Parameters:
repositoryName - The repository name.
Returns:
The repository or null if not found.

getRepositories

public java.util.List<ModuleRepository> getRepositories()
Returns a list of all registered repositories.

Specified by:
getRepositories in class Configuration
Returns:
The list.

getRootArchive

public ModuleArchive getRootArchive()
Returns the root ModuleArchive, which is the sole exporter of packages with the "java." prefix.

Specified by:
getRootArchive in class Configuration
Returns:
The root ModuleArchive.

getRootModule

public Module getRootModule()
Returns the root ClassSpace, which is the sole exporter of packages with the "java." prefix.

Specified by:
getRootModule in class Configuration
Returns:
The root ClassSpace.

getConnectionCoordinator

public ConnectionCoordinator getConnectionCoordinator()
Returns the ConnectionCoordinator.

Specified by:
getConnectionCoordinator in class Configuration
Returns:
The coordinator.

getOSNames

public java.lang.String[] getOSNames()
Returns the value of the os.name system property and any known aliases of it, with the value of the system property as the first element.

Specified by:
getOSNames in class Configuration
Returns:
The names.

getOSArchNames

public java.lang.String[] getOSArchNames()
Returns the value of the os.arch system property and any known aliases of it, with the value of the system property as the first element.

Specified by:
getOSArchNames in class Configuration
Returns:
The names.

toString

public java.lang.String toString()
Returns a string description of this configuration.

Overrides:
toString in class java.lang.Object
Returns:
The description.

loadOSNameProperties

protected java.util.Properties loadOSNameProperties()
Load the os names properties. Expected to contain comma separated values for the os.name.aliases and os.arch.aliases keys.

Returns:
The properties.

getOSNames

protected java.lang.String[] getOSNames(java.lang.String key,
                                        java.util.Properties values)

Qwylt

Send comments or questions to Bryan Atsatt