Class OneShotServerImpl

    • Field Detail

      • SCREEN_NAME

        public static final java.lang.String SCREEN_NAME
        The short-form name (display name) of this implementation.
        See Also:
        Constant Field Values
      • IMPL_COMMENTS

        public static final java.lang.String IMPL_COMMENTS
        Implementation-specific comments (dependencies, limitations, etc.).
        See Also:
        Constant Field Values
      • PROTOCOL_NAME

        public static final java.lang.String PROTOCOL_NAME
        The specific protocol name to be used in URIs for this implementation.
      • SSL_PROTOCOL_NAME

        public static final java.lang.String SSL_PROTOCOL_NAME
        The specific SSL protocol name to be used in URIs for this implementation.
      • DEFAULT_STATUS

        public static final boolean DEFAULT_STATUS
        True IFF this is the default implementation. There must be only one of these...
        See Also:
        Constant Field Values
      • MINIMUM_SUPPORTED_SERVER_LEVEL

        public static final int MINIMUM_SUPPORTED_SERVER_LEVEL
        The minimum Perforce server level required by this implementation.
        See Also:
        Constant Field Values
      • TRACE_PREFIX

        public static final java.lang.String TRACE_PREFIX
        What we use as a P4JTracer trace prefix for methods here.
        See Also:
        Constant Field Values
      • socketPool

        protected RpcSocketPool socketPool
        Socket pool for this server
    • Constructor Detail

      • OneShotServerImpl

        public OneShotServerImpl()
    • Method Detail

      • init

        public ServerStatus init​(java.lang.String host,
                                 int port,
                                 java.util.Properties props,
                                 UsageOptions opts,
                                 boolean secure,
                                 java.lang.String rsh)
                          throws ConfigException,
                                 ConnectionException
        Initialize the server. Basically defers to the superclass after setting up the required server version and any optional socket pools.
        Specified by:
        init in interface IServerControl
        Overrides:
        init in class Server
        Parameters:
        host - the Perforce server hostname or IP address as passed in to the factory method
        port - the Perforce server port number as passed in to the factory method
        props - the properties passed in to the factory method
        opts - the UsageOptions object to be associated with the server object; if null, the server should construct a new default UsageOptions object.
        secure - indicates whether the server is secure (SSL) or not.
        rsh - the 'rsh' mode server launch command.
        Returns:
        the resulting status; should be ACTIVE unless otherwise specified
        Throws:
        ConfigException - if there's something wrong with the specified configuration or associated config files, etc.
        ConnectionException - if the server is unreachable on initialization, and that unreachability is serious and unrecoverable (there are implementations that don't really do connections per se, so they may not consider this an error or even try connecting during initialisation).
        See Also:
        RpcServer.init(java.lang.String, int, java.util.Properties, com.perforce.p4java.option.UsageOptions, boolean)
      • init

        public ServerStatus init​(java.lang.String host,
                                 int port,
                                 java.util.Properties props,
                                 UsageOptions opts)
                          throws ConfigException,
                                 ConnectionException
        Shorthand for the options-based init() above, but with a false secure arg.
        Specified by:
        init in interface IServerControl
        Overrides:
        init in class RpcServer
        Parameters:
        host - the Perforce server hostname or IP address as passed in to the factory method
        port - the Perforce server port number as passed in to the factory method
        props - the properties passed in to the factory method
        opts - the UsageOptions object to be associated with the server object; if null, the server should construct a new default UsageOptions object.
        Returns:
        the resulting status; should be ACTIVE unless otherwise specified
        Throws:
        ConfigException - if there's something wrong with the specified configuration or associated config files, etc.
        ConnectionException - if the server is unreachable on initialization, and that unreachability is serious and unrecoverable (there are implementations that don't really do connections per se, so they may not consider this an error or even try connecting during initialisation).
        See Also:
        RpcServer.init(java.lang.String, int, java.util.Properties, com.perforce.p4java.option.UsageOptions)
      • init

        public ServerStatus init​(java.lang.String host,
                                 int port,
                                 java.util.Properties props)
                          throws ConfigException,
                                 ConnectionException
        Shorthand for the options-based init() above, but with a null opts arg.
        Specified by:
        init in interface IServerControl
        Overrides:
        init in class RpcServer
        Parameters:
        host - the Perforce server hostname or IP address as passed in to the factory method
        port - the Perforce server port number as passed in to the factory method
        props - the UsageOptions object to be associated with the server object; if null, the server should construct a new default UsageOptions object.
        Returns:
        the resulting status; should be ACTIVE unless otherwise specified
        Throws:
        ConfigException - if there's something wrong with the specified configuration or associated config files, etc.
        ConnectionException - if the server is unreachable on initialization, and that unreachability is serious and unrecoverable (there are implementations that don't really do connections per se, so they may not consider this an error or even try connecting during initialisation).
        See Also:
        RpcServer.init(java.lang.String, int, java.util.Properties)
      • execMapCmd

        public java.util.Map<java.lang.String,​java.lang.Object>[] execMapCmd​(java.lang.String cmdName,
                                                                                   java.lang.String[] cmdArgs,
                                                                                   java.util.Map<java.lang.String,​java.lang.Object> inMap)
                                                                            throws ConnectionException,
                                                                                   AccessException,
                                                                                   RequestException
        Description copied from interface: IServer
        Issue an arbitrary P4Java command to the Perforce server and return the results as a map.

        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 Map 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.
        AccessException - if the Perforce server denies access to the caller
        RequestException - if the Perforce server encounters an error during its processing of the request
        See Also:
        IServer.execMapCmd(java.lang.String, java.lang.String[], java.util.Map)
      • execMapCmdList

        public 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
        Description copied from interface: IHelixCommandExecutor
        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.
        AccessException - if the Perforce server denies access to the caller
        RequestException - if the Perforce server encounters an error during its processing of the request
        See Also:
        IHelixCommandExecutor.execMapCmdList(java.lang.String, java.lang.String[], java.util.Map)
      • execMapCmdList

        public 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
        Description copied from interface: IHelixCommandExecutor
        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.
        See Also:
        IHelixCommandExecutor.execMapCmdList(java.lang.String, java.lang.String[], java.util.Map, com.perforce.p4java.server.callback.IFilterCallback)
      • execQuietMapCmd

        public java.util.Map<java.lang.String,​java.lang.Object>[] execQuietMapCmd​(java.lang.String cmdName,
                                                                                        java.lang.String[] cmdArgs,
                                                                                        java.util.Map<java.lang.String,​java.lang.Object> inMap)
                                                                                 throws ConnectionException,
                                                                                        RequestException,
                                                                                        AccessException
        Description copied from interface: IServer
        Issue an arbitrary P4Java command to the Perforce server and return the results as a map without invoking any command callbacks.

        Basically equivalent to execMapCmd with temporary disabling of any ICommandCallback calls and / or listeners; this turns out to be useful for various reasons we won't go into here...

        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 Map 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
        See Also:
        IServer.execQuietMapCmd(java.lang.String, java.lang.String[], java.util.Map)
      • execQuietMapCmdList

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> execQuietMapCmdList​(java.lang.String cmdName,
                                                                                                          java.lang.String[] cmdArgs,
                                                                                                          java.util.Map<java.lang.String,​java.lang.Object> inMap)
                                                                                                   throws P4JavaException
        Description copied from interface: IOptionsServer
        Issue an arbitrary P4Java command to the Perforce server and return the results as a list of maps without invoking any command callbacks.

        Basically equivalent to execMapCmd with temporary disabling of any ICommandCallback calls and / or listeners; this turns out to be useful for various reasons we won't go into here...

        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 Map 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
        See Also:
        IOptionsServer.execQuietMapCmdList(java.lang.String, java.lang.String[], java.util.Map)
      • execInputStringMapCmd

        public java.util.Map<java.lang.String,​java.lang.Object>[] execInputStringMapCmd​(java.lang.String cmdName,
                                                                                              java.lang.String[] cmdArgs,
                                                                                              java.lang.String inString)
                                                                                       throws P4JavaException
        Description copied from interface: IServer
        Issue an arbitrary P4Java command to the Perforce server and return the results as a map.

        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.
        inString - an optional string to be sent to the server as standard input unchanged (this must be in the format expected by the server, typically as required when using the "-i" flag to the p4 command line app for the same command). You must remember to issue the relevant command-specific option to enable this if needed.
        Returns:
        a non-null Java Map 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
        See Also:
        IServer.execInputStringMapCmd(java.lang.String, java.lang.String[], java.lang.String)
      • execInputStringMapCmdList

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> execInputStringMapCmdList​(java.lang.String cmdName,
                                                                                                                java.lang.String[] cmdArgs,
                                                                                                                java.lang.String inString)
                                                                                                         throws P4JavaException
        Description copied from interface: IOptionsServer
        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.
        inString - an optional string to be sent to the server as standard input unchanged (this must be in the format expected by the server, typically as required when using the "-i" flag to the p4 command line app for the same command). You must remember to issue the relevant command-specific option to enable this if needed.
        Returns:
        a non-null Java Map 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
        See Also:
        IOptionsServer.execInputStringMapCmdList(java.lang.String, java.lang.String[], java.lang.String)
      • execInputStringMapCmdList

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> execInputStringMapCmdList​(java.lang.String cmdName,
                                                                                                                java.lang.String[] cmdArgs,
                                                                                                                java.lang.String inString,
                                                                                                                IFilterCallback filterCallback)
                                                                                                         throws P4JavaException
        Description copied from interface: IOptionsServer
        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.
        inString - an optional string to be sent to the server as standard input unchanged (this must be in the format expected by the server, typically as required when using the "-i" flag to the p4 command line app for the same command). 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 Map 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
        See Also:
        IOptionsServer.execInputStringMapCmdList(java.lang.String, java.lang.String[], java.lang.String, com.perforce.p4java.server.callback.IFilterCallback)
      • execMapCmdList

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> execMapCmdList​(java.lang.String cmdName,
                                                                                                     java.lang.String[] cmdArgs,
                                                                                                     IFilterCallback filterCallback,
                                                                                                     IParallelCallback parallelCallback)
                                                                                              throws P4JavaException
        Description copied from interface: IOptionsServer
        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.
        filterCallback - an optional filter callback to decide on skipping or keeping individual key/value pairs as part of the results map.
        parallelCallback - an optional parallel sync/submit callback to provide a multi-threaded file transfer implementation.
        Returns:
        a non-null Java Map 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
      • execInputStringStreamingMapComd

        @Deprecated
        public void execInputStringStreamingMapComd​(java.lang.String cmdName,
                                                    java.lang.String[] cmdArgs,
                                                    java.lang.String inString,
                                                    IStreamingCallback callback,
                                                    int key)
                                             throws P4JavaException
        Description copied from interface: IServer
        Issue a streaming map command to the Perforce server, using an optional string for any input expected by the server (such as label or job specs, etc.).

        Streaming commands allow users to get each result from a suitably-issued command as it comes in from the server, rather than waiting for the entire command method to complete (and getting the results back as a completed List or Map or whatever).

        The results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it suitably in much the same way as a user unpacks or processes the results from the other low-level exec methods like execMapCommand.

        NOTE: 'streaming' here has nothing at all to do with Perforce 'streams', which are (or will be) implemented elsewhere.

        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.
        inString - an optional string to be sent to the server as standard input unchanged (this must be in the format expected by the server, typically as required when using the "-i" flag to the p4 command line app for the same command). You must remember to issue the relevant command-specific option to enable this if needed.
        callback - a non-null IStreamingCallback to be used to process the incoming results.
        key - an opaque integer key that is passed to the IStreamingCallback callback methods to identify the action as being associated with this specific call.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.
        See Also:
        IServer.execInputStringStreamingMapComd(java.lang.String, java.lang.String[], java.lang.String, com.perforce.p4java.server.callback.IStreamingCallback, int)
      • execInputStringStreamingMapCmd

        public void execInputStringStreamingMapCmd​(java.lang.String cmdName,
                                                   java.lang.String[] cmdArgs,
                                                   java.lang.String inString,
                                                   IStreamingCallback callback,
                                                   int key)
                                            throws P4JavaException
        Description copied from interface: IOptionsServer
        Issue a streaming map command to the Perforce server, using an optional string for any input expected by the server (such as label or job specs, etc.).

        Streaming commands allow users to get each result from a suitably-issued command as it comes in from the server, rather than waiting for the entire command method to complete (and getting the results back as a completed List or Map or whatever).

        The results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it suitably in much the same way as a user unpacks or processes the results from the other low-level exec methods like execMapCommand.

        NOTE: 'streaming' here has nothing at all to do with Perforce 'streams', which are (or will be) implemented elsewhere.

        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.
        inString - an optional string to be sent to the server as standard input unchanged (this must be in the format expected by the server, typically as required when using the "-i" flag to the p4 command line app for the same command). You must remember to issue the relevant command-specific option to enable this if needed.
        callback - a non-null IStreamingCallback to be used to process the incoming results.
        key - an opaque integer key that is passed to the IStreamingCallback callback methods to identify the action as being associated with this specific call.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.
        See Also:
        IOptionsServer.execInputStringStreamingMapCmd(java.lang.String, java.lang.String[], java.lang.String, com.perforce.p4java.server.callback.IStreamingCallback, int)
      • execStreamingMapCommand

        public void execStreamingMapCommand​(java.lang.String cmdName,
                                            java.lang.String[] cmdArgs,
                                            java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                            IStreamingCallback callback,
                                            int key)
                                     throws P4JavaException
        Description copied from interface: IServer
        Issue a streaming map command to the Perforce server, using an optional map for any input expected by the server (such as label or job specs, etc.).

        Streaming commands allow users to get each result from a suitably-issued command as it comes in from the server, rather than waiting for the entire command method to complete (and getting the results back as a completed List or Map or whatever).

        The results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it suitably in much the same way as a user unpacks or processes the results from the other low-level exec methods like execMapCommand.

        NOTE: 'streaming' here has nothing at all to do with Perforce 'streams', which are (or will be) implemented elsewhere.

        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.
        callback - a non-null IStreamingCallback to be used to process the incoming results.
        key - an opaque integer key that is passed to the IStreamingCallback callback methods to identify the action as being associated with this specific call.
        Throws:
        P4JavaException - if an error occurs processing this method and its parameters.
        See Also:
        IServer.execStreamingMapCommand(java.lang.String, java.lang.String[], java.util.Map, com.perforce.p4java.server.callback.IStreamingCallback, int)
      • execStreamingMapCommand

        public void execStreamingMapCommand​(java.lang.String cmdName,
                                            java.lang.String[] cmdArgs,
                                            java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                            IStreamingCallback callback,
                                            int key,
                                            IParallelCallback parallelCallback)
                                     throws P4JavaException
        Description copied from interface: IServer
        Issue a parallelised streaming map command to the Perforce server, using an optional map for any input expected by the server (such as label or job specs, etc.).

        Streaming commands allow users to get each result from a suitably-issued command as it comes in from the server, rather than waiting for the entire command method to complete (and getting the results back as a completed List or Map or whatever).

        The results are sent to the user using the IStreamingCallback handleResult method; see the IStreamingCallback Javadoc for details. The payload passed to handleResult is usually the raw map gathered together deep in the RPC protocol layer, and the user is assumed to have the knowledge and technology to be able to parse it and use it suitably in much the same way as a user unpacks or processes the results from the other low-level exec methods like execMapCommand.

        NOTE: 'streaming' here has nothing at all to do with Perforce 'streams', which are (or will be) implemented elsewhere.

        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.
        callback - a non-null IStreamingCallback to be used to process the incoming results.
        key - an opaque integer key that is passed to the IStreamingCallback callback methods to identify the action as being associated with this specific call.
        parallelCallback - IParallelCallback used to parallelise the task
        Throws:
        P4JavaException - on error
        See Also:
        IOptionsServer.execMapCmdList(String, String[], IFilterCallback, IParallelCallback)
      • execQuietStreamCmd

        public java.io.InputStream execQuietStreamCmd​(java.lang.String cmdName,
                                                      java.lang.String[] cmdArgs)
                                               throws ConnectionException,
                                                      RequestException,
                                                      AccessException
        Description copied from interface: IServer
        Issue an arbitrary P4Java command to the Perforce server and get the results as a stream without invoking any command callbacks.

        Basically equivalent to execStreamCmd with temporary disabling of any ICommandCallback calls and / or listeners; this turns out to be useful for various reasons we won't go into here...

        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
        See Also:
        IServer.execQuietStreamCmd(java.lang.String, java.lang.String[])
      • execStreamCmd

        public java.io.InputStream execStreamCmd​(java.lang.String cmdName,
                                                 java.lang.String[] cmdArgs)
                                          throws ConnectionException,
                                                 RequestException,
                                                 AccessException
        Description copied from interface: IHelixCommandExecutor
        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
        See Also:
        IHelixCommandExecutor.execStreamCmd(java.lang.String, java.lang.String[])
      • execStreamCmdForBuffer

        public java.nio.ByteBuffer execStreamCmdForBuffer​(java.lang.String cmdName,
                                                          java.lang.String[] cmdArgs)
                                                   throws ConnectionException,
                                                          RequestException,
                                                          AccessException
        Description copied from interface: IHelixCommandExecutor
        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
      • execStreamCmd

        public java.io.InputStream execStreamCmd​(java.lang.String cmdName,
                                                 java.lang.String[] cmdArgs,
                                                 java.util.Map<java.lang.String,​java.lang.Object> inMap)
                                          throws P4JavaException
        Description copied from interface: IOptionsServer
        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.
        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:
        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
        P4JavaException
        See Also:
        IOptionsServer.execStreamCmd(String, String[], Map)
      • execInputStringStreamCmd

        public java.io.InputStream execInputStringStreamCmd​(java.lang.String cmdName,
                                                            java.lang.String[] cmdArgs,
                                                            java.lang.String inString)
                                                     throws P4JavaException
        Description copied from interface: IOptionsServer
        Issue an arbitrary P4Java command to the Perforce server and return 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 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.
        inString - an optional string to be sent to the server as standard input unchanged (this must be in the format expected by the server, typically as required when using the "-i" flag to the p4 command line app for the same command). You must remember to issue the relevant command-specific option to enable this if needed.
        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:
        P4JavaException - if an error occurs processing this method and its parameters
        See Also:
        IOptionsServer.execInputStringStreamCmd(String, String[], String)
      • execStreamCmd

        protected java.io.InputStream execStreamCmd​(java.lang.String cmdName,
                                                    java.lang.String[] cmdArgs,
                                                    java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                                    java.lang.String inString,
                                                    boolean ignoreCallbacks)
                                             throws ConnectionException,
                                                    RequestException,
                                                    AccessException
        Note that this method does the access / request exception processing here rather than passing things up the stack; we may introduce an extended version of this method to take the map array as an output parameter in later releases.
        Parameters:
        cmdName - cmdName
        cmdArgs - cmdArgs
        inMap - inMap
        inString - inString
        ignoreCallbacks - ignoreCallbacks
        Returns:
        stream
        Throws:
        ConnectionException - on error
        RequestException - on error
        AccessException - on error
      • execStreamCmdForBuffer

        protected java.nio.ByteBuffer execStreamCmdForBuffer​(java.lang.String cmdName,
                                                             java.lang.String[] cmdArgs,
                                                             java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                                             java.lang.String inString,
                                                             boolean ignoreCallbacks)
                                                      throws ConnectionException,
                                                             RequestException,
                                                             AccessException
        Note that this method does the access / request exception processing here rather than passing things up the stack; we may introduce an extended version of this method to take the map array as an output parameter in later releases.
        Parameters:
        cmdName - cmdName
        cmdArgs - cmdArgs
        inMap - inMap
        inString - inString
        ignoreCallbacks - ignoreCallbacks
        Returns:
        bytebuffer
        Throws:
        ConnectionException - on error
        RequestException - on error
        AccessException - on error
      • setupCmd

        protected ExternalEnv setupCmd​(RpcPacketDispatcher dispatcher,
                                       RpcConnection rpcConnection,
                                       ProtocolCommand protocolSpecs,
                                       java.lang.String cmdName,
                                       java.lang.String[] cmdArgs,
                                       java.util.Map<java.lang.String,​java.lang.Object> inMap,
                                       boolean ignoreCallbacks,
                                       int cmdCallBackKey,
                                       boolean isStream)
                                throws ConnectionException,
                                       AccessException,
                                       RequestException
        Factors out the command setup that's common to stream and map commands.
        Parameters:
        dispatcher - dispatcher
        rpcConnection - rpcConnection
        protocolSpecs - protocolSpecs
        cmdName - cmdName
        cmdArgs - cmdArgs
        inMap - inMap
        ignoreCallbacks - ignoreCallbacks
        cmdCallBackKey - cmdCallBackKey
        isStream - isStream
        Returns:
        ExternalEnv
        Throws:
        ConnectionException - on error
        AccessException - on error
        RequestException - on error