Top Description Fields Constructors Methods
org.apache.derby.shared.common.reference

public Class ModuleUtil

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.util.HashMap, .Locale, .ServiceLoader, org.apache.derby.shared.api.DerbyModuleAPI, org.apache.derby.shared.common.error.StandardException, org.apache.derby.shared.common.info.JVMInfo

Utility methods for handling the components introduced by the Java Platform Module System (project Jigsaw) in Java 9.

Field Summary

Modifier and TypeField and Description
private static HashMap<String, Module>
_derbyModules

Map of module names to Derby modules

public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Module

Returns:

the corresponding module, or null if none is found
derbyModule
(String
The name of the module
moduleName
)

Return the Derby module with the given name.

public static InputStream

Returns:

a stream opened on the resource or null if it was not found
getResourceAsStream
(String
The name of the resource to find
resourceName
)

Lookup a resource in all the Derby modules.

private static InputStream

Returns:

a stream opened on the resource or null we can't find the resource in the module.
getResourceAsStream
(final Module
The module in which to look for the resource
module
,
final String
The name of the resource
resourceName
)

Lookup a resource in a module.

private static void
initModuleInfo()

Initialize the map of Derby modules.

public static String

Returns:

the corresponding module name
localizationModuleName
(String
The locale suffix to use
localeString
)

Get the name of the module containing the localized messages for the given locale.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_derbyModulesback to summary
private static HashMap<String, Module> _derbyModules

Map of module names to Derby modules

CLIENT_MODULE_NAMEback to summary
public static final String CLIENT_MODULE_NAME
ENGINE_MODULE_NAMEback to summary
public static final String ENGINE_MODULE_NAME
LOCALE_MODULE_NAME_PREFIXback to summary
public static final String LOCALE_MODULE_NAME_PREFIX
OPTIONALTOOLS_MODULE_NAMEback to summary
public static final String OPTIONALTOOLS_MODULE_NAME
RUNNER_MODULE_NAMEback to summary
public static final String RUNNER_MODULE_NAME
SERVER_MODULE_NAMEback to summary
public static final String SERVER_MODULE_NAME
SHARED_MODULE_NAMEback to summary
public static final String SHARED_MODULE_NAME
TESTING_MODULE_NAMEback to summary
public static final String TESTING_MODULE_NAME
TOOLS_MODULE_NAMEback to summary
public static final String TOOLS_MODULE_NAME

Constructor Detail

ModuleUtilback to summary
public ModuleUtil()

Method Detail

derbyModuleback to summary
public static Module derbyModule(String moduleName)

Return the Derby module with the given name.

Parameters
moduleName:String

The name of the module

Returns:Module

the corresponding module, or null if none is found

getResourceAsStreamback to summary
public static InputStream getResourceAsStream(String resourceName) throws StandardException

Lookup a resource in all the Derby modules. Returns the first version of the resource which can be found. This should be unambiguous due to the fact that packages cannot straddle multiple modules.

Parameters
resourceName:String

The name of the resource to find

Returns:InputStream

a stream opened on the resource or null if it was not found

getResourceAsStreamback to summary
private static InputStream getResourceAsStream(final Module module, final String resourceName) throws StandardException

Lookup a resource in a module.

Parameters
module:Module

The module in which to look for the resource

resourceName:String

The name of the resource

Returns:InputStream

a stream opened on the resource or null we can't find the resource in the module.

initModuleInfoback to summary
private static void initModuleInfo()

Initialize the map of Derby modules.

localizationModuleNameback to summary
public static String localizationModuleName(String localeString)

Get the name of the module containing the localized messages for the given locale.

Parameters
localeString:String

The locale suffix to use

Returns:String

the corresponding module name