001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 package org.apache.oozie.action.control; 019 020 import org.apache.oozie.action.ActionExecutor; 021 import org.apache.oozie.action.ActionExecutorException; 022 import org.apache.oozie.action.hadoop.FsActionExecutor; 023 import org.apache.oozie.client.WorkflowAction; 024 import org.apache.oozie.util.XLog; 025 import org.apache.oozie.util.XmlUtils; 026 import org.apache.oozie.workflow.lite.ControlNodeHandler; 027 import org.jdom.Element; 028 import org.jdom.JDOMException; 029 import org.jdom.Namespace; 030 031 import java.util.List; 032 033 /** 034 * Base action executor for control nodes: START/END/KILL/FORK/JOIN 035 * <p/> 036 * This action executor, similar to {@link FsActionExecutor}, is completed during the 037 * {@link #start(Context, WorkflowAction)}. 038 * <p/> 039 * By hooking control nodes to an action executor, control nodes get WF action entries in the DB. 040 */ 041 public abstract class ControlNodeActionExecutor extends ActionExecutor { 042 043 public ControlNodeActionExecutor(String type) { 044 super(type); 045 } 046 047 @SuppressWarnings("unchecked") 048 public void start(Context context, WorkflowAction action) throws ActionExecutorException { 049 context.setStartData("-", "-", "-"); 050 context.setExecutionData("OK", null); 051 } 052 053 public void end(Context context, WorkflowAction action) throws ActionExecutorException { 054 context.setEndData(WorkflowAction.Status.OK, getActionSignal(WorkflowAction.Status.OK)); 055 } 056 057 public void check(Context context, WorkflowAction action) throws ActionExecutorException { 058 throw new UnsupportedOperationException(); 059 } 060 061 public void kill(Context context, WorkflowAction action) throws ActionExecutorException { 062 throw new UnsupportedOperationException(); 063 } 064 065 public boolean isCompleted(String externalStatus) { 066 return true; 067 } 068 069 }