Class TorrentCommand

    • Field Detail

      • action

        private final java.lang.String action
    • Constructor Detail

      • TorrentCommand

        public TorrentCommand​(java.lang.String main_name,
                              java.lang.String short_name,
                              java.lang.String action)
        initializes the torrent command
        Parameters:
        commandNames - (the first item in the array is regarded as the primary command name)
        action - a description to be used when this command is executed
    • Method Detail

      • getAction

        protected java.lang.String getAction()
      • performCommand

        protected abstract boolean performCommand​(ConsoleInput ci,
                                                  DownloadManager dm,
                                                  java.util.List<java.lang.String> args)
      • performCommand

        protected boolean performCommand​(ConsoleInput ci,
                                         TRHostTorrent torrent,
                                         java.util.List<java.lang.String> args)
        Stub for commands that operate on a hosted torrent rather than downloadmanager
        Parameters:
        ci -
        args -
        Returns:
      • execute

        public void execute​(java.lang.String commandName,
                            ConsoleInput ci,
                            java.util.List<java.lang.String> args)
        Description copied from class: IConsoleCommand
        execute the command with the specified name using the specified arguments
        Specified by:
        execute in class IConsoleCommand
      • performCommandIfAllowed

        private void performCommandIfAllowed​(ConsoleInput ci,
                                             java.util.List args,
                                             DownloadManager dm,
                                             java.lang.String desc,
                                             java.lang.String name)
        checks the role of the user. if the user is a 'guest', they are not able to perform any actions on the torrents. they are a 'read only' role. if they are a 'user' role, they are only able to modify their own torrents. users with the 'admin' role can modify anybody's torrents
        Parameters:
        ci -
        args -
        dm -
        name -
        subcommand -
      • performCommandIfAllowed

        private void performCommandIfAllowed​(ConsoleInput ci,
                                             java.util.List args,
                                             TRHostTorrent torrent,
                                             java.lang.String desc,
                                             java.lang.String name)
      • printHelpExtra

        public void printHelpExtra​(java.io.PrintStream out,
                                   java.util.List args)
        prints out the syntax of this command
        Overrides:
        printHelpExtra in class IConsoleCommand