org.jvnet.hk2.osgiadapter
Class AbstractOSGiModulesRegistryImpl

java.lang.Object
  extended by com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl
      extended by org.jvnet.hk2.osgiadapter.AbstractOSGiModulesRegistryImpl
All Implemented Interfaces:
ModuleChangeListener, ModulesRegistry, HabitatFactory, InhabitantsParserFactory
Direct Known Subclasses:
OSGiModulesRegistryImpl, OSGiObrModulesRegistryImpl

public abstract class AbstractOSGiModulesRegistryImpl
extends AbstractModulesRegistryImpl

Author:
sanjeeb.sahoo@oracle.com

Field Summary
protected  org.osgi.service.packageadmin.PackageAdmin pa
           
 
Fields inherited from class com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl
modules, parent, providers, repositories
 
Constructor Summary
protected AbstractOSGiModulesRegistryImpl(org.osgi.framework.BundleContext bctx)
           
 
Method Summary
 void addModuleChangeListener(ModuleChangeListener listener, OSGiModuleImpl module)
           
 ModulesRegistry createChild()
           
 void detachAll()
           
 Module find(Class clazz)
           
 ClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> defs)
          Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition
 ClassLoader getModulesClassLoader(ClassLoader parent, Collection<ModuleDefinition> mds, URL[] urls)
          Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition and also load new urls.
 org.osgi.service.packageadmin.PackageAdmin getPackageAdmin()
           
 ClassLoader getParentClassLoader()
          Returns the parent class loader parenting the class loaders created by modules associated with this registry.
 void parseInhabitants(Module module, String name, InhabitantsParser inhabitantsParser)
           
 void register(ModuleLifecycleListener listener)
           
 boolean removeModuleChangeListener(ModuleChangeListener listener)
           
 void setParentClassLoader(ClassLoader parent)
          Sets the classloader parenting the class loaders created by the modules associated with this registry.
 void shutdown()
           
 void unregister(ModuleLifecycleListener listener)
           
 
Methods inherited from class com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl
add, add, add, addRepository, addRepository, changed, createHabitat, createHabitat, createHabitat, createInhabitantsParser, dumpState, getModules, getModules, getModulesProvider, getProvidersClass, getProvidingModule, getRepository, getRunningServices, initializeHabitat, loadFromRepository, makeModuleFor, makeModuleFor, makeModuleFor, newHabitat, newHabitat, newModule, populateConfig, print, registerRunningService, remove, removeRepository, unregisterRunningService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pa

protected org.osgi.service.packageadmin.PackageAdmin pa
Constructor Detail

AbstractOSGiModulesRegistryImpl

protected AbstractOSGiModulesRegistryImpl(org.osgi.framework.BundleContext bctx)
Method Detail

shutdown

public void shutdown()

parseInhabitants

public void parseInhabitants(Module module,
                             String name,
                             InhabitantsParser inhabitantsParser)
                      throws IOException
Specified by:
parseInhabitants in class AbstractModulesRegistryImpl
Throws:
IOException

createChild

public ModulesRegistry createChild()

detachAll

public void detachAll()

setParentClassLoader

public void setParentClassLoader(ClassLoader parent)
Sets the classloader parenting the class loaders created by the modules associated with this registry.

Parameters:
parent - parent class loader

getParentClassLoader

public ClassLoader getParentClassLoader()
Returns the parent class loader parenting the class loaders created by modules associated with this registry.

Returns:
the parent classloader

getModulesClassLoader

public ClassLoader getModulesClassLoader(ClassLoader parent,
                                         Collection<ModuleDefinition> mds,
                                         URL[] urls)
                                  throws ResolveError
Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition and also load new urls.

Parameters:
parent - the parent class loader for the returned class loader instance
mds - module definitions for all modules this classloader should be capable of loading
urls - urls to be added to the module classloader
Returns:
class loader instance
Throws:
ResolveError - if one of the provided module definition cannot be resolved

getModulesClassLoader

public ClassLoader getModulesClassLoader(ClassLoader parent,
                                         Collection<ModuleDefinition> defs)
                                  throws ResolveError
Returns a ClassLoader capable of loading classes from a set of modules identified by their module definition

Parameters:
parent - the parent class loader for the returned class loader instance
defs - module definitions for all modules this classloader should be capable of loading classes from
Returns:
class loader instance
Throws:
ResolveError - if one of the provided module definition cannot be resolved

find

public Module find(Class clazz)

getPackageAdmin

public org.osgi.service.packageadmin.PackageAdmin getPackageAdmin()

addModuleChangeListener

public void addModuleChangeListener(ModuleChangeListener listener,
                                    OSGiModuleImpl module)

removeModuleChangeListener

public boolean removeModuleChangeListener(ModuleChangeListener listener)

register

public void register(ModuleLifecycleListener listener)

unregister

public void unregister(ModuleLifecycleListener listener)


Copyright © 2012 Oracle Corporation. All Rights Reserved.