You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ki...@apache.org on 2012/10/25 00:26:41 UTC
[47/47] Refactoring from com.linkedin.helix to org.apache.helix
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Consumer.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Consumer.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Consumer.java
deleted file mode 100644
index f5760e9..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Consumer.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import java.util.List;
-
-import com.linkedin.helix.HelixManager;
-import com.linkedin.helix.HelixManagerFactory;
-import com.linkedin.helix.InstanceType;
-import com.linkedin.helix.manager.zk.ZKHelixAdmin;
-import com.linkedin.helix.manager.zk.ZNRecordSerializer;
-import com.linkedin.helix.manager.zk.ZkClient;
-import com.linkedin.helix.model.InstanceConfig;
-import com.linkedin.helix.participant.StateMachineEngine;
-
-public class Consumer
-{
- private final String _zkAddr;
- private final String _clusterName;
- private final String _consumerId;
- private final String _mqServer;
- private HelixManager _manager = null;
-
- public Consumer(String zkAddr, String clusterName, String consumerId, String mqServer)
- {
- _zkAddr = zkAddr;
- _clusterName = clusterName;
- _consumerId = consumerId;
- _mqServer = mqServer;
- }
-
- public void connect()
- {
- try
- {
- _manager =
- HelixManagerFactory.getZKHelixManager(_clusterName,
- _consumerId,
- InstanceType.PARTICIPANT,
- _zkAddr);
-
- StateMachineEngine stateMach = _manager.getStateMachineEngine();
- ConsumerStateModelFactory modelFactory =
- new ConsumerStateModelFactory(_consumerId, _mqServer);
- stateMach.registerStateModelFactory(SetupConsumerCluster.DEFAULT_STATE_MODEL, modelFactory);
-
- _manager.connect();
-
- Thread.currentThread().join();
- }
- catch (InterruptedException e)
- {
- System.err.println(" [-] " + _consumerId + " is interrupted ...");
- }
- catch (Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- finally
- {
- disconnect();
- }
- }
-
- public void disconnect()
- {
- if (_manager != null)
- {
- _manager.disconnect();
- }
- }
-
- public static void main(String[] args) throws Exception
- {
- if (args.length < 3)
- {
- System.err.println("USAGE: java Consumer zookeeperAddress (e.g. localhost:2181) consumerId (0-2), rabbitmqServer (e.g. localhost)");
- System.exit(1);
- }
-
- final String zkAddr = args[0];
- final String clusterName = SetupConsumerCluster.DEFAULT_CLUSTER_NAME;
- final String consumerId = args[1];
- final String mqServer = args[2];
-
- ZkClient zkclient = null;
- try
- {
- // add node to cluster if not already added
- zkclient =
- new ZkClient(zkAddr,
- ZkClient.DEFAULT_SESSION_TIMEOUT,
- ZkClient.DEFAULT_CONNECTION_TIMEOUT,
- new ZNRecordSerializer());
- ZKHelixAdmin admin = new ZKHelixAdmin(zkclient);
-
- List<String> nodes = admin.getInstancesInCluster(clusterName);
- if (!nodes.contains("consumer_" + consumerId))
- {
- InstanceConfig config = new InstanceConfig("consumer_" + consumerId);
- config.setHostName("localhost");
- config.setInstanceEnabled(true);
- admin.addInstance(clusterName, config);
- }
-
- // start consumer
- final Consumer consumer =
- new Consumer(zkAddr, clusterName, "consumer_" + consumerId, mqServer);
-
- Runtime.getRuntime().addShutdownHook(new Thread()
- {
- @Override
- public void run()
- {
- System.out.println("Shutting down consumer_" + consumerId);
- consumer.disconnect();
- }
- });
-
- consumer.connect();
- }
- finally
- {
- if (zkclient != null)
- {
- zkclient.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModel.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModel.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModel.java
deleted file mode 100644
index e4cbd94..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModel.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import org.apache.log4j.Logger;
-
-import com.linkedin.helix.NotificationContext;
-import com.linkedin.helix.model.Message;
-import com.linkedin.helix.participant.statemachine.StateModel;
-import com.linkedin.helix.participant.statemachine.StateModelInfo;
-import com.linkedin.helix.participant.statemachine.Transition;
-
-@StateModelInfo(initialState = "OFFLINE", states = { "ONLINE", "ERROR" })
-public class ConsumerStateModel extends StateModel
-{
- private static Logger LOG = Logger.getLogger(ConsumerStateModel.class);
-
- private final String _consumerId;
- private final String _partition;
-
- private final String _mqServer;
- private ConsumerThread _thread = null;
-
- public ConsumerStateModel(String consumerId, String partition, String mqServer)
- {
- _partition = partition;
- _consumerId = consumerId;
- _mqServer = mqServer;
- }
-
- @Transition(to = "ONLINE", from = "OFFLINE")
- public void onBecomeOnlineFromOffline(Message message, NotificationContext context)
- {
- LOG.debug(_consumerId + " becomes ONLINE from OFFLINE for " + _partition);
-
- if (_thread == null)
- {
- LOG.debug("Starting ConsumerThread for " + _partition + "...");
- _thread = new ConsumerThread(_partition, _mqServer, _consumerId);
- _thread.start();
- LOG.debug("Starting ConsumerThread for " + _partition + " done");
-
- }
- }
-
- @Transition(to = "OFFLINE", from = "ONLINE")
- public void onBecomeOfflineFromOnline(Message message, NotificationContext context)
- throws InterruptedException
- {
- LOG.debug(_consumerId + " becomes OFFLINE from ONLINE for " + _partition);
-
- if (_thread != null)
- {
- LOG.debug("Stopping " + _consumerId + " for " + _partition + "...");
-
- _thread.interrupt();
- _thread.join(2000);
- _thread = null;
- LOG.debug("Stopping " + _consumerId + " for " + _partition + " done");
-
- }
- }
-
- @Transition(to = "DROPPED", from = "OFFLINE")
- public void onBecomeDroppedFromOffline(Message message, NotificationContext context)
- {
- LOG.debug(_consumerId + " becomes DROPPED from OFFLINE for " + _partition);
- }
-
- @Transition(to = "OFFLINE", from = "ERROR")
- public void onBecomeOfflineFromError(Message message, NotificationContext context)
- {
- LOG.debug(_consumerId + " becomes OFFLINE from ERROR for " + _partition);
- }
-
- @Override
- public void reset()
- {
- LOG.warn("Default reset() invoked");
-
- if (_thread != null)
- {
- LOG.debug("Stopping " + _consumerId + " for " + _partition + "...");
-
- _thread.interrupt();
- try
- {
- _thread.join(2000);
- } catch (InterruptedException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- _thread = null;
- LOG.debug("Stopping " + _consumerId + " for " + _partition + " done");
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModelFactory.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModelFactory.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModelFactory.java
deleted file mode 100644
index 6c504eb..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerStateModelFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import com.linkedin.helix.participant.statemachine.StateModelFactory;
-
-public class ConsumerStateModelFactory extends StateModelFactory<ConsumerStateModel>
-{
- private final String _consumerId;
- private final String _mqServer;
- public ConsumerStateModelFactory(String consumerId, String msServer)
- {
- _consumerId = consumerId;
- _mqServer = msServer;
- }
-
- @Override
- public ConsumerStateModel createNewStateModel(String partition)
- {
- ConsumerStateModel model = new ConsumerStateModel(_consumerId, partition, _mqServer);
- return model;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerThread.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerThread.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerThread.java
deleted file mode 100644
index 17f5c9a..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/ConsumerThread.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import java.io.IOException;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-import com.rabbitmq.client.QueueingConsumer;
-
-public class ConsumerThread extends Thread
-{
- private static final String EXCHANGE_NAME = "topic_logs";
- private final String _partition;
- private final String _mqServer;
- private final String _consumerId;
-
- public ConsumerThread(String partition, String mqServer, String consumerId)
- {
- _partition = partition;
- _mqServer = mqServer;
- _consumerId = consumerId;
- }
-
- @Override
- public void run()
- {
- Connection connection = null;
- try
- {
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(_mqServer);
- connection = factory.newConnection();
- Channel channel = connection.createChannel();
-
- channel.exchangeDeclare(EXCHANGE_NAME, "topic");
- String queueName = channel.queueDeclare().getQueue();
-
- String bindingKey = _partition;
- channel.queueBind(queueName, EXCHANGE_NAME, bindingKey);
-
- System.out.println(" [*] " + _consumerId + " Waiting for messages on " + bindingKey + ". To exit press CTRL+C");
-
- QueueingConsumer consumer = new QueueingConsumer(channel);
- channel.basicConsume(queueName, true, consumer);
-
- while (true)
- {
- QueueingConsumer.Delivery delivery = consumer.nextDelivery();
- String message = new String(delivery.getBody());
- String routingKey = delivery.getEnvelope().getRoutingKey();
-
- System.out.println(" [x] " + _consumerId + " Received '" + routingKey + "':'" + message + "'");
- }
- } catch (InterruptedException e)
- {
- System.err.println(" [-] " + _consumerId + " on " + _partition + " is interrupted ...");
- }
- catch (Exception e)
- {
- e.printStackTrace();
- } finally
- {
- if (connection != null)
- {
- try
- {
- connection.close();
- } catch (IOException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Emitter.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Emitter.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Emitter.java
deleted file mode 100644
index e303f29..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/Emitter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-
-public class Emitter
-{
-
- private static final String EXCHANGE_NAME = "topic_logs";
-
- public static void main(String[] args) throws Exception
- {
- if (args.length < 1)
- {
- System.err.println("USAGE: java Emitter rabbitmqServer (e.g. localhost) numberOfMessage (optional)");
- System.exit(1);
- }
-
- final String mqServer = args[0]; // "zzhang-ld";
- int count = Integer.MAX_VALUE;
- if (args.length > 1)
- {
- try
- {
- count = Integer.parseInt(args[1]);
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
- System.out.println("Sending " + count + " messages with random topic id");
-
-
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(mqServer);
- Connection connection = factory.newConnection();
- Channel channel = connection.createChannel();
-
- channel.exchangeDeclare(EXCHANGE_NAME, "topic");
-
- for (int i = 0; i < count; i++)
- {
- int rand = ((int) (Math.random() * 10000) % SetupConsumerCluster.DEFAULT_PARTITION_NUMBER);
- String routingKey = "topic_" + rand;
- String message = "message_" + rand;
-
- channel.basicPublish(EXCHANGE_NAME, routingKey, null, message.getBytes());
- System.out.println(" [x] Sent '" + routingKey + "':'" + message + "'");
-
- Thread.sleep(1000);
- }
-
- connection.close();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/SetupConsumerCluster.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/SetupConsumerCluster.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/SetupConsumerCluster.java
deleted file mode 100644
index c9508b4..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/SetupConsumerCluster.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import com.linkedin.helix.manager.zk.ZKHelixAdmin;
-import com.linkedin.helix.manager.zk.ZNRecordSerializer;
-import com.linkedin.helix.manager.zk.ZkClient;
-import com.linkedin.helix.model.IdealState.IdealStateModeProperty;
-import com.linkedin.helix.model.StateModelDefinition;
-import com.linkedin.helix.tools.StateModelConfigGenerator;
-
-public class SetupConsumerCluster
-{
- public static final String DEFAULT_CLUSTER_NAME = "rabbitmq-consumer-cluster";
- public static final String DEFAULT_RESOURCE_NAME = "topic";
- public static final int DEFAULT_PARTITION_NUMBER = 6;
- public static final String DEFAULT_STATE_MODEL = "OnlineOffline";
-
- public static void main(String[] args)
- {
- if (args.length < 1)
- {
- System.err.println("USAGE: java SetupConsumerCluster zookeeperAddress (e.g. localhost:2181)");
- System.exit(1);
- }
-
- final String zkAddr = args[0];
- final String clusterName = DEFAULT_CLUSTER_NAME;
-
- ZkClient zkclient = null;
- try
- {
- zkclient = new ZkClient(zkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT,
- ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
- ZKHelixAdmin admin = new ZKHelixAdmin(zkclient);
-
- // add cluster
- admin.addCluster(clusterName, true);
-
- // add state model definition
- StateModelConfigGenerator generator = new StateModelConfigGenerator();
- admin.addStateModelDef(clusterName, DEFAULT_STATE_MODEL,
- new StateModelDefinition(generator.generateConfigForOnlineOffline()));
-
- // add resource "topic" which has 6 partitions
- String resourceName = DEFAULT_RESOURCE_NAME;
- admin.addResource(clusterName, resourceName, DEFAULT_PARTITION_NUMBER, DEFAULT_STATE_MODEL,
- IdealStateModeProperty.AUTO_REBALANCE.toString());
-
- admin.rebalance(clusterName, resourceName, 1);
-
- } finally
- {
- if (zkclient != null)
- {
- zkclient.close();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/StartClusterManager.java
----------------------------------------------------------------------
diff --git a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/StartClusterManager.java b/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/StartClusterManager.java
deleted file mode 100644
index 51f15a3..0000000
--- a/recipes/rabbitmq-consumer-group/src/main/java/com/linkedin/helix/recipes/rabbitmq/StartClusterManager.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.linkedin.helix.recipes.rabbitmq;
-
-import com.linkedin.helix.HelixManager;
-import com.linkedin.helix.controller.HelixControllerMain;
-
-public class StartClusterManager
-{
- public static void main(String[] args)
- {
- if (args.length < 1)
- {
- System.err.println("USAGE: java StartClusterManager zookeeperAddress (e.g. localhost:2181)");
- System.exit(1);
- }
-
- final String clusterName = SetupConsumerCluster.DEFAULT_CLUSTER_NAME;
- final String zkAddr = args[0];
-
- try
- {
- final HelixManager manager = HelixControllerMain.startHelixController(zkAddr, clusterName, null,
- HelixControllerMain.STANDALONE);
-
- Runtime.getRuntime().addShutdownHook(new Thread()
- {
- @Override
- public void run()
- {
- System.out.println("Shutting down cluster manager: " + manager.getInstanceName());
- manager.disconnect();
- }
- });
-
- Thread.currentThread().join();
- }
- catch (Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-helix/blob/3cb7a1c9/sun_checks.xml
----------------------------------------------------------------------
diff --git a/sun_checks.xml b/sun_checks.xml
deleted file mode 100644
index e38b928..0000000
--- a/sun_checks.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Copyright (C) 2012 LinkedIn Inc <op...@linkedin.com>
-
- Licensed 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.
-
--->
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<!--
-
- Checkstyle configuration that checks the sun coding conventions from:
-
- - the Java Language Specification at
- http://java.sun.com/docs/books/jls/second_edition/html/index.html
-
- - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
-
- - the Javadoc guidelines at
- http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
-
- - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
-
- - some best practices
-
- Checkstyle is very configurable. Be sure to read the documentation at
- http://checkstyle.sf.net (or in your downloaded distribution).
-
- Most Checks are configurable, be sure to consult the documentation.
-
- To completely disable a check, just comment it out or delete it from the file.
-
- Finally, it is worth reading the documentation.
-
--->
-
-<module name="Checker">
- <property name="severity" value="warning"/>
-
- <!-- Checks that a package.html file exists for each package. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
- <module name="PackageHtml"/>
-
- <!-- Checks whether files end with a new line. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
- <module name="NewlineAtEndOfFile"/>
-
- <!-- Checks that property files contain the same keys. -->
- <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
- <module name="Translation"/>
-
-
- <module name="TreeWalker">
-
- <!-- Checks for Javadoc comments. -->
- <!-- See http://checkstyle.sf.net/config_javadoc.html -->
- <module name="JavadocMethod"/>
- <module name="JavadocType"/>
- <module name="JavadocVariable"/>
- <module name="JavadocStyle"/>
-
-
- <!-- Checks for Naming Conventions. -->
- <!-- See http://checkstyle.sf.net/config_naming.html -->
- <module name="ConstantName"/>
- <module name="LocalFinalVariableName"/>
- <module name="LocalVariableName"/>
- <module name="MemberName"/>
- <module name="MethodName"/>
- <module name="PackageName"/>
- <module name="ParameterName"/>
- <module name="StaticVariableName"/>
- <module name="TypeName"/>
-
-
- <!-- Checks for Headers -->
- <!-- See http://checkstyle.sf.net/config_header.html -->
- <!-- <module name="Header"> -->
- <!-- The follow property value demonstrates the ability -->
- <!-- to have access to ANT properties. In this case it uses -->
- <!-- the ${basedir} property to allow Checkstyle to be run -->
- <!-- from any directory within a project. See property -->
- <!-- expansion, -->
- <!-- http://checkstyle.sf.net/config.html#properties -->
- <!-- <property -->
- <!-- name="headerFile" -->
- <!-- value="${basedir}/java.header"/> -->
- <!-- </module> -->
-
- <!-- Following interprets the header file as regular expressions. -->
- <!-- <module name="RegexpHeader"/> -->
-
-
- <!-- Checks for imports -->
- <!-- See http://checkstyle.sf.net/config_import.html -->
- <module name="AvoidStarImport"/>
- <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
- <module name="RedundantImport"/>
- <module name="UnusedImports"/>
-
-
- <!-- Checks for Size Violations. -->
- <!-- See http://checkstyle.sf.net/config_sizes.html -->
- <module name="FileLength"/>
- <module name="LineLength"/>
- <module name="MethodLength"/>
- <module name="ParameterNumber"/>
-
-
- <!-- Checks for whitespace -->
- <!-- See http://checkstyle.sf.net/config_whitespace.html -->
- <!-- With modifications for generics -->
- <module name="EmptyForIteratorPad"/>
- <module name="MethodParamPad"/>
- <module name="NoWhitespaceAfter">
- <property name="tokens" value="ARRAY_INIT, BNOT, DEC, DOT, INC, LNOT,
- UNARY_MINUS, UNARY_PLUS, GENERIC_START"/>
- </module>
- <module name="NoWhitespaceBefore">
- <property name="tokens" value="SEMI, POST_DEC, POST_INC,
- GENERIC_START, GENERIC_END"/>
- </module>
- <module name="OperatorWrap"/>
- <module name="ParenPad"/>
- <module name="TypecastParenPad"/>
- <module name="WhitespaceAfter">
- <property name="tokens" value="COMMA, SEMI, TYPECAST, GENERIC_END"/>
- </module>
- <module name="WhitespaceAround">
- <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
- BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV,
- DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT,
- LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
- LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED,
- LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD,
- MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL,
- SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,
- TYPE_EXTENSION_AND"/>
- </module>
-
-
- <!-- Modifier Checks -->
- <!-- See http://checkstyle.sf.net/config_modifiers.html -->
- <module name="ModifierOrder"/>
- <module name="RedundantModifier"/>
-
-
- <!-- Checks for blocks. You know, those {}'s -->
- <!-- See http://checkstyle.sf.net/config_blocks.html -->
- <module name="AvoidNestedBlocks"/>
- <module name="EmptyBlock"/>
- <module name="LeftCurly"/>
- <module name="NeedBraces"/>
- <module name="RightCurly"/>
-
-
- <!-- Checks for common coding problems -->
- <!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="AvoidInlineConditionals"/>
- <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
- <module name="EmptyStatement"/>
- <module name="EqualsHashCode"/>
- <module name="HiddenField"/>
- <module name="IllegalInstantiation"/>
- <module name="InnerAssignment"/>
- <module name="MagicNumber"/>
- <module name="MissingSwitchDefault"/>
- <module name="RedundantThrows"/>
- <module name="SimplifyBooleanExpression"/>
- <module name="SimplifyBooleanReturn"/>
-
- <!-- Checks for class design -->
- <!-- See http://checkstyle.sf.net/config_design.html -->
- <module name="DesignForExtension"/>
- <module name="FinalClass"/>
- <module name="HideUtilityClassConstructor"/>
- <module name="InterfaceIsType"/>
- <module name="VisibilityModifier"/>
-
-
- <!-- Miscellaneous other checks. -->
- <!-- See http://checkstyle.sf.net/config_misc.html -->
- <module name="ArrayTypeStyle"/>
- <module name="FinalParameters"/>
- <module name="GenericIllegalRegexp">
- <property name="format" value="\s+$"/>
- <property name="message" value="Line has trailing spaces."/>
- </module>
- <module name="TodoComment"/>
- <module name="UpperEll"/>
-
- </module>
-
-</module>
-