falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject [3/3] falcon git commit: FALCON-1596 Spring shell based CLI for falcon
Date Wed, 03 Aug 2016 12:09:55 GMT
FALCON-1596 Spring shell based CLI for falcon

Author: Praveen Adlakha <adlakha.praveen@gmail.com>

Reviewers: Ajay Yadava <ajayyadava@apache.org>, Venkat Ranganathan<vrangan@apache.org>

Closes #249 from PraveenAdlakha/shell_final


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

Branch: refs/heads/master
Commit: da767c2f6b2cc80af9b8bf663cdd45515bd440f0
Parents: 075f02c
Author: Praveen Adlakha <adlakha.praveen@gmail.com>
Authored: Wed Aug 3 17:12:48 2016 +0530
Committer: Ajay Yadava <ajayyadava@apache.org>
Committed: Wed Aug 3 17:12:48 2016 +0530

----------------------------------------------------------------------
 cli/pom.xml                                     |   9 -
 .../org/apache/falcon/cli/FalconAdminCLI.java   |   9 +-
 .../java/org/apache/falcon/cli/FalconCLI.java   | 117 +-----
 .../org/apache/falcon/cli/FalconEntityCLI.java  | 168 +++++----
 .../apache/falcon/cli/FalconExtensionCLI.java   |   2 +-
 .../apache/falcon/cli/FalconInstanceCLI.java    | 240 +++++++------
 .../apache/falcon/cli/FalconMetadataCLI.java    | 177 ++++-----
 .../falcon/cli/commands/BaseFalconCommands.java | 150 --------
 .../cli/commands/FalconConnectionCommands.java  |  58 ---
 .../cli/commands/FalconEntityCommands.java      | 326 -----------------
 .../cli/commands/FalconInstanceCommands.java    |  29 --
 .../apache/falcon/cli/skel/FalconBanner.java    |  61 ----
 .../cli/skel/FalconHistoryFileProvider.java     |  46 ---
 .../falcon/cli/skel/FalconPromptProvider.java   |  47 ---
 .../META-INF/spring/spring-shell-plugin.xml     |  40 ---
 .../commands/FalconConnectionCommandsTest.java  |  47 ---
 .../org/apache/falcon/FalconCLIConstants.java   |  81 -----
 .../java/org/apache/falcon/ValidationUtil.java  | 199 +++++++++++
 .../falcon/client/AbstractFalconClient.java     |  32 ++
 .../falcon/client/FalconCLIConstants.java       | 220 ++++++++++++
 .../org/apache/falcon/client/FalconClient.java  |   6 +-
 common/pom.xml                                  |  11 +-
 pom.xml                                         |   1 +
 shell/pom.xml                                   | 196 ++++++++++
 .../shell/commands/BaseFalconCommands.java      | 155 ++++++++
 .../shell/commands/FalconAdminCommands.java     |  64 ++++
 .../commands/FalconConnectionCommands.java      |  58 +++
 .../shell/commands/FalconEntityCommands.java    | 330 +++++++++++++++++
 .../shell/commands/FalconInstanceCommands.java  | 358 +++++++++++++++++++
 .../shell/commands/FalconMetadataCommands.java  | 162 +++++++++
 .../shell/commands/FalconProfileCommands.java   |  86 +++++
 .../apache/falcon/shell/skel/FalconBanner.java  |  64 ++++
 .../shell/skel/FalconHistoryFileProvider.java   |  46 +++
 .../falcon/shell/skel/FalconPromptProvider.java |  47 +++
 .../META-INF/spring/spring-shell-plugin.xml     |  40 +++
 shell/src/main/resources/shell.properties       |  25 ++
 .../src/test/FalconConnectionCommandsTest.java  |  47 +++
 src/bin/falcon-shell                            |  39 ++
 src/conf/shell.properties                       |  25 ++
 src/main/assemblies/standalone-package.xml      |   6 +
 .../apache/falcon/unit/FalconUnitClient.java    |  71 ++++
 .../java/org/apache/falcon/cli/FalconCLIIT.java |   2 +-
 .../org/apache/falcon/resource/TestContext.java |   2 +-
 43 files changed, 2570 insertions(+), 1329 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/pom.xml
----------------------------------------------------------------------
diff --git a/cli/pom.xml b/cli/pom.xml
index e0a8968..a41e6d9 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -215,15 +215,6 @@
                     </execution>
                 </executions>
             </plugin>
