001/* 002 * Copyright (c) 2016-2018 Chris K Wensel <chris@wensel.net>. All Rights Reserved. 003 * Copyright (c) 2007-2017 Xplenty, Inc. All Rights Reserved. 004 * 005 * Project and contact information: http://www.cascading.org/ 006 * 007 * This file is part of the Cascading project. 008 * 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 */ 021 022package cascading.tap.type; 023 024import java.io.IOException; 025 026import cascading.flow.FlowProcess; 027 028/** Interface FileType marks specific platform {@link cascading.tap.Tap} classes as representing a file like interface. */ 029public interface FileType<Config> 030 { 031 String CASCADING_SOURCE_PATH = "cascading.source.path"; 032 033 /** 034 * Method isDirectory returns true if the underlying resource represents a directory or folder instead 035 * of an individual file. 036 * 037 * @param flowProcess 038 * @return boolean 039 * @throws java.io.IOException 040 */ 041 boolean isDirectory( FlowProcess<? extends Config> flowProcess ) throws IOException; 042 043 /** 044 * Method isDirectory returns true if the underlying resource represents a directory or folder instead 045 * of an individual file. 046 * 047 * @param conf of Conf 048 * @return boolean 049 * @throws java.io.IOException 050 */ 051 boolean isDirectory( Config conf ) throws IOException; 052 053 /** 054 * Method getChildIdentifiers returns an array of child identifiers if this resource is a directory. 055 * <p> 056 * This method will skip Hadoop log directories ({@code _log}). 057 * 058 * @param flowProcess of type FlowProcess 059 * @return String[] 060 * @throws java.io.IOException 061 */ 062 String[] getChildIdentifiers( FlowProcess<? extends Config> flowProcess ) throws IOException; 063 064 /** 065 * Method getChildIdentifiers returns an array of child identifiers if this resource is a directory. 066 * <p> 067 * This method will skip Hadoop log directories ({@code _log}). 068 * 069 * @param conf of type Conf 070 * @return String[] 071 * @throws IOException 072 */ 073 String[] getChildIdentifiers( Config conf ) throws IOException; 074 075 /** 076 * Method getChildIdentifiers returns an array of child identifiers if this resource is a directory. 077 * <p> 078 * This method will skip Hadoop log directories ({@code _log}). 079 * <p> 080 * Note that all files encountered up to depth will be returned, and no directories unless 081 * the directory is the final path at max depth. 082 * 083 * @param flowProcess 084 * @param depth 085 * @param fullyQualified 086 * @return String{} 087 * @throws IOException 088 */ 089 String[] getChildIdentifiers( FlowProcess<? extends Config> flowProcess, int depth, boolean fullyQualified ) throws IOException; 090 091 /** 092 * Method getChildIdentifiers returns an array of child identifiers if this resource is a directory. 093 * <p> 094 * This method will skip Hadoop log directories ({@code _log}). 095 * <p> 096 * Note that all files encountered up to depth will be returned, and no directories unless 097 * the directory is the final path at max depth. 098 * 099 * @param conf of type Conf 100 * @param depth the max depth to return. 101 * @param fullyQualified true if the returned paths should be fully qualified 102 * @return String[] 103 * @throws IOException 104 */ 105 String[] getChildIdentifiers( Config conf, int depth, boolean fullyQualified ) throws IOException; 106 107 /** 108 * Method getSize returns the size of the file referenced by this tap. 109 * 110 * @param flowProcess 111 * @return The size of the file reference by this tap. 112 * @throws java.io.IOException 113 */ 114 long getSize( FlowProcess<? extends Config> flowProcess ) throws IOException; 115 116 /** 117 * Method getSize returns the size of the file referenced by this tap. 118 * 119 * @param conf of type Config 120 * @return The size of the file reference by this tap. 121 * @throws java.io.IOException 122 */ 123 long getSize( Config conf ) throws IOException; 124 }