Class AnnotationBasedEventManager

java.lang.Object
org.adempiere.base.AnnotationBasedFactory
org.adempiere.base.AnnotationBasedEventManager
Direct Known Subclasses:
DefaultAnnotationBasedEventManager

public abstract class AnnotationBasedEventManager extends AnnotationBasedFactory
Scan, discover and register classes with EventTopicDelegate annotation
Author:
hengsin
  • Field Details

    • eventManager

      protected IEventManager eventManager
    • bundleContext

      protected org.osgi.framework.BundleContext bundleContext
    • handlers

      protected List<org.osgi.service.event.EventHandler> handlers
  • Constructor Details

    • AnnotationBasedEventManager

      public AnnotationBasedEventManager()
      default constructor
  • Method Details

    • getPackages

      public abstract String[] getPackages()
      Subclass would override this to define the list of packages to perform the scan, discover and register operation
      Returns:
      packages to scan
    • activate

      public void activate(org.osgi.service.component.ComponentContext context)
    • deactivate

      public void deactivate(org.osgi.service.component.ComponentContext context)
    • bindService

      protected void bindService(IEventManager eventManager)
      Parameters:
      eventManager -
    • unbindService

      protected void unbindService(IEventManager eventManager)
      Parameters:
      eventManager -
    • scan

      public CompletableFuture<List<org.osgi.service.event.EventHandler>> scan(org.osgi.framework.BundleContext context, String... packageNames)
      Scan, discover and register annotated event delegate classes.
      The scan is asynchronous and return CompletableFuture to caller. If needed, caller can use the return CompletableFuture to wait for the scan to complete (using either get or join).
      Parameters:
      context - bundle context
      packageNames - one or more package to scan
      Returns:
      CompletableFuture<List<EventHandler>>
    • scan

      protected CompletableFuture<List<org.osgi.service.event.EventHandler>> scan(org.osgi.framework.BundleContext context, boolean logScanDuration, String... packageNames)
      Scan, discover and register annotated event delegate classes.
      Parameters:
      context - bundle context
      logScanDuration -
      packageNames - one or more package to scan
      Returns:
      CompletableFuture<List<EventHandler>>
    • scan

      protected void scan()
      Perform asynchronous scan, discover and register of annotated event delegate classes.