com.ibm.jtopenlite.command

Class CommandConnection

  • All Implemented Interfaces:
    Connection


    public class CommandConnection
    extends HostServerConnection
    Represents a TCP/IP socket connection to the System i Remote Command host server (QSYSWRK/QZRCSRVS prestart jobs). This connection can be used to call programs and execute CL commands. See CallCommand for sample program that uses CommandConnection.
    • Field Detail

      • DEFAULT_COMMAND_SERVER_PORT

        public static final int DEFAULT_COMMAND_SERVER_PORT
        The default TCP/IP port the Remote Command host server listens on. If your system has been configured to use a different port, use the PortMapper class to determine the port.
        See Also:
        Constant Field Values
      • DEFAULT_SSL_COMMAND_SERVER_PORT

        public static final int DEFAULT_SSL_COMMAND_SERVER_PORT
        See Also:
        Constant Field Values
    • Method Detail

      • getNLV

        public java.lang.String getNLV()
        Get the NLV used by the connection
        Returns:
        NLV used by the connection
      • getCcsid

        public int getCcsid()
        Get the CCSID used by the connection
        Returns:
        CCSID used by the connection
      • getConnection

        public static CommandConnection getConnection(java.lang.String system,
                                      java.lang.String user,
                                      java.lang.String password)
                                               throws java.io.IOException
        Connects to the Remote Command host server on the default port after first connecting to the Signon host server and authenticating the specified user.
        Throws:
        java.io.IOException
      • getConnection

        public static CommandConnection getConnection(boolean isSSL,
                                      java.lang.String system,
                                      java.lang.String user,
                                      java.lang.String password)
                                               throws java.io.IOException
        Connects to the Remote Command host server on the default port after first connecting to the Signon host server and authenticating the specified user.
        Throws:
        java.io.IOException
      • getConnection

        public static CommandConnection getConnection(SystemInfo info,
                                      java.lang.String user,
                                      java.lang.String password)
                                               throws java.io.IOException
        Connects to the Remote Command host server on the default port using the specified system information and user.
        Throws:
        java.io.IOException
      • getConnection

        public static CommandConnection getConnection(boolean isSSL,
                                      SystemInfo info,
                                      java.lang.String user,
                                      java.lang.String password)
                                               throws java.io.IOException
        Connects to the Remote Command host server on the default port using the specified system information and user.
        Throws:
        java.io.IOException
      • getConnection

        public static CommandConnection getConnection(SystemInfo info,
                                      java.lang.String user,
                                      java.lang.String password,
                                      int commandPort,
                                      boolean compress)
                                               throws java.io.IOException
        Connects to the Remote Command host server on the specified port using the specified system information and user.
        Throws:
        java.io.IOException
      • getConnection

        public static CommandConnection getConnection(boolean isSSL,
                                      SystemInfo info,
                                      java.lang.String user,
                                      java.lang.String password,
                                      int commandPort,
                                      boolean compress)
                                               throws java.io.IOException
        Connects to the Remote Command host server on the specified port using the specified system information and user.
        Throws:
        java.io.IOException
      • call

        public CommandResult call(java.lang.String pgmLibrary,
                         java.lang.String pgmName,
                         Parameter[] parms)
                           throws java.io.IOException
        Calls the specified program using the specified parameter data and returns the result.
        Throws:
        java.io.IOException
      • call

        public CommandResult call(Program pgm)
                           throws java.io.IOException
        Calls the specified program and returns the result.
        Throws:
        java.io.IOException
      • execute

        public CommandResult execute(java.lang.String cmd)
                              throws java.io.IOException
        Executes the specified CL command string and returns the result. The command must be non-interactive.
        Throws:
        java.io.IOException