001 /* 002 * Copyright (c) 2011, Cloudera, Inc. All Rights Reserved. 003 * 004 * Cloudera, Inc. licenses this file to you under the Apache License, 005 * Version 2.0 (the "License"). You may not use this file except in 006 * compliance with the License. You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 011 * CONDITIONS OF ANY KIND, either express or implied. See the License for 012 * the specific language governing permissions and limitations under the 013 * License. 014 */ 015 package com.cloudera.lib.service; 016 017 import org.apache.hadoop.conf.Configuration; 018 import org.apache.hadoop.fs.FileSystem; 019 import org.apache.hadoop.mapred.JobClient; 020 021 import java.io.IOException; 022 023 public interface Hadoop { 024 025 public interface FileSystemExecutor<T> { 026 027 public T execute(FileSystem fs) throws IOException; 028 } 029 030 public interface JobClientExecutor<T> { 031 032 public T execute(JobClient jobClient, FileSystem fs) throws IOException; 033 } 034 035 public <T> T execute(String user, Configuration conf, FileSystemExecutor<T> executor) throws HadoopException; 036 037 public <T> T execute(String user, Configuration conf, JobClientExecutor<T> executor) throws HadoopException; 038 039 public FileSystem createFileSystem(String user, Configuration conf) throws IOException, HadoopException; 040 041 public void releaseFileSystem(FileSystem fs) throws IOException; 042 043 public Configuration getDefaultConfiguration(); 044 045 }