[
https://issues.apache.org/jira/browse/EAGLE-442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15416517#comment-15416517
]
ASF GitHub Bot commented on EAGLE-442:
--------------------------------------
Github user haoch closed the pull request at:
https://github.com/apache/incubator-eagle/pull/323
> Support to extend metastore DAO modules in SPI
> ----------------------------------------------
>
> Key: EAGLE-442
> URL: https://issues.apache.org/jira/browse/EAGLE-442
> Project: Eagle
> Issue Type: Sub-task
> Affects Versions: v0.5.0
> Reporter: Hao Chen
> Assignee: Hao Chen
> Labels: app-framework, extensibility
> Fix For: v0.5.0
>
>
> h1. Module Registry Interfaces
> * ApplicationProvider
> {code}
> ApplicationProvider{
> void register(ModuleRegistry)
> }
> {code}
> * ModuleRegistry
> {code}
> ModuleRegistry {
> void register(ModuleScope scope,Module module);
> default void register(Module moduel) {
> register(GlobalScope.class, module)
> }
> }
> {code}
> * 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)
> {code}
> ModuleScope
> |- GlobalScope
> |- MetadataStore
> |- MySQLMetadataStore
> |- MongodbMetadataStore
> |- MemoryMetadataStore
> {code}
> h1. Example
> * Registry: in `HBaseAuditLogAppProvider`
> {code}
> @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);
> }
> });
> }
> {code}
> * 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)
> {code}
> @Inject
> public HbaseMetadataBrowseWebResource(ApplicationEntityService
> entityService, ISecurityMetadataDAO metadataDAO){
> this.entityService = entityService;
> this.dao = metadataDAO;
> }
> {code}
> h1. More Use Cases
> * ExampleResource
> * ExampleService
> * ExampleApplicationProviderTest#testApplicationExtensions
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)