Class Main
- java.lang.Object
-
- com.sun.enterprise.module.bootstrap.Main
-
public class Main extends java.lang.Object
CLI entry point that will setup the module subsystem and delegate the main execution to the first archive in its import list... TODO: reusability of this class needs to be improved.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Main.MainFilter
This filter matches against the name, including only matching a ModuleStartup with no name if name is null (unlike a normal "null" returned from name, which acts as a wildcard for the name)
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_NAME
private java.lang.ClassLoader
parentClassLoader
-
Constructor Summary
Constructors Constructor Description Main()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addDescriptorFileFinder(ServiceLocator serviceLocator, DescriptorFileFinder descriptorFileFinder)
ServiceLocator
createServiceLocator(ModulesRegistry mr, StartupContext context, java.util.List<PopulatorPostProcessor> postProcessors, DescriptorFileFinder descriptorFileFinder)
protected void
defineParentClassLoader()
ModuleStartup
findStartupService(ModulesRegistry registry, ServiceLocator serviceLocator, java.lang.String mainModuleName, StartupContext context)
Return the ModuleStartup service configured to be used to start the system.protected java.io.File
getBootstrapFile()
We need to determine which jar file has been used to load this class Using the getResourceURL we can get this information, after that, it is just a bit of detective work to get the file path for the jar file.protected java.lang.ClassLoader
getParentClassLoader()
ServiceLocator
getServiceLocator()
protected void
launch(ModuleStartup startupCode, StartupContext context)
ModuleStartup
launch(ModulesRegistry registry, java.lang.String mainModuleName, StartupContext context)
Launches the module system and hand over the execution to theModuleStartup
implementation of the main module.static void
main(java.lang.String[] args)
void
run(java.lang.String[] args)
void
start(java.lang.String[] args)
Start the server from the command line
-
-
-
Field Detail
-
parentClassLoader
private java.lang.ClassLoader parentClassLoader
-
DEFAULT_NAME
public static final java.lang.String DEFAULT_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args)
-
run
public void run(java.lang.String[] args)
-
getBootstrapFile
protected java.io.File getBootstrapFile() throws BootException
We need to determine which jar file has been used to load this class Using the getResourceURL we can get this information, after that, it is just a bit of detective work to get the file path for the jar file.- Returns:
- the path to the jar file containing this class. always returns non-null.
- Throws:
BootException
- If failed to determine the bootstrap file name.
-
start
public void start(java.lang.String[] args) throws BootException
Start the server from the command line- Parameters:
args
- the command line arguments- Throws:
BootException
-
defineParentClassLoader
protected void defineParentClassLoader() throws BootException
- Throws:
BootException
-
getParentClassLoader
protected java.lang.ClassLoader getParentClassLoader()
-
launch
public ModuleStartup launch(ModulesRegistry registry, java.lang.String mainModuleName, StartupContext context) throws BootException
Launches the module system and hand over the execution to theModuleStartup
implementation of the main module.- Parameters:
mainModuleName
- The module that will provideModuleStartup
. If null, one will be auto-discovered.context
- startup context instance- Returns:
- The ModuleStartup service
- Throws:
BootException
-
findStartupService
public ModuleStartup findStartupService(ModulesRegistry registry, ServiceLocator serviceLocator, java.lang.String mainModuleName, StartupContext context) throws BootException
Return the ModuleStartup service configured to be used to start the system.- Parameters:
registry
-serviceLocator
-mainModuleName
-context
-- Returns:
- Throws:
BootException
-
createServiceLocator
public ServiceLocator createServiceLocator(ModulesRegistry mr, StartupContext context, java.util.List<PopulatorPostProcessor> postProcessors, DescriptorFileFinder descriptorFileFinder) throws BootException
- Throws:
BootException
-
launch
protected void launch(ModuleStartup startupCode, StartupContext context) throws BootException
- Throws:
BootException
-
getServiceLocator
public ServiceLocator getServiceLocator()
-
addDescriptorFileFinder
private void addDescriptorFileFinder(ServiceLocator serviceLocator, DescriptorFileFinder descriptorFileFinder)
-
-