eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject incubator-eagle git commit: [EAGLE-736] Fix eagle-data-process checkstyle warnings
Date Wed, 09 Nov 2016 03:00:08 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master ab3ed13e1 -> 1d549abbe


[EAGLE-736] Fix eagle-data-process checkstyle warnings

<!--
{% comment %}
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.
{% endcomment %}
-->

https://issues.apache.org/jira/browse/EAGLE-736
---

Author: koone <luokun1028@126.com>

Closes #623 from koone/master.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/1d549abb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/1d549abb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/1d549abb

Branch: refs/heads/master
Commit: 1d549abbea9a18d1cd5c28e646b9f70a2565f62a
Parents: ab3ed13
Author: koone <luokun1028@126.com>
Authored: Wed Nov 9 11:00:00 2016 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Wed Nov 9 11:00:00 2016 +0800

----------------------------------------------------------------------
 eagle-core/eagle-data-process/pom.xml           | 12 +++++--
 .../dataproc/impl/storm/StormSpoutProvider.java |  3 +-
 .../eagle/dataproc/impl/storm/ValuesArray.java  | 10 +++---
 .../impl/storm/kafka/KafkaSpoutProvider.java    | 33 +++++++++++---------
 .../kafka/SpoutKafkaMessageDeserializer.java    |  4 +--
 .../partition/CustomPartitionGrouping.java      |  2 +-
 .../storm/partition/PartitionStrategyImpl.java  |  8 ++---
 .../src/main/resources/log4j.properties         |  2 --
 8 files changed, 40 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/pom.xml b/eagle-core/eagle-data-process/pom.xml
index ef5d738..7dee4ce 100644
--- a/eagle-core/eagle-data-process/pom.xml
+++ b/eagle-core/eagle-data-process/pom.xml
@@ -108,6 +108,14 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <failOnViolation>true</failOnViolation>
+                    <failsOnError>true</failsOnError>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.scala-tools</groupId>
                 <artifactId>maven-scala-plugin</artifactId>
                 <executions>
@@ -136,7 +144,7 @@
                     <skipTests>true</skipTests>
                 </configuration>
             </plugin>
-            <plugin>
+            <!--<plugin>
                 <groupId>org.scalatest</groupId>
                 <artifactId>scalatest-maven-plugin</artifactId>
                 <configuration>
@@ -152,7 +160,7 @@
                         </goals>
                     </execution>
                 </executions>
-            </plugin>
+            </plugin>-->
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
index 18f3dc0..c1dac86 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/StormSpoutProvider.java
@@ -17,7 +17,6 @@
 package org.apache.eagle.dataproc.impl.storm;
 
 import backtype.storm.topology.base.BaseRichSpout;
