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