Todo
concurrency bug in the acess of the repositories field.
| Modifier and Type | Field and Description |
|---|---|
| private Map | |
| private final ReentrantLock | |
| pack-priv Map | |
| protected final ConcurrentMap | |
| protected final ModulesRegistry | parent
|
| protected final Map | providers
Service provider class names and which modules they are in. This is used for the classloader punch-in hack — to work nicely with classic service loader implementation, we need to be able to allow any modules to see these classes. |
| protected final Map | |
| private final ConcurrentMap |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public HK2Module | add(ModuleDefinition info)
Implements com. Registers a new DefaultModuleDefinition in this registry. |
| public HK2Module | add(ModuleDefinition info, boolean resolve)
Implements com. Registers a new DefaultModuleDefinition in this registry. |
| public void | addRepository(Repository
new repository to attach to this registry repository, int int value from 1 to 100 to specify the search order weight)Implements com. Add a new |
| public void | addRepository(Repository
new repository to attach to this registry repository)Implements com. Add a new |
| public void | changed(HK2Module service)
Implements com. Modules can notify their registry that they have changed (classes, resources,etc...). |
| public ServiceLocator | createServiceLocator(ServiceLocator parent, String name, List<PopulatorPostProcessor> postProcessors)
Implements com. Creates a |
| public ServiceLocator | createServiceLocator(String name)
Implements com. Creates a |
| public ServiceLocator | createServiceLocator()
Implements com. Creates the default |
| public void | |
| protected Set | |
| public Collection | Returns: an umodifiable list of loaded modulesImplements com. Returns the list of shared Modules registered in this instance. |
| public Collection | getModules(String moduleName)
Implements com. Returns the list of shared Modules registered in this instance whose name matches the given name
The returned list will not include the modules defined in the ancestor
|
| public Iterable | Returns: a collection of modulethe service interface class serviceClass)Implements com. Returns a collection of HK2Module containing at least one implementation of the passed service interface class. |
| public <T> Iterable | getProvidersClass(final Class<T> serviceClass)
Implements com.
|
| public HK2Module | getProvidingModule(String providerClassName)
Implements com. Gets the |
| public Repository | Returns: the repository or null if not foundname of the repository to return name)Implements com. Get a repository from the list of attached repositories |
| public <T> List | Returns: the list of providers of that service.the service interface serviceClass)Implements com. Returns all running services implementation of the passed service interface |
| private <T> T | |
| protected void | |
| protected HK2Module | |
| public HK2Module | Returns: the module instance or null if none can be foundthe module name name, String the module version. version)Implements com. Returns the |
| public HK2Module | makeModuleFor(String name, String version, boolean resolve)
Implements com. Returns the |
| public HK2Module | Returns: theHK2Module instance implementing the package
name or null if not found.the requested implementation package name. packageName)Implements com. Find and return a loaded HK2Module that has the package name in its list of exported interfaces. |
| protected abstract HK2Module | Returns: a new HK2Module instancemodule definition of the new module to be created moduleDef)Factory method for creating new instances of HK2Module. |
| public ServiceLocator | newServiceLocator()
Implements com. Creates an uninitialized |
| public ServiceLocator | newServiceLocator(ServiceLocator parent)
Implements com. Create a new ServiceLocator optionally providing a parent Services |
| protected abstract List | parseInhabitants(HK2Module module, String name, ServiceLocator serviceLocator, List<PopulatorPostProcessor> postProcessors)
|
| public void | populateConfig(ServiceLocator serviceLocator)
Implements com.
|
| public void | populateServiceLocator(String
Determines which descriptors are loaded. name, ServiceLocator serviceLocator, List<PopulatorPostProcessor> postProcessors)Implements com. Creates a |
| public void | print(Logger
the logger to dump on logger)Implements com. Print a Registry dump to the logger |
| public <T> void | registerRunningService(Class<T>
the service interface serviceClass, T the provider of that service. provider)Implements com. Registers a running service, this is useful when other components need to have access to a provider of a service without having to create a new instance and initialize it. |
| public void | |
| public void | removeRepository(String
name of the repository to remove name)Implements com. Remove a repository from the list of attached repositories to this instances. |
| private void | |
| public <T> boolean | unregisterRunningService(Class<T> serviceClass, T provider)
Implements com. Removes a running service, this is useful when a service instance is no longer available as a provider of a service. |
| habitats | back to summary |
|---|---|
| private Map<ServiceLocator, String> habitats | |
| lock | back to summary |
|---|---|
| private final ReentrantLock lock | |
| moduleDescriptors | back to summary |
|---|---|
| pack-priv Map<HK2Module, Map<ServiceLocator, List<ActiveDescriptor<T>>>> moduleDescriptors | |
| modules | back to summary |
|---|---|
| protected final ConcurrentMap<ModuleId, HK2Module> modules | |
| parent | back to summary |
|---|---|
| protected final ModulesRegistry parent
| |
| providers | back to summary |
|---|---|
| protected final Map<String, HK2Module> providers Service provider class names and which modules they are in. This is used for the classloader punch-in hack — to work nicely with classic service loader implementation, we need to be able to allow any modules to see these classes. | |
| repositories | back to summary |
|---|---|
| protected final Map<Integer, Repository> repositories | |
| runningServices | back to summary |
|---|---|
| private final ConcurrentMap<Class<?>, CopyOnWriteArrayList<?>> runningServices | |
| AbstractModulesRegistryImpl | back to summary |
|---|---|
| protected AbstractModulesRegistryImpl(ModulesRegistry parent) | |
| add | back to summary |
|---|---|
| protected void add(HK2Module newModule) Add a new module to this registry. Once added, the module will be available through one of the getServiceImplementor methods.
| |
| add | back to summary |
|---|---|
| public HK2Module add(ModuleDefinition info) throws ResolveError Implements com. Registers a new DefaultModuleDefinition in this registry. Using this module
definition, the registry will be capable of created shared and private
| |
| add | back to summary |
|---|---|
| public HK2Module add(ModuleDefinition info, boolean resolve) throws ResolveError Implements com. Doc from com. Registers a new DefaultModuleDefinition in this registry. Using this module
definition, the registry will be capable of created shared and private
| |
| addRepository | back to summary |
|---|---|
| public void addRepository(Repository repository, int weight) Implements com. Add a new
| |
| addRepository | back to summary |
|---|---|
| public void addRepository(Repository repository) Implements com. Add a new
| |
| changed | back to summary |
|---|---|
| public void changed(HK2Module service) Implements com. Modules can notify their registry that they have changed (classes, resources,etc...). Registries are requested to take appropriate action to make the new module available. | |
| createServiceLocator | back to summary |
|---|---|
| public ServiceLocator createServiceLocator(ServiceLocator parent, String name, List<PopulatorPostProcessor> postProcessors) throws MultiException Implements com. Doc from com. Creates a | |
| createServiceLocator | back to summary |
|---|---|
| public ServiceLocator createServiceLocator(String name) throws MultiException Implements com. Doc from com. Creates a | |
| createServiceLocator | back to summary |
|---|---|
| public ServiceLocator createServiceLocator() throws MultiException Implements com. Doc from com. Creates the default | |
| dumpState | back to summary |
|---|---|
| public void dumpState(PrintStream writer) Implements com. | |
| getAllServiceLocators | back to summary |
|---|---|
| protected Set | |
| getModules | back to summary |
|---|---|
| public Collection Implements com. Returns the list of shared Modules registered in this instance.
The returned list will not include the modules defined in the ancestor
| |
| getModules | back to summary |
|---|---|
| public Collection Implements com. Doc from com. Returns the list of shared Modules registered in this instance whose name matches the given name
The returned list will not include the modules defined in the ancestor
| |
| getModulesProvider | back to summary |
|---|---|
| public Iterable Implements com. Returns a collection of HK2Module containing at least one implementation of the passed service interface class. | |
| getProvidersClass | back to summary |
|---|---|
| public <T> Iterable Implements com. | |
| getProvidingModule | back to summary |
|---|---|
| public HK2Module getProvidingModule(String providerClassName) Implements com. Doc from com. Gets the
| |
| getRepository | back to summary |
|---|---|
| public Repository getRepository(String name) Implements com. Get a repository from the list of attached repositories
| |
| getRunningServices | back to summary |
|---|---|
| public <T> List Implements com. Returns all running services implementation of the passed service interface | |
| getServiceOrFail | back to summary |
|---|---|
| private <T> T getServiceOrFail(ServiceLocator serviceLocator, Class<T> contractOrImpl) | |
| initializeServiceLocator | back to summary |
|---|---|
| protected void initializeServiceLocator(ServiceLocator serviceLocator) throws MultiException | |
| loadFromRepository | back to summary |
|---|---|
| protected HK2Module loadFromRepository(String name, String version) | |
| makeModuleFor | back to summary |
|---|---|
| public HK2Module makeModuleFor(String name, String version) throws ResolveError Implements com. Returns the
| |
| makeModuleFor | back to summary |
|---|---|
| public HK2Module makeModuleFor(String name, String version, boolean resolve) throws ResolveError Implements com. Doc from com. Returns the
| |
| makeModuleFor | back to summary |
|---|---|
| public HK2Module makeModuleFor(String packageName) throws ResolveError Implements com. Find and return a loaded HK2Module that has the package name in its list of exported interfaces.
| |
| newModule | back to summary |
|---|---|
| protected abstract HK2Module newModule(ModuleDefinition moduleDef) Factory method for creating new instances of HK2Module.
| |
| newServiceLocator | back to summary |
|---|---|
| public ServiceLocator newServiceLocator() throws MultiException Implements com. Creates an uninitialized
| |
| newServiceLocator | back to summary |
|---|---|
| public ServiceLocator newServiceLocator(ServiceLocator parent) throws MultiException Implements com. Create a new ServiceLocator optionally providing a parent Services
| |
| parseInhabitants | back to summary |
|---|---|
| protected abstract List | |
| populateConfig | back to summary |
|---|---|
| public void populateConfig(ServiceLocator serviceLocator) Implements com.
| |
| populateServiceLocator | back to summary |
|---|---|
| public void populateServiceLocator(String name, ServiceLocator serviceLocator, List<PopulatorPostProcessor> postProcessors) throws MultiException Implements com. Creates a
| |
| back to summary | |
|---|---|
| public void print(Logger logger) Implements com. Print a Registry dump to the logger
| |
| registerRunningService | back to summary |
|---|---|
| public <T> void registerRunningService(Class<T> serviceClass, T provider) Implements com. Registers a running service, this is useful when other components need to have access to a provider of a service without having to create a new instance and initialize it.
| |
| remove | back to summary |
|---|---|
| public void remove(HK2Module module) Removes a module from the registry. The module will not be accessible from this registry after this method returns. | |
| removeRepository | back to summary |
|---|---|
| public void removeRepository(String name) Implements com. Remove a repository from the list of attached repositories to
this instances. After this call, the
| |
| removeShutdownLocators | back to summary |
|---|---|
| private void removeShutdownLocators() | |
| unregisterRunningService | back to summary |
|---|---|
| public <T> boolean unregisterRunningService(Class<T> serviceClass, T provider) Implements com. Removes a running service, this is useful when a service instance is no longer available as a provider of a service. | |