Coverage Report - au.csiro.netcdf.cli.Command
 
Classes in this File Line Coverage Branch Coverage Complexity
Command
N/A
N/A
1
 
 1  
 /**
 2  
  * Copyright 2010, CSIRO Australia.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *         http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 /**
 18  
  * 
 19  
  */
 20  
 package au.csiro.netcdf.cli;
 21  
 
 22  
 import java.io.IOException;
 23  
 
 24  
 import org.apache.commons.cli.Options;
 25  
 import org.apache.commons.cli.ParseException;
 26  
 
 27  
 /**
 28  
  * This interface represents the generic functionality of a netCDF Tools command.
 29  
  * <p>
 30  
  * It forms part of a command pattern.
 31  
  * <p>
 32  
  * Copyright 2010, CSIRO Australia
 33  
  * All rights reserved.
 34  
  * 
 35  
  * @author      Robert Bridle on 17/03/2010
 36  
  * @version     $Revision: 78 $  $Date: 2010-07-24 16:23:13 +1000 (Sat, 24 Jul 2010) $  
 37  
  */
 38  
 public interface Command
 39  
 {   
 40  
 
 41  
     /**
 42  
      * The column width for printing helps and usage statements.
 43  
      */
 44  
     public static final int PRINT_WIDTH = 80;
 45  
     
 46  
     /**
 47  
      * The maximum file size, in bytes, before a 64-bit file offset is required. A 64-bit file offset is specified via
 48  
      * the large file support flag.
 49  
      */
 50  
     public static final long MAX_32BIT_OFFSET_FILE_SIZE = new Long("2147483648"); // 2^31
 51  
 
 52  
     /**
 53  
      * Run the command.
 54  
      * 
 55  
      * @param args command line arguments.
 56  
      * @throws ParseException thrown if the command line arguments can not be parsed.
 57  
      * @throws IOException thrown if netCDF can to be written to or read from.
 58  
      */
 59  
     public void execute(String[] args) throws ParseException, IOException;
 60  
     
 61  
     /**
 62  
      * Create the command line options for this command.
 63  
      * 
 64  
      * @return the command line options for this command.
 65  
      */
 66  
     public Options createOptions();
 67  
 
 68  
     /**
 69  
      * Determine if this command is valid, check its syntax.
 70  
      * 
 71  
      * @param args command line arguments.
 72  
      * @return error if found.
 73  
      */
 74  
     public String validCommand(String[] args);
 75  
     
 76  
     /**
 77  
      * @return the command name for this command.
 78  
      */
 79  
     public String getCommandName();
 80  
     
 81  
     /**
 82  
      * @return the usage for this command.
 83  
      */
 84  
     public String getUsageString();
 85  
 }