Top Description Fields Constructors Methods
com.sun.enterprise.module.single

public Class ProxyModule

extends Object
implements HK2Module
Class Inheritance
All Implemented Interfaces
com.sun.enterprise.module.HK2Module
Imports
com.sun.enterprise.module.*, java.util.List, .ArrayList, java.io.PrintStream

Creates a HK2Module implementation based on a single class loader
Author
Jerome Dochez

Field Summary

Modifier and TypeField and Description
pack-priv final ClassLoader
pack-priv final ModuleDefinition
pack-priv final ModulesRegistry

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public HK2Module
addImport(ModuleDependency dependency)

Implements com.sun.enterprise.module.HK2Module.addImport.

Create and add a new module to this module's list of imports.

public void
addListener(ModuleChangeListener listener)

Implements com.sun.enterprise.module.HK2Module.addListener.

Add a new module change listener

public void
detach()

Implements com.sun.enterprise.module.HK2Module.detach.

Detach this module from its registry.

public void
public ClassLoader
getClassLoader()

Implements com.sun.enterprise.module.HK2Module.getClassLoader.

Return the ClassLoader instance associated with this module.

public List<HK2Module>
getImports()

Implements com.sun.enterprise.module.HK2Module.getImports.

Returns the list of imported modules.

public ModuleMetadata
getMetadata()

Implements com.sun.enterprise.module.HK2Module.getMetadata.

Gets the metadata of this module.

public ModuleDefinition
getModuleDefinition()

Implements com.sun.enterprise.module.HK2Module.getModuleDefinition.

Returns the module definition for this module instance

public String
getName()

Implements com.sun.enterprise.module.HK2Module.getName.

Short-cut for getModuleDefinition().getName().

public <T> Iterable<Class<? extends T>>
public Iterable<Class<T>>
public ModulesRegistry
getRegistry()

Implements com.sun.enterprise.module.HK2Module.getRegistry.

Returns the registry owning this module

public ModuleState
getState()

Implements com.sun.enterprise.module.HK2Module.getState.

Returns the module's state

public boolean
hasProvider(Class<T> serviceClass)

Implements com.sun.enterprise.module.HK2Module.hasProvider.

Returns true if this module has any provider for the given service class.

public boolean
isShared()

Implements com.sun.enterprise.module.HK2Module.isShared.

Returns true if this module is sharable.

public boolean
isSticky()

Implements com.sun.enterprise.module.HK2Module.isSticky.

Returns true if the module is sticky.

public void
refresh()

Implements com.sun.enterprise.module.HK2Module.refresh.

Trigger manual refresh mechanism, the module will check all its URLs and generate change events if any of them has changed.

public void
removeListener(ModuleChangeListener listener)

Implements com.sun.enterprise.module.HK2Module.removeListener.

Unregister a module change listener

public void
resolve()

Implements com.sun.enterprise.module.HK2Module.resolve.

Ensure that this module is resolved.

public void
setSticky(boolean sticky)

Implements com.sun.enterprise.module.HK2Module.setSticky.

Sets the sticky flag.

public void
start()

Implements com.sun.enterprise.module.HK2Module.start.

Forces module startup.

public boolean
stop()

Implements com.sun.enterprise.module.HK2Module.stop.

Forces module stop.

public void
uninstall()

Implements com.sun.enterprise.module.HK2Module.uninstall.

Removes the module from the registry backing store, the module will need be reinstalled to be loaded.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classLoaderback to summary
pack-priv final ClassLoader classLoader
moduleDefback to summary
pack-priv final ModuleDefinition moduleDef
modulesRegistryback to summary
pack-priv final ModulesRegistry modulesRegistry

Constructor Detail

ProxyModuleback to summary
public ProxyModule(ModulesRegistry registry, ModuleDefinition moduleDef, ClassLoader cl)

Method Detail

addImportback to summary
public void addImport(HK2Module module)

Implements com.sun.enterprise.module.HK2Module.addImport.

addImportback to summary
public HK2Module addImport(ModuleDependency dependency)

Implements com.sun.enterprise.module.HK2Module.addImport.

Doc from com.sun.enterprise.module.HK2Module.addImport.

Create and add a new module to this module's list of imports.

addListenerback to summary
public void addListener(ModuleChangeListener listener)

Implements com.sun.enterprise.module.HK2Module.addListener.

Doc from com.sun.enterprise.module.HK2Module.addListener.

Add a new module change listener

detachback to summary
public void detach()

Implements com.sun.enterprise.module.HK2Module.detach.

Doc from com.sun.enterprise.module.HK2Module.detach.

Detach this module from its registry. This does not free any of the loaded resources. Only proper release of all references to the public class loader will ensure module being garbage collected. Detached modules are orphan and will be garbage collected if resources are properly disposed.

dumpStateback to summary
public void dumpState(PrintStream writer)

Implements com.sun.enterprise.module.HK2Module.dumpState.

getClassLoaderback to summary
public ClassLoader getClassLoader()

Implements com.sun.enterprise.module.HK2Module.getClassLoader.

Doc from com.sun.enterprise.module.HK2Module.getClassLoader.

Return the ClassLoader instance associated with this module. Only designated public interfaces will be loaded and returned by this classloader

getImportsback to summary
public List<HK2Module> getImports()

Implements com.sun.enterprise.module.HK2Module.getImports.

