001/* 002 * Copyright (c) 2007-2015 Concurrent, Inc. All Rights Reserved. 003 * 004 * Project and contact information: http://www.cascading.org/ 005 * 006 * This file is part of the Cascading project. 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package cascading.tap.type; 022 023import java.io.IOException; 024 025import cascading.flow.FlowProcess; 026 027/** Interface FileType marks specific platform {@link cascading.tap.Tap} classes as representing a file like interface. */ 028public interface FileType<Config> 029 { 030 /** 031 * Method isDirectory returns true if the underlying resource represents a directory or folder instead 032 * of an individual file. 033 * 034 * @param flowProcess 035 * @return boolean 036 * @throws java.io.IOException 037 */ 038 boolean isDirectory( FlowProcess<? extends Config> flowProcess ) throws IOException; 039 040 /** 041 * Method isDirectory returns true if the underlying resource represents a directory or folder instead 042 * of an individual file. 043 * 044 * @param conf of JobConf 045 * @return boolean 046 * @throws java.io.IOException 047 */ 048 boolean isDirectory( Config conf ) throws IOException; 049 050 /** 051 * Method getChildIdentifiers returns an array of child identifiers if this resource is a directory. 052 * <p/> 053 * This method will skip Hadoop log directories ({@code _log}). 054 * 055 * @param flowProcess 056 * @return String[] 057 * @throws java.io.IOException 058 */ 059 String[] getChildIdentifiers( FlowProcess<? extends Config> flowProcess ) throws IOException; 060 061 /** 062 * Method getChildIdentifiers returns an array of child identifiers if this resource is a directory. 063 * <p/> 064 * This method will skip Hadoop log directories ({@code _log}). 065 * 066 * @param conf of JobConf 067 * @return String[] 068 * @throws java.io.IOException 069 */ 070 String[] getChildIdentifiers( Config conf ) throws IOException; 071 072 String[] getChildIdentifiers( FlowProcess<? extends Config> flowProcess, int depth, boolean fullyQualified ) throws IOException; 073 074 String[] getChildIdentifiers( Config conf, int depth, boolean fullyQualified ) throws IOException; 075 076 /** 077 * Method getSize returns the size of the file referenced by this tap. 078 * 079 * @param flowProcess 080 * @return The size of the file reference by this tap. 081 * @throws java.io.IOException 082 */ 083 long getSize( FlowProcess<? extends Config> flowProcess ) throws IOException; 084 085 /** 086 * Method getSize returns the size of the file referenced by this tap. 087 * 088 * @param conf of type Config 089 * @return The size of the file reference by this tap. 090 * @throws java.io.IOException 091 */ 092 long getSize( Config conf ) throws IOException; 093 }