com.sun.enterprise.module.bootstrap
Class Main

java.lang.Object
  extended by 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.

Author:
dochez

Constructor Summary
Main()
           
 
Method Summary
protected  void addRepo(Repository repo, ModulesRegistry mr, java.lang.String weight)
           
 org.jvnet.hk2.component.Habitat createHabitat(ModulesRegistry registry, StartupContext context)
           
protected  com.sun.hk2.component.InhabitantsParser createInhabitantsParser(org.jvnet.hk2.component.Habitat habitat)
          Creates InhabitantsParser to fill in Habitat.
protected  void createRepository(java.io.File root, java.io.File bootstrapJar, java.util.jar.Manifest mf, ModulesRegistry mr)
          Creates repositories needed for the launch and adds the repositories to ModulesRegistry
protected  java.lang.String findMainModuleName(java.io.File bootstrap)
           
protected  java.lang.String findModuleStartupClassName(Module mainModule, java.lang.String serviceName, java.lang.String habitatName)
          Finds ModuleStartup implementation class name to perform the launch.
 ModuleStartup findStartupService(ModulesRegistry registry, org.jvnet.hk2.component.Habitat habitat, 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.
 ModuleStartup launch(ModulesRegistry registry, org.jvnet.hk2.component.Habitat habitat, java.lang.String mainModuleName, StartupContext context)
          Launches the module system and hand over the execution to the ModuleStartup implementation of the main module.
 org.jvnet.hk2.component.Habitat launch(ModulesRegistry registry, StartupContext context)
          Launches the module system and hand over the execution to the ModuleStartup implementation of the main module.
 org.jvnet.hk2.component.Habitat launch(ModulesRegistry registry, java.lang.String mainModuleName, StartupContext context)
           
protected  void launch(ModuleStartup startupCode, StartupContext context)
           
static void main(java.lang.String[] args)
           
 void run(java.lang.String[] args)
           
protected  void setParentClassLoader(StartupContext context, ModulesRegistry mr)
           
 void start(java.lang.String[] args)
          Start the server from the command line
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
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

setParentClassLoader

protected void setParentClassLoader(StartupContext context,
                                    ModulesRegistry mr)
                             throws BootException
Throws:
BootException

createRepository

protected void createRepository(java.io.File root,
                                java.io.File bootstrapJar,
                                java.util.jar.Manifest mf,
                                ModulesRegistry mr)
                         throws BootException
Creates repositories needed for the launch and adds the repositories to ModulesRegistry

Parameters:
bootstrapJar - The file from which manifest entries are loaded. Used for error reporting
Throws:
BootException

addRepo

protected void addRepo(Repository repo,
                       ModulesRegistry mr,
                       java.lang.String weight)
                throws java.io.IOException
Throws:
java.io.IOException

launch

public org.jvnet.hk2.component.Habitat launch(ModulesRegistry registry,
                                              StartupContext context)
                                       throws BootException
Launches the module system and hand over the execution to the ModuleStartup implementation of the main module.

This version of the method auto-discoveres the main module. If there's more than one ModuleStartup implementation, it is an error.

All the launch methods start additional threads and run GFv3, then return from the method.

Parameters:
context - startup context instance
Returns:
the entry point to all the components in this newly launched GlassFish.
Throws:
BootException

launch

public org.jvnet.hk2.component.Habitat launch(ModulesRegistry registry,
                                              java.lang.String mainModuleName,
                                              StartupContext context)
                                       throws BootException
Throws:
BootException

launch

public ModuleStartup launch(ModulesRegistry registry,
                            org.jvnet.hk2.component.Habitat habitat,
                            java.lang.String mainModuleName,
                            StartupContext context)
                     throws BootException
Launches the module system and hand over the execution to the ModuleStartup implementation of the main module.

Parameters:
mainModuleName - The module that will provide ModuleStartup. If null, one will be auto-discovered.
context - startup context instance
Returns:
The ModuleStartup service
Throws:
BootException

findStartupService

public ModuleStartup findStartupService(ModulesRegistry registry,
                                        org.jvnet.hk2.component.Habitat habitat,
                                        java.lang.String mainModuleName,
                                        StartupContext context)
                                 throws BootException
Return the ModuleStartup service configured to be used to start the system.

Parameters:
registry -
habitat -
mainModuleName -
context -
Returns:
Throws:
BootException

createHabitat

public org.jvnet.hk2.component.Habitat createHabitat(ModulesRegistry registry,
                                                     StartupContext context)
                                              throws BootException
Throws:
BootException

createInhabitantsParser

protected com.sun.hk2.component.InhabitantsParser createInhabitantsParser(org.jvnet.hk2.component.Habitat habitat)
Creates InhabitantsParser to fill in Habitat. Override for customizing the behavior.


findMainModuleName

protected java.lang.String findMainModuleName(java.io.File bootstrap)
                                       throws BootException
Throws:
BootException

launch

protected void launch(ModuleStartup startupCode,
                      StartupContext context)
               throws BootException
Throws:
BootException

findModuleStartupClassName

protected java.lang.String findModuleStartupClassName(Module mainModule,
                                                      java.lang.String serviceName,
                                                      java.lang.String habitatName)
                                               throws BootException
Finds ModuleStartup implementation class name to perform the launch.

This implementation does so by looking it up from services.

Throws:
BootException


Copyright © 2011 Oracle Corporation. All Rights Reserved.