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.DataInput; 022import java.io.DataOutput; 023import java.io.IOException; 024import java.util.ArrayList; 025import java.util.List; 026 027import org.apache.commons.lang.StringUtils; 028import org.apache.hadoop.io.Writable; 029import org.apache.oozie.coord.CoordELFunctions; 030import org.apache.oozie.util.WritableUtils; 031 032public class CoordUnResolvedInputDependency implements Writable { 033 034 private boolean isResolved; 035 private List<String> dependency = new ArrayList<String>(); 036 private List<String> resolvedList = new ArrayList<String>(); 037 038 public CoordUnResolvedInputDependency(List<String> dependency) { 039 this.dependency = dependency; 040 041 } 042 043 public CoordUnResolvedInputDependency() { 044 } 045 046 public boolean isResolved() { 047 return isResolved; 048 } 049 050 public void setResolved(boolean isResolved) { 051 this.isResolved = isResolved; 052 } 053 054 public List<String> getDependencies() { 055 return dependency; 056 } 057 058 public List<String> getResolvedList() { 059 return resolvedList; 060 } 061 062 public void setResolvedList(List<String> resolvedList) { 063 this.resolvedList = resolvedList; 064 } 065 066 public void addResolvedList(List<String> resolvedList) { 067 this.resolvedList.addAll(resolvedList); 068 } 069 070 public String getUnResolvedList() { 071 if (!isResolved) { 072 return StringUtils.join(dependency, CoordELFunctions.INSTANCE_SEPARATOR); 073 } 074 else 075 return ""; 076 } 077 078 @Override 079 public void write(DataOutput out) throws IOException { 080 out.writeBoolean(isResolved); 081 WritableUtils.writeStringList(out, dependency); 082 WritableUtils.writeStringList(out, resolvedList); 083 } 084 085 @Override 086 public void readFields(DataInput in) throws IOException { 087 088 isResolved = in.readBoolean(); 089 dependency = WritableUtils.readStringList(in); 090 resolvedList = WritableUtils.readStringList(in); 091 } 092}