Class ModuleContainerAdaptor

java.lang.Object
org.eclipse.osgi.container.ModuleContainerAdaptor

public abstract class ModuleContainerAdaptor extends Object
Adapts the behavior of a container.
Since:
3.10
  • Constructor Details

    • ModuleContainerAdaptor

      public ModuleContainerAdaptor()
  • Method Details

    • getModuleCollisionHook

      public abstract ModuleCollisionHook getModuleCollisionHook()
      Returns the collision hook the container will use.
      Returns:
      the collision hook the container will use.
    • getResolverHookFactory

      public abstract ResolverHookFactory 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 event
      module - the module associated with the event
      error - the error associated with the event, may be null
      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 publish
      module - the module the event is associated with
      origin - the module which is the origin of the event. For the event type ModuleContainerAdaptor.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 type ModuleContainerAdaptor.ModuleEvent.INSTALLED.
    • getProperty

      public String getProperty(String key)
      Returns the specified configuration property value
      Parameters:
      key - the key of the configuration property
      Returns:
      the configuration property value
    • createModuleLoader

      public ModuleLoader createModuleLoader(ModuleWiring wiring)
      Creates a new ModuleLoader 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 when loading persistent data into this database.
      Parameters:
      location - the location for the module
      id - the id for the module
      settings - the settings for the module. May be null if there are no settings.
      startlevel - the start level for the module
      Returns:
      the Module
    • createSystemModule

      public abstract SystemModule createSystemModule()
      Creates the system module. This gets called when the system module is installed or when loading persistent data into this database.

      The returned system module must have an id of zero and a location of System Bundle.

      Returns:
      the system module
    • getRevisionInfo

      public Object getRevisionInfo(String location, long id)
      Returns the current revision info for a module with the specified location and id
      Parameters:
      location - the location of the module
      id - the id of the module
      Returns:
      the revision info, may be null
    • associateRevision

      public void associateRevision(ModuleRevision revision, Object revisionInfo)
      After a revision is created this method is called with the specified revision info.
      Parameters:
      revision - the newly created revision
      revisionInfo - the revision info that got associated with the revision
    • invalidateWiring

      public void invalidateWiring(ModuleWiring moduleWiring, ModuleLoader current)
      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 invalidated
      current - the current module loader associated with the wiring, may be null.
    • 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 the SystemModule.init() is running.
    • initEnd

      public void initEnd()
      This is called just before the SystemModule.init() returns.
    • getDebugOptions

      public DebugOptions 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

      public Executor getResolverExecutor()
      Returns the executor used to perform resolve operations
      Returns:
      the executor used to perform resolve operations
      Since:
      3.11
    • getStartLevelExecutor

      public Executor getStartLevelExecutor()
      Returns the executor used to by the FrameworkStartLevel 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 is installed into the container or when an existing module is updated 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 either installed or updated.
      origin - The module which originated the lifecycle operation. The origin may be null for installed operations. This is the module passed to the install or update method.
      builder - the builder that will be used to create a new ModuleRevision.
      revisionInfo - the revision info that will be used for the new revision, may be null.
      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

      public ScheduledExecutorService 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