-
 import com.typesafe.config.Config;
 
 /**
@@ -25,5 +24,5 @@ import com.typesafe.config.Config;
  * which can be retrieved from getSpout method.
  */
 public interface StormSpoutProvider {
-	BaseRichSpout getSpout(Config context);
+    BaseRichSpout getSpout(Config context);
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/ValuesArray.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/ValuesArray.java
b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/ValuesArray.java
index de06105..470471b 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/ValuesArray.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/ValuesArray.java
@@ -20,18 +20,18 @@ import java.util.ArrayList;
 
 /**
  * multiple datapoints are stored within one ValuesArray object
- * sent out
+ * sent out.
  */
-public class ValuesArray extends ArrayList<Object>{
-	private static final long serialVersionUID = -8218427810421668178L;
+public class ValuesArray extends ArrayList<Object> {
+    private static final long serialVersionUID = -8218427810421668178L;
 
-	public ValuesArray() {
+    public ValuesArray() {
 
     }
 
     public ValuesArray(Object... vals) {
         super(vals.length);
-        for(Object o: vals) {
+        for (Object o : vals) {
             add(o);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/KafkaSpoutProvider.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/KafkaSpoutProvider.java
b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/KafkaSpoutProvider.java
index 26440e8..677cfa2 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/KafkaSpoutProvider.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/KafkaSpoutProvider.java
@@ -36,23 +36,26 @@ import java.util.stream.Collectors;
  * Since 6/8/16.
  */
 public class KafkaSpoutProvider implements StormSpoutProvider {
-    private final static Logger LOG = LoggerFactory.getLogger(KafkaSpoutProvider.class);
-    private final static String DEFAULT_CONFIG_PREFIX = "dataSourceConfig";
-    private final static String DEFAULT_CONSUMER_GROUP_ID = "eagleConsumer";
-    private final static String DEFAULT_TRANSACTION_ZK_ROOT = "/consumers";
+    private static final Logger LOG = LoggerFactory.getLogger(KafkaSpoutProvider.class);
+    private static final String DEFAULT_CONFIG_PREFIX = "dataSourceConfig";
+    private static final String DEFAULT_CONSUMER_GROUP_ID = "eagleConsumer";
+    private static final String DEFAULT_TRANSACTION_ZK_ROOT = "/consumers";
 
     private String configPrefix = DEFAULT_CONFIG_PREFIX;
 
-    public KafkaSpoutProvider(){}
+    public KafkaSpoutProvider() {
+    }
 
-    public KafkaSpoutProvider(String prefix){
+    public KafkaSpoutProvider(String prefix) {
         this.configPrefix = prefix;
     }
 
     @Override
-    public BaseRichSpout getSpout(Config config){
+    public BaseRichSpout getSpout(Config config) {
         Config context = config;
-        if(this.configPrefix!=null) context = config.getConfig(configPrefix);
+        if (this.configPrefix != null) {
+            context = config.getConfig(configPrefix);
+        }
 
         // the following is for fetching data from one topic
         // Kafka topic
@@ -76,16 +79,16 @@ public class KafkaSpoutProvider implements StormSpoutProvider {
         String groupId = context.hasPath("consumerGroupId") ? context.getString("consumerGroupId")
: DEFAULT_CONSUMER_GROUP_ID;
         String brokerZkPath = context.hasPath("brokerZkPath") ? context.getString("brokerZkPath")
: null;
         BrokerHosts hosts;
-        if(brokerZkPath == null) {
+        if (brokerZkPath == null) {
             hosts = new ZkHosts(zkConnString);
         } else {
             hosts = new ZkHosts(zkConnString, brokerZkPath);
         }
 
         SpoutConfig spoutConfig = new SpoutConfig(hosts,
-                topic,
-                zkRoot + "/" + topic,
-                groupId);
+            topic,
+            zkRoot + "/" + topic,
+            groupId);
 
         // transaction zkServers to store kafka consumer offset. Default to use storm zookeeper
         if (context.hasPath("txZkServers")) {
@@ -112,13 +115,13 @@ public class KafkaSpoutProvider implements StormSpoutProvider {
 
         if (context.hasPath("schemeCls")) {
             try {
-                Scheme s = (Scheme)Class.forName(context.getString("schemeCls")).newInstance();
+                Scheme s = (Scheme) Class.forName(context.getString("schemeCls")).newInstance();
                 spoutConfig.scheme = new SchemeAsMultiScheme(s);
-            }catch(Exception ex){
+            } catch (Exception ex) {
                 LOG.error("error instantiating scheme object");
                 throw new IllegalStateException(ex);
             }
-        }else{
+        } else {
             String err = "schemeCls must be present";
             LOG.error(err);
             throw new IllegalStateException(err);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/SpoutKafkaMessageDeserializer.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/SpoutKafkaMessageDeserializer.java
b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/SpoutKafkaMessageDeserializer.java
index 76ca458..721fe99 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/SpoutKafkaMessageDeserializer.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/kafka/SpoutKafkaMessageDeserializer.java
@@ -18,6 +18,6 @@ package org.apache.eagle.dataproc.impl.storm.kafka;
 
 import java.io.Serializable;
 
-public interface SpoutKafkaMessageDeserializer extends Serializable{
-	public Object deserialize(byte[] arg0);
+public interface SpoutKafkaMessageDeserializer extends Serializable {
+    public Object deserialize(byte[] arg0);
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/CustomPartitionGrouping.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/CustomPartitionGrouping.java
b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/CustomPartitionGrouping.java
index 09193de..7253b65 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/CustomPartitionGrouping.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/CustomPartitionGrouping.java
@@ -42,7 +42,7 @@ public class CustomPartitionGrouping implements CustomStreamGrouping {
     @Override
     public List<Integer> chooseTasks(int taskId, List<Object> values) {
         int numTasks = targetTasks.size();
-        int targetTaskIndex = strategy.balance((String)values.get(0), numTasks);
+        int targetTaskIndex = strategy.balance((String) values.get(0), numTasks);
         return Arrays.asList(targetTasks.get(targetTaskIndex));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/PartitionStrategyImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/PartitionStrategyImpl.java
b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/PartitionStrategyImpl.java
index e36e75c..bc7e69b 100644
--- a/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/PartitionStrategyImpl.java
+++ b/eagle-core/eagle-data-process/src/main/java/org/apache/eagle/dataproc/impl/storm/partition/PartitionStrategyImpl.java
@@ -34,7 +34,7 @@ public class PartitionStrategyImpl implements PartitionStrategy {
     public long timeRange;
     public static long DEFAULT_TIME_RANGE = 2 * DateUtils.MILLIS_PER_DAY;
     public static long DEFAULT_REFRESH_INTERVAL = 2 * DateUtils.MILLIS_PER_HOUR;
-    private final Logger LOG = LoggerFactory.getLogger(PartitionStrategyImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(PartitionStrategyImpl.class);
 
     public PartitionStrategyImpl(DataDistributionDao dao, PartitionAlgorithm algorithm, long
refreshInterval, long timeRange) {
         this.dao = dao;
@@ -61,8 +61,7 @@ public class PartitionStrategyImpl implements PartitionStrategy {
             List<Weight> weights = dao.fetchDataDistribution(currentTime - timeRange,
currentTime);
             routingTable = algorithm.partition(weights, buckNum);
             return routingTable;
-        }
-        catch (Exception ex) {
+        } catch (Exception ex) {
             throw new RuntimeException(ex);
         }
     }
@@ -76,8 +75,7 @@ public class PartitionStrategyImpl implements PartitionStrategy {
         }
         if (routingTable.containsKey(key)) {
             return routingTable.get(key);
-        }
-        else {
+        } else {
             return Math.abs(key.hashCode()) % buckNum;
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/1d549abb/eagle-core/eagle-data-process/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-data-process/src/main/resources/log4j.properties b/eagle-core/eagle-data-process/src/main/resources/log4j.properties
index d59ded6..9c6875d 100644
--- a/eagle-core/eagle-data-process/src/main/resources/log4j.properties
+++ b/eagle-core/eagle-data-process/src/main/resources/log4j.properties
@@ -12,9 +12,7 @@
 # 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.
-
 log4j.rootLogger=INFO, stdout
-
 # standard output
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout


Mime
View raw message