Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
v0.5.0
-
None
Description
Module Registry Interfaces
- ApplicationProvider
ApplicationProvider{ void register(ModuleRegistry) }
- ModuleRegistry
ModuleRegistry { void register(ModuleScope scope,Module module); default void register(Module moduel) { register(GlobalScope.class, module) } }
- ModuleScope
- Modules registered in scope of `GlobalScope` will be visible globally
- Modules registered in `MySQLMetadataStore`/`MongodbMetadataStore`/`MemoryMetadataStore` will only be visible when selected MetadataStore is active (set in configuration file)
ModuleScope |- GlobalScope |- MetadataStore |- MySQLMetadataStore |- MongodbMetadataStore |- MemoryMetadataStore
Example
- Registry: in `HBaseAuditLogAppProvider`
@Override public void register(ModuleRegistry registry) { registry.register(MemoryMetadataStore.class, new AbstractModule() { @Override protected void configure() { bind(ISecurityMetadataDAO.class).to(InMemMetadataDaoImpl.class); } }); registry.register(MySQLMetadataStore.class, new AbstractModule() { @Override protected void configure() { bind(ISecurityMetadataDAO.class).to(JDBCSecurityMetadataDAO.class); } }); }
- Inject: For example, `HbaseMetadataBrowseWebResource` could get current `ISecurityMetadataDAO` with `@Inject ISecurityMetadataDAO metadataDAO` as following, instead of using [`MetadataDaoFactory`](https://github.com/apache/incubator-eagle/blob/9b10f22221b60f0f6451e71ac3396b326f9565ef/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/MetadataDaoFactory.java)
@Inject public HbaseMetadataBrowseWebResource(ApplicationEntityService entityService, ISecurityMetadataDAO metadataDAO){ this.entityService = entityService; this.dao = metadataDAO; }
More Use Cases
- ExampleResource
- ExampleService
- ExampleApplicationProviderTest#testApplicationExtensions
Attachments
Issue Links
- relates to
-
EAGLE-431 MetadataDaoFactory should use config from eagle server
- Resolved
- links to