Return-Path: X-Original-To: apmail-falcon-commits-archive@minotaur.apache.org Delivered-To: apmail-falcon-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B212F18C1F for ; Tue, 29 Dec 2015 20:56:21 +0000 (UTC) Received: (qmail 58245 invoked by uid 500); 29 Dec 2015 20:56:21 -0000 Delivered-To: apmail-falcon-commits-archive@falcon.apache.org Received: (qmail 58211 invoked by uid 500); 29 Dec 2015 20:56:21 -0000 Mailing-List: contact commits-help@falcon.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@falcon.apache.org Delivered-To: mailing list commits@falcon.apache.org Received: (qmail 58202 invoked by uid 99); 29 Dec 2015 20:56:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Dec 2015 20:56:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 74313E04EE; Tue, 29 Dec 2015 20:56:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ajayyadava@apache.org To: commits@falcon.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: falcon git commit: FALCON-1702 Exception thrown by workflow status listeners on success notification. Contributed by Pallavi Rao. Date: Tue, 29 Dec 2015 20:56:21 +0000 (UTC) Repository: falcon Updated Branches: refs/heads/master ad9f2dea2 -> 5e34524fd FALCON-1702 Exception thrown by workflow status listeners on success notification. Contributed by Pallavi Rao. Project: http://git-wip-us.apache.org/repos/asf/falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/5e34524f Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/5e34524f Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/5e34524f Branch: refs/heads/master Commit: 5e34524fd4712dc8979244b2283de7093cf1f5a7 Parents: ad9f2de Author: Ajay Yadava Authored: Wed Dec 30 02:13:04 2015 +0530 Committer: Ajay Yadava Committed: Wed Dec 30 02:13:04 2015 +0530 ---------------------------------------------------------------------- CHANGES.txt | 2 ++ .../workflow/WorkflowExecutionContext.java | 2 +- .../falcon/messaging/JMSMessageConsumer.java | 25 ++++++++++++++++++-- 3 files changed, 26 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/falcon/blob/5e34524f/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 7ec8ce6..fe4216d 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -90,6 +90,8 @@ Trunk (Unreleased) OPTIMIZATIONS BUG FIXES + FALCON-1702 Exception thrown by workflow status listeners on success notification(Pallavi Rao via Ajay Yadava) + FALCON-1703 Falcon docs module not generating html files(Pallavi Rao via Ajay Yadava) FALCON-1565 Listing API non-intuitive response if time > endTime (Praveen Adlakha via Ajay Yadava) http://git-wip-us.apache.org/repos/asf/falcon/blob/5e34524f/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java ---------------------------------------------------------------------- diff --git a/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java b/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java index e51ad28..5866369 100644 --- a/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java +++ b/common/src/main/java/org/apache/falcon/workflow/WorkflowExecutionContext.java @@ -75,7 +75,7 @@ public class WorkflowExecutionContext { * Entity operations supported. */ public enum EntityOperations { - GENERATE, DELETE, ARCHIVE, REPLICATE, CHMOD, IMPORT, EXPORT + GENERATE, DELETE, REPLICATE, IMPORT, EXPORT } public static final WorkflowExecutionArgs[] USER_MESSAGE_ARGS = { http://git-wip-us.apache.org/repos/asf/falcon/blob/5e34524f/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java ---------------------------------------------------------------------- diff --git a/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java b/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java index bbb5d9b..2380e47 100644 --- a/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java +++ b/messaging/src/main/java/org/apache/falcon/messaging/JMSMessageConsumer.java @@ -21,6 +21,7 @@ package org.apache.falcon.messaging; import org.apache.commons.lang3.StringUtils; import org.apache.falcon.FalconException; import org.apache.falcon.Pair; +import org.apache.falcon.Tag; import org.apache.falcon.aspect.GenericAlert; import org.apache.falcon.entity.WorkflowNameBuilder; import org.apache.falcon.entity.v0.EntityType; @@ -146,11 +147,12 @@ public class JMSMessageConsumer implements MessageListener, ExceptionListener { wfProperties.put(WorkflowExecutionArgs.NOMINAL_TIME, getNominalTimeString(Long.parseLong(json.getString("nominalTime")))); } - Pair entityTypePair = WorkflowNameBuilder.WorkflowName.getEntityNameAndType( - message.getStringProperty("appName")); + String appName = message.getStringProperty("appName"); + Pair entityTypePair = WorkflowNameBuilder.WorkflowName.getEntityNameAndType(appName); wfProperties.put(WorkflowExecutionArgs.ENTITY_NAME, entityTypePair.first); wfProperties.put(WorkflowExecutionArgs.ENTITY_TYPE, entityTypePair.second.name()); wfProperties.put(WorkflowExecutionArgs.WORKFLOW_USER, message.getStringProperty("user")); + wfProperties.put(WorkflowExecutionArgs.OPERATION, getOperation(appName).name()); String appType = message.getStringProperty("appType"); return WorkflowExecutionContext.create(wfProperties, WorkflowExecutionContext.Type.valueOf(appType)); @@ -160,6 +162,25 @@ public class JMSMessageConsumer implements MessageListener, ExceptionListener { } } + // Retrieves EntityOperation from the workflow name + private WorkflowExecutionContext.EntityOperations getOperation(String appName) { + Tag tag = WorkflowNameBuilder.WorkflowName.getTagAndSuffixes(appName).first; + switch(tag) { + case REPLICATION: + return WorkflowExecutionContext.EntityOperations.REPLICATE; + case RETENTION: + return WorkflowExecutionContext.EntityOperations.DELETE; + case IMPORT: + return WorkflowExecutionContext.EntityOperations.IMPORT; + case EXPORT: + return WorkflowExecutionContext.EntityOperations.EXPORT; + case DEFAULT: + return WorkflowExecutionContext.EntityOperations.GENERATE; + default: + throw new IllegalArgumentException("Invalid tag - " + tag); + } + } + private String getNominalTimeString(long timeInMillis) { Date time = new Date(timeInMillis); final String format = "yyyy-MM-dd-HH-mm";