Class AdHocCommandManager


  • public class AdHocCommandManager
    extends Object
    An AdHocCommandManager is responsible for keeping the list of available commands offered by a service and for processing commands requests. Typically, instances of this class are private to the service offering ad-hoc commands.
    Author:
    Gaston Dombiak
    • Field Detail

      • COMMAND_LIMIT

        public static final SystemProperty<Integer> COMMAND_LIMIT
        The maximum allowed simultaneous command sessions per user.
      • COMMAND_TIMEOUT

        public static final SystemProperty<Duration> COMMAND_TIMEOUT
        The maximum allowed duration of a command session (all stages of a command need to have provided by the user within this time).
    • Constructor Detail

      • AdHocCommandManager

        public AdHocCommandManager()
    • Method Detail

      • addCommand

        public void addCommand​(AdHocCommand command)
        Adds a new command to the list of supported ad-hoc commands by this server. The new command will appear in the discoverable items list and will be executed for those users with enough permission.
        Parameters:
        command - the new ad-hoc command to add.
      • removeCommand

        public boolean removeCommand​(AdHocCommand command)
        Removes the command from the list of ad-hoc commands supported by this server. The command will no longer appear in the discoverable items list.
        Parameters:
        command - the ad-hoc command to remove.
        Returns:
        true if the requested command was removed from the list of available commands.
      • getCommands

        public Collection<AdHocCommand> getCommands()
        Returns a list with the available commands in this command manager.
        Returns:
        a list with the available commands in this command manager.
      • getCommand

        public AdHocCommand getCommand​(String code)
        Returns the command whose code matches the specified code or null if none was found.
        Parameters:
        code - the code of the command to find.
        Returns:
        the command whose code matches the specified code or null if none was found.
      • process

        public org.xmpp.packet.IQ process​(org.xmpp.packet.IQ packet)
      • stop

        public void stop()