Package be.panako.cli

Class Application

java.lang.Object
be.panako.cli.Application
Direct Known Subclasses:
Clear, Configuration, Delete, Load, Monitor, Play, Print, Query, Resolve, Same, Stats, Store

public abstract class Application
extends java.lang.Object
Application is the abstract base class of applications with a command line interface.
  • Constructor Summary

    Constructors
    Constructor Description
    Application()  
  • Method Summary

    Modifier and Type Method Description
    static int availableProcessors()
    Checks the configuration and returns either the number of configured number of available processors to use or the maximum number of available processors if the configured value is zero or negative.
    abstract java.lang.String description()  
    java.util.List<java.io.File> getFilesFromArguments​(java.lang.String[] arguments)
    Returns a list of exiting (checked) files in the argument list.
    java.lang.String name()
    The name of the application is the class lower case class name.
    abstract boolean needsStorage()  
    void printHelp()  
    abstract void run​(java.lang.String... args)  
    abstract java.lang.String synopsis()
    The synopsis is a short description of the required or optional arguments.
    abstract boolean writesToStorage()  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Application

      public Application()
  • Method Details

    • run

      public abstract void run​(java.lang.String... args)
      Parameters:
      args - The arguments to start the program.
    • name

      public final java.lang.String name()
      The name of the application is the class lower case class name.
      Returns:
      The name of the application.
    • description

      public abstract java.lang.String description()
      Returns:
      The description of the application. What does it do?
    • synopsis

      public abstract java.lang.String synopsis()
      The synopsis is a short description of the required or optional arguments.
      Returns:
      The command line synopsis.
    • needsStorage

      public abstract boolean needsStorage()
      Returns:
      True if this application needs the storage, false otherwise.
    • getFilesFromArguments

      public java.util.List<java.io.File> getFilesFromArguments​(java.lang.String[] arguments)
      Returns a list of exiting (checked) files in the argument list. If a text (with txt extension) file is found its contents is read and each line in the file interpreted as an absolute path to a file.
      Parameters:
      arguments - the list of command line arguments
      Returns:
      A list of checked file.
    • availableProcessors

      public static int availableProcessors()
      Checks the configuration and returns either the number of configured number of available processors to use or the maximum number of available processors if the configured value is zero or negative.
      Returns:
      Either the number of configured number of available processors to use or the maximum number of available processors if the configured value is zero or negative.
    • writesToStorage

      public abstract boolean writesToStorage()
      Returns:
      true if this application writes to storage.
    • printHelp

      public void printHelp()