Github user haoch commented on the issue:
https://github.com/apache/incubator-eagle/pull/323
I think ApplicationProvider is just for providing a package of static
application process/metadata/extensions but not for runtime.
As following typical example, for different scope of memory/mysql,
`ISecurityMetadataDAO` should bind to different implementation
`InMemMetadataDaoImpl`/ `JDBCSecurityMetadataDAO`, and caller just need to
inject with `@Inject ISecurityMetadataDAO dao`.
~~~
@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);
}
});
}
~~~
While if register with current metadata store instance, then the code have
to be as following, it will bind the register interface with MetadataStore and
not extensible enough.
~~~
@Override
public void register(MetadataStore store, ModuleRegistry registry) {
if(store instance of MemoryMetadataStore){
registry.register(MemoryMetadataStore.class, new
AbstractModule() {
@Override
protected void configure() {
bind(ISecurityMetadataDAO.class).to(InMemMetadataDaoImpl.class);
}
});
} else if (store instance of MySQLMetadataStore){
registry.register(new AbstractModule() {
@Override
protected void configure() {
bind(ISecurityMetadataDAO.class).to(JDBCSecurityMetadataDAO.class);
}
});
}
}
~~~
I think both maybe ok, and have similar implementation code, but the first
implementation should be more flexible, especially in future we may be able to
extend more than MetadataStore.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---