001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.hbtop.terminal.impl.batch;
019
020import edu.umd.cs.findbugs.annotations.Nullable;
021import org.apache.hadoop.hbase.hbtop.terminal.CursorPosition;
022import org.apache.hadoop.hbase.hbtop.terminal.KeyPress;
023import org.apache.hadoop.hbase.hbtop.terminal.Terminal;
024import org.apache.hadoop.hbase.hbtop.terminal.TerminalPrinter;
025import org.apache.hadoop.hbase.hbtop.terminal.TerminalSize;
026
027/**
028 * An implementation of the {@link Terminal} interface for batch mode. This implementation produces
029 * output that's more sensible for collecting to a log file or for parsing. There is no limit on the
030 * number of output lines, and the output doesn't contain any escape sequences for formatting.
031 */
032public class BatchTerminal implements Terminal {
033
034  private static final TerminalPrinter TERMINAL_PRINTER = new BatchTerminalPrinter();
035
036  @Override
037  public void clear() {
038  }
039
040  @Override
041  public void refresh() {
042    // Add a new line
043    TERMINAL_PRINTER.endOfLine();
044  }
045
046  @Nullable
047  @Override
048  public TerminalSize getSize() {
049    return null;
050  }
051
052  @Nullable
053  @Override
054  public TerminalSize doResizeIfNecessary() {
055    return null;
056  }
057
058  @Nullable
059  @Override
060  public KeyPress pollKeyPress() {
061    return null;
062  }
063
064  @Override
065  public CursorPosition getCursorPosition() {
066    return null;
067  }
068
069  @Override
070  public void setCursorPosition(int column, int row) {
071  }
072
073  @Override
074  public void hideCursor() {
075  }
076
077  @Override
078  public TerminalPrinter getTerminalPrinter(int startRow) {
079    return TERMINAL_PRINTER;
080  }
081
082  @Override
083  public void close() {
084  }
085}