| /** |
| * 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.workflow; |
| |
| import org.apache.commons.cli.CommandLine; |
| import org.apache.commons.cli.Option; |
| |
| /** |
| * Arguments for workflow execution. |
| */ |
| public enum WorkflowExecutionArgs { |
| |
| // instance details |
| NOMINAL_TIME("nominalTime", "instance time"), |
| ENTITY_TYPE("entityType", "type of the entity"), |
| ENTITY_NAME("entityName", "name of the entity"), |
| TIMESTAMP("timeStamp", "current timestamp"), |
| |
| // where |
| CLUSTER_NAME("cluster", "name of the current cluster"), |
| OPERATION("operation", "operation like generate, delete, replicate"), |
| |
| // who |
| WORKFLOW_USER("workflowUser", "user who owns the feed instance (partition)"), |
| |
| // what |
| // workflow details |
| USER_WORKFLOW_ENGINE("userWorkflowEngine", "user workflow engine type", false), |
| USER_WORKFLOW_NAME("userWorkflowName", "user workflow name", false), |
| USER_WORKFLOW_VERSION("userWorkflowVersion", "user workflow version", false), |
| |
| // workflow execution details |
| WORKFLOW_ID("workflowId", "current workflow-id of the instance"), |
| RUN_ID("runId", "current run-id of the instance"), |
| STATUS("status", "status of the user workflow isnstance"), |
| WF_ENGINE_URL("workflowEngineUrl", "url of workflow engine server, ex:oozie", false), |
| USER_SUBFLOW_ID("subflowId", "external id of user workflow", false), |
| |
| WF_START_TIME("workflowStartTime", "workflow start time", false), |
| WF_END_TIME("workflowEndTime", "workflow end time", false), |
| WF_DURATION("workflowDuration", "workflow duration", false), |
| |
| // what inputs |
| INPUT_FEED_NAMES("falconInputFeeds", "name of the feeds which are used as inputs", false), |
| INPUT_FEED_PATHS("falconInputPaths", "comma separated input feed instance paths", false), |
| |
| // what outputs |
| FEED_NAMES("feedNames", "name of the feeds which are generated/replicated/deleted"), |
| FEED_INSTANCE_PATHS("feedInstancePaths", "comma separated feed instance paths"), |
| |
| // broker related parameters |
| TOPIC_NAME("topicName", "name of the topic to be used to send JMS message", false), |
| BRKR_IMPL_CLASS("brokerImplClass", "falcon message broker Implementation class"), |
| BRKR_URL("brokerUrl", "falcon message broker url"), |
| USER_BRKR_IMPL_CLASS("userBrokerImplClass", "user broker Impl class", false), |
| USER_BRKR_URL("userBrokerUrl", "user broker url", false), |
| BRKR_TTL("brokerTTL", "time to live for broker message in sec", false), |
| |
| // state maintained |
| LOG_FILE("logFile", "log file path where feeds to be deleted are recorded"), |
| // execution context data recorded |
| LOG_DIR("logDir", "log dir where lineage can be recorded"), |
| |
| CONTEXT_FILE("contextFile", "wf execution context file path where wf properties are recorded", false), |
| CONTEXT_TYPE("contextType", "wf execution context type, pre or post processing", false); |
| |
| |
| private final String name; |
| private final String description; |
| private final boolean isRequired; |
| |
| WorkflowExecutionArgs(String name, String description) { |
| this(name, description, true); |
| } |
| |
| WorkflowExecutionArgs(String name, String description, boolean isRequired) { |
| this.name = name; |
| this.description = description; |
| this.isRequired = isRequired; |
| } |
| |
| public Option getOption() { |
| return new Option(this.name, true, this.description); |
| } |
| |
| public String getName() { |
| return this.name; |
| } |
| |
| public String getDescription() { |
| return description; |
| } |
| |
| public boolean isRequired() { |
| return isRequired; |
| } |
| |
| public String getOptionValue(CommandLine cmd) { |
| return cmd.getOptionValue(this.name); |
| } |
| |
| @Override |
| public String toString() { |
| return getName(); |
| } |
| } |