Package org.eclipse.osgi.container
Class ModuleContainerAdaptor
java.lang.Object
org.eclipse.osgi.container.ModuleContainerAdaptor
Adapts the behavior of a container.
- Since:
- 3.10
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Event types that may bepublished
for a container.static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadaptModuleRevisionBuilder
(ModuleContainerAdaptor.ModuleEvent operation, Module origin, ModuleRevisionBuilder builder, Object revisionInfo) Allows a builder to be modified before it is used by the container.void
associateRevision
(ModuleRevision revision, Object revisionInfo) After a revision is created this method is called with the specified revision info.abstract Module
createModule
(String location, long id, EnumSet<Module.Settings> settings, int startlevel) Creates a new module.createModuleLoader
(ModuleWiring wiring) Creates a newModuleLoader
for the specified wiring.abstract SystemModule
Creates the system module.Returns the debug options for the module container.abstract ModuleCollisionHook
Returns the collision hook the container will use.getProperty
(String key) Returns the specified configuration property valueReturns the executor used to perform resolve operationsabstract ResolverHookFactory
Returns the resolver hook factory the container will use.getRevisionInfo
(String location, long id) Returns the current revision info for a module with the specified location and idReturns the scheduled executor that may be used by the container to schedule background tasks.Returns the executor used to by theFrameworkStartLevel
implementation to start bundles that have the same start level.void
This is called when theSystemModule.init()
is running.void
initEnd()
This is called just before theSystemModule.init()
returns.void
invalidateWiring
(ModuleWiring moduleWiring, ModuleLoader current) This is called when a wiring is made invalid and allows the adaptor to react to this.abstract void
publishContainerEvent
(ModuleContainerAdaptor.ContainerEvent type, Module module, Throwable error, FrameworkListener... listeners) Publishes the specified container event.abstract void
publishModuleEvent
(ModuleContainerAdaptor.ModuleEvent type, Module module, Module origin) Publishes the specified module event type for the specified module.void
This is called if a request to refresh modules causes the system module to be refreshed.void
This is called whenever the module database has been updated.
-
Constructor Details
-
ModuleContainerAdaptor
public ModuleContainerAdaptor()
-
-
Method Details
-
getModuleCollisionHook
Returns the collision hook the container will use.- Returns:
- the collision hook the container will use.
-
getResolverHookFactory
Returns the resolver hook factory the container will use.- Returns:
- the resolver hook factory the container will use.
-
publishContainerEvent
public abstract void publishContainerEvent(ModuleContainerAdaptor.ContainerEvent type, Module module, Throwable error, FrameworkListener... listeners) Publishes the specified container event. No locks are held by the container when this method is called- Parameters:
type
- the type of eventmodule
- the module associated with the eventerror
- the error associated with the event, may benull
listeners
- additional listeners to publish the event to synchronously
-
publishModuleEvent
public abstract void publishModuleEvent(ModuleContainerAdaptor.ModuleEvent type, Module module, Module origin) Publishes the specified module event type for the specified module. No locks are held by the container when this method is called- Parameters:
type
- the event type to publishmodule
- the module the event is associated withorigin
- the module which is the origin of the event. For the event typeModuleContainerAdaptor.ModuleEvent.INSTALLED
, this is the module whose context was used to install the module. Otherwise it is the module itself. May be null only when the event is not of typeModuleContainerAdaptor.ModuleEvent.INSTALLED
.
-
getProperty
Returns the specified configuration property value- Parameters:
key
- the key of the configuration property- Returns:
- the configuration property value
-
createModuleLoader
Creates a newModuleLoader
for the specified wiring.- Parameters:
wiring
- the module wiring to create a module loader for- Returns:
- a new
ModuleLoader
for the specified wiring.
-
createModule
public abstract Module createModule(String location, long id, EnumSet<Module.Settings> settings, int startlevel) Creates a new module. This gets called when a new module is installed or whenloading
persistent data into this database.- Parameters:
location
- the location for the moduleid
- the id for the modulesettings
- the settings for the module. May benull
if there are no settings.startlevel
- the start level for the module- Returns:
- the Module
-
createSystemModule
Creates the system module. This gets called when the system module is installed or whenloading
persistent data into this database.The returned system module must have an
id
of zero and a location ofSystem Bundle
.- Returns:
- the system module
-
getRevisionInfo
Returns the current revision info for a module with the specified location and id- Parameters:
location
- the location of the moduleid
- the id of the module- Returns:
- the revision info, may be
null
-
associateRevision
After a revision is created this method is called with the specified revision info.- Parameters:
revision
- the newly created revisionrevisionInfo
- the revision info that got associated with the revision
-
invalidateWiring
This is called when a wiring is made invalid and allows the adaptor to react to this. This method is called while holding state change lock for the module as well as for the module database. Care must be taken not to introduce deadlock.- Parameters:
moduleWiring
- the module wiring being invalidatedcurrent
- the current module loader associated with the wiring, may benull
.
-
refreshedSystemModule
public void refreshedSystemModule()This is called if a request to refresh modules causes the system module to be refreshed. This causes the system module to be stopped in a back ground thread. This method is called before the background thread is started to stop the system module. -
updatedDatabase
public void updatedDatabase()This is called whenever the module database has been updated. -
initBegin
public void initBegin()This is called when theSystemModule.init()
is running. -
initEnd
public void initEnd()This is called just before theSystemModule.init()
returns. -
getDebugOptions
Returns the debug options for the module container.- Returns:
- the debug options for the module container, or null if there are no debug options.
-
getResolverExecutor
Returns the executor used to perform resolve operations- Returns:
- the executor used to perform resolve operations
- Since:
- 3.11
-
getStartLevelExecutor
Returns the executor used to by theFrameworkStartLevel
implementation to start bundles that have the same start level. This allows bundles to be started in parallel.- Returns:
- the executor used by the
FrameworkStartLevel
implementation. - Since:
- 3.14
-
adaptModuleRevisionBuilder
public ModuleRevisionBuilder adaptModuleRevisionBuilder(ModuleContainerAdaptor.ModuleEvent operation, Module origin, ModuleRevisionBuilder builder, Object revisionInfo) Allows a builder to be modified before it is used by the container. This gets call when a new module isinstalled
into the container or when an existing module isupdated
with a new revision. The container does not call any methods on the builder before calling this method.- Parameters:
operation
- The lifecycle operation event that is in progress using the supplied builder. This will be eitherinstalled
orupdated
.origin
- The module which originated the lifecycle operation. The origin may benull
forinstalled
operations. This is the module passed to theinstall
orupdate
method.builder
- the builder that will be used to create a newModuleRevision
.revisionInfo
- the revision info that will be used for the new revision, may benull
.- Returns:
- The modified builder or a completely new builder to be used by the
bundle. A
null
value indicates the original builder should be used, which may have been modified by adding requirements or capabilities. - Since:
- 3.12
-
getScheduledExecutor
Returns the scheduled executor that may be used by the container to schedule background tasks.- Returns:
- the scheduled executor, or null if background tasks are not supported
- Since:
- 3.13
-