HdfsFileViewer.java

47 lines | 1.358 kB Blame History Raw Download
/*
 * Copyright 2012 LinkedIn Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package azkaban.viewer.hdfs;

import java.util.EnumSet;
import java.util.Set;
import java.io.IOException;
import java.io.OutputStream;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.AccessControlException;

public abstract class HdfsFileViewer {
  public abstract String getName();

  public Set<Capability> getCapabilities(FileSystem fs, Path path)
      throws AccessControlException {
    return EnumSet.noneOf(Capability.class);
  }

  public abstract void displayFile(FileSystem fs, Path path,
      OutputStream outStream, int startLine, int endLine) throws IOException;

  public String getSchema(FileSystem fs, Path path) {
    return null;
  }

  public ContentType getContentType() {
    return ContentType.TEXT;
  }
}