Class AbstractGitOperation

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.SizeOfHandler, Serializable
    Direct Known Subclasses:
    Add, Commit, Rollback

    public abstract class AbstractGitOperation
    extends adams.core.option.AbstractOptionHandler
    implements adams.core.QuickInfoSupporter
    Ancestor for git operations.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected GitOperation m_GitOperation
      the git operation instance to use.
      protected GitRepo m_GitRepo
      the GitRepo instance to use.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract Class[] accepts()
      The type of data accepted as input.
      boolean canExecute​(Object input, adams.core.MessageCollection errors)
      Checks whether the git operation can be executed.
      protected void check​(Object input, adams.core.MessageCollection errors)
      Hook method for checking.
      protected abstract boolean doCanExecute​(Object input, adams.core.MessageCollection errors)
      Checks whether the git operation can be executed.
      protected abstract Object doExecute​(Object input, adams.core.MessageCollection errors)
      Executes the git operation.
      Object execute​(Object input, adams.core.MessageCollection errors)
      Executes the git operation.
      abstract Class[] generates()
      The type of data that is being generated.
      GitRepo getGitRepo()
      Returns the GitRepo instance in use.
      String getQuickInfo()
      Returns a quick info about the object, which can be displayed in the GUI.
      boolean requiresGitRepo()
      Whether a GitRepo instance is required.
      void setGitRepo​(GitRepo value)
      Sets the GitRepo instance to use.
      static File[] toFiles​(Object input)
      Converts String/File and String[]/File[] to a file array.
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, toCommandLine, toString
      • Methods inherited from class adams.core.logging.CustomLoggingLevelObject

        setLoggingLevel
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Field Detail

      • m_GitRepo

        protected GitRepo m_GitRepo
        the GitRepo instance to use.
      • m_GitOperation

        protected GitOperation m_GitOperation
        the git operation instance to use.
    • Constructor Detail

      • AbstractGitOperation

        public AbstractGitOperation()
    • Method Detail

      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Default implementation returns null.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Returns:
        null if no info available, otherwise short string
      • requiresGitRepo

        public boolean requiresGitRepo()
        Whether a GitRepo instance is required.
        Returns:
        true if required
      • setGitRepo

        public void setGitRepo​(GitRepo value)
        Sets the GitRepo instance to use.
        Parameters:
        value - the instance to use
      • getGitRepo

        public GitRepo getGitRepo()
        Returns the GitRepo instance in use.
        Returns:
        the instance in use
      • accepts

        public abstract Class[] accepts()
        The type of data accepted as input.
        Returns:
        the accepted input
      • generates

        public abstract Class[] generates()
        The type of data that is being generated.
        Returns:
        the generated output
      • check

        protected void check​(Object input,
                             adams.core.MessageCollection errors)
        Hook method for checking.
        Parameters:
        input - the input data
      • doCanExecute

        protected abstract boolean doCanExecute​(Object input,
                                                adams.core.MessageCollection errors)
        Checks whether the git operation can be executed.
        Parameters:
        input - the input data
        errors - for storing errors, can be null
        Returns:
        whether operation can be executed
      • canExecute

        public boolean canExecute​(Object input,
                                  adams.core.MessageCollection errors)
        Checks whether the git operation can be executed.
        Parameters:
        input - the input data
        errors - for storing errors, can be null
        Returns:
        whether operation can be executed
      • doExecute

        protected abstract Object doExecute​(Object input,
                                            adams.core.MessageCollection errors)
        Executes the git operation.
        Parameters:
        input - the input data
        errors - for storing errors, can be null
        Returns:
        the result of the operation
      • execute

        public Object execute​(Object input,
                              adams.core.MessageCollection errors)
        Executes the git operation.
        Parameters:
        input - the input data
        errors - for storing errors, can be null
        Returns:
        the result of the operation
      • toFiles

        public static File[] toFiles​(Object input)
        Converts String/File and String[]/File[] to a file array.
        Parameters:
        input - the input to process
        Returns:
        the generated output