falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srik...@apache.org
Subject [28/47] git commit: Check style fixes relating to messaging module
Date Fri, 26 Apr 2013 15:50:44 GMT
Check style fixes relating to messaging module


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/46f07b34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/46f07b34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/46f07b34

Branch: refs/heads/master
Commit: 46f07b342e8f0b5e2dcc670d2f1f6c949ac4f355
Parents: afbcea0
Author: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
Authored: Wed Apr 17 15:24:35 2013 +0530
Committer: srikanth.sundarrajan <srikanth.sundarrajan@inmobi.com>
Committed: Wed Apr 17 15:24:35 2013 +0530

----------------------------------------------------------------------
 .../falcon/messaging/EntityInstanceMessage.java    |   23 ++++++++------
 .../messaging/EntityInstanceMessageCreator.java    |    2 +-
 .../apache/falcon/messaging/MessageProducer.java   |   23 +++++++--------
 .../falcon/messaging/FalconTopicProducerTest.java  |   11 ++++--
 .../apache/falcon/messaging/FeedProducerTest.java  |   15 ++++++----
 .../falcon/messaging/ProcessProducerTest.java      |   11 ++++--
 6 files changed, 48 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/46f07b34/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessage.java
----------------------------------------------------------------------
diff --git a/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessage.java
b/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessage.java
index f6b90df..a2ced24 100644
--- a/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessage.java
+++ b/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessage.java
@@ -36,7 +36,7 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
- * Value Object which is stored in JMS Topic as MapMessage
+ * Value Object which is stored in JMS Topic as MapMessage.
  */
 public class EntityInstanceMessage {
 
@@ -45,10 +45,16 @@ public class EntityInstanceMessage {
             .getLogger(EntityInstanceMessage.class);
     private static final String FALCON_ENTITY_TOPIC_NAME = "FALCON.ENTITY.TOPIC";
 
+    /**
+     * Feed Entity operations supported.
+     */
     public enum EntityOps {
         GENERATE, DELETE, ARCHIVE, REPLICATE, CHMOD
     }
 
+    /**
+     * properties available in feed entity operation workflow.
+     */
     public enum ARG {
         entityName("entityName"), feedNames("feedNames"), feedInstancePaths(
                 "feedInstancePaths"), workflowId("workflowId"), runId("runId"), nominalTime(
@@ -122,7 +128,8 @@ public class EntityInstanceMessage {
     }
 
     public static EntityInstanceMessage[] getMessages(CommandLine cmd)
-            throws ParseException {
+        throws ParseException {
+
         String[] feedNames = getFeedNames(cmd);
         if (feedNames == null) {
             return null;
@@ -181,16 +188,12 @@ public class EntityInstanceMessage {
         if (topicName.equals(FALCON_ENTITY_TOPIC_NAME)) {
             LOG.debug("Returning instance paths for Falcon Topic: "
                     + cmd.getOptionValue(ARG.feedInstancePaths.getArgName()));
-            return new String[]{cmd.getOptionValue(ARG.feedInstancePaths
-                    .getArgName())};
+            return new String[]{cmd.getOptionValue(ARG.feedInstancePaths.getArgName()), };
         }
 
-        if (operation.equals(EntityOps.GENERATE.name())
-                || operation.equals(EntityOps.REPLICATE.name())) {
-            LOG.debug("Returning instance paths: "
-                    + cmd.getOptionValue(ARG.feedInstancePaths.getArgName()));
-            return cmd.getOptionValue(ARG.feedInstancePaths.getArgName())
-                    .split(",");
+        if (operation.equals(EntityOps.GENERATE.name()) || operation.equals(EntityOps.REPLICATE.name()))
{
+            LOG.debug("Returning instance paths: " + cmd.getOptionValue(ARG.feedInstancePaths.getArgName()));
+            return cmd.getOptionValue(ARG.feedInstancePaths.getArgName()).split(",");
         }
         //else case of feed retention
         Path logFile = new Path(cmd.getOptionValue(ARG.logFile.getArgName()));

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/46f07b34/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessageCreator.java
----------------------------------------------------------------------
diff --git a/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessageCreator.java
b/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessageCreator.java
index 0a8e7df..ecda5eb 100644
--- a/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessageCreator.java
+++ b/messaging/src/main/java/org/apache/falcon/messaging/EntityInstanceMessageCreator.java
@@ -27,7 +27,7 @@ import javax.jms.Session;
 import java.util.Map.Entry;
 
 /**
- * Falcon JMS message creator- creates JMS TextMessage
+ * Falcon JMS message creator- creates JMS TextMessage.
  */
 public class EntityInstanceMessageCreator {
 

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/46f07b34/messaging/src/main/java/org/apache/falcon/messaging/MessageProducer.java
----------------------------------------------------------------------
diff --git a/messaging/src/main/java/org/apache/falcon/messaging/MessageProducer.java b/messaging/src/main/java/org/apache/falcon/messaging/MessageProducer.java
index cb0ad8a..cf5c2d7 100644
--- a/messaging/src/main/java/org/apache/falcon/messaging/MessageProducer.java
+++ b/messaging/src/main/java/org/apache/falcon/messaging/MessageProducer.java
@@ -28,6 +28,9 @@ import org.apache.log4j.Logger;
 import javax.jms.*;
 import java.lang.reflect.InvocationTargetException;
 
+/**
+ * Message producer used in the workflow to send a message to the queue/topic.
+ */
 public class MessageProducer extends Configured implements Tool {
 
     private Connection connection;
@@ -35,13 +38,13 @@ public class MessageProducer extends Configured implements Tool {
     private static final long DEFAULT_TTL = 3 * 24 * 60 * 60 * 1000;
 
     /**
-     * @param arguments - Accepts a Message to be send to JMS topic, creates a new
+     * @param entityInstanceMessage - Accepts a Message to be send to JMS topic, creates
a new
      *                  Topic based on topic name if it does not exist or else
      *                  existing topic with the same name is used to send the message.
      * @throws JMSException
      */
     protected void sendMessage(EntityInstanceMessage entityInstanceMessage)
-            throws JMSException {
+        throws JMSException {
 
         Session session = connection.createSession(false,
                 Session.AUTO_ACKNOWLEDGE);
@@ -69,15 +72,10 @@ public class MessageProducer extends Configured implements Tool {
         ToolRunner.run(new MessageProducer(), args);
     }
 
-    private void createAndStartConnection(String implementation,
-                                          String userName, String password, String url) throws
JMSException,
-                                                                                        
      ClassNotFoundException,
-                                                                                        
      IllegalArgumentException,
-                                                                                        
      SecurityException,
-                                                                                        
      InstantiationException,
-                                                                                        
      IllegalAccessException,
-                                                                                        
      InvocationTargetException,
-                                                                                        
      NoSuchMethodException {
+    private void createAndStartConnection(String implementation, String userName,
+                                          String password, String url)
+        throws JMSException, ClassNotFoundException, InstantiationException,
+               IllegalAccessException, InvocationTargetException, NoSuchMethodException {
 
         Class<ConnectionFactory> clazz = (Class<ConnectionFactory>) MessageProducer.class
                 .getClassLoader().loadClass(implementation);
@@ -91,7 +89,8 @@ public class MessageProducer extends Configured implements Tool {
     }
 
     private static CommandLine getCommand(String[] arguments)
-            throws ParseException {
+        throws ParseException {
+
         Options options = new Options();
         addOption(options, new Option(ARG.brokerImplClass.getArgName(), true,
                 "message broker Implementation class"));

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/46f07b34/messaging/src/test/java/org/apache/falcon/messaging/FalconTopicProducerTest.java
----------------------------------------------------------------------
diff --git a/messaging/src/test/java/org/apache/falcon/messaging/FalconTopicProducerTest.java
b/messaging/src/test/java/org/apache/falcon/messaging/FalconTopicProducerTest.java
index 9a13738..9912678 100644
--- a/messaging/src/test/java/org/apache/falcon/messaging/FalconTopicProducerTest.java
+++ b/messaging/src/test/java/org/apache/falcon/messaging/FalconTopicProducerTest.java
@@ -27,6 +27,9 @@ import org.testng.annotations.Test;
 
 import javax.jms.*;
 
+/**
+ * Test for falcon topic message producer.
+ */
 public class FalconTopicProducerTest {
 
     private static final String BROKER_URL = "vm://localhost?broker.useJmx=false&broker.persistent=true";
@@ -71,7 +74,7 @@ public class FalconTopicProducerTest {
                                      "-" + ARG.topicName.getArgName(), (TOPIC_NAME),
                                      "-" + ARG.status.getArgName(), ("SUCCEEDED"),
                                      "-" + ARG.brokerTTL.getArgName(), "10",
-                                     "-" + ARG.cluster.getArgName(), "corp"};
+                                     "-" + ARG.cluster.getArgName(), "corp", };
         testProcessMessageCreator(args);
     }
 
@@ -93,7 +96,7 @@ public class FalconTopicProducerTest {
                                      "-" + ARG.topicName.getArgName(), (TOPIC_NAME),
                                      "-" + ARG.status.getArgName(), ("SUCCEEDED"),
                                      "-" + ARG.brokerTTL.getArgName(), "10",
-                                     "-" + ARG.cluster.getArgName(), "corp"};
+                                     "-" + ARG.cluster.getArgName(), "corp", };
         testProcessMessageCreator(args);
     }
 
@@ -107,7 +110,7 @@ public class FalconTopicProducerTest {
                 } catch (AssertionError e) {
                     error = e;
                 } catch (JMSException ignore) {
-
+                    error = null;
                 }
             }
         };
@@ -133,7 +136,7 @@ public class FalconTopicProducerTest {
 
         // wait till you get atleast one message
         MapMessage m;
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/46f07b34/messaging/src/test/java/org/apache/falcon/messaging/FeedProducerTest.java
----------------------------------------------------------------------
diff --git a/messaging/src/test/java/org/apache/falcon/messaging/FeedProducerTest.java b/messaging/src/test/java/org/apache/falcon/messaging/FeedProducerTest.java
index 45252dd..32f731f 100644
--- a/messaging/src/test/java/org/apache/falcon/messaging/FeedProducerTest.java
+++ b/messaging/src/test/java/org/apache/falcon/messaging/FeedProducerTest.java
@@ -36,6 +36,9 @@ import javax.jms.*;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+/**
+ * Test for feed message producer.
+ */
 public class FeedProducerTest {
 
     private String[] args;
@@ -76,7 +79,7 @@ public class FeedProducerTest {
                             "-" + ARG.topicName.getArgName(), (TOPIC_NAME),
                             "-" + ARG.status.getArgName(), ("SUCCEEDED"),
                             "-" + ARG.brokerTTL.getArgName(), "10",
-                            "-" + ARG.cluster.getArgName(), "corp"};
+                            "-" + ARG.cluster.getArgName(), "corp", };
 
         broker = new BrokerService();
         broker.addConnector(BROKER_URL);
@@ -125,7 +128,7 @@ public class FeedProducerTest {
                 } catch (AssertionError e) {
                     error = e;
                 } catch (JMSException ignore) {
-
+                    error = null;
                 }
             }
         };
@@ -151,7 +154,7 @@ public class FeedProducerTest {
 
         // wait till you get atleast one message
         MapMessage m;
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());
@@ -159,7 +162,7 @@ public class FeedProducerTest {
         Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                 "/falcon/feed/agg-logs/path1/2010/10/10/20");
 
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());
@@ -167,7 +170,7 @@ public class FeedProducerTest {
         Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                 "/falcon/feed/agg-logs/path1/2010/10/10/21");
 
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());
@@ -175,7 +178,7 @@ public class FeedProducerTest {
         Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                 "/falcon/feed/agg-logs/path1/2010/10/10/22");
 
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/46f07b34/messaging/src/test/java/org/apache/falcon/messaging/ProcessProducerTest.java
----------------------------------------------------------------------
diff --git a/messaging/src/test/java/org/apache/falcon/messaging/ProcessProducerTest.java
b/messaging/src/test/java/org/apache/falcon/messaging/ProcessProducerTest.java
index 55a5fc0..078b9c2 100644
--- a/messaging/src/test/java/org/apache/falcon/messaging/ProcessProducerTest.java
+++ b/messaging/src/test/java/org/apache/falcon/messaging/ProcessProducerTest.java
@@ -28,6 +28,9 @@ import org.testng.annotations.Test;
 
 import javax.jms.*;
 
+/**
+ * Test for process message producer.
+ */
 public class ProcessProducerTest {
 
     private String[] args;
@@ -58,7 +61,7 @@ public class ProcessProducerTest {
                             "-" + ARG.topicName.getArgName(), (TOPIC_NAME),
                             "-" + ARG.status.getArgName(), ("SUCCEEDED"),
                             "-" + ARG.brokerTTL.getArgName(), "10",
-                            "-" + ARG.cluster.getArgName(), "corp"};
+                            "-" + ARG.cluster.getArgName(), "corp", };
         broker = new BrokerService();
         broker.addConnector(BROKER_URL);
         broker.setDataDirectory("target/activemq");
@@ -84,7 +87,7 @@ public class ProcessProducerTest {
                 } catch (AssertionError e) {
                     error = e;
                 } catch (JMSException ignore) {
-
+                    error = null;
                 }
             }
         };
@@ -110,7 +113,7 @@ public class ProcessProducerTest {
 
         // wait till you get atleast one message
         MapMessage m;
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());
@@ -120,7 +123,7 @@ public class ProcessProducerTest {
         Assert.assertEquals(m.getString(ARG.feedInstancePaths.getArgName()),
                 "/click-logs/10/05/05/00/20");
 
-        for (m = null; m == null; ) {
+        for (m = null; m == null;) {
             m = (MapMessage) consumer.receive();
         }
         System.out.println("Consumed: " + m.toString());


Mime
View raw message