eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject [06/51] [partial] incubator-eagle git commit: EAGLE-184 Migrate eagle website from https://github.com/eaglemonitoring/eaglemonitoring.github.io to document branch
Date Thu, 03 Mar 2016 18:09:39 GMT
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionConfigFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionConfigFactory.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionConfigFactory.java
deleted file mode 100644
index 71f19aa..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionConfigFactory.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn;
-
-import org.apache.eagle.common.config.EagleConfigFactory;
-import org.apache.eagle.storage.jdbc.JdbcConstants;
-
-/**
- * @since 3/26/15
- */
-public class ConnectionConfigFactory {
-    /**
-     * Read connection config from config.properties
-     *
-     * @return
-     */
-    public static ConnectionConfig getFromEagleConfig(){
-        String username = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_DB_USERNAME);
-        String password = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_DB_PASSWORD);
-        String connUrl = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_CONN_URL);
-        String connProps = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_CONN_PROPS);
-        String adapter = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_ADAPTER);
-        String databaseName = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_DATABASE);
-        String driverClass = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_DRIVER_CLASS);
-        String connMaxSize = EagleConfigFactory.load().getConfig().getString(JdbcConstants.EAGLE_CONN_MAX_SIZE);
-
-        ConnectionConfig config = new ConnectionConfig();
-        if(username != null) config.setUserName(username);
-        if(password != null)config.setPassword(password);
-        if(connUrl != null) config.setConnectionUrl(connUrl);
-        if(connProps!=null) config.setConnectionProperties(connProps);
-        if(adapter!=null) config.setAdapter(adapter);
-        if(databaseName!=null) config.setDatabaseName(databaseName);
-        if(driverClass!=null) config.setDriverClassName(driverClass);
-
-
-        if(connMaxSize!=null){
-            config.setConnectionMaxActive(Integer.parseInt(connMaxSize));
-        }
-
-        return config;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManager.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManager.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManager.java
deleted file mode 100644
index 4472542..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManager.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn;
-
-import java.sql.Connection;
-
-/**
- * @since 3/27/15
- */
-public interface ConnectionManager {
-    /**
-     *
-     * @param config
-     * @throws Exception
-     */
-    void init(ConnectionConfig config) throws Exception;
-
-    ConnectionConfig getConfig();
-
-    /**
-     *
-     * @return
-     * @throws Exception
-     */
-    Connection getConnection() throws Exception;
-
-    /**
-     * Get default database StatementExecutor
-     *
-     * @return StatementExecutor implementation
-     */
-    <T extends StatementExecutor> T getStatementExecutor();
-
-    /**
-     * Get default database StatementExecutor
-     *
-     * @return StatementExecutor implementation
-     */
-    <T extends StatementExecutor> T getStatementExecutor(String tableName);
-
-    /**
-     *
-     * @param connection
-     * @throws Exception
-     */
-    void close(Connection connection) throws Exception;
-
-    /**
-     *
-     * @throws Exception
-     */
-    void shutdown() throws Exception;
-
-    boolean isClosed();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManagerFactory.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManagerFactory.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManagerFactory.java
deleted file mode 100644
index 089ca60..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/ConnectionManagerFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn;
-
-import org.apache.eagle.storage.jdbc.conn.impl.TorqueConnectionManagerImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @since 3/27/15
- */
-public class ConnectionManagerFactory {
-	private final static Logger LOG = LoggerFactory.getLogger(ConnectionManagerFactory.class);
-    private static ConnectionManager instance;
-    private static volatile boolean initialized; 
-    private final static Object lock = new Object();
-    
-    private static void initialize(ConnectionConfig config) throws Exception{
-    	instance = new TorqueConnectionManagerImpl();
-        LOG.info("Created new connection manager instance "+instance);
-        LOG.info("Initializing connection manager");
-        instance.init(config);
-        Runtime.getRuntime().addShutdownHook(new ConnectionManagerShutdownHook(instance));
-        if(LOG.isDebugEnabled()) LOG.debug("Registered connection manager shutdown hook");
-    }
-
-    /**
-     * Get instance from eagle configuration
-     *
-     * @return
-     */
-    public static ConnectionManager getInstance() throws Exception {
-    	if(!initialized){
-    		synchronized(lock){
-    			if(!initialized){
-    				initialize(ConnectionConfigFactory.getFromEagleConfig());
-    				initialized = true;
-    			}
-    		}
-    	}
-    	return instance;
-    }
-
-    private static class ConnectionManagerShutdownHook extends Thread{
-        private final ConnectionManager connectionManager;
-
-        ConnectionManagerShutdownHook(ConnectionManager connectionManager){
-            this.connectionManager = connectionManager;
-        }
-
-        @Override
-        public void run() {
-            LOG.info("Shutting down");
-            try {
-                this.connectionManager.shutdown();
-            } catch (Exception e) {
-                LOG.error(e.getMessage(),e);
-            }
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/PrimaryKeyBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/PrimaryKeyBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/PrimaryKeyBuilder.java
deleted file mode 100644
index 2e6829b..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/PrimaryKeyBuilder.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn;
-
-/**
- * Primary key builder
- *
- * @since 3/29/15
- */
-public interface PrimaryKeyBuilder<K> {
-    /**
-     *
-     * @param t entity instance
-     * @param <T> entity type
-     * @return primary in type of K
-     */
-    <T> K build(T t);
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/StatementExecutor.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/StatementExecutor.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/StatementExecutor.java
deleted file mode 100644
index 7edfdb9..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/StatementExecutor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn;
-
-/**
- * An interface for abstract StatementExecutor from detailed implementation
- *
- * @since 3/29/15
- */
-public interface StatementExecutor {
-    /**
-     * Initialize statement for action like SELECT
-     *
-     * @param config
-     */
-    void init(ConnectionConfig config);
-
-    /**
-     * Initialize statement for action like CREATE, UPDATE, DELETE which need table name
-     *
-     * @param config connection config
-     * @param tableName
-     */
-    void init(ConnectionConfig config,String tableName);
-    /**
-     * @return customized primary key builder if no built-in primary key generation method like auto-increment and so on.
-     */
-    PrimaryKeyBuilder<String> getPrimaryKeyBuilder();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueConnectionManagerImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueConnectionManagerImpl.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueConnectionManagerImpl.java
deleted file mode 100644
index 42e851b..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueConnectionManagerImpl.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn.impl;
-
-import org.apache.eagle.storage.jdbc.JdbcConstants;
-import org.apache.eagle.storage.jdbc.conn.ConnectionConfig;
-import org.apache.eagle.storage.jdbc.conn.ConnectionManager;
-import org.apache.commons.configuration.BaseConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.torque.Torque;
-import org.apache.torque.TorqueException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Connection;
-
-/**
- * @since 3/27/15
- */
-public class TorqueConnectionManagerImpl implements ConnectionManager {
-    private final static Logger LOG = LoggerFactory.getLogger(TorqueConnectionManagerImpl.class);
-    public final static String DEFAULT_DATA_SOURCE_FACTORY_CLASS = "org.apache.torque.dsfactory.SharedPoolDataSourceFactory";
-
-    private ConnectionConfig config;
-
-    @Override
-    public void init(ConnectionConfig config) throws Exception {
-        if(this.config != null) LOG.warn("Resetting config");
-        this.config = config;
-
-        if(!Torque.isInit()) {
-            try {
-                if(LOG.isDebugEnabled()) LOG.debug("Apache Torque initializing");
-                Torque.init(buildConfiguration(config));
-            } catch (TorqueException e) {
-                throw new Exception(e);
-            }
-        }else{
-            LOG.warn("Apache Torque has already been initialized, ignore");
-        }
-    }
-
-    @Override
-    public ConnectionConfig getConfig() {
-        return this.config;
-    }
-
-    @Override
-    public Connection getConnection() throws Exception {
-        try {
-            return Torque.getConnection();
-        } catch (TorqueException e) {
-            LOG.error("Failed to get connection",e);
-            throw new Exception(e);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public TorqueStatementPeerImpl getStatementExecutor() {
-        TorqueStatementPeerImpl statementPeer = new TorqueStatementPeerImpl();
-        statementPeer.init(this.getConfig());
-        return statementPeer;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public TorqueStatementPeerImpl getStatementExecutor(String tableName) {
-        TorqueStatementPeerImpl statementPeer = new TorqueStatementPeerImpl();
-        statementPeer.init(this.getConfig(),tableName);
-        return statementPeer;
-    }
-
-    @Override
-    public void close(Connection connection) {
-        Torque.closeConnection(connection);
-    }
-
-    @Override
-    public void shutdown() throws Exception {
-        Torque.shutdown();
-    }
-
-    @Override
-    public boolean isClosed() {
-        return !Torque.isInit();
-    }
-
-    /**
-     * http://db.apache.org/torque/torque-4.0/documentation/orm-reference/initialisation-configuration.html
-     * http://commons.apache.org/proper/commons-dbcp/configuration.html
-     *
-     * @param config
-     * @return
-     */
-    private Configuration buildConfiguration(ConnectionConfig config){
-        Configuration configuration = new BaseConfiguration();
-
-
-        String databaseName = config.getDatabaseName();
-        if(databaseName==null){
-            LOG.warn(JdbcConstants.EAGLE_DATABASE+" is null, trying default database name as: eagle");
-            databaseName = "eagle";
-        }
-
-        LOG.info("Using default database: "+databaseName+" (adapter: "+config.getAdapter()+")");
-
-        configuration.addProperty("torque.database.default",config.getDatabaseName());
-
-        // This factory uses the SharedDataSource available in the commons-dbcp package
-        configuration.addProperty(String.format("torque.dsfactory.%s.factory",databaseName), DEFAULT_DATA_SOURCE_FACTORY_CLASS);
-
-        // mysql, oracle, ...
-        configuration.addProperty(String.format("torque.database.%s.adapter",databaseName),config.getAdapter());
-
-        // "org.gjt.mm.mysql.Driver"
-        configuration.addProperty(String.format("torque.dsfactory.%s.connection.driver",databaseName),config.getDriverClassName());
-
-        configuration.addProperty(String.format("torque.dsfactory.%s.connection.url",databaseName),config.getConnectionUrl());
-        configuration.addProperty(String.format("torque.dsfactory.%s.connection.user",databaseName),config.getUserName());
-        configuration.addProperty(String.format("torque.dsfactory.%s.connection.password",databaseName),config.getPassword());
-        configuration.addProperty(String.format("torque.dsfactory.%s.pool.maxActive",databaseName),Integer.toString(config.getConnectionMaxActive()));
-//        configuration.addProperty(String.format("torque.dsfactory.%s.pool.minIdle",databaseName),Integer.toString(config.getConnectionMinIdle()));
-//        configuration.addProperty(String.format("torque.dsfactory.%s.pool.initialSize",databaseName),Integer.toString(config.getConnectionInitialSize()));
-
-        return configuration;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueStatementPeerImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueStatementPeerImpl.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueStatementPeerImpl.java
deleted file mode 100644
index 69e1192..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/TorqueStatementPeerImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn.impl;
-
-import org.apache.eagle.storage.jdbc.conn.ConnectionConfig;
-import org.apache.eagle.storage.jdbc.conn.PrimaryKeyBuilder;
-import org.apache.eagle.storage.jdbc.conn.StatementExecutor;
-import org.apache.torque.adapter.IDMethod;
-import org.apache.torque.map.TableMap;
-import org.apache.torque.util.BasePeerImpl;
-
-/**
- * @since 3/29/15
- */
-public class TorqueStatementPeerImpl<T> implements StatementExecutor {
-    private BasePeerImpl<T> basePeer;
-    public TorqueStatementPeerImpl(){
-        this.basePeer = new BasePeerImpl<T>();
-    }
-
-    @Override
-    public void init(ConnectionConfig config) {
-        this.basePeer.setDatabaseName(config.getDatabaseName());
-    }
-
-    @Override
-    public void init(ConnectionConfig config, String tableName) {
-        this.basePeer.setDatabaseName(config.getDatabaseName());
-        TableMap tableMap = new TableMap(tableName,null,null);
-        tableMap.setPrimaryKeyMethodInfo(IDMethod.NO_ID_METHOD);
-        this.basePeer.setTableMap(tableMap);
-    }
-
-    private static PrimaryKeyBuilder<String> _primaryKeyBuilderInstance = new UUIDPrimaryKeyBuilder();;
-    @Override
-    public PrimaryKeyBuilder<String> getPrimaryKeyBuilder() {
-        return _primaryKeyBuilderInstance;
-    }
-
-    public BasePeerImpl<T> delegate(){
-        return this.basePeer;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/UUIDPrimaryKeyBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/UUIDPrimaryKeyBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/UUIDPrimaryKeyBuilder.java
deleted file mode 100644
index 74bde6b..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/conn/impl/UUIDPrimaryKeyBuilder.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.conn.impl;
-
-import org.apache.eagle.storage.jdbc.conn.PrimaryKeyBuilder;
-
-import java.util.UUID;
-
-/**
- * @since 3/29/15
- */
-public class UUIDPrimaryKeyBuilder implements PrimaryKeyBuilder<String> {
-    @Override
-    public <T> String build(T t) {
-        return UUID.randomUUID().toString();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriteriaBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriteriaBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriteriaBuilder.java
deleted file mode 100644
index f8db26a..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriteriaBuilder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.criteria;
-
-import org.apache.torque.criteria.Criteria;
-
-/**
- * @since 3/27/15
- */
-public interface CriteriaBuilder {
-    Criteria build();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriterionBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriterionBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriterionBuilder.java
deleted file mode 100644
index a5347a9..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/CriterionBuilder.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.criteria;
-
-import org.apache.torque.criteria.Criterion;
-
-/**
- * @since 3/27/15
- */
-public interface CriterionBuilder {
-    Criterion build();
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/ExpressionCriterionBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/ExpressionCriterionBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/ExpressionCriterionBuilder.java
deleted file mode 100644
index ec92849..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/ExpressionCriterionBuilder.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.criteria.impl;
-
-import org.apache.eagle.log.entity.EntityQualifierUtils;
-import org.apache.eagle.storage.jdbc.criteria.CriterionBuilder;
-import org.apache.eagle.query.parser.*;
-import org.apache.torque.ColumnImpl;
-import org.apache.torque.criteria.Criterion;
-import org.apache.torque.criteria.SqlEnum;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-
-/**
- * @since 3/27/15
- */
-public class ExpressionCriterionBuilder implements CriterionBuilder {
-    private final String tableName;
-    private final ORExpression expression;
-
-    public ExpressionCriterionBuilder(ORExpression expression,String tableName) {
-        this.expression = expression;
-        this.tableName = tableName;
-    }
-
-    @Override
-    public Criterion build() {
-        Criterion orCriterion = null;
-        for(ANDExpression andExpression:expression.getANDExprList()){
-            Criterion andCriterion = null;
-            for(AtomicExpression atomicExpression : andExpression.getAtomicExprList()){
-                Criterion atomicCriterion = toAtomicCriterion(atomicExpression);
-                if(andCriterion == null){
-                    andCriterion = atomicCriterion;
-                }else{
-                    andCriterion = andCriterion.and(atomicCriterion);
-                }
-            }
-
-            if(andCriterion!=null){
-                if(orCriterion == null){
-                    orCriterion = andCriterion;
-                }else{
-                    orCriterion = orCriterion.or(andCriterion);
-                }
-            }
-        }
-        return orCriterion;
-    }
-
-    private Criterion toAtomicCriterion(AtomicExpression atomic){
-        Object left = toColumn(atomic.getKeyType(), atomic.getKey(),atomic.getOp());
-        Object right = toColumn(atomic.getValueType(), atomic.getValue(),atomic.getOp());
-        SqlEnum op = toSqlEnum(atomic.getOp());
-        return new Criterion(left,right,op);
-    }
-
-    private Object toColumn(TokenType tokenType,String value,ComparisonOperator op){
-        if(op.equals(ComparisonOperator.CONTAINS) && tokenType.equals(TokenType.STRING)){
-            return "%"+value+"%";
-        }else if(tokenType.equals(TokenType.ID)){
-            return new ColumnImpl(this.tableName,parseEntityAttribute(value));
-        }else if(!tokenType.equals(TokenType.ID) && op.equals(ComparisonOperator.IN)){
-            return EntityQualifierUtils.parseList(value);
-        }else if(tokenType.equals(TokenType.NUMBER)){
-            // TODO: currently only treat all number value as double
-            return Double.parseDouble(value);
-        }else{
-            // TODO: parse type according entity field type
-            return value;
-        }
-    }
-
-    private SqlEnum toSqlEnum(ComparisonOperator op){
-        SqlEnum sqlEnum = _opSqlEnum.get(op);
-        if(sqlEnum == null){
-            throw new IllegalArgumentException("Failed to convert ComparisonOperator:"+op+" to SqlEnum");
-        }
-        return sqlEnum;
-    }
-
-    private static String parseEntityAttribute(String fieldName){
-        Matcher m = TokenConstant.ID_PATTERN.matcher(fieldName);
-        if(m.find()){
-            return m.group(1);
-        }
-        return fieldName;
-    }
-
-    private final static Map<ComparisonOperator,SqlEnum> _opSqlEnum = new HashMap<ComparisonOperator,SqlEnum>();
-    static{
-        _opSqlEnum.put(ComparisonOperator.CONTAINS, SqlEnum.LIKE);
-        _opSqlEnum.put(ComparisonOperator.EQUAL, SqlEnum.EQUAL);
-        _opSqlEnum.put(ComparisonOperator.GREATER, SqlEnum.GREATER_THAN);
-        _opSqlEnum.put(ComparisonOperator.GREATER_OR_EQUAL, SqlEnum.GREATER_EQUAL);
-        _opSqlEnum.put(ComparisonOperator.IN, SqlEnum.IN);
-        _opSqlEnum.put(ComparisonOperator.IS, SqlEnum.EQUAL);
-        _opSqlEnum.put(ComparisonOperator.IS_NOT, SqlEnum.NOT_EQUAL);
-        _opSqlEnum.put(ComparisonOperator.LESS, SqlEnum.LESS_THAN);
-        _opSqlEnum.put(ComparisonOperator.LESS_OR_EQUAL, SqlEnum.LESS_EQUAL);
-        _opSqlEnum.put(ComparisonOperator.LIKE, SqlEnum.LIKE);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/PrimaryKeyCriteriaBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/PrimaryKeyCriteriaBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/PrimaryKeyCriteriaBuilder.java
deleted file mode 100644
index 4683cf0..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/PrimaryKeyCriteriaBuilder.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.criteria.impl;
-
-import org.apache.eagle.storage.jdbc.JdbcConstants;
-import org.apache.eagle.storage.jdbc.criteria.CriteriaBuilder;
-import org.apache.torque.ColumnImpl;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.criteria.Criterion;
-import org.apache.torque.criteria.SqlEnum;
-
-import java.util.List;
-
-/**
- * @since 3/30/15
- */
-public class PrimaryKeyCriteriaBuilder implements CriteriaBuilder {
-    private final List<String> keys;
-    private final String tableName;
-
-    public PrimaryKeyCriteriaBuilder(List<String> keys,String tableName){
-        this.keys = keys;
-        this.tableName = tableName;
-    }
-
-    @Override
-    public Criteria build() {
-        Criteria root = new Criteria();
-        for(String key:keys){
-            root = root.or(new Criterion(new ColumnImpl(this.tableName, JdbcConstants.ROW_KEY_COLUMN_NAME),key, SqlEnum.EQUAL));
-        }
-        return root;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/QueryCriteriaBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/QueryCriteriaBuilder.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/QueryCriteriaBuilder.java
deleted file mode 100644
index 4d590de..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/criteria/impl/QueryCriteriaBuilder.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.criteria.impl;
-
-import org.apache.eagle.log.entity.GenericMetricEntity;
-import org.apache.eagle.log.entity.SearchCondition;
-import org.apache.eagle.query.aggregate.AggregateFunctionType;
-import org.apache.eagle.query.parser.ORExpression;
-import org.apache.eagle.storage.jdbc.criteria.CriteriaBuilder;
-import org.apache.eagle.storage.jdbc.criteria.CriterionBuilder;
-import org.apache.eagle.storage.jdbc.JdbcConstants;
-import org.apache.eagle.storage.operation.CompiledQuery;
-import org.apache.torque.ColumnImpl;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.criteria.Criterion;
-import org.apache.torque.criteria.SqlEnum;
-
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public class QueryCriteriaBuilder implements CriteriaBuilder {
-
-    private final CompiledQuery query;
-    private final String tableName;
-
-    public QueryCriteriaBuilder(CompiledQuery query, String tableName){
-        this.query = query;
-        this.tableName = tableName;
-    }
-
-    @Override
-    public Criteria build() {
-        Criteria root = new Criteria();
-        SearchCondition searchCondition = query.getSearchCondition();
-
-        // SELECT
-        if(query.isHasAgg()){
-            List<String> aggFields = query.getAggregateFields();
-            List<AggregateFunctionType> aggFuncs = query.getAggregateFunctionTypes();
-            for(int i=0;i<aggFuncs.size();i++){
-                AggregateFunctionType aggFunc = aggFuncs.get(i);
-                String aggField = aggFields.get(i);
-                if(aggFunc.equals(AggregateFunctionType.count)){
-                    root.addSelectColumn(new ColumnImpl(aggFunc.name()+"(*)"));
-                }else{
-                    root.addSelectColumn(new ColumnImpl(String.format("%s(%s.%s)",aggFunc.name(),this.tableName,aggField)));
-                }
-            }
-        } else if(searchCondition.isOutputAll()){
-            // SELECT *
-            root.addSelectColumn(new ColumnImpl(this.tableName, "*"));
-        }else{
-            // SELECT $outputFields
-            List<String> outputFields = searchCondition.getOutputFields();
-            for(String field:outputFields) {
-                root.addSelectColumn(new ColumnImpl(this.tableName, field));
-            }
-            if(!outputFields.contains(JdbcConstants.ROW_KEY_COLUMN_NAME)) {
-                root.addSelectColumn(new ColumnImpl(this.tableName, JdbcConstants.ROW_KEY_COLUMN_NAME));
-            }
-            if(!outputFields.contains(JdbcConstants.TIMESTAMP_COLUMN_NAME)) {
-                root.addSelectColumn(new ColumnImpl(this.tableName, JdbcConstants.TIMESTAMP_COLUMN_NAME));
-            }
-        }
-
-        // FROM $tableName
-        root.addFrom(this.tableName);
-
-        // WHERE timestamp in time range
-        Criterion where = new Criterion(new ColumnImpl(this.tableName, JdbcConstants.TIMESTAMP_COLUMN_NAME),query.getStartTime(), SqlEnum.GREATER_EQUAL)
-                        .and(new Criterion(new ColumnImpl(this.tableName, JdbcConstants.TIMESTAMP_COLUMN_NAME),query.getEndTime(), SqlEnum.LESS_THAN));
-        ORExpression expression = searchCondition.getQueryExpression();
-        if(expression!=null){
-            CriterionBuilder criterionBuilder = new ExpressionCriterionBuilder(expression,tableName);
-            where = where.and(criterionBuilder.build());
-        }
-
-        // AND metricName = "metric.name.value"
-        if(query.getServiceName().equals(GenericMetricEntity.GENERIC_METRIC_SERVICE)){
-            where = where.and(new Criterion(new ColumnImpl(this.tableName, JdbcConstants.METRIC_NAME_COLUMN_NAME),this.query.getRawQuery().getMetricName(),SqlEnum.EQUAL));
-        }
-
-        root.where(where);
-
-        // LIMITED BY $pageSize
-        root.setLimit((int) searchCondition.getPageSize());
-
-        // TODO: GROUP BY
-        if(query.isHasAgg()){
-            for(String groupByField:query.getGroupByFields()){
-                root.addGroupByColumn(new ColumnImpl(this.tableName,groupByField));
-            }
-        }
-
-        // TODO: ORDER BY
-
-        return root;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityDeleter.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityDeleter.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityDeleter.java
deleted file mode 100644
index 56cd0bf..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityDeleter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.storage.operation.CompiledQuery;
-
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public interface JdbcEntityDeleter<E extends TaggedLogAPIEntity> {
-    /**
-     *
-     * @param entities
-     * @return
-     */
-    public int delete(List<E> entities) throws Exception;
-
-    /**
-     *
-     * @param ids
-     * @return
-     */
-    public int deleteByIds(List<String> ids)  throws Exception;
-
-    /**
-     *
-     * @param query
-     * @return
-     */
-    public int deleteByQuery(CompiledQuery query) throws Exception;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityReader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityReader.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityReader.java
deleted file mode 100644
index 8e85ebf..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityReader.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity;
-
-import org.apache.eagle.storage.operation.CompiledQuery;
-
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public interface JdbcEntityReader {
-    /**
-     *
-     * @param query query
-     * @param <E> entity type
-     * @return result entities list
-     * @throws Exception
-     */
-    public <E extends Object> List<E> query(CompiledQuery query) throws Exception;
-
-    public <E extends Object> List<E> query(List<String> pk) throws Exception;
-
-    /**
-     *
-     * @return firstTimestamp
-     */
-    public Long getResultFirstTimestamp();
-
-    /**
-     *
-     * @return lastTimeStamp
-     */
-    public Long getResultLastTimestamp();
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntitySerDeserHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntitySerDeserHelper.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntitySerDeserHelper.java
deleted file mode 100644
index 651ee19..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntitySerDeserHelper.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.log.entity.GenericMetricEntity;
-import org.apache.eagle.log.entity.meta.EntityDefinition;
-import org.apache.eagle.log.entity.meta.Qualifier;
-import org.apache.eagle.storage.jdbc.JdbcConstants;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinitionManager;
-import org.apache.eagle.storage.jdbc.schema.serializer.JdbcSerDeser;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.torque.ColumnImpl;
-import org.apache.torque.util.ColumnValues;
-import org.apache.torque.util.JdbcTypedValue;
-
-import java.beans.PropertyDescriptor;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @since 3/26/15
- */
-public class JdbcEntitySerDeserHelper {
-    /**
-     *
-     * @param row
-     * @param entityDefinition
-     * @param <E>
-     * @return
-     * @throws IllegalAccessException
-     * @throws InstantiationException
-     * @throws InvocationTargetException
-     * @throws NoSuchMethodException
-     */
-    public static <E extends TaggedLogAPIEntity> E buildEntity(Map<String, Object> row, JdbcEntityDefinition entityDefinition) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
-        EntityDefinition ed = entityDefinition.getInternal();
-
-        Class<? extends TaggedLogAPIEntity> clazz = ed.getEntityClass();
-        if(clazz == null){
-            throw new NullPointerException("Entity class of service "+ed.getService()+" is null");
-        }
-
-        TaggedLogAPIEntity obj = clazz.newInstance();
-        Map<String, Qualifier> map = ed.getDisplayNameMap();
-        for(Map.Entry<String, Object> entry : row.entrySet()){
-            // timestamp;
-            if(JdbcConstants.TIMESTAMP_COLUMN_NAME.equals(entry.getKey())){
-                obj.setTimestamp((Long) entry.getValue());
-                continue;
-            }
-
-            // set metric as prefix for generic metric
-            if(entityDefinition.getInternal().getService().equals(GenericMetricEntity.GENERIC_METRIC_SERVICE) &&
-                    JdbcConstants.METRIC_NAME_COLUMN_NAME.equals(entry.getKey())){
-                obj.setPrefix((String) entry.getValue());
-                continue;
-            }
-
-            // rowkey: uuid
-            if(JdbcConstants.ROW_KEY_COLUMN_NAME.equals(entry.getKey())){
-                obj.setEncodedRowkey((String) entry.getValue());
-                continue;
-            }
-
-            Qualifier q = map.get(entry.getKey().toLowerCase());
-            if(q == null){
-                // if it's not pre-defined qualifier, it must be tag unless it's a bug
-                if(obj.getTags() == null){
-                    obj.setTags(new HashMap<String, String>());
-                }
-                obj.getTags().put(entry.getKey(), (String) entry.getValue());
-                continue;
-            }
-
-            // parse different types of qualifiers
-            String fieldName = q.getDisplayName();
-            // PropertyDescriptor pd = PropertyUtils.getPropertyDescriptor(obj, fieldName);
-            PropertyDescriptor pd = getPropertyDescriptor(obj,fieldName);
-            if(entry.getValue() != null){
-                pd.getWriteMethod().invoke(obj, entry.getValue());
-            }
-        }
-
-        if(!entityDefinition.getInternal().getService().equals(GenericMetricEntity.GENERIC_METRIC_SERVICE) ){
-            obj.setPrefix(entityDefinition.getInternal().getPrefix());
-        }
-        return (E)obj;
-    }
-
-    private final static Map<String,PropertyDescriptor> _propertyDescriptorCache = new HashMap<String, PropertyDescriptor>();
-
-    /**
-     *
-     * @param obj
-     * @param fieldName
-     * @return
-     * @throws IllegalAccessException
-     * @throws NoSuchMethodException
-     * @throws InvocationTargetException
-     */
-    public static PropertyDescriptor getPropertyDescriptor(Object obj,String fieldName) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException {
-        String key = obj.getClass().getName()+"."+fieldName;
-        PropertyDescriptor propertyDescriptor = _propertyDescriptorCache.get(key);
-        if(propertyDescriptor ==null){
-            propertyDescriptor = PropertyUtils.getPropertyDescriptor(obj, fieldName);
-            _propertyDescriptorCache.put(key,propertyDescriptor);
-        }
-        return propertyDescriptor;
-    }
-
-    /**
-     *
-     * @param resultSet
-     * @param entityDefinition
-     * @param <E>
-     * @return
-     * @throws IOException
-     * @throws SQLException
-     * @throws InvocationTargetException
-     * @throws NoSuchMethodException
-     * @throws InstantiationException
-     * @throws IllegalAccessException
-     */
-    public static <E extends TaggedLogAPIEntity> E readEntity(ResultSet resultSet, JdbcEntityDefinition entityDefinition) throws IOException, SQLException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
-        return buildEntity(readInternal(resultSet, entityDefinition), entityDefinition);
-    }
-
-    /**
-     *
-     * @param resultSet
-     * @param entityDefinition
-     * @return
-     * @throws SQLException
-     * @throws IOException
-     */
-    public static Map<String,Object> readInternal(ResultSet resultSet, JdbcEntityDefinition entityDefinition) throws SQLException, IOException {
-        ResultSetMetaData metadata = resultSet.getMetaData();
-        int columnCount = metadata.getColumnCount();
-        Map<String,Object> row = new HashMap<String, Object>();
-        for (int i = 1; i <= columnCount; i++) {
-            String columnName = metadata.getColumnName(i);
-            JdbcSerDeser serDeser = entityDefinition.getJdbcSerDeser(columnName);
-            if(serDeser==null){
-                throw new IOException("SQLSerDeser for column: "+columnName+" is null");
-            }
-            Object value = serDeser.readValue(resultSet, columnName, entityDefinition);
-            row.put(columnName,value);
-        }
-        return row;
-    }
-
-    /**
-     *
-     * @param entity
-     * @param jdbcEntityDefinition
-     * @param <E>
-     * @return
-     * @throws InvocationTargetException
-     * @throws IllegalAccessException
-     */
-    public static <E extends TaggedLogAPIEntity> ColumnValues buildColumnValues(E entity, JdbcEntityDefinition jdbcEntityDefinition) throws InvocationTargetException, IllegalAccessException {
-        String tableName = jdbcEntityDefinition.getJdbcTableName();
-        ColumnValues columnValues = new ColumnValues();
-
-        if(jdbcEntityDefinition.isGenericMetric()){
-            columnValues.put(new ColumnImpl(tableName, JdbcConstants.METRIC_NAME_COLUMN_NAME),new JdbcTypedValue(entity.getPrefix(), Types.VARCHAR));
-        }
-
-        columnValues.put(new ColumnImpl(tableName, JdbcConstants.ROW_KEY_COLUMN_NAME),new JdbcTypedValue(entity.getEncodedRowkey(), Types.VARCHAR));
-        columnValues.put(new ColumnImpl(tableName, JdbcConstants.TIMESTAMP_COLUMN_NAME),new JdbcTypedValue(entity.getTimestamp(), Types.BIGINT));
-
-        // qualifier fields
-        Map<String,Qualifier> displayQualifier = jdbcEntityDefinition.getInternal().getDisplayNameMap();
-        Map<String,Method> getMethods = jdbcEntityDefinition.getInternal().getQualifierGetterMap();
-        for(Map.Entry<String,Qualifier> entry:displayQualifier.entrySet()){
-            String displayName = entry.getKey();
-
-            Qualifier qualifier = entry.getValue();
-//            String qualifierName = qualifier.getQualifierName();
-            Method getMethod = getMethods.get(displayName);
-            Object fieldValue = getMethod.invoke(entity);
-
-            Class<?> fieldType = qualifier.getSerDeser().type();
-            JdbcSerDeser jdbcSerDeser = JdbcEntityDefinitionManager.getJdbcSerDeser(fieldType);
-            JdbcTypedValue jdbcTypedValue = jdbcSerDeser.getJdbcTypedValue(fieldValue, fieldType);
-            columnValues.put(new ColumnImpl(tableName,displayName),jdbcTypedValue);
-        }
-
-        // tag fields
-        if(entity.getTags()!=null) {
-            for (Map.Entry<String, String> tag : entity.getTags().entrySet()) {
-                columnValues.put(new ColumnImpl(tableName, tag.getKey()), new JdbcTypedValue(tag.getValue(), Types.VARCHAR));
-            }
-        }
-        return columnValues;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityUpdater.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityUpdater.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityUpdater.java
deleted file mode 100644
index f844d11..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityUpdater.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public interface JdbcEntityUpdater<E extends TaggedLogAPIEntity> {
-    /**
-     *
-     * @param entities
-     * @return
-     * @throws Exception
-     */
-    public int update(List<E> entities) throws Exception;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityWriter.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityWriter.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityWriter.java
deleted file mode 100644
index 072174e..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/JdbcEntityWriter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public interface JdbcEntityWriter<E extends TaggedLogAPIEntity> {
-    /**
-     * <h2>Consistency Guarantee</h2>
-     *
-     * Rollback all changes if any single entity throws exception to make sure consistency guarantee
-     *
-     * @param entities entities to write
-     * @return primary keys' list
-     * @throws Exception
-     */
-    public List<String> write(List<E> entities) throws Exception;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/AggreagteRecordMapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/AggreagteRecordMapper.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/AggreagteRecordMapper.java
deleted file mode 100644
index 6dffd9f..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/AggreagteRecordMapper.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity.impl;
-
-import org.apache.eagle.storage.jdbc.entity.JdbcEntitySerDeserHelper;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.eagle.storage.operation.CompiledQuery;
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-import org.apache.torque.om.mapper.RecordMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Map;
-
-/**
- * @since 3/27/15
- */
-public class AggreagteRecordMapper implements RecordMapper<Map> {
-    private final static Logger LOG = LoggerFactory.getLogger(AggreagteRecordMapper.class);
-    private final JdbcEntityDefinition jdbcEntityDefinition;
-
-    public AggreagteRecordMapper(CompiledQuery query, JdbcEntityDefinition jdbcEntityDefinition) {
-        this.jdbcEntityDefinition = jdbcEntityDefinition;
-    }
-
-    @Override
-    public Map processRow(ResultSet resultSet, int rowOffset, CriteriaInterface<?> criteria) throws TorqueException {
-        try {
-            return JdbcEntitySerDeserHelper.readInternal(resultSet, this.jdbcEntityDefinition);
-        } catch (SQLException e) {
-            LOG.error("Failed to read result set",e);
-            throw new TorqueException(e);
-        } catch (IOException e) {
-            LOG.error("Failed to read result set",e);
-            throw new TorqueException(e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/EntityRecordMapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/EntityRecordMapper.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/EntityRecordMapper.java
deleted file mode 100644
index 553f90b..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/EntityRecordMapper.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity.impl;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntitySerDeserHelper;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.torque.TorqueException;
-import org.apache.torque.criteria.CriteriaInterface;
-import org.apache.torque.om.mapper.RecordMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.ResultSet;
-
-/**
- * @since 3/27/15
- */
-public class EntityRecordMapper<E extends TaggedLogAPIEntity> implements RecordMapper<E> {
-    private final static Logger LOG = LoggerFactory.getLogger(EntityRecordMapper.class);
-
-    private final JdbcEntityDefinition entityDefinition;
-
-    public EntityRecordMapper(JdbcEntityDefinition entityDefinition) {
-        this.entityDefinition = entityDefinition;
-    }
-
-    @Override
-    public E processRow(ResultSet resultSet, int rowOffset, CriteriaInterface<?> criteria) throws TorqueException {
-        try {
-            return JdbcEntitySerDeserHelper.readEntity(resultSet, entityDefinition);
-        } catch (Exception e) {
-            LOG.error(e.getMessage(),e);
-            throw new TorqueException(e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityDeleterImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityDeleterImpl.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityDeleterImpl.java
deleted file mode 100644
index 35e1078..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityDeleterImpl.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity.impl;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.storage.jdbc.conn.ConnectionManagerFactory;
-import org.apache.eagle.storage.jdbc.conn.impl.TorqueStatementPeerImpl;
-import org.apache.eagle.storage.jdbc.criteria.impl.PrimaryKeyCriteriaBuilder;
-import org.apache.eagle.storage.jdbc.criteria.impl.QueryCriteriaBuilder;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntityDeleter;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.eagle.storage.operation.CompiledQuery;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.sql.SqlBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public class JdbcEntityDeleterImpl<E extends TaggedLogAPIEntity> implements JdbcEntityDeleter<E> {
-    private final static Logger LOG = LoggerFactory.getLogger(JdbcEntityDeleterImpl.class);
-    private final JdbcEntityDefinition jdbcEntityDefinition;
-    public JdbcEntityDeleterImpl(JdbcEntityDefinition jdbcEntityDefinition) {
-        this.jdbcEntityDefinition = jdbcEntityDefinition;
-    }
-
-    @Override
-    public int delete(List<E> entities) throws Exception {
-        List<String> primaryKeys = new LinkedList<String>();
-        for(E e:entities){
-            primaryKeys.add(e.getEncodedRowkey());
-        }
-        return deleteByIds(primaryKeys);
-    }
-
-    @Override
-    public int deleteByIds(List<String> ids) throws Exception {
-        PrimaryKeyCriteriaBuilder primaryKeyCriteriaBuilder = new PrimaryKeyCriteriaBuilder(ids,this.jdbcEntityDefinition.getJdbcTableName());
-        Criteria criteria = primaryKeyCriteriaBuilder.build();
-        return deleteByCriteria(criteria);
-    }
-
-    @Override
-    public int deleteByQuery(CompiledQuery query) throws Exception {
-        QueryCriteriaBuilder criteriaBuilder = new QueryCriteriaBuilder(query,this.jdbcEntityDefinition.getJdbcTableName());
-        Criteria criteria = criteriaBuilder.build();
-        return deleteByCriteria(criteria);
-    }
-
-    private int deleteByCriteria(Criteria criteria) throws Exception {
-        String displaySql = SqlBuilder.buildQuery(criteria).getDisplayString();
-        StopWatch stopWatch = new StopWatch();
-        stopWatch.start();
-
-        if(LOG.isDebugEnabled()) LOG.debug("Deleting by query: " + displaySql);
-        try {
-            TorqueStatementPeerImpl peer = ConnectionManagerFactory.getInstance().getStatementExecutor();
-            int result = peer.delegate().doDelete(criteria);
-            LOG.info(String.format("Deleted %s records in %s ms (sql: %s)",result,stopWatch.getTime(),displaySql));
-            return result;
-        } catch (Exception e) {
-            LOG.error("Failed to delete by query: "+displaySql,e);
-            throw e;
-        } finally {
-            stopWatch.stop();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityReaderImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityReaderImpl.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityReaderImpl.java
deleted file mode 100644
index d0d6a61..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityReaderImpl.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity.impl;
-
-import org.apache.eagle.storage.jdbc.conn.ConnectionManagerFactory;
-import org.apache.eagle.storage.jdbc.conn.impl.TorqueStatementPeerImpl;
-import org.apache.eagle.storage.jdbc.criteria.impl.PrimaryKeyCriteriaBuilder;
-import org.apache.eagle.storage.jdbc.criteria.impl.QueryCriteriaBuilder;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntityReader;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.eagle.storage.operation.CompiledQuery;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.om.mapper.RecordMapper;
-import org.apache.torque.sql.SqlBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public class JdbcEntityReaderImpl implements JdbcEntityReader {
-    private final static Logger LOG = LoggerFactory.getLogger(JdbcEntityReaderImpl.class);
-    private final JdbcEntityDefinition jdbcEntityDefinition;
-    private long resultFirstTimestamp = 0;
-    private long resultLastTimestamp = 0;
-
-    public JdbcEntityReaderImpl(JdbcEntityDefinition jdbcEntityDefinition) {
-        this.jdbcEntityDefinition = jdbcEntityDefinition;
-    }
-
-    @SuppressWarnings("unchecked")
-    public <E extends Object> List<E> query(CompiledQuery query) throws Exception {
-        QueryCriteriaBuilder criteriaBuilder = new QueryCriteriaBuilder(query,this.jdbcEntityDefinition.getJdbcTableName());
-        Criteria criteria = criteriaBuilder.build();
-        String displaySql = SqlBuilder.buildQuery(criteria).getDisplayString();
-
-        if(LOG.isDebugEnabled()) LOG.debug("Querying: " + displaySql);
-
-        RecordMapper<E> recordMapper;
-        if(query.isHasAgg()) {
-            recordMapper = (RecordMapper<E>) new AggreagteRecordMapper(query, jdbcEntityDefinition);
-        }else{
-            recordMapper = new EntityRecordMapper(jdbcEntityDefinition);
-        }
-        final StopWatch stopWatch = new StopWatch();
-        List<E> result;
-        try {
-            stopWatch.start();
-            TorqueStatementPeerImpl peer = ConnectionManagerFactory.getInstance().getStatementExecutor();
-            result = peer.delegate().doSelect(criteria, recordMapper);
-            LOG.info(String.format("Read %s records in %s ms (sql: %s)",result.size(),stopWatch.getTime(),displaySql));
-        }catch (Exception ex){
-            LOG.error("Failed to query by: "+displaySql+", due to: "+ex.getMessage(),ex);
-            throw new IOException("Failed to query by: "+displaySql,ex);
-        }finally {
-            stopWatch.stop();
-        }
-        return result;
-    }
-
-    @Override
-    public <E> List<E> query(List<String> ids) throws Exception {
-        PrimaryKeyCriteriaBuilder criteriaBuilder = new PrimaryKeyCriteriaBuilder(ids,this.jdbcEntityDefinition.getJdbcTableName());
-        Criteria criteria = criteriaBuilder.build();
-        String displaySql = SqlBuilder.buildQuery(criteria).getDisplayString();
-        if(LOG.isDebugEnabled()) LOG.debug("Querying: " + displaySql);
-        EntityRecordMapper recordMapper = new EntityRecordMapper(jdbcEntityDefinition);
-        final StopWatch stopWatch = new StopWatch();
-        List<E> result;
-        try {
-            stopWatch.start();
-            TorqueStatementPeerImpl peer = ConnectionManagerFactory.getInstance().getStatementExecutor();
-            result = peer.delegate().doSelect(criteria, recordMapper);
-            LOG.info(String.format("Read %s records in %s ms (sql: %s)",result.size(),stopWatch.getTime(),displaySql));
-        }catch (Exception ex){
-            LOG.error("Failed to query by: "+displaySql+", due to: "+ex.getMessage(),ex);
-            throw new IOException("Failed to query by: "+displaySql,ex);
-        }finally {
-            stopWatch.stop();
-        }
-        return result;
-    }
-
-    public Long getResultFirstTimestamp() {
-        return resultFirstTimestamp;
-    }
-
-    public Long getResultLastTimestamp() {
-        return resultLastTimestamp;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityUpdaterImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityUpdaterImpl.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityUpdaterImpl.java
deleted file mode 100644
index 6f9bf3d..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityUpdaterImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity.impl;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.storage.jdbc.conn.ConnectionManager;
-import org.apache.eagle.storage.jdbc.conn.ConnectionManagerFactory;
-import org.apache.eagle.storage.jdbc.conn.impl.TorqueStatementPeerImpl;
-import org.apache.eagle.storage.jdbc.criteria.impl.PrimaryKeyCriteriaBuilder;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntitySerDeserHelper;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntityUpdater;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.torque.criteria.Criteria;
-import org.apache.torque.sql.SqlBuilder;
-import org.apache.torque.util.ColumnValues;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Connection;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public class JdbcEntityUpdaterImpl<E extends TaggedLogAPIEntity> implements JdbcEntityUpdater<E> {
-    private final static Logger LOG = LoggerFactory.getLogger(JdbcEntityUpdaterImpl.class);
-    private final JdbcEntityDefinition jdbcEntityDefinition;
-
-    public JdbcEntityUpdaterImpl(JdbcEntityDefinition jdbcEntityDefinition) {
-        this.jdbcEntityDefinition = jdbcEntityDefinition;
-    }
-
-    @Override
-    public int update(List<E> entities) throws Exception {
-        ConnectionManager cm = ConnectionManagerFactory.getInstance();
-        TorqueStatementPeerImpl<E> peer = cm.getStatementExecutor(this.jdbcEntityDefinition.getJdbcTableName());
-        Connection connection = cm.getConnection();
-        connection.setAutoCommit(false);
-
-        StopWatch stopWatch = new StopWatch();
-        stopWatch.start();
-        int num = 0;
-        try {
-            for (E entity : entities) {
-                String primaryKey = entity.getEncodedRowkey();
-                PrimaryKeyCriteriaBuilder pkBuilder = new PrimaryKeyCriteriaBuilder(Arrays.asList(primaryKey), this.jdbcEntityDefinition.getJdbcTableName());
-                Criteria selectCriteria = pkBuilder.build();
-                if(LOG.isDebugEnabled()) LOG.debug("Updating by query: "+SqlBuilder.buildQuery(selectCriteria).getDisplayString());
-                ColumnValues columnValues = JdbcEntitySerDeserHelper.buildColumnValues(entity, this.jdbcEntityDefinition);
-                num += peer.delegate().doUpdate(selectCriteria, columnValues, connection);
-            }
-            if(LOG.isDebugEnabled()) LOG.debug("Committing updates");
-            connection.commit();
-        } catch (Exception ex) {
-            LOG.error("Failed to update, rolling back",ex);
-            connection.rollback();
-            throw ex;
-        }finally {
-            stopWatch.stop();
-            if(LOG.isDebugEnabled()) LOG.debug("Closing connection");
-            connection.close();
-        }
-        LOG.info(String.format("Updated %s records in %s ms",num,stopWatch.getTime()));
-        return num;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/0ea130ef/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java b/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
deleted file mode 100644
index d1dc9bd..0000000
--- a/eagle-core/eagle-query/eagle-storage-jdbc/src/main/java/org/apache/eagle/storage/jdbc/entity/impl/JdbcEntityWriterImpl.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.eagle.storage.jdbc.entity.impl;
-
-import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import org.apache.eagle.storage.jdbc.conn.ConnectionManager;
-import org.apache.eagle.storage.jdbc.conn.ConnectionManagerFactory;
-import org.apache.eagle.storage.jdbc.conn.impl.TorqueStatementPeerImpl;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntitySerDeserHelper;
-import org.apache.eagle.storage.jdbc.entity.JdbcEntityWriter;
-import org.apache.eagle.storage.jdbc.schema.JdbcEntityDefinition;
-import org.apache.commons.lang.time.StopWatch;
-import org.apache.torque.om.ObjectKey;
-import org.apache.torque.util.ColumnValues;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @since 3/27/15
- */
-public class JdbcEntityWriterImpl<E extends TaggedLogAPIEntity> implements JdbcEntityWriter<E> {
-    private final static Logger LOG = LoggerFactory.getLogger(JdbcEntityWriterImpl.class);
-
-    private ConnectionManager connectionManager;
-    private JdbcEntityDefinition jdbcEntityDefinition;
-
-    public JdbcEntityWriterImpl(JdbcEntityDefinition jdbcEntityDefinition) {
-        this.jdbcEntityDefinition = jdbcEntityDefinition;
-        try {
-            this.connectionManager = ConnectionManagerFactory.getInstance();
-        } catch (Exception e) {
-            LOG.error(e.getMessage(),e);
-            throw new RuntimeException(e);
-        }
-    }
-
-    @Override
-    public List<String> write(List<E> entities) throws Exception {
-        List<String> keys = new ArrayList<String>();
-        if(LOG.isDebugEnabled()) LOG.debug("Writing "+entities.size()+" entities");
-        StopWatch stopWatch = new StopWatch();
-        stopWatch.start();
-        Connection connection = ConnectionManagerFactory.getInstance().getConnection();
-        // set auto commit false and commit by hands for 3x~5x better performance
-        connection.setAutoCommit(false);
-
-        try {
-            TorqueStatementPeerImpl<E> peer = connectionManager.getStatementExecutor(this.jdbcEntityDefinition.getJdbcTableName());
-            for (E entity : entities) {
-                entity.setEncodedRowkey(peer.getPrimaryKeyBuilder().build(entity));
-                ColumnValues columnValues = JdbcEntitySerDeserHelper.buildColumnValues(entity, this.jdbcEntityDefinition);
-
-                // TODO: implement batch insert for better performance
-                ObjectKey key = peer.delegate().doInsert(columnValues,connection);
-
-                try {
-                    if (key != null) {
-                        keys.add((String) key.getValue());
-                    } else {
-                        keys.add(entity.getEncodedRowkey());
-                    }
-                } catch (ClassCastException ex) {
-                    throw new RuntimeException("Key is not in type of String (VARCHAR) , but JdbcType (java.sql.Types): " + key.getJdbcType() + ", value: " + key.getValue(), ex);
-                }
-            }
-
-            // Why not commit in finally: give up all if any single entity throws exception to make sure consistency guarantee
-            if(LOG.isDebugEnabled()){
-                LOG.debug("Committing writing");
-            }
-            connection.commit();
-        }catch (Exception ex) {
-            LOG.error("Failed to write records, rolling back",ex);
-            connection.rollback();
-            throw ex;
-        }finally {
-            stopWatch.stop();
-            if(LOG.isDebugEnabled()) LOG.debug("Closing connection");
-            connection.close();
-        }
-
-        LOG.info(String.format("Wrote %s records in %s ms (table: %s)",keys.size(),stopWatch.getTime(),this.jdbcEntityDefinition.getJdbcTableName()));
-        return keys;
-    }
-}
\ No newline at end of file


Mime
View raw message