com.ibm.as400.access

Class CommandList

  • java.lang.Object
    • com.ibm.as400.access.CommandList
  • All Implemented Interfaces:
    java.io.Serializable


    public class CommandList
    extends java.lang.Object
    implements java.io.Serializable
    The CommandList class represents a list of CL command (*CMD) objects on the system. This class allows the user to retrieve a list of Command objects which can then be used to retrieve information about each individual CL command in the list.

    The following example demonstrates the use of CommandList:

    
        AS400 system = new AS400("mySystem");
    
        // Generate a list of commands that start with "CRT".
        CommandList list = new CommandList(system, "QSYS", "CRT*");
        try
        {
            Command[] cmdList = list.generateList();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
      
    See Also:
    Command, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String ALL
      Constant used to retrieve all commands in a given library.
    • Constructor Summary

      Constructors 
      Constructor and Description
      CommandList()
      Constructs a CommandList object.
      CommandList(AS400 system, java.lang.String library, java.lang.String command)
      Constructs a CommandList object.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Adds a PropertyChangeListener.
      Command[] generateList()
      Generate a list of commands.
      java.lang.String getCommand()
      Returns the command name used to generate a list for.
      java.lang.String getLibrary()
      Returns the library where the command(s) reside.
      AS400 getSystem()
      Returns the system from which to retrieve the command list.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Removes the PropertyChangeListener.
      void setCommand(java.lang.String command)
      Sets the command name filter used to generate the list.
      void setLibrary(java.lang.String library)
      Sets the library where the command(s) reside.
      void setSystem(AS400 system)
      Sets the system from which to retrieve the command list.
      java.lang.String toString()
      Returns a String representation of this CommandList.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ALL

        public static final java.lang.String ALL
        Constant used to retrieve all commands in a given library.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CommandList

        public CommandList()
        Constructs a CommandList object.
      • CommandList

        public CommandList(AS400 system,
                   java.lang.String library,
                   java.lang.String command)
        Constructs a CommandList object.
        Parameters:
        system - The system on which the commands resides.
        library - The library in which the commands resides, e.g. "QSYS".
        command - The name of a command or list of commands, e.g. "CRTUSRPRF" or "CRT*". Wildcards or the CommandList.ALL constant can be used.
    >
    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
        Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method will be called each time the value of any bound property is changed. The PropertyChangeListener object is added to a list of PropertyChangeListeners managed by this CommandList. It can be removed with removePropertyChangeListener.
        Parameters:
        listener - The PropertyChangeListener.
      • getCommand

        public java.lang.String getCommand()
        Returns the command name used to generate a list for.
        Returns:
        The command, or null if no command has been set.
        See Also:
        setCommand(java.lang.String)
      • getLibrary

        public java.lang.String getLibrary()
        Returns the library where the command(s) reside.
        Returns:
        The library, or null if no library has been set.
        See Also:
        setLibrary(java.lang.String)
      • getSystem

        public AS400 getSystem()
        Returns the system from which to retrieve the command list.
        Returns:
        The system from which to retrieve the commands, or null if no system has been set.
        See Also:
        setSystem(com.ibm.as400.access.AS400)
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Removes the PropertyChangeListener. If the PropertyChangeListener is not on the list, nothing is done.
        Parameters:
        listener - The PropertyChangeListener.
      • setCommand

        public void setCommand(java.lang.String command)
        Sets the command name filter used to generate the list. Wildcards like "CRT*" can be used.
        Parameters:
        command - The command(s) for which to generate a list.
        See Also:
        getCommand()
      • setLibrary

        public void setLibrary(java.lang.String library)
        Sets the library where the command(s) reside.
        Parameters:
        library - The library where the command(s) reside.
        See Also:
        getLibrary()
      • setSystem

        public void setSystem(AS400 system)
        Sets the system from which to retrieve the command list.
        Parameters:
        system - The system from which to retrieve the commands.
        See Also:
        getSystem()
      • toString

        public java.lang.String toString()
        Returns a String representation of this CommandList.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The string, which includes the library and command name filter used.