001/* 002 * Copyright (c) 2016-2017 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 JobConf 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 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 JobConf 070 * @return String[] 071 * @throws java.io.IOException 072 */ 073 String[] getChildIdentifiers( Config conf ) throws IOException; 074 075 String[] getChildIdentifiers( FlowProcess<? extends Config> flowProcess, int depth, boolean fullyQualified ) throws IOException; 076 077 String[] getChildIdentifiers( Config conf, int depth, boolean fullyQualified ) throws IOException; 078 079 /** 080 * Method getSize returns the size of the file referenced by this tap. 081 * 082 * @param flowProcess 083 * @return The size of the file reference by this tap. 084 * @throws java.io.IOException 085 */ 086 long getSize( FlowProcess<? extends Config> flowProcess ) throws IOException; 087 088 /** 089 * Method getSize returns the size of the file referenced by this tap. 090 * 091 * @param conf of type Config 092 * @return The size of the file reference by this tap. 093 * @throws java.io.IOException 094 */ 095 long getSize( Config conf ) throws IOException; 096 }