Interface ICommandCallback
-
public interface ICommandCallback
Provides a simple server command and command results notification callback interface for P4Java consumers.The intention of the server series of methods is to notify the consumer that P4Java has issued a Perforce server command or received a result back from the server. The format of the results passed to the callback method are generally intended to mimic what would have been seen from a p4 command line command, but they may not always be identical.
NOTE: you must ensure that there are no threading or reentrancy issues with your implementation of this interface, and that calling any of the methods here will not cause the caller (P4Java) to block or spend too much time processing the callback.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
completedServerCommand(int key, long millisecsTaken)
Report the completion of a Perforce server command, and, as a bonus, report how long in milliseconds it took from start to finish.void
issuingServerCommand(int key, java.lang.String commandString)
Report that P4Java is about to issue a Perforce server command.void
receivedServerErrorLine(int key, java.lang.String errorLine)
Report receiving an error message result from the Perforce server.void
receivedServerInfoLine(int key, java.lang.String infoLine)
Report receiving an info result message from the Perforce server.void
receivedServerMessage(int key, int genericCode, int severityCode, java.lang.String message)
Report receiving a server message, which may be an error, an info message, a warning, etc., but will not typically be an actual result.
-
-
-
Method Detail
-
issuingServerCommand
void issuingServerCommand(int key, java.lang.String commandString)
Report that P4Java is about to issue a Perforce server command. This is called immediately before the command itself is issued.The int return value is intended to be an opaque key for associated completedServerCommand, receivedServerInfoLine, and receivedServerErrorLine calls, allowing the consumer to correlate subsequent calls with the original command issuance. The key will also be the same value as used for any associated progress callbacks (see IProgressCallback) for the same command. In any case, this key will be unique across all calls (simultaneous or otherwise) to a given IServer, but is not guaranteed to be unique across an entire P4Java instance.
- Parameters:
key
- -- opaque integer key for correlation with subsidiary calls.commandString
- non-null "normalised" p4 command string.
-
completedServerCommand
void completedServerCommand(int key, long millisecsTaken)
Report the completion of a Perforce server command, and, as a bonus, report how long in milliseconds it took from start to finish. Note that the duration reported may not be absolutely accurate, but is probably useful for relative comparisons.- Parameters:
key
- -- opaque integer key as returned from the associated issuingServerCommand call.millisecsTaken
- -- rough measure of the milliseconds elapsed since the original issuing of this command to its completion.
-
receivedServerInfoLine
void receivedServerInfoLine(int key, java.lang.String infoLine)
Report receiving an info result message from the Perforce server. These are typically informational messages from the server that flag files being opened for edit, etc., but they may also include trigger output on forms submission, etc.- Parameters:
key
- -- opaque integer key as returned from the associated issuingServerCommand call.infoLine
- non-null info message. May contain newlines.
-
receivedServerErrorLine
void receivedServerErrorLine(int key, java.lang.String errorLine)
Report receiving an error message result from the Perforce server.- Parameters:
key
- -- opaque integer key as returned from the associated issuingServerCommand call.errorLine
- non-null error message. May contain newlines.
-
receivedServerMessage
void receivedServerMessage(int key, int genericCode, int severityCode, java.lang.String message)
Report receiving a server message, which may be an error, an info message, a warning, etc., but will not typically be an actual result. This method can be used in place of the separate receivedServerInfoLine and receivedServerErrorLine for more general usage.- Parameters:
key
- opaque integer key as returned from the associated issuingServerCommand call.genericCode
- Perforce generic code, as documented in MessageGenericCode.severityCode
- Perforce severity code, as documented in MessageSeverityCode.message
- non-null message. May contain newlines.
-
-