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 019package org.apache.oozie.coord.input.dependency; 020 021import java.io.IOException; 022import java.util.Collection; 023import java.util.List; 024import java.util.Map; 025 026import org.apache.oozie.CoordinatorActionBean; 027import org.apache.oozie.command.CommandException; 028import org.apache.oozie.dependency.ActionDependency; 029import org.jdom.Element; 030import org.jdom.JDOMException; 031 032public interface CoordInputDependency { 033 034 String INTERNAL_VERSION_ID = "V=1"; 035 036 /** 037 * Adds the input instance list. 038 * 039 * @param inputEventName the input event name 040 * @param inputInstanceList the input instance list 041 */ 042 void addInputInstanceList(String inputEventName, List<CoordInputInstance> inputInstanceList); 043 044 /** 045 * Gets the missing dependencies. 046 * 047 * @return the missing dependencies 048 */ 049 String getMissingDependencies(); 050 051 /** 052 * Checks if dependencies are meet. 053 * 054 * @return true, if dependencies are meet 055 */ 056 boolean isDependencyMet(); 057 058 /** 059 * Checks if is unresolved dependencies met. 060 * 061 * @return true, if unresolved dependencies are met 062 */ 063 boolean isUnResolvedDependencyMet(); 064 065 /** 066 * Sets the dependency meet. 067 * 068 * @param isMissingDependenciesMet the new dependency met 069 */ 070 void setDependencyMet(boolean isMissingDependenciesMet); 071 072 /** 073 * Serialize. 074 * 075 * @return the string 076 * @throws IOException Signals that an I/O exception has occurred. 077 */ 078 String serialize() throws IOException; 079 080 /** 081 * Gets the missing dependencies as list. 082 * 083 * @return the missing dependencies as list 084 */ 085 List<String> getMissingDependenciesAsList(); 086 087 /** 088 * Gets the available dependencies as list. 089 * 090 * @return the available dependencies as list 091 */ 092 List<String> getAvailableDependenciesAsList(); 093 094 /** 095 * Sets the missing dependencies. 096 * 097 * @param missingDependencies the new missing dependencies 098 */ 099 void setMissingDependencies(String missingDependencies); 100 101 /** 102 * Adds the un resolved list. 103 * 104 * @param name the name 105 * @param tmpUnresolved the tmp unresolved 106 */ 107 void addUnResolvedList(String name, String tmpUnresolved); 108 109 /** 110 * Gets the available dependencies. 111 * 112 * @param dataSet the data set 113 * @return the available dependencies 114 */ 115 List<String> getAvailableDependencies(String dataSet); 116 117 /** 118 * Adds the to available dependencies. 119 * 120 * @param availDepList the avail dep list 121 */ 122 void addToAvailableDependencies(Collection<String> availDepList); 123 124 /** 125 * Check push missing dependencies. 126 * 127 * @param coordAction the coord action 128 * @param registerForNotification the register for notification 129 * @return the action dependency 130 * @throws CommandException the command exception 131 * @throws IOException Signals that an I/O exception has occurred. 132 * @throws JDOMException the JDOM exception 133 */ 134 ActionDependency checkPushMissingDependencies(CoordinatorActionBean coordAction, 135 boolean registerForNotification) throws CommandException, IOException, JDOMException; 136 137 /** 138 * Gets the missing dependencies. 139 * 140 * @param coordAction the coord action 141 * @return the missing dependencies 142 * @throws CommandException the command exception 143 * @throws IOException Signals that an I/O exception has occurred. 144 * @throws JDOMException the JDOM exception 145 */ 146 public Map<String, ActionDependency> getMissingDependencies(CoordinatorActionBean coordAction) 147 throws CommandException, IOException, JDOMException; 148 149 /** 150 * Gets the first missing dependency. 151 * 152 * @return the first missing dependency 153 */ 154 public String getFirstMissingDependency(); 155 156 /** 157 * Check pull missing dependencies. 158 * 159 * @param coordAction the coord action 160 * @param existList the exist list 161 * @param nonExistList the non exist list 162 * @return true, if successful 163 * @throws IOException Signals that an I/O exception has occurred. 164 * @throws JDOMException the JDOM exception 165 */ 166 boolean checkPullMissingDependencies(CoordinatorActionBean coordAction, StringBuilder existList, 167 StringBuilder nonExistList) throws IOException, JDOMException; 168 169 /** 170 * Checks if is change in dependency. 171 * 172 * @param nonExistList the non exist list 173 * @param missingDependencies the missing dependencies 174 * @param nonResolvedList the non resolved list 175 * @param status the status 176 * @return true, if is change in dependency 177 */ 178 boolean isChangeInDependency(StringBuilder nonExistList, String missingDependencies, 179 StringBuilder nonResolvedList, boolean status); 180 181 /** 182 * Check unresolved. 183 * 184 * @param coordAction the coord action 185 * @param eAction the element for the action 186 * @return true, if successful 187 * @throws Exception the exception 188 */ 189 boolean checkUnresolved(CoordinatorActionBean coordAction, Element eAction) 190 throws Exception; 191 192}