[jira] [Commented] (EAGLE-455) Provide shared JDBCQueryService for JDBCMetadataStore

2016-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/EAGLE-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15418247#comment-15418247
 ] 

ASF GitHub Bot commented on EAGLE-455:
--

Github user haoch closed the pull request at:

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


> Provide shared JDBCQueryService for JDBCMetadataStore
> -
>
> Key: EAGLE-455
> URL: https://issues.apache.org/jira/browse/EAGLE-455
> Project: Eagle
>  Issue Type: New Feature
>Reporter: Hao Chen
>Assignee: Hao Chen
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (EAGLE-455) Provide shared JDBCQueryService for JDBCMetadataStore

2016-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/EAGLE-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15418246#comment-15418246
 ] 

ASF GitHub Bot commented on EAGLE-455:
--

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;`



> Provide shared JDBCQueryService for JDBCMetadataStore
> -
>
> Key: EAGLE-455
> URL: https://issues.apache.org/jira/browse/EAGLE-455
> Project: Eagle
>  Issue Type: New Feature
>Reporter: Hao Chen
>Assignee: Hao Chen
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (EAGLE-455) Provide shared JDBCQueryService for JDBCMetadataStore

2016-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/EAGLE-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15417980#comment-15417980
 ] 

ASF GitHub Bot commented on EAGLE-455:
--

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.


> Provide shared JDBCQueryService for JDBCMetadataStore
> -
>
> Key: EAGLE-455
> URL: https://issues.apache.org/jira/browse/EAGLE-455
> Project: Eagle
>  Issue Type: New Feature
>Reporter: Hao Chen
>Assignee: Hao Chen
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (EAGLE-455) Provide shared JDBCQueryService for JDBCMetadataStore

2016-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/EAGLE-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15417971#comment-15417971
 ] 

ASF GitHub Bot commented on EAGLE-455:
--

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.


> Provide shared JDBCQueryService for JDBCMetadataStore
> -
>
> Key: EAGLE-455
> URL: https://issues.apache.org/jira/browse/EAGLE-455
> Project: Eagle
>  Issue Type: New Feature
>Reporter: Hao Chen
>Assignee: Hao Chen
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (EAGLE-455) Provide shared JDBCQueryService for JDBCMetadataStore

2016-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/EAGLE-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15417193#comment-15417193
 ] 

ASF GitHub Bot commented on EAGLE-455:
--

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.


> Provide shared JDBCQueryService for JDBCMetadataStore
> -
>
> Key: EAGLE-455
> URL: https://issues.apache.org/jira/browse/EAGLE-455
> Project: Eagle
>  Issue Type: New Feature
>Reporter: Hao Chen
>Assignee: Hao Chen
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (EAGLE-455) Provide shared JDBCQueryService for JDBCMetadataStore

2016-08-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/EAGLE-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15417189#comment-15417189
 ] 

ASF GitHub Bot commented on EAGLE-455:
--

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 
Date:   2016-08-11T13:02:06Z

EAGLE-455 Add JDBCMetadataQueryService, JDBCDataSourceConfig, 
GuiceJUnitRunner




> Provide shared JDBCQueryService for JDBCMetadataStore
> -
>
> Key: EAGLE-455
> URL: https://issues.apache.org/jira/browse/EAGLE-455
> Project: Eagle
>  Issue Type: New Feature
>Reporter: Hao Chen
>Assignee: Hao Chen
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)