-            <plugin>
-                <groupId>org.apache.rat</groupId>
-                <artifactId>apache-rat-plugin</artifactId>
-                <configuration>
-                    <excludes>
-                        <exclude>falcon-cli-hist.log</exclude>
-                    </excludes>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 </project>

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
index 1b6d289..2c2d392 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconAdminCLI.java
@@ -23,20 +23,22 @@ import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
-import org.apache.falcon.FalconCLIConstants;
+import org.apache.falcon.client.FalconCLIConstants;
 import org.apache.falcon.client.FalconCLIException;
 import org.apache.falcon.client.FalconClient;
 
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Set;
+import static org.apache.falcon.client.FalconCLIConstants.STACK_OPTION;
 
 /**
  * Admin extension to Falcon Command Line Interface - wraps the RESTful API for admin commands.
  */
 public class FalconAdminCLI extends FalconCLI {
 
-    private static final String STACK_OPTION = "stack";
+
+
 
     public FalconAdminCLI() throws Exception {
         super();
@@ -73,8 +75,7 @@ public class FalconAdminCLI extends FalconCLI {
         return adminOptions;
     }
 
-    public int adminCommand(CommandLine commandLine, FalconClient client,
-                             String falconUrl) throws IOException {
+    public int adminCommand(CommandLine commandLine, FalconClient client, String falconUrl) throws IOException {
         String result;
         Set<String> optionsList = new HashSet<String>();
         for (Option option : commandLine.getOptions()) {

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
index bff818a..0dd11f6 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconCLI.java
@@ -24,21 +24,18 @@ import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.FalconCLIConstants;
+import org.apache.falcon.client.FalconCLIConstants;
 import org.apache.falcon.cliParser.CLIParser;
 import org.apache.falcon.client.FalconCLIException;
 import org.apache.falcon.client.FalconClient;
-import org.apache.falcon.entity.v0.EntityType;
-import org.apache.falcon.resource.EntityList;
-import org.apache.falcon.resource.InstancesResult;
-import org.apache.falcon.resource.InstancesSummaryResult;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintStream;
-import java.util.Arrays;
 import java.util.Properties;
 import java.util.concurrent.atomic.AtomicReference;
+import static org.apache.falcon.client.FalconCLIConstants.FALCON_URL;
+
 
 /**
  * Falcon Command Line Interface - wraps the RESTful API.
@@ -48,45 +45,6 @@ public class FalconCLI {
     public static final AtomicReference<PrintStream> ERR = new AtomicReference<PrintStream>(System.err);
     public static final AtomicReference<PrintStream> OUT = new AtomicReference<PrintStream>(System.out);
 
-    public static final String ENV_FALCON_DEBUG = "FALCON_DEBUG";
-    public static final String DEBUG_OPTION = "debug";
-    public static final String URL_OPTION = "url";
-    public static final String FALCON_URL = "FALCON_URL";
-
-    public static final String ADMIN_CMD = "admin";
-    public static final String HELP_CMD = "help";
-    public static final String METADATA_CMD = "metadata";
-    public static final String ENTITY_CMD = "entity";
-    public static final String INSTANCE_CMD = "instance";
-    public static final String RECIPE_CMD = "recipe";
-
-    public static final String TYPE_OPT = "type";
-    public static final String COLO_OPT = "colo";
-    public static final String CLUSTER_OPT = "cluster";
-    public static final String FEED_OPT = "feed";
-    public static final String PROCESS_OPT = "process";
-    public static final String ENTITY_NAME_OPT = "name";
-    public static final String FILE_PATH_OPT = "file";
-    public static final String VERSION_OPT = "version";
-    public static final String SCHEDULE_OPT = "schedule";
-    public static final String SUSPEND_OPT = "suspend";
-    public static final String RESUME_OPT = "resume";
-    public static final String STATUS_OPT = "status";
-    public static final String SUMMARY_OPT = "summary";
-    public static final String DEPENDENCY_OPT = "dependency";
-    public static final String LIST_OPT = "list";
-    public static final String SKIPDRYRUN_OPT = "skipDryRun";
-    public static final String FILTER_BY_OPT = "filterBy";
-    public static final String ORDER_BY_OPT = "orderBy";
-    public static final String SORT_ORDER_OPT = "sortOrder";
-    public static final String OFFSET_OPT = "offset";
-    public static final String NUM_RESULTS_OPT = "numResults";
-    public static final String START_OPT = "start";
-    public static final String END_OPT = "end";
-    public static final String CURRENT_COLO = "current.colo";
-    public static final String CLIENT_PROPERTIES = "/client.properties";
-    public static final String DO_AS_OPT = "doAs";
-
     private final Properties clientProperties;
 
     public FalconCLI() throws Exception {
@@ -206,29 +164,6 @@ public class FalconCLI {
         return integer;
     }
 
-    public static void validateEntityTypeForSummary(String type) {
-        EntityType entityType = EntityType.getEnum(type);
-        if (!entityType.isSchedulable()) {
-            throw new FalconCLIException("Invalid entity type " + entityType
-                    + " for EntitySummary API. Valid options are feed or process");
-        }
-    }
-
-    protected void validateNotEmpty(String paramVal, String paramName) {
-        if (StringUtils.isBlank(paramVal)) {
-            throw new FalconCLIException("Missing argument : " + paramName);
-        }
-    }
-
-    protected void validateSortOrder(String sortOrder) {
-        if (!StringUtils.isBlank(sortOrder)) {
-            if (!sortOrder.equalsIgnoreCase("asc") && !sortOrder.equalsIgnoreCase("desc")) {
-                throw new FalconCLIException("Value for param sortOrder should be \"asc\" or \"desc\". It is  : "
-                        + sortOrder);
-            }
-        }
-    }
-
     protected String getColo(String colo) throws IOException {
         if (colo == null) {
             Properties prop = getClientProperties();
@@ -237,52 +172,6 @@ public class FalconCLI {
         return colo;
     }
 
-    public static void validateFilterBy(String filterBy, String filterType) {
-        if (StringUtils.isEmpty(filterBy)) {
-            return;
-        }
-        String[] filterSplits = filterBy.split(",");
-        for (String s : filterSplits) {
-            String[] tempKeyVal = s.split(":", 2);
-            try {
-                if (filterType.equals("entity")) {
-                    EntityList.EntityFilterByFields.valueOf(tempKeyVal[0].toUpperCase());
-                } else if (filterType.equals("instance")) {
-                    InstancesResult.InstanceFilterFields.valueOf(tempKeyVal[0].toUpperCase());
-                }else if (filterType.equals("summary")) {
-                    InstancesSummaryResult.InstanceSummaryFilterFields.valueOf(tempKeyVal[0].toUpperCase());
-                } else {
-                    throw new IllegalArgumentException("Invalid API call: filterType is not valid");
-                }
-            } catch (IllegalArgumentException ie) {
-                throw new FalconCLIException("Invalid filterBy argument : " + tempKeyVal[0] + " in : " + s);
-            }
-        }
-    }
-
-    public static void validateOrderBy(String orderBy, String action) {
-        if (StringUtils.isBlank(orderBy)) {
-            return;
-        }
-        if (action.equals("instance")) {
-            if (Arrays.asList(new String[]{"status", "cluster", "starttime", "endtime"})
-                .contains(orderBy.toLowerCase())) {
-                return;
-            }
-        } else if (action.equals("entity")) {
-            if (Arrays.asList(new String[] {"type", "name"}).contains(orderBy.toLowerCase())) {
-                return;
-            }
-        } else if (action.equals("summary")) {
-            if (Arrays.asList(new String[]{"cluster"})
-                    .contains(orderBy.toLowerCase())) {
-                return;
-            }
-        }
-        throw new FalconCLIException("Invalid orderBy argument : " + orderBy);
-    }
-
-
     protected String getFalconEndpoint(CommandLine commandLine) throws IOException {
         String url = commandLine.getOptionValue(FalconCLIConstants.URL_OPTION);
         if (url == null) {

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
index facb147..a8aea52 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconEntityCLI.java
@@ -23,7 +23,8 @@ import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.FalconCLIConstants;
+import org.apache.falcon.client.FalconCLIConstants;
+import org.apache.falcon.ValidationUtil;
 import org.apache.falcon.ResponseHelper;
 import org.apache.falcon.client.FalconCLIException;
 import org.apache.falcon.client.FalconClient;
@@ -38,71 +39,82 @@ import java.util.Date;
 import java.util.HashSet;
 import java.util.Set;
 
+import static org.apache.falcon.client.FalconCLIConstants.SUBMIT_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.UPDATE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SCHEDULE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SUSPEND_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RESUME_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DELETE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SUBMIT_AND_SCHEDULE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.VALIDATE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SUBMIT_AND_SCHEDULE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.VALIDATE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.STATUS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEFINITION_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEPENDENCY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LIST_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LOOKUP_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SLA_MISS_ALERT_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SUMMARY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TOUCH_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.UPDATE_CLUSTER_DEPENDENTS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.URL_OPTION_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.URL_OPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TYPE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FILE_PATH_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FILE_PATH_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.ENTITY_NAME_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.ENTITY_NAME_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.START_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.START_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.END_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.END_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.COLO_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.COLO_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TYPE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.CLUSTER_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FIELDS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FIELDS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.FILTER_BY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FILTER_BY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TAGS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.TAGS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NAMESEQ_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.CLUSTER_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TAGKEYS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.TAGKEYS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.ORDER_BY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.ORDER_BY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SORT_ORDER_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SORT_ORDER_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.OFFSET_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.OFFSET_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_RESULTS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_RESULTS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_INSTANCES_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_INSTANCES_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.PATH_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.PATH_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SKIPDRYRUN_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SKIPDRYRUN_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DO_AS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.DO_AS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.PROPS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.PROPS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SHOWSCHEDULER_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SHOWSCHEDULER_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEBUG_OPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEBUG_OPTION_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NAMESEQ_OPT_DESCRIPTION;
+import static org.apache.falcon.ValidationUtil.validateNotEmpty;
+import static org.apache.falcon.ValidationUtil.validateSortOrder;
+
+
 /**
  * Entity extension to Falcon Command Line Interface - wraps the RESTful API for entities.
  */
 public class FalconEntityCLI extends FalconCLI {
 
-    public static final String SUBMIT_OPT_DESCRIPTION = "Submits an entity xml to Falcon";
-    public static final String UPDATE_OPT_DESCRIPTION = "Updates an existing entity";
-    public static final String DELETE_OPT_DESCRIPTION = "Deletes an entity in Falcon, and kills its instance from "
-            + "workflow engine";
-    public static final String SUBMIT_AND_SCHEDULE_OPT = "submitAndSchedule";
-    public static final String SUBMIT_AND_SCHEDULE_OPT_DESCRIPTION = "Submits an entity to Falcon and "
-            + "schedules it immediately";
-    public static final String VALIDATE_OPT = "validate";
-    public static final String VALIDATE_OPT_DESCRIPTION = "Validates an entity based on the entity type";
-    public static final String DEFINITION_OPT_DESCRIPTION = "Gets the Definition of entity";
-    public static final String SLA_MISS_ALERT_OPT_DESCRIPTION = "Get missing feed instances which missed SLA";
-
-
-    public static final String LOOKUP_OPT_DESCRIPTION = "Lookup a feed given its instance's path";
-    public static final String PATH_OPT = "path";
-    public static final String PATH_OPT_DESCRIPTION = "Path for a feed's instance";
-    public static final String TOUCH_OPT_DESCRIPTION = "Force update the entity in workflow engine"
-            + "(even without any changes to entity)";
-    public static final String PROPS_OPT = "properties";
-    public static final String PROPS_OPT_DESCRIPTION = "User supplied comma separated key value properties";
-    public static final String FIELDS_OPT = "fields";
-    public static final String FIELDS_OPT_DESCRIPTION = "Entity fields to show for a request";
-    public static final String TAGS_OPT = "tags";
-    public static final String TAGS_OPT_DESCRIPTION = "Filter returned entities by the specified tags";
-    public static final String NUM_INSTANCES_OPT = "numInstances";
-    public static final String NUM_INSTANCES_OPT_DESCRIPTION = "Number of instances to return per entity "
-            + "summary request";
-    public static final String NAMESEQ_OPT = "nameseq";
-    public static final String NAMESEQ_OPT_DESCRIPTION = "Subsequence of entity name";
-    public static final String TAGKEYS_OPT = "tagkeys";
-    public static final String TAGKEYS_OPT_DESCRIPTION = "Keywords in tags";
-    public static final String OFFSET_OPT_DESCRIPTION = "Start returning entities from this offset";
-    public static final String SHOWSCHEDULER_OPT = "showScheduler";
-    public static final String SHOWSCHEDULER_OPT_DESCRIPTION = "To return the scheduler "
-            + "on which the entity is scheduled.";
-    public static final String DEBUG_OPTION_DESCRIPTION = "Use debug mode to see debugging statements on stdout";
-    public static final String URL_OPTION_DESCRIPTION = "Falcon URL";
-    public static final String TYPE_OPT_DESCRIPTION = "Type of the entity. Valid entity types are: cluster, feed, "
-        + "process and datasource.";
-    public static final String COLO_OPT_DESCRIPTION = "Colo name";
-    public static final String END_OPT_DESCRIPTION = "End time is optional for summary";
-    public static final String CLUSTER_OPT_DESCRIPTION = "Cluster name";
-    public static final String ENTITY_NAME_OPT_DESCRIPTION = "Name of the entity, recommended but not mandatory "
-        + "to be unique.";
-    public static final String FILE_PATH_OPT_DESCRIPTION = "Path to entity xml file";
-    public static final String SCHEDULE_OPT_DESCRIPTION = "Schedules a submited entity in Falcon";
-    public static final String SUSPEND_OPT_DESCRIPTION = "Suspends a running entity in Falcon";
-    public static final String RESUME_OPT_DESCRIPTION = "Resumes a suspended entity in Falcon";
-    public static final String STATUS_OPT_DESCRIPTION = "Gets the status of entity";
-    public static final String SUMMARY_OPT_DESCRIPTION = "Get summary of instances for list of entities";
-    public static final String DEPENDENCY_OPT_DESCRIPTION = "Gets the dependencies of entity";
-    public static final String LIST_OPT_DESCRIPTION = "List entities registered for a type";
-    public static final String SKIPDRYRUN_OPT_DESCRIPTION = "skip dry run in workflow engine";
-    public static final String FILTER_BY_OPT_DESCRIPTION = "Filter returned entities by the specified status";
-    public static final String ORDER_BY_OPT_DESCRIPTION = "Order returned entities by this field";
-    public static final String SORT_ORDER_OPT_DESCRIPTION = "asc or desc order for results";
-    public static final String NUM_RESULTS_OPT_DESCRIPTION = "Number of results to return per request";
-    public static final String START_OPT_DESCRIPTION = "Start time is optional for summary";
-    public static final String DO_AS_OPT_DESCRIPTION = "doAs user";
-
     public FalconEntityCLI() throws Exception {
         super();
     }
@@ -129,11 +141,10 @@ public class FalconEntityCLI extends FalconCLI {
         Option entitySummary = new Option(FalconCLIConstants.SUMMARY_OPT, false, SUMMARY_OPT_DESCRIPTION);
         Option touch = new Option(FalconCLIConstants.TOUCH_OPT, false, TOUCH_OPT_DESCRIPTION);
 
-        Option updateClusterDependents = new Option(FalconCLIConstants.UPDATE_CLUSTER_DEPENDENTS_OPT, false,
+        Option updateClusterDependents = new Option(UPDATE_CLUSTER_DEPENDENTS_OPT, false,
                 "Updates dependent entities of a cluster in workflow engine");
 
         OptionGroup group = new OptionGroup();
-        group.addOption(submit);
         group.addOption(update);
         group.addOption(updateClusterDependents);
         group.addOption(schedule);
@@ -150,6 +161,7 @@ public class FalconEntityCLI extends FalconCLI {
         group.addOption(slaAlert);
         group.addOption(entitySummary);
         group.addOption(touch);
+        group.addOption(submit);
 
         Option url = new Option(URL_OPTION, true, URL_OPTION_DESCRIPTION);
         Option entityType = new Option(TYPE_OPT, true, TYPE_OPT_DESCRIPTION);
@@ -245,7 +257,7 @@ public class FalconEntityCLI extends FalconCLI {
         }
         EntityType entityTypeEnum = null;
         if (optionsList.contains(FalconCLIConstants.LIST_OPT)
-                || optionsList.contains(FalconCLIConstants.UPDATE_CLUSTER_DEPENDENTS_OPT)) {
+                || optionsList.contains(UPDATE_CLUSTER_DEPENDENTS_OPT)) {
             if (entityType == null) {
                 entityType = "";
             }
@@ -328,18 +340,18 @@ public class FalconEntityCLI extends FalconCLI {
             result = client.getDependency(entityType, entityName, doAsUser).toString();
         } else if (optionsList.contains(FalconCLIConstants.LIST_OPT)) {
             validateColo(optionsList);
-            validateEntityFields(fields);
-            validateOrderBy(orderBy, entityAction);
-            validateFilterBy(filterBy, entityAction);
+            ValidationUtil.validateEntityFields(fields);
+            ValidationUtil.validateOrderBy(orderBy, entityAction);
+            ValidationUtil.validateFilterBy(filterBy, entityAction);
             EntityList entityList = client.getEntityList(entityType, fields, nameSubsequence, tagKeywords,
                     filterBy, filterTags, orderBy, sortOrder, offset, numResults, doAsUser);
             result = entityList != null ? entityList.toString() : "No entity of type (" + entityType + ") found.";
         }  else if (optionsList.contains(FalconCLIConstants.SUMMARY_OPT)) {
-            validateEntityTypeForSummary(entityType);
+            ValidationUtil.validateEntityTypeForSummary(entityType);
             validateNotEmpty(cluster, FalconCLIConstants.CLUSTER_OPT);
-            validateEntityFields(fields);
-            validateFilterBy(filterBy, entityAction);
-            validateOrderBy(orderBy, entityAction);
+            ValidationUtil.validateEntityFields(fields);
+            ValidationUtil.validateFilterBy(filterBy, entityAction);
+            ValidationUtil.validateOrderBy(orderBy, entityAction);
             result = ResponseHelper.getString(client.getEntitySummary(
                     entityType, cluster, start, end, fields, filterBy, filterTags,
                     orderBy, sortOrder, offset, numResults, numInstances, doAsUser));
@@ -363,20 +375,6 @@ public class FalconEntityCLI extends FalconCLI {
         }
     }
 
-    public static void validateEntityFields(String fields) {
-        if (StringUtils.isEmpty(fields)) {
-            return;
-        }
-        String[] fieldsList = fields.split(",");
-        for (String s : fieldsList) {
-            try {
-                EntityList.EntityFieldList.valueOf(s.toUpperCase());
-            } catch (IllegalArgumentException ie) {
-                throw new FalconCLIException("Invalid fields argument : " + FalconCLIConstants.FIELDS_OPT);
-            }
-        }
-    }
-
     private Date parseDateString(String time) {
         if (time != null && !time.isEmpty()) {
             try {

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
index a8a30ab..dafd7a8 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconExtensionCLI.java
@@ -27,7 +27,7 @@ import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.FalconCLIConstants;
+import org.apache.falcon.client.FalconCLIConstants;
 import org.apache.falcon.client.FalconCLIException;
 import org.apache.falcon.client.FalconClient;
 import org.apache.falcon.resource.ExtensionInstanceList;

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
index f882eb5..cd2ade0 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconInstanceCLI.java
@@ -22,7 +22,8 @@ import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
-import org.apache.falcon.FalconCLIConstants;
+import org.apache.falcon.client.FalconCLIConstants;
+import org.apache.falcon.ValidationUtil;
 import org.apache.falcon.LifeCycle;
 import org.apache.falcon.ResponseHelper;
 import org.apache.falcon.client.FalconCLIException;
@@ -30,32 +31,89 @@ import org.apache.falcon.client.FalconClient;
 import org.apache.falcon.resource.InstanceDependencyResult;
 
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
+import static org.apache.falcon.client.FalconCLIConstants.RUNNING_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.RUNNING_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LIST_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LIST_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.STATUS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.STATUS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SUMMARY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SUMMARY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.KILL_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.KILL_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SUSPEND_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SUSPEND_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RESUME_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.RESUME_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RERUN_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LOG_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LOG_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.PARARMS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.PARARMS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LISTING_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LISTING_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEPENDENCY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEPENDENCY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.TRIAGE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.TRIAGE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SEARCH_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.URL_OPTION;
+import static org.apache.falcon.client.FalconCLIConstants.START_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.START_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.END_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.END_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RUNID_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.CLUSTERS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.CLUSTERS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SOURCECLUSTER_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SOURCECLUSTER_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.FILE_PATH_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FILE_PATH_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TYPE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.TYPE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.ENTITY_NAME_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.ENTITY_NAME_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.COLO_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.COLO_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RERUN_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.URL_OPTION_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RUNID_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LIFECYCLE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LIFECYCLE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.FILTER_BY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FILTER_BY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.ORDER_BY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.ORDER_BY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.SORT_ORDER_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.SORT_ORDER_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.OFFSET_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.OFFSET_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_RESULTS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_RESULTS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.FORCE_RERUN_FLAG;
+import static org.apache.falcon.client.FalconCLIConstants.FORCE_RERUN_FLAG_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DO_AS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.DO_AS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEBUG_OPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEBUG_OPTION_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.INSTANCE_TIME_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.INSTANCE_TIME_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.ALL_ATTEMPTS;
+import static org.apache.falcon.client.FalconCLIConstants.ALL_ATTEMPTS_DESCRIPTION;
+import static org.apache.falcon.ValidationUtil.getLifeCycle;
+import static org.apache.falcon.ValidationUtil.validateSortOrder;
+import static org.apache.falcon.ValidationUtil.validateNotEmpty;
+
+
 /**
  * Instance extension to Falcon Command Line Interface - wraps the RESTful API for instances.
  */
 public class FalconInstanceCLI extends FalconCLI {
 
-    private static final String FORCE_RERUN_FLAG = "force";
-    private static final String INSTANCE_TIME_OPT = "instanceTime";
-    private static final String RUNNING_OPT = "running";
-    private static final String KILL_OPT = "kill";
-    private static final String RERUN_OPT = "rerun";
-    private static final String LOG_OPT = "logs";
-    private static final String SEARCH_OPT = "search";
-    private static final String ALL_ATTEMPTS = "allAttempts";
-    private static final String RUNID_OPT = "runid";
-    private static final String CLUSTERS_OPT = "clusters";
-    private static final String SOURCECLUSTER_OPT = "sourceClusters";
-    private static final String LIFECYCLE_OPT = "lifecycle";
-    private static final String PARARMS_OPT = "params";
-    private static final String LISTING_OPT = "listing";
-    private static final String TRIAGE_OPT = "triage";
-
     public FalconInstanceCLI() throws Exception {
         super();
     }
@@ -63,40 +121,21 @@ public class FalconInstanceCLI extends FalconCLI {
     public Options createInstanceOptions() {
 
         Options instanceOptions = new Options();
-
-        Option running = new Option(RUNNING_OPT, false,
-                "Gets running process instances for a given process");
-        Option list = new Option(FalconCLIConstants.LIST_OPT, false,
-                "Gets all instances for a given process in the range start time and optional end time");
-        Option status = new Option(FalconCLIConstants.STATUS_OPT, false,
-                "Gets status of process instances for a given process in the range start time and optional end time");
-        Option summary = new Option(FalconCLIConstants.SUMMARY_OPT, false,
-                "Gets summary of instances for a given process in the range start time and optional end time");
-        Option kill = new Option(KILL_OPT, false,
-                "Kills active process instances for a given process in the range start time and optional end time");
-        Option suspend = new Option(FalconCLIConstants.SUSPEND_OPT, false,
-                "Suspends active process instances for a given process in the range start time and optional end time");
-        Option resume = new Option(FalconCLIConstants.RESUME_OPT, false,
-                "Resumes suspended process instances for a given process "
-                        + "in the range start time and optional end time");
-        Option rerun = new Option(RERUN_OPT, false,
-                "Reruns process instances for a given process in the range start time and "
-                        + "optional end time and overrides properties present in job.properties file");
-        Option logs = new Option(LOG_OPT, false,
-                "Logs print the logs for process instances for a given process in "
-                        + "the range start time and optional end time");
-        Option params = new Option(PARARMS_OPT, false,
-                "Displays the workflow parameters for a given instance of specified nominal time"
-                        + "start time represents nominal time and end time is not considered");
-        Option listing = new Option(LISTING_OPT, false,
-                "Displays feed listing and their status between a start and end time range.");
-        Option dependency = new Option(FalconCLIConstants.DEPENDENCY_OPT, false,
-                "Displays dependent instances for a specified instance.");
-        Option triage = new Option(TRIAGE_OPT, false,
-                "Triage a feed or process instance and find the failures in it's lineage.");
+        Option running = new Option(RUNNING_OPT, false, RUNNING_OPT_DESCRIPTION);
+        Option list = new Option(LIST_OPT, false, LIST_OPT_DESCRIPTION);
+        Option status = new Option(STATUS_OPT, false, STATUS_OPT_DESCRIPTION);
+        Option summary = new Option(SUMMARY_OPT, false, SUMMARY_OPT_DESCRIPTION);
+        Option kill = new Option(KILL_OPT, false, KILL_OPT_DESCRIPTION);
+        Option suspend = new Option(SUSPEND_OPT, false, SUSPEND_OPT_DESCRIPTION);
+        Option resume = new Option(RESUME_OPT, false, RESUME_OPT_DESCRIPTION);
+        Option rerun = new Option(RERUN_OPT, false, RERUN_OPT_DESCRIPTION);
+        Option logs = new Option(LOG_OPT, false, LOG_OPT_DESCRIPTION);
+        Option params = new Option(PARARMS_OPT, false, PARARMS_OPT_DESCRIPTION);
+        Option listing = new Option(LISTING_OPT, false, LISTING_OPT_DESCRIPTION);
+        Option dependency = new Option(DEPENDENCY_OPT, false, DEPENDENCY_OPT_DESCRIPTION);
+        Option triage = new Option(TRIAGE_OPT, false, TRIAGE_OPT_DESCRIPTION);
         Option search = new Option(SEARCH_OPT, false,
                 "Search instances with filtering criteria on the entity, instance time and status.");
-
         OptionGroup group = new OptionGroup();
         group.addOption(running);
         group.addOption(list);
@@ -114,52 +153,32 @@ public class FalconInstanceCLI extends FalconCLI {
         group.addOption(triage);
         group.addOption(search);
 
-        Option url = new Option(FalconCLIConstants.URL_OPTION, true, "Falcon URL");
-        Option start = new Option(FalconCLIConstants.START_OPT, true,
-                "Start time is required for commands, status, kill, suspend, resume and re-run"
-                        + "and it is nominal time while displaying workflow params");
-        Option end = new Option(FalconCLIConstants.END_OPT, true,
-                "End time is optional for commands, status, kill, suspend, resume and re-run; "
-                        + "if not specified then current time is considered as end time");
-        Option runid = new Option(RUNID_OPT, true,
-                "Instance runid  is optional and user can specify the runid, defaults to 0");
-        Option clusters = new Option(CLUSTERS_OPT, true,
-                "clusters is optional for commands kill, suspend and resume, "
-                        + "should not be specified for other commands");
-        Option sourceClusters = new Option(SOURCECLUSTER_OPT, true,
-                " source cluster is optional for commands kill, suspend and resume, "
-                        + "should not be specified for other commands (required for only feed)");
-        Option filePath = new Option(FalconCLIConstants.FILE_PATH_OPT, true,
-                "Path to job.properties file is required for rerun command, "
-                        + "it should contain name=value pair for properties to override for rerun");
-        Option entityType = new Option(FalconCLIConstants.TYPE_OPT, true,
-                "Entity type, can be feed or process xml");
-        Option entityName = new Option(FalconCLIConstants.ENTITY_NAME_OPT, true,
-                "Entity name, can be feed or process name");
-        Option colo = new Option(FalconCLIConstants.COLO_OPT, true,
-                "Colo on which the cmd has to be executed");
-        Option lifecycle = new Option(LIFECYCLE_OPT, true,
-                "describes life cycle of entity , for feed it can be replication/retention "
-                        + "and for process it can be execution");
-        Option filterBy = new Option(FalconCLIConstants.FILTER_BY_OPT, true,
-                "Filter returned instances by the specified fields");
-        Option orderBy = new Option(FalconCLIConstants.ORDER_BY_OPT, true,
-                "Order returned instances by this field");
-        Option sortOrder = new Option(FalconCLIConstants.SORT_ORDER_OPT, true, "asc or desc order for results");
-        Option offset = new Option(FalconCLIConstants.OFFSET_OPT, true,
-                "Start returning instances from this offset");
-        Option numResults = new Option(FalconCLIConstants.NUM_RESULTS_OPT, true,
-                "Number of results to return per request");
-        Option forceRerun = new Option(FORCE_RERUN_FLAG, false,
-                "Flag to forcefully rerun entire workflow of an instance");
-        Option doAs = new Option(FalconCLIConstants.DO_AS_OPT, true, "doAs user");
-        Option debug = new Option(FalconCLIConstants.DEBUG_OPTION, false, "Use debug mode to see"
-                + " debugging statements on stdout");
-        Option instanceTime = new Option(INSTANCE_TIME_OPT, true, "Time for an instance");
+        Option url = new Option(URL_OPTION, true, URL_OPTION_DESCRIPTION);
+        Option start = new Option(START_OPT, true, START_OPT_DESCRIPTION);
+        Option end = new Option(END_OPT, true, END_OPT_DESCRIPTION);
+        Option runid = new Option(RUNID_OPT, true, RUNID_OPT_DESCRIPTION);
+        Option clusters = new Option(CLUSTERS_OPT, true, CLUSTERS_OPT_DESCRIPTION);
+        Option sourceClusters = new Option(SOURCECLUSTER_OPT, true, SOURCECLUSTER_OPT_DESCRIPTION);
+        Option filePath = new Option(FILE_PATH_OPT, true, FILE_PATH_OPT_DESCRIPTION);
+        Option entityType = new Option(TYPE_OPT, true, TYPE_OPT_DESCRIPTION);
+        Option entityName = new Option(ENTITY_NAME_OPT, true, ENTITY_NAME_OPT_DESCRIPTION);
+        Option colo = new Option(COLO_OPT, true, COLO_OPT_DESCRIPTION);
+        Option lifecycle = new Option(LIFECYCLE_OPT, true, LIFECYCLE_OPT_DESCRIPTION);
+        Option filterBy = new Option(FILTER_BY_OPT, true, FILTER_BY_OPT_DESCRIPTION);
+        Option orderBy = new Option(ORDER_BY_OPT, true, ORDER_BY_OPT_DESCRIPTION);
+        Option sortOrder = new Option(SORT_ORDER_OPT, true, SORT_ORDER_OPT_DESCRIPTION);
+        Option offset = new Option(OFFSET_OPT, true, OFFSET_OPT_DESCRIPTION);
+        Option numResults = new Option(NUM_RESULTS_OPT, true, NUM_RESULTS_OPT_DESCRIPTION);
+        Option forceRerun = new Option(FORCE_RERUN_FLAG, false, FORCE_RERUN_FLAG_DESCRIPTION);
+        Option doAs = new Option(DO_AS_OPT, true, DO_AS_OPT_DESCRIPTION);
+        Option debug = new Option(DEBUG_OPTION, false, DEBUG_OPTION_DESCRIPTION);
+
+        Option instanceTime = new Option(INSTANCE_TIME_OPT, true, INSTANCE_TIME_OPT_DESCRIPTION);
+
+        Option allAttempts = new Option(ALL_ATTEMPTS, false, ALL_ATTEMPTS_DESCRIPTION);
         Option instanceStatus = new Option(FalconCLIConstants.INSTANCE_STATUS_OPT, true, "Instance status");
         Option nameSubsequence = new Option(FalconCLIConstants.NAMESEQ_OPT, true, "Subsequence of entity name");
         Option tagKeywords = new Option(FalconCLIConstants.TAGKEYS_OPT, true, "Keywords in tags");
-        Option allAttempts = new Option(ALL_ATTEMPTS, false, "To get all attempts of corresponding instances");
 
         instanceOptions.addOption(url);
         instanceOptions.addOptionGroup(group);
@@ -230,7 +249,7 @@ public class FalconInstanceCLI extends FalconCLI {
             validateNotEmpty(colo, FalconCLIConstants.COLO_OPT);
             validateNotEmpty(start, FalconCLIConstants.START_OPT);
             validateNotEmpty(type, FalconCLIConstants.TYPE_OPT);
-            validateEntityTypeForSummary(type);
+            ValidationUtil.validateEntityTypeForSummary(type);
             validateNotEmpty(entity, FalconCLIConstants.ENTITY_NAME_OPT);
             result = client.triage(type, entity, start, colo).toString();
         } else if (optionsList.contains(FalconCLIConstants.DEPENDENCY_OPT)) {
@@ -239,8 +258,8 @@ public class FalconInstanceCLI extends FalconCLI {
             result = ResponseHelper.getString(response);
 
         } else if (optionsList.contains(RUNNING_OPT)) {
-            validateOrderBy(orderBy, instanceAction);
-            validateFilterBy(filterBy, instanceAction);
+            ValidationUtil.validateOrderBy(orderBy, instanceAction);
+            ValidationUtil.validateFilterBy(filterBy, instanceAction);
             result = ResponseHelper.getString(client.getRunningInstances(type,
                     entity, colo, lifeCycles, filterBy, orderBy, sortOrder, offset, numResults, doAsUser));
         } else if (optionsList.contains(FalconCLIConstants.STATUS_OPT)
@@ -249,13 +268,13 @@ public class FalconInstanceCLI extends FalconCLI {
             if (optionsList.contains(ALL_ATTEMPTS)) {
                 allAttempts = true;
             }
-            validateOrderBy(orderBy, instanceAction);
-            validateFilterBy(filterBy, instanceAction);
+            ValidationUtil.validateOrderBy(orderBy, instanceAction);
+            ValidationUtil.validateFilterBy(filterBy, instanceAction);
             result = ResponseHelper.getString(client.getStatusOfInstances(type, entity, start, end, colo,
                     lifeCycles, filterBy, orderBy, sortOrder, offset, numResults, doAsUser, allAttempts));
         } else if (optionsList.contains(FalconCLIConstants.SUMMARY_OPT)) {
-            validateOrderBy(orderBy, "summary");
-            validateFilterBy(filterBy, "summary");
+            ValidationUtil.validateOrderBy(orderBy, "summary");
+            ValidationUtil.validateFilterBy(filterBy, "summary");
             result = ResponseHelper.getString(client.getSummaryOfInstances(type, entity, start, end, colo,
                     lifeCycles, filterBy, orderBy, sortOrder, doAsUser));
         } else if (optionsList.contains(KILL_OPT)) {
@@ -283,8 +302,8 @@ public class FalconInstanceCLI extends FalconCLI {
             result = ResponseHelper.getString(client.rerunInstances(type, entity, start, end, filePath, colo,
                     clusters, sourceClusters, lifeCycles, isForced, doAsUser));
         } else if (optionsList.contains(LOG_OPT)) {
-            validateOrderBy(orderBy, instanceAction);
-            validateFilterBy(filterBy, instanceAction);
+            ValidationUtil.validateOrderBy(orderBy, instanceAction);
+            ValidationUtil.validateFilterBy(filterBy, instanceAction);
             result = ResponseHelper.getString(client.getLogsOfInstances(type, entity, start, end, colo, runId,
                     lifeCycles, filterBy, orderBy, sortOrder, offset, numResults, doAsUser), runId);
         } else if (optionsList.contains(PARARMS_OPT)) {
@@ -338,21 +357,4 @@ public class FalconInstanceCLI extends FalconCLI {
         }
     }
 
-    private List<LifeCycle> getLifeCycle(String lifeCycleValue) {
-
-        if (lifeCycleValue != null) {
-            String[] lifeCycleValues = lifeCycleValue.split(",");
-            List<LifeCycle> lifeCycles = new ArrayList<LifeCycle>();
-            try {
-                for (String lifeCycle : lifeCycleValues) {
-                    lifeCycles.add(LifeCycle.valueOf(lifeCycle.toUpperCase().trim()));
-                }
-            } catch (IllegalArgumentException e) {
-                throw new FalconCLIException("Invalid life cycle values: " + lifeCycles, e);
-            }
-            return lifeCycles;
-        }
-        return null;
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java b/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
index 98a29ef..ec53e7c 100644
--- a/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
+++ b/cli/src/main/java/org/apache/falcon/cli/FalconMetadataCLI.java
@@ -23,7 +23,7 @@ import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.FalconCLIConstants;
+import org.apache.falcon.client.FalconCLIConstants;
 import org.apache.falcon.client.FalconCLIException;
 import org.apache.falcon.client.FalconClient;
 import org.apache.falcon.entity.v0.EntityType;
@@ -34,6 +34,60 @@ import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 
+import static org.apache.falcon.client.FalconCLIConstants.DISCOVERY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.DISCOVERY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LINEAGE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LINEAGE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.PIPELINE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.PIPELINE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.LIST_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.LIST_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.RELATIONS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.RELATIONS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.URL_OPTION;
+import static org.apache.falcon.client.FalconCLIConstants.URL_OPTION_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.TYPE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.TYPE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NAME_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.NAME_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEBUG_OPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DEBUG_OPTION_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DIRECTION_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.DIRECTION_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.VALUE_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.VALUE_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.KEY_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.KEY_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.ID_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.ID_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.EDGE_CMD_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.EDGE_CMD;
+import static org.apache.falcon.client.FalconCLIConstants.VERTEX_EDGES_CMD_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.VERTEX_EDGES_CMD;
+import static org.apache.falcon.client.FalconCLIConstants.VERTICES_CMD_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.VERTICES_CMD;
+import static org.apache.falcon.client.FalconCLIConstants.VERTEX_CMD_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.VERTEX_CMD;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_RESULTS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.NUM_RESULTS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.PROCESS_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.PROCESS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.FEED_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.FEED_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.CLUSTER_OPT_DESCRIPTION;
+import static org.apache.falcon.client.FalconCLIConstants.CLUSTER_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.DO_AS_OPT;
+import static org.apache.falcon.client.FalconCLIConstants.DO_AS_DESCRIPTION;
+import static org.apache.falcon.ValidationUtil.validateDimensionName;
+import static org.apache.falcon.ValidationUtil.validateDimensionType;
+import static org.apache.falcon.ValidationUtil.validateId;
+import static org.apache.falcon.ValidationUtil.validateScheduleEntity;
+import static org.apache.falcon.ValidationUtil.validateVertexEdgesCommand;
+import static org.apache.falcon.ValidationUtil.validateVerticesCommand;
+import static org.apache.falcon.ValidationUtil.validatePipelineName;
+
+
+
 /**
  * Metadata extension to Falcon Command Line Interface - wraps the RESTful API for Metadata.
  */
@@ -41,21 +95,6 @@ public class FalconMetadataCLI extends FalconCLI {
 
     public static final AtomicReference<PrintStream> OUT = new AtomicReference<PrintStream>(System.out);
 
-    // Discovery Commands
-    public static final String DISCOVERY_OPT = "discovery";
-    public static final String LIST_OPT = "list";
-    public static final String URL_OPTION = "url";
-
-    // Lineage Commands
-    public static final String LINEAGE_OPT = "lineage";
-    public static final String VERTEX_CMD = "vertex";
-    public static final String VERTICES_CMD = "vertices";
-    public static final String VERTEX_EDGES_CMD = "edges";
-    public static final String EDGE_CMD = "edge";
-    public static final String ID_OPT = "id";
-    public static final String KEY_OPT = "key";
-    public static final String VALUE_OPT = "value";
-    public static final String DIRECTION_OPT = "direction";
 
     public FalconMetadataCLI() throws Exception {
         super();
@@ -65,29 +104,27 @@ public class FalconMetadataCLI extends FalconCLI {
         Options metadataOptions = new Options();
 
         OptionGroup group = new OptionGroup();
-        Option discovery = new Option(DISCOVERY_OPT, false, "Discover falcon metadata relations");
-        Option lineage = new Option(LINEAGE_OPT, false, "Get falcon metadata lineage information");
+        Option discovery = new Option(DISCOVERY_OPT, false, DISCOVERY_OPT_DESCRIPTION);
+        Option lineage = new Option(LINEAGE_OPT, false, LINEAGE_OPT_DESCRIPTION);
         group.addOption(discovery);
         group.addOption(lineage);
-        Option pipeline = new Option(FalconCLIConstants.PIPELINE_OPT, true,
-                "Get lineage graph for the entities in a pipeline");
+        Option pipeline = new Option(PIPELINE_OPT, true, PIPELINE_OPT_DESCRIPTION);
         metadataOptions.addOptionGroup(group);
 
         // Add discovery options
 
-        Option list = new Option(LIST_OPT, false, "List all dimensions");
-        Option relations = new Option(FalconCLIConstants.RELATIONS_OPT, false, "List all relations for a dimension");
+        Option list = new Option(LIST_OPT, false, LIST_OPT_DESCRIPTION);
+        Option relations = new Option(RELATIONS_OPT, false, RELATIONS_OPT_DESCRIPTION);
         metadataOptions.addOption(list);
         metadataOptions.addOption(relations);
 
-        Option url = new Option(URL_OPTION, true, "Falcon URL");
-        Option type = new Option(FalconCLIConstants.TYPE_OPT, true, "Dimension type");
-        Option name = new Option(FalconCLIConstants.NAME_OPT, true, "Dimension name");
-        Option cluster = new Option(FalconCLIConstants.CLUSTER_OPT, true, "Cluster name");
-        Option feed = new Option(FalconCLIConstants.FEED_OPT, true, "Feed Entity name");
-        Option process = new Option(FalconCLIConstants.PROCESS_OPT, true, "Process Entity name");
-        Option numResults = new Option(FalconCLIConstants.NUM_RESULTS_OPT, true,
-                "Number of results to return per request");
+        Option url = new Option(URL_OPTION, true, URL_OPTION_DESCRIPTION);
+        Option type = new Option(TYPE_OPT, true, TYPE_OPT_DESCRIPTION);
+        Option name = new Option(NAME_OPT, true, NAME_OPT_DESCRIPTION);
+        Option cluster = new Option(CLUSTER_OPT, true, CLUSTER_OPT_DESCRIPTION);
+        Option feed = new Option(FEED_OPT, true, FEED_OPT_DESCRIPTION);
+        Option process = new Option(PROCESS_OPT, true, PROCESS_OPT_DESCRIPTION);
+        Option numResults = new Option(NUM_RESULTS_OPT, true, NUM_RESULTS_OPT_DESCRIPTION);
 
         // Add lineage options
         metadataOptions.addOption(pipeline);
@@ -100,16 +137,15 @@ public class FalconMetadataCLI extends FalconCLI {
         metadataOptions.addOption(process);
         metadataOptions.addOption(numResults);
 
-        Option vertex = new Option(VERTEX_CMD, false, "show the vertices");
-        Option vertices = new Option(VERTICES_CMD, false, "show the vertices");
-        Option vertexEdges = new Option(VERTEX_EDGES_CMD, false, "show the edges for a given vertex");
-        Option edges = new Option(EDGE_CMD, false, "show the edges");
-        Option id = new Option(ID_OPT, true, "vertex or edge id");
-        Option key = new Option(KEY_OPT, true, "key property");
-        Option value = new Option(VALUE_OPT, true, "value property");
-        Option direction = new Option(DIRECTION_OPT, true, "edge direction property");
-        Option debug = new Option(FalconCLIConstants.DEBUG_OPTION, false,
-                "Use debug mode to see debugging statements on stdout");
+        Option vertex = new Option(VERTEX_CMD, false, VERTEX_CMD_DESCRIPTION);
+        Option vertices = new Option(VERTICES_CMD, false, VERTICES_CMD_DESCRIPTION);
+        Option vertexEdges = new Option(VERTEX_EDGES_CMD, false, VERTEX_EDGES_CMD_DESCRIPTION);
+        Option edges = new Option(EDGE_CMD, false, EDGE_CMD_DESCRIPTION);
+        Option id = new Option(ID_OPT, true, ID_OPT_DESCRIPTION);
+        Option key = new Option(KEY_OPT, true, KEY_OPT_DESCRIPTION);
+        Option value = new Option(VALUE_OPT, true, VALUE_OPT_DESCRIPTION);
+        Option direction = new Option(DIRECTION_OPT, true, DIRECTION_OPT_DESCRIPTION);
+        Option debug = new Option(DEBUG_OPTION, false, DEBUG_OPTION_DESCRIPTION);
 
         metadataOptions.addOption(vertex);
         metadataOptions.addOption(vertices);
@@ -121,7 +157,8 @@ public class FalconMetadataCLI extends FalconCLI {
         metadataOptions.addOption(direction);
         metadataOptions.addOption(debug);
 
-        Option doAs = new Option(FalconCLIConstants.DO_AS_OPT, true, "doAs user");
+        Option doAs = new Option(DO_AS_OPT, true, DO_AS_DESCRIPTION);
+
         metadataOptions.addOption(doAs);
 
         return metadataOptions;
@@ -196,63 +233,5 @@ public class FalconMetadataCLI extends FalconCLI {
         OUT.get().println(result);
     }
 
-    private void validatePipelineName(String pipeline) {
-        if (StringUtils.isEmpty(pipeline)) {
-            throw new FalconCLIException("Invalid value for pipeline");
-        }
-    }
-
-    private void validateDimensionType(String dimensionType) {
-        if (StringUtils.isEmpty(dimensionType)
-                ||  dimensionType.contains("INSTANCE")) {
-            throw new FalconCLIException("Invalid value provided for queryParam \"type\" " + dimensionType);
-        }
-        try {
-            RelationshipType.valueOf(dimensionType);
-        } catch (IllegalArgumentException iae) {
-            throw new FalconCLIException("Invalid value provided for queryParam \"type\" " + dimensionType);
-        }
-    }
-
-    private void validateDimensionName(String dimensionName, String action) {
-        if (StringUtils.isEmpty(dimensionName)) {
-            throw new FalconCLIException("Dimension ID cannot be empty or null for action " + action);
-        }
-    }
-
-    private void validateScheduleEntity(String schedEntityType, String schedEntityName) {
-        if (StringUtils.isBlank(schedEntityType)) {
-            throw new FalconCLIException("Entity must be schedulable type : -feed/process");
-        }
 
-        if (StringUtils.isBlank(schedEntityName)) {
-            throw new FalconCLIException("Entity name is missing");
-        }
-    }
-
-    private void validateId(String id) {
-        if (id == null || id.length() == 0) {
-            throw new FalconCLIException("Missing argument: id");
-        }
-    }
-
-    private void validateVerticesCommand(String key, String value) {
-        if (key == null || key.length() == 0) {
-            throw new FalconCLIException("Missing argument: key");
-        }
-
-        if (value == null || value.length() == 0) {
-            throw new FalconCLIException("Missing argument: value");
-        }
-    }
-
-    private void validateVertexEdgesCommand(String id, String direction) {
-        if (id == null || id.length() == 0) {
-            throw new FalconCLIException("Missing argument: id");
-        }
-
-        if (direction == null || direction.length() == 0) {
-            throw new FalconCLIException("Missing argument: direction");
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java b/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
deleted file mode 100644
index acff70e..0000000
--- a/cli/src/main/java/org/apache/falcon/cli/commands/BaseFalconCommands.java
+++ /dev/null
@@ -1,150 +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.falcon.cli.commands;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.falcon.client.AbstractFalconClient;
-import org.apache.falcon.client.FalconCLIException;
-import org.apache.falcon.client.FalconClient;
-import org.springframework.shell.core.ExecutionProcessor;
-import org.springframework.shell.event.ParseResult;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import static org.apache.falcon.cli.FalconCLI.CURRENT_COLO;
-import static org.apache.falcon.cli.FalconCLI.FALCON_URL;
-
-/**
- * Common code for all falcon command classes.
- */
-public class BaseFalconCommands implements ExecutionProcessor {
-    private static final String FALCON_URL_PROPERTY = "falcon.url";
-    private static final String DO_AS = "DO_AS";
-    private static final String DO_AS_PROPERTY = "do.as";
-    private static final String CLIENT_PROPERTIES = "/client.properties";
-    protected static final String FALCON_URL_ABSENT = "Failed to get falcon url from environment or client properties";
-    private static Properties clientProperties;
-    private static Properties backupProperties = new Properties();
-    private static AbstractFalconClient client;
-
-    protected static Properties getClientProperties() {
-        if (clientProperties == null) {
-            InputStream inputStream = null;
-            Properties prop = new Properties(System.getProperties());
-            prop.putAll(backupProperties);
-            try {
-                inputStream = BaseFalconCommands.class.getResourceAsStream(CLIENT_PROPERTIES);
-                if (inputStream != null) {
-                    try {
-                        prop.load(inputStream);
-                    } catch (IOException e) {
-                        throw new FalconCLIException(e);
-                    }
-                }
-            } finally {
-                IOUtils.closeQuietly(inputStream);
-            }
-            String urlOverride = System.getenv(FALCON_URL);
-            if (urlOverride != null) {
-                prop.setProperty(FALCON_URL_PROPERTY, urlOverride);
-            }
-            if (prop.getProperty(FALCON_URL_PROPERTY) == null) {
-                throw new FalconCLIException(FALCON_URL_ABSENT);
-            }
-            String doAsOverride = System.getenv(DO_AS);
-            if (doAsOverride != null) {
-                prop.setProperty(DO_AS_PROPERTY, doAsOverride);
-            }
-            clientProperties = prop;
-            backupProperties.clear();
-        }
-        return clientProperties;
-    }
-
-    static void setClientProperty(String key, String value) {
-        Properties props;
-        try {
-            props = getClientProperties();
-        } catch (FalconCLIException e) {
-            props = backupProperties;
-        }
-        if (StringUtils.isBlank(value)) {
-            props.remove(key);
-        } else {
-            props.setProperty(key, value);
-        }
-        // Re-load client in the next call
-        client = null;
-    }
-
-    public static AbstractFalconClient getFalconClient() {
-        if (client == null) {
-            client = new FalconClient(getClientProperties().getProperty(FALCON_URL_PROPERTY), getClientProperties());
-        }
-        return client;
-    }
-
-    public static void setFalconClient(AbstractFalconClient abstractFalconClient) {
-        client = abstractFalconClient;
-    }
-
-    protected String getColo(String colo) {
-        if (colo == null) {
-            Properties prop = getClientProperties();
-            colo = prop.getProperty(CURRENT_COLO, "*");
-        }
-        return colo;
-    }
-
-    protected String getDoAs() {
-        return getClientProperties().getProperty(DO_AS_PROPERTY);
-    }
-
-    @Override
-    public ParseResult beforeInvocation(ParseResult parseResult) {
-        Object[] args = parseResult.getArguments();
-        if (args != null) {
-            boolean allEqual = true;
-            for (int i = 1; i < args.length; i++) {
-                allEqual &= args[0].equals(args[i]);
-            }
-            if (allEqual) {
-                if (args[0] instanceof String) {
-                    String[] split = ((String) args[0]).split("\\s+");
-                    Object[] newArgs = new String[args.length];
-                    System.arraycopy(split, 0, newArgs, 0, split.length);
-                    parseResult = new ParseResult(parseResult.getMethod(), parseResult.getInstance(), newArgs);
-                }
-            }
-        }
-        return parseResult;
-    }
-
-    @Override
-    public void afterReturningInvocation(ParseResult parseResult, Object o) {
-
-    }
-
-    @Override
-    public void afterThrowingInvocation(ParseResult parseResult, Throwable throwable) {
-    }
-}

http://git-wip-us.apache.org/repos/asf/falcon/blob/da767c2f/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java b/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
deleted file mode 100644
index c1e7e30..0000000
--- a/cli/src/main/java/org/apache/falcon/cli/commands/FalconConnectionCommands.java
+++ /dev/null
@@ -1,58 +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.falcon.cli.commands;
-
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.shell.core.annotation.CliCommand;
-import org.springframework.shell.core.annotation.CliOption;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Nonnull;
-
-/**
- * Connection Commands.
- */
-@Component
-public class FalconConnectionCommands extends BaseFalconCommands {
-
-    @CliCommand(value = "get", help = "get properties")
-    public String getParameter(@CliOption(key = {"", "key"}, mandatory = false, help = "<key>") final String key) {
-        if (StringUtils.isBlank(key)) {
-            return getClientProperties().toString();
-        }
-        return getClientProperties().getProperty(key);
-    }
-
-    @CliCommand(value = "set", help = "set properties")
-    public void setParameter(@CliOption(key = {"", "keyval"}, mandatory = true, help = "<key-val>")
-                             @Nonnull final String keyVal) {
-        String[] kvArray = keyVal.split("=");
-        String key = "";
-        String value = "";
-        if (kvArray.length > 0) {
-            key = kvArray[0];
-        }
-        if (kvArray.length > 1) {
-            value = kvArray[1];
-        }
-        setClientProperty(key, value);
-    }
-}


Mime
View raw message