Class ClientUserInteraction
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.rpc.func.client.ClientUserInteraction
-
public class ClientUserInteraction extends java.lang.Object
Class for Perforce client end-user interaction commands like prompting or password-setting ("end-user interaction" is being rather broadly-defined here...).Note that in general we don't actually do any end-user interaction in P4Java -- it's all done before a call by the app that P4Java's been embedded in.
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
RESP_LENGTH
static java.lang.String
TRACE_PREFIX
protected static int
TRUNCATE_LENGTH
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClientUserInteraction(java.util.Properties props, RpcServer server)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientAck(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Respond back to the server with what amounts to a yes / no response in the face of errors or success.protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientActionResolve(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientCrypto(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Process the client-Crypto command from the Perforce server.protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientEditData(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientErrorPause(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientHandleError(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientInputData(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Get some requested data (typically something like a submit form) from somewhere (typically a map passed in from the upper levels of the API) and pass it back to the server, properly munged.protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientOpenURL(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientPing(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientPrompt(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Prompt the end-user (i.e.protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientReceiveFiles(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientSetPassword(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Set the client-side password in response to a Perforce server command telling us to do just that, usually as a result of an earlier successful login attempt in the same session.protected RpcPacketDispatcher.RpcPacketDispatcherResult
clientSingleSignon(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap)
Implements the client-side of the Perforce single sign on (SSO) protocol.protected byte[]
getStreamBytes(java.lang.String cmdName, java.io.InputStream inStream)
Get bytes from the stream passed in.
-
-
-
Field Detail
-
TRACE_PREFIX
public static final java.lang.String TRACE_PREFIX
- See Also:
- Constant Field Values
-
RESP_LENGTH
protected static final int RESP_LENGTH
- See Also:
- Constant Field Values
-
TRUNCATE_LENGTH
protected static final int TRUNCATE_LENGTH
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClientUserInteraction
protected ClientUserInteraction(java.util.Properties props, RpcServer server)
-
-
Method Detail
-
clientPrompt
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientPrompt(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
Prompt the end-user (i.e. the upper-levels of P4Java...) in response to a server request. The various parameters in resultsMap determine things like whether the prompt uses echoing, what digest to use (if any), what prompt string to use, etc., many of which aren't relevant in our context.In the most common usage -- password extraction from the user -- we follow a fairly simple scheme where we first hash the password with an MD5 digest, then pass the results of that operation through a new MD5 cycle and hash it against the "digest" string passed in from the server. Everything else that's sent to us from the server is simply echoed for the server's own purposes (i.e. I still don't know what some of this stuff does...).
Note that we have to do what the C++ API does in the same circumstances; this means converting the hash hex string results into upper-case, etc., and several other mild quirks whose use or motivation aren't always obvious.
Note also that we're not currently implementing the full panoply of possible processing here, just the subset that's useful to us for P4WSAD and that presumes a 2003.2 or later server in not-too-strict mode.
- Parameters:
rpcConnection
- rpcConnectioncmdEnv
- cmdEnvresultsMap
- resultsMap- Returns:
- RpcPacketDispatcherResult
- Throws:
ConnectionException
- on error
-
clientSetPassword
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientSetPassword(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
Set the client-side password in response to a Perforce server command telling us to do just that, usually as a result of an earlier successful login attempt in the same session.In this context setting the password really just means performing a few sanity and consistency checks, then returning a suitable ticket for use with the -P option in future commands. This can be an arbitrarily complex process...
- Parameters:
rpcConnection
- rpcConnectioncmdEnv
- cmdEnvresultsMap
- resultsMap- Returns:
- RpcPacketDispatcherResult
- Throws:
ConnectionException
- on error
-
clientSingleSignon
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientSingleSignon(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
Implements the client-side of the Perforce single sign on (SSO) protocol. Basically defers to the registered SSO callback (if it exists) and simply responds back to the server appropriately.- Parameters:
rpcConnection
- rpcConnectioncmdEnv
- cmdEnvresultsMap
- resultsMap- Returns:
- RpcPacketDispatcherResult
- Throws:
ConnectionException
- on error
-
clientReceiveFiles
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientReceiveFiles(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
clientAck
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientAck(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
Respond back to the server with what amounts to a yes / no response in the face of errors or success. Intended for interactive clients, I guess; we just decline automatically if anything went wrong, and say yes ("dm-OpenFile") if things went fine... in effect, we just do a pass-through. This may change as we gain experience.- Parameters:
rpcConnection
- rpcConnectioncmdEnv
- cmdEnvresultsMap
- resultsMap- Returns:
- RpcPacketDispatcherResult
- Throws:
ConnectionException
- on error
-
clientCrypto
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientCrypto(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
Process the client-Crypto command from the Perforce server. This is typically called in response to an earlier login using the ticket feature (which is how we normally do logins in P4Java).In the P4Java context, this really means first MD5-hashing the incoming token, then hashing the previously-returned ticket, then returning the results to the server for inspection.
- Parameters:
rpcConnection
- rpcConnectioncmdEnv
- cmdEnvresultsMap
- resultsMap- Returns:
- RpcPacketDispatcherResult
- Throws:
ConnectionException
- on error
-
clientOpenURL
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientOpenURL(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
clientInputData
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientInputData(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
Get some requested data (typically something like a submit form) from somewhere (typically a map passed in from the upper levels of the API) and pass it back to the server, properly munged.- Parameters:
rpcConnection
- rpcConnectioncmdEnv
- cmdEnvresultsMap
- resultsMap- Returns:
- RpcPacketDispatcherResult
- Throws:
ConnectionException
- on error
-
getStreamBytes
protected byte[] getStreamBytes(java.lang.String cmdName, java.io.InputStream inStream)
Get bytes from the stream passed in.- Parameters:
cmdName
- cmdNameinStream
- inStream- Returns:
- bytes
-
clientPing
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientPing(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
clientErrorPause
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientErrorPause(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
clientHandleError
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientHandleError(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
clientActionResolve
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientActionResolve(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
clientEditData
protected RpcPacketDispatcher.RpcPacketDispatcherResult clientEditData(RpcConnection rpcConnection, CommandEnv cmdEnv, java.util.Map<java.lang.String,java.lang.Object> resultsMap) throws ConnectionException
- Throws:
ConnectionException
-
-