Interface IHelixCommandExecutor

    • Method Detail

      • execMapCmdList

        java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> execMapCmdList​(java.lang.String cmdName,
                                                                                              java.lang.String[] cmdArgs,
                                                                                              java.util.Map<java.lang.String,​java.lang.Object> inMap)
                                                                                       throws ConnectionException,
                                                                                              AccessException,
                                                                                              RequestException
        Issue an arbitrary P4Java command to the Perforce server and return the results as a list of maps.

        This method is intended for low-level commands in the spirit and format of the p4 command line interpreter, and offers a simple way to issue commands to the associated Perforce server without the overhead of the more abstract Java interfaces and methods.

        No guidance is given here on the format of the returned map; however, it produces the same output as the p4 command line interpreter in -G (Python map) mode.

        Note that this method does not allow you to set "usage" options for the command; these may be added later. Note also that although option arguments passed to this method must be in a form recognized by the p4 command line interpreter, that does not mean the method is being implemented by the interpreter -- the actual implementation depends on the options used to get the server object in the first place from the server factory.

        Parameters:
        cmdName - the command to be issued; must be non-null, and correspond to a Perforce command recognized by P4Java and defined in CmdSpec.
        cmdArgs - the array of command arguments (options and file arguments, etc.) to be sent to the Perforce server. These must be in the form used by the corresponding p4 command line interpreter. Ignored if null.
        inMap - an optional map to be sent to the server as standard input, using the Python map format (-G) form. You must remember to issue the relevant command-specific option to enable this if needed.
        Returns:
        a non-null Java List of results; these results are as returned from issuing the command using the -G option with the p4 command line interpreter.
        Throws:
        ConnectionException - if the Perforce server is unreachable or is not connected.
        RequestException - if the Perforce server encounters an error during its processing of the request
        AccessException - if the Perforce server denies access to the caller
        Since:
        2013.1
      • execMapCmdList

        java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> execMapCmdList​(java.lang.String cmdName,
                                                                                              java.lang.String[] cmdArgs,
                                                                                              java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                                                                              IFilterCallback filterCallback)
                                                                                       throws P4JavaException
        Issue an arbitrary P4Java command to the Perforce server and return the results as a list of maps.

        This method is intended for low-level commands in the spirit and format of the p4 command line interpreter, and offers a simple way to issue commands to the associated Perforce server without the overhead of the more abstract Java interfaces and methods.

        No guidance is given here on the format of the returned map; however, it produces the same output as the p4 command line interpreter in -G (Python map) mode.

        Note that this method does not allow you to set "usage" options for the command; these may be added later. Note also that although option arguments passed to this method must be in a form recognized by the p4 command line interpreter, that does not mean the method is being implemented by the interpreter -- the actual implementation depends on the options used to get the server object in the first place from the server factory.

        Parameters:
        cmdName - the command to be issued; must be non-null, and correspond to a Perforce command recognized by P4Java and defined in CmdSpec.
        cmdArgs - the array of command arguments (options and file arguments, etc.) to be sent to the Perforce server. These must be in the form used by the corresponding p4 command line interpreter. Ignored if null.
        inMap - an optional map to be sent to the server as standard input, using the Python map format (-G) form. You must remember to issue the relevant command-specific option to enable this if needed.
        filterCallback - an optional filter callback to decide on skipping or keeping individual key/value pairs as part of the results map.
        Returns:
        a non-null Java List of results; these results are as returned from issuing the command using the -G option with the p4 command line interpreter.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.
        Since:
        2013.1
      • execStreamCmd

        java.io.InputStream execStreamCmd​(java.lang.String cmdName,
                                          java.lang.String[] cmdArgs)
                                   throws ConnectionException,
                                          RequestException,
                                          AccessException
        Issue an arbitrary P4Java command to the Perforce server and get the results as a stream.

        This method is intended for low-level commands in the spirit and format of the p4 command line interpreter, and offers a simple way to issue commands to the associated Perforce server without the overhead of the more abstract Java interfaces and methods.

        Note that this method is intended for things like getting file contents, and may have unpredictable results on commands not originally expected to return i/o streams.

        Note that this method does not allow you to set "usage" options for the command; these may be added later. Note also that although option arguments passed to this method must be in a form recognized by P4Java (as defined by the CmdSpec enum), that does not mean the method is being implemented by the interpreter -- the actual implementation depends on the options used to get the server object in the first place from the server factory.

        Parameters:
        cmdName - the command to be issued; must be non-null, and correspond to a Perforce command recognized by P4Java and defined in CmdSpec.
        cmdArgs - the array of command arguments (options and file arguments, etc.) to be sent to the Perforce server. These must be in the form used by the corresponding p4 command line interpreter. Ignored if null.
        Returns:
        an InputStream on the command output. This will never be null, but it may be empty. You must properly close this stream after use or temporary files may be left lying around the VM's java.io.tmpdir area.
        Throws:
        ConnectionException - if the Perforce server is unreachable or is not connected.
        RequestException - if the Perforce server encounters an error during its processing of the request
        AccessException - if the Perforce server denies access to the caller
      • execStreamCmdForBuffer

        java.nio.ByteBuffer execStreamCmdForBuffer​(java.lang.String cmdName,
                                                   java.lang.String[] cmdArgs)
                                            throws ConnectionException,
                                                   RequestException,
                                                   AccessException
        Issue an arbitrary P4Java command to the Perforce server and get the results as a byte buffer.
        Parameters:
        cmdName - the command to be issued; must be non-null, and correspond to a Perforce command recognized by P4Java and defined in CmdSpec.
        cmdArgs - the array of command arguments (options and file arguments, etc.) to be sent to the Perforce server. These must be in the form used by the corresponding p4 command line interpreter. Ignored if null.
        Returns:
        an ByteBuffer on the command output. This will never be null, but it may be empty.
        Throws:
        ConnectionException - if the Perforce server is unreachable or is not connected.
        RequestException - if the Perforce server encounters an error during its processing of the request
        AccessException - if the Perforce server denies access to the caller
      • getErrorOrInfoStr

        @Deprecated
        java.lang.String getErrorOrInfoStr​(java.util.Map<java.lang.String,​java.lang.Object> map)
        Gets the info/warning/error/fatal message from the passed-in Perforce command results map. If no info/warning/error/fatal message found in the results map it returns null.

        Note that the minimum severity code is MessageSeverityCode.E_INFO. Therefore, only message with severity code >= MessageSeverityCode.E_INFO will be returned.

        RPC impl errors come across the wire as a map in the form usually like this:

         fmt0=Access for user '%user%' has not been enabled by 'p4 protect'.,
         func=client-Message, user=nouser, code0=822483067
         
        Note that the code0 entry will be used to get the severity level; the fmt0 entry contains the message.

        Parameters:
        map - Perforce command results map
        Returns:
        possibly-null info/warning/error/fatal string
        Since:
        2011.2
      • getErrorStr

        @Deprecated
        java.lang.String getErrorStr​(java.util.Map<java.lang.String,​java.lang.Object> map)
        Gets the error/fatal message from the passed-in Perforce command results map. If no error/fatal message found in the results map it returns null.

        Note that the minimum severity code is MessageSeverityCode.E_FAILED. Therefore, only message with severity code >= MessageSeverityCode.E_FAILED will be returned.

        RPC impl errors come across the wire as a map in the form usually like this:

         fmt0=Access for user '%user%' has not been enabled by 'p4 protect'.,
         func=client-Message, user=nouser, code0=822483067
         
        Note that the code0 entry will be used to get the severity level; the fmt0 entry contains the message.

        Parameters:
        map - Perforce command results map
        Returns:
        possibly-null error/fatal string
        Since:
        2011.2
      • isAuthFail

        @Deprecated
        boolean isAuthFail​(java.lang.String errStr)
        Parameters:
        errStr - error string
        Returns:
        true if error
      • getInfoStr

        @Deprecated
        java.lang.String getInfoStr​(java.util.Map<java.lang.String,​java.lang.Object> map)
        Gets the info message from the passed-in Perforce command results map. If no info message found in the results map it returns null.

        Note that the severity code is MessageSeverityCode.E_INFO. Therefore, only message with severity code = MessageSeverityCode.E_INFO will be returned.

        RPC impl errors come across the wire as a map in the form usually like this:

         fmt0=Access for user '%user%' has not been enabled by 'p4 protect'.,
         func=client-Message, user=nouser, code0=822483067
         
        Note that the code0 entry will be used to get the severity level; the fmt0 entry contains the message.

        Parameters:
        map - Perforce command results map
        Returns:
        possibly-null info string
        Since:
        2011.2
      • isInfoMessage

        @Deprecated
        boolean isInfoMessage​(java.util.Map<java.lang.String,​java.lang.Object> map)
        Checks if is info message.
        Parameters:
        map - the map
        Returns:
        true, if is info message