You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eagle.apache.org by haoch <gi...@git.apache.org> on 2016/08/11 13:06:21 UTC

[GitHub] incubator-eagle pull request #331: EAGLE-455 Add JDBCMetadataQueryService, J...

GitHub user haoch opened a pull request:

    https://github.com/apache/incubator-eagle/pull/331

    EAGLE-455 Add JDBCMetadataQueryService, JDBCDataSourceConfig, GuiceJUnitRunner

    - Enhanced JDBC Metadata Framework by adding JDBCMetadataQueryService, JDBCDataSourceConfig, GuiceJUnitRunner
    - Refine `JDBCSecurityMetadataDAO` with `JDBCMetadataQueryService` and add unit test case `JDBCSecurityMetadataDAOTest`

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/haoch/incubator-eagle EAGLE-455

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-eagle/pull/331.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #331
    
----
commit afaadc69e52606afbbb3addb326c0209cc67cae5
Author: Hao Chen <ha...@apache.org>
Date:   2016-08-11T13:02:06Z

    EAGLE-455 Add JDBCMetadataQueryService, JDBCDataSourceConfig, GuiceJUnitRunner

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle pull request #331: EAGLE-455 Add JDBCMetadataQueryService, J...

Posted by haoch <gi...@git.apache.org>.
Github user haoch commented on a diff in the pull request:

    https://github.com/apache/incubator-eagle/pull/331#discussion_r74418107
  
    --- Diff: eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/service/JDBCSecurityMetadataDAO.java ---
    @@ -20,73 +20,72 @@
     package org.apache.eagle.security.service;
     
     import com.google.inject.Inject;
    -import com.typesafe.config.Config;
    +import org.apache.eagle.metadata.store.jdbc.JDBCMetadataQueryService;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
    -import java.sql.*;
    -import java.util.ArrayList;
    +import javax.sql.DataSource;
    +import java.sql.Connection;
    +import java.sql.PreparedStatement;
    +import java.sql.SQLException;
     import java.util.Collection;
    +import java.util.Collections;
     
     /**
      * Since 8/8/16.
      */
     public class JDBCSecurityMetadataDAO implements ISecurityMetadataDAO  {
         private static final Logger LOG = LoggerFactory.getLogger(JDBCSecurityMetadataDAO.class);
     
    -    private Config config;
         /**
          * composite primary key: site and hbase_resource
          */
    +    private final String TABLE_DDL_STATEMENT = "create table if not exists hbase_sensitivity_entity (site varchar(20), hbase_resource varchar(100), sensitivity_type varchar(20), primary key (site, hbase_resource));";
         private final String QUERY_ALL_STATEMENT = "SELECT site, hbase_resource, sensitivity_type FROM hbase_sensitivity_entity";
         private final String INSERT_STATEMENT = "INSERT INTO hbase_sensitivity_entity (site, hbase_resource, sensitivity_type) VALUES (?, ?, ?)";
     
    -    // get connection url from config
    +    private DataSource dataSource;
    +    private JDBCMetadataQueryService queryService;
    +
    +    /**
    +     * Inject datasource
    +     *
    +     * @param dataSource
    +     */
         @Inject
    -    public JDBCSecurityMetadataDAO(Config config){
    -        this.config = config;
    +    public JDBCSecurityMetadataDAO(DataSource dataSource, JDBCMetadataQueryService queryService) {
    --- End diff --
    
    Create table if not exists when initializing.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle issue #331: EAGLE-455 Add JDBCMetadataQueryService, JDBCData...

Posted by yonzhang <gi...@git.apache.org>.
Github user yonzhang commented on the issue:

    https://github.com/apache/incubator-eagle/pull/331
  
    -1 for the early abstraction, we should still use existing implementation and push abstraction after we tested all the applications.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle issue #331: EAGLE-455 Add JDBCMetadataQueryService, JDBCData...

Posted by yonzhang <gi...@git.apache.org>.
Github user yonzhang commented on the issue:

    https://github.com/apache/incubator-eagle/pull/331
  
    @Override
        public void register(ModuleRegistry registry) {
            registry.register(MemoryMetadataStore.class, new AbstractModule() {
                @Override
                protected void configure() {
                    bind(ISecurityMetadataDAO.class).to(InMemMetadataDaoImpl.class);
                }
            });
    
            registry.register(JDBCMetadataStore.class, new AbstractModule() {
                @Override
                protected void configure() {
                    bind(ISecurityMetadataDAO.class).to(JDBCSecurityMetadataDAO.class);
                }
            });
        }
    
    Again this is too cumbersome, too much code for application and application developer need understand the framework to use.
    Further, what if the application needs know configuration for eagle server. I still prefer to have global configuration to each application for flexibility.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle pull request #331: EAGLE-455 Add JDBCMetadataQueryService, J...

Posted by haoch <gi...@git.apache.org>.
Github user haoch closed the pull request at:

    https://github.com/apache/incubator-eagle/pull/331


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-eagle issue #331: EAGLE-455 Add JDBCMetadataQueryService, JDBCData...

Posted by haoch <gi...@git.apache.org>.
Github user haoch commented on the issue:

    https://github.com/apache/incubator-eagle/pull/331
  
    I think the implementation is to provide the foundation for make sure the code modules extensible, as how much code developer should write it's to continue simplifying the interface or DSL. I was told to think interface earlier than implementation.
    
    > - Further, what if the application needs know configuration for eagle server
    
    We should follow the defined interface of Application. For Application standalone mode, the configuration should be passed through configuration file, for Application managed by server, the configuration should be passed through: https://github.com/apache/incubator-eagle/blob/develop/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/service/ApplicationContext.java#L70
    
        this.config = ConfigFactory.parseMap(executionConfig).withFallback(envConfig);
    
    For managed classes, it could easily get server config by `@Inject Config config;`



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---