Doc from com.sun.enterprise.module.HK2Module.getImports.

Returns the list of imported modules.

This is the module version of ModuleDefinition#getDependencies(), but after fully resolved.

To enforce the stable class visibility, once HK2Module is created, dependencies cannot be changed — that is, we don't want "a.b.C" to suddenly mean something different once the code starts running.

getMetadataback to summary
public ModuleMetadata getMetadata()

Implements com.sun.enterprise.module.HK2Module.getMetadata.

Doc from com.sun.enterprise.module.HK2Module.getMetadata.

Gets the metadata of this module.

getModuleDefinitionback to summary
public ModuleDefinition getModuleDefinition()

Implements com.sun.enterprise.module.HK2Module.getModuleDefinition.

Doc from com.sun.enterprise.module.HK2Module.getModuleDefinition.

Returns the module definition for this module instance

getNameback to summary
public String getName()

Implements com.sun.enterprise.module.HK2Module.getName.

Doc from com.sun.enterprise.module.HK2Module.getName.

Short-cut for getModuleDefinition().getName().

getProvidersClassback to summary
public <T> Iterable<Class<? extends T>> getProvidersClass(Class<T> serviceClass)

Implements com.sun.enterprise.module.HK2Module.getProvidersClass.

getProvidersClassback to summary
public Iterable<Class<T>> getProvidersClass(String name)

Implements com.sun.enterprise.module.HK2Module.getProvidersClass.

getRegistryback to summary
public ModulesRegistry getRegistry()

Implements com.sun.enterprise.module.HK2Module.getRegistry.

Doc from com.sun.enterprise.module.HK2Module.getRegistry.

Returns the registry owning this module

getStateback to summary
public ModuleState getState()

Implements com.sun.enterprise.module.HK2Module.getState.

Doc from com.sun.enterprise.module.HK2Module.getState.

Returns the module's state

hasProviderback to summary
public boolean hasProvider(Class<T> serviceClass)

Implements com.sun.enterprise.module.HK2Module.hasProvider.

Doc from com.sun.enterprise.module.HK2Module.hasProvider.

Returns true if this module has any provider for the given service class.

isSharedback to summary
public boolean isShared()

Implements com.sun.enterprise.module.HK2Module.isShared.

Doc from com.sun.enterprise.module.HK2Module.isShared.

Returns true if this module is sharable. A sharable module means that onlu one instance of the module classloader will be used by all users.

isStickyback to summary
public boolean isSticky()

Implements com.sun.enterprise.module.HK2Module.isSticky.

Doc from com.sun.enterprise.module.HK2Module.isSticky.

Returns true if the module is sticky. A sticky module cannot be stopped or unloaded. Once a sticky module is loaded or started, it will stay in the JVM until it exists.

refreshback to summary
public void refresh()

Implements com.sun.enterprise.module.HK2Module.refresh.

Doc from com.sun.enterprise.module.HK2Module.refresh.

Trigger manual refresh mechanism, the module will check all its URLs and generate change events if any of them has changed. This will allow the owning registry to force a module upgrade at next module request.

removeListenerback to summary
public void removeListener(ModuleChangeListener listener)

Implements com.sun.enterprise.module.HK2Module.removeListener.

Doc from com.sun.enterprise.module.HK2Module.removeListener.

Unregister a module change listener

resolveback to summary
public void resolve() throws ResolveError

Implements com.sun.enterprise.module.HK2Module.resolve.

Doc from com.sun.enterprise.module.HK2Module.resolve.

Ensure that this module is resolved.

If the module is already resolved, this method does nothing. Otherwise, iterate over all declared ModuleDependency instances and use the associated ModuleRegistry to resolve it. After successful completion of this method, the module state is ModuleState#RESOLVED.

Exceptions
ResolveError:
if any of the declared dependency of this module cannot be satisfied
setStickyback to summary
public void setSticky(boolean sticky)

Implements com.sun.enterprise.module.HK2Module.setSticky.

Doc from com.sun.enterprise.module.HK2Module.setSticky.

Sets the sticky flag.

startback to summary
public void start() throws ResolveError

Implements com.sun.enterprise.module.HK2Module.start.

Doc from com.sun.enterprise.module.HK2Module.start.

Forces module startup. In most cases, the runtime will take care of starting modules when they are first used. There could be cases where code need to manually start a sub module. Invoking this method will move the module to the ModuleState.READY, the Lifecycle.start method will be invoked.

stopback to summary
public boolean stop()

Implements com.sun.enterprise.module.HK2Module.stop.

Doc from com.sun.enterprise.module.HK2Module.stop.

Forces module stop. In most cases, the runtime will take care of stopping modules when the last module user released its interest. However, in certain cases, it may be interesting to manually stop the module. Stopping the module means that the module is removed from the registry, the class loader references are released (note : the class loaders will only be released if all instances of any class loaded by them are gc'ed). If a LifecyclePolicy for this module is defined, the Lifecycle.stop(HK2Module) method will be called and finally the module state will be returned to ModuleState.NEW.

uninstallback to summary
public void uninstall()

Implements com.sun.enterprise.module.HK2Module.uninstall.

Doc from com.sun.enterprise.module.HK2Module.uninstall.

Removes the module from the registry backing store, the module will need be reinstalled to be loaded.