Package org.adempiere.base
Class AnnotationBasedEventManager
java.lang.Object
org.adempiere.base.AnnotationBasedFactory
org.adempiere.base.AnnotationBasedEventManager
- Direct Known Subclasses:
DefaultAnnotationBasedEventManager
Scan, discover and register classes with
EventTopicDelegate
annotation- Author:
- hengsin
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.osgi.framework.BundleContext
protected IEventManager
protected List<org.osgi.service.event.EventHandler>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(org.osgi.service.component.ComponentContext context) protected void
bindService
(IEventManager eventManager) void
deactivate
(org.osgi.service.component.ComponentContext context) abstract String[]
Subclass would override this to define the list of packages to perform the scan, discover and register operationprotected void
scan()
Perform asynchronous scan, discover and register of annotated event delegate classes.protected CompletableFuture<List<org.osgi.service.event.EventHandler>>
Scan, discover and register annotated event delegate classes.CompletableFuture<List<org.osgi.service.event.EventHandler>>
Scan, discover and register annotated event delegate classes.protected void
unbindService
(IEventManager eventManager) Methods inherited from class org.adempiere.base.AnnotationBasedFactory
blockWhileScanning, getExecutorService, getMaxThreads, getScanFailureHandler, signalScanCompletion
-
Field Details
-
eventManager
-
bundleContext
protected org.osgi.framework.BundleContext bundleContext -
handlers
-
-
Constructor Details
-
AnnotationBasedEventManager
public AnnotationBasedEventManager()default constructor
-
-
Method Details
-
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
- Parameters:
eventManager
-
-
unbindService
- 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 returnCompletableFuture
to caller. If needed, caller can use the returnCompletableFuture
to wait for the scan to complete (using either get or join).- Parameters:
context
- bundle contextpackageNames
- 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 contextlogScanDuration
-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.
-