Top Description Inners Fields Constructors Methods
com.sun.enterprise.module.bootstrap

public Class Main

extends Object
Class Inheritance
Imports
java.io.File, .IOException, java.security.AccessController, .PrivilegedAction, java.util.List, org.glassfish.hk2.api.Descriptor, .DescriptorFileFinder, .DynamicConfiguration, .DynamicConfigurationService, .IndexedFilter, .MultiException, .PopulatorPostProcessor, .ServiceLocator, org.glassfish.hk2.utilities.BuilderHelper, com.sun.enterprise.module.ModulesRegistry, com.sun.enterprise.module.common_impl.AbstractFactory, com.sun.enterprise.module.impl.HK2Factory

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

Nested and Inner Type Summary

Modifier and TypeClass and 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

Modifier and TypeField and Description
public static final String
private ClassLoader

Constructor Summary

AccessConstructor and Description
public
Main()

Method Summary

Modifier and TypeMethod and Description
private void
addDescriptorFileFinder(ServiceLocator serviceLocator, DescriptorFileFinder descriptorFileFinder)

public ServiceLocator
protected void
public ModuleStartup
findStartupService(ModulesRegistry registry, ServiceLocator serviceLocator, String mainModuleName, StartupContext context)

Return the ModuleStartup service configured to be used to start the system.

protected File

Returns:

the path to the jar file containing this class. always returns non-null.
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 ClassLoader
public ServiceLocator
public ModuleStartup

Returns:

The ModuleStartup service
launch
(ModulesRegistry registry, String
The module that will provide ModuleStartup. If null, one will be auto-discovered.
mainModuleName
,
StartupContext
startup context instance
context
)

Launches the module system and hand over the execution to the ModuleStartup implementation of the main module.

protected void
launch(ModuleStartup startupCode, StartupContext context)

public static void
main(final String[] args)

public void
run(final String[] args)

public void
start(String[]
the command line arguments
args
)

Start the server from the command line

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_NAMEback to summary
public static final String DEFAULT_NAME
parentClassLoaderback to summary
private ClassLoader parentClassLoader

Constructor Detail

Mainback to summary
public Main()

Method Detail

addDescriptorFileFinderback to summary
private void addDescriptorFileFinder(ServiceLocator serviceLocator, DescriptorFileFinder descriptorFileFinder)
createServiceLocatorback to summary
public ServiceLocator createServiceLocator(ModulesRegistry mr, StartupContext context, List<PopulatorPostProcessor> postProcessors, DescriptorFileFinder descriptorFileFinder) throws BootException
defineParentClassLoaderback to summary
protected void defineParentClassLoader() throws BootException
findStartupServiceback to summary
public ModuleStartup findStartupService(ModulesRegistry registry, ServiceLocator serviceLocator, String mainModuleName, StartupContext context) throws BootException

Return the ModuleStartup service configured to be used to start the system.

Annotations
@SuppressWarnings:unchecked
getBootstrapFileback to summary
protected 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:File

the path to the jar file containing this class. always returns non-null.

Exceptions
BootException:
If failed to determine the bootstrap file name.
getParentClassLoaderback to summary
protected ClassLoader getParentClassLoader()
getServiceLocatorback to summary
public ServiceLocator getServiceLocator()
launchback to summary
public ModuleStartup launch(ModulesRegistry registry, 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:String

The module that will provide ModuleStartup. If null, one will be auto-discovered.

context:StartupContext

startup context instance

Returns:ModuleStartup

The ModuleStartup service

launchback to summary
protected void launch(ModuleStartup startupCode, StartupContext context) throws BootException
mainback to summary
public static void main(final String[] args)
runback to summary
public void run(final String[] args)
startback to summary
public void start(String[] args) throws BootException

Start the server from the command line

Parameters
args:String[]

the command line arguments

com.sun.enterprise.module.bootstrap back to summary

private Class Main.MainFilter

extends Object
implements IndexedFilter
Class Inheritance
All Implemented Interfaces
org.glassfish.hk2.api.IndexedFilter, org.glassfish.hk2.api.Filter

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)
Author
jwells

Field Summary

Modifier and TypeField and Description
private final String

Constructor Summary

AccessConstructor and Description
private
MainFilter(String
The name of the ModuleStartup to find. If null this Filter will only match ModuleStartups with no name
name
)

The name given here will match the ModuleStartup

Method Summary

Modifier and TypeMethod and Description
public String
getAdvertisedContract()

Implements org.glassfish.hk2.api.IndexedFilter.getAdvertisedContract.

If this returns non-null then this index will be used to limit the set of Descriptors that will be passed to the matches method.

public String
getName()

Implements org.glassfish.hk2.api.IndexedFilter.getName.

If this returns non-null then this name will be used to limit the set of Descriptors that will be passed to the matches method.

public boolean
matches(Descriptor d)

Implements org.glassfish.hk2.api.Filter.matches.

Returns true if this filter matches the given object

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private final String name

Constructor Detail

MainFilterback to summary
private MainFilter(String name)

The name given here will match the ModuleStartup

Parameters
name:String

The name of the ModuleStartup to find. If null this Filter will only match ModuleStartups with no name

Method Detail

getAdvertisedContractback to summary
public String getAdvertisedContract()

Implements org.glassfish.hk2.api.IndexedFilter.getAdvertisedContract.

Doc from org.glassfish.hk2.api.IndexedFilter.getAdvertisedContract.

If this returns non-null then this index will be used to limit the set of Descriptors that will be passed to the matches method. Only those descriptors that have an AdverisedContract of this value will be passed to the matches method.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.glassfish.hk2.api.IndexedFilter.getName.

Doc from org.glassfish.hk2.api.IndexedFilter.getName.

If this returns non-null then this name will be used to limit the set of Descriptors that will be passed to the matches method. Only those descriptors that has an name of this value will be passed to the matches method.

Annotations
@Override
matchesback to summary
public boolean matches(Descriptor d)

Implements org.glassfish.hk2.api.Filter.matches.

Doc from org.glassfish.hk2.api.Filter.matches.

Returns true if this filter matches the given object

Annotations
